#discord-bots

1 messages · Page 56 of 1

slate swan
#

Huh

#

Bro blocked me

hollow badger
#

Please keep it on-topic.

slate swan
#

Ok sorry

slate swan
hollow badger
#

In lemons

slate swan
glad cradle
hollow badger
#

The best.

slate swan
hollow badger
#

No.

slate swan
hollow badger
#

Yes.

#

Now please stick to the topic.

slate swan
#

Can’t be releasing your secrets

#

do you have multiple versions of python installed?

cerulean shale
#

i recently installed latest version

slate swan
#

venv is not a feature limited to pycharm and changing dies don't fix runtime errors

slate swan
cerulean shale
slate swan
cerulean shale
#

i am using asyncpraw and i installed it but when i am trying to run the code, it is showing that asyncpraw is not installed ;-;

slate swan
#

you definately have multiple versions of python then

cerulean shale
#

oh-

slate swan
#

type ctrl+shift+p and search for "python interpreter", it will show a list of all installations

faint sapphire
#

hi, my bot is offline, im hosting it on heroku, it used to work then suddenly stopped.
the bot works when i host in vs code,
i tried deploying again, heroku says no errors, but its still offline
any suggestions?

vale wing
#

Heroku is unsuitable for hosting that's it

faint sapphire
vale wing
#

Definitely

faint sapphire
#

ok then

faint sapphire
vale wing
#

Absolutely free no

faint sapphire
#

how much would it cost if i have to pay

cursive nova
#

what kind of bot is it konrad ?

vale wing
#

There are free tiers however

faint sapphire
#

multi purpose bot

cursive nova
#

does it need much data/usage

vale wing
#

Oracle cloud, amazon aws and microsoft azure

cursive nova
#

if not i can hook you up with a docker container that can run python code

faint sapphire
#

it uses a sqlite3 db (it will soon)

#

it has big dictionaries atm instead

cursive nova
#

sqlite is just a local file if i remember correct ?

maiden fable
#

Yes

faint sapphire
maiden fable
#

It is

faint sapphire
#

idk what a docker is

maiden fable
#

But they all need Credit Card information

vale wing
#

It's just not beginner friendly

vale wing
faint sapphire
vale wing
#

Why cry

sick birch
faint sapphire
#

i know the two words

vale wing
#

It's highly recommended to use a container for hosting discord bots

faint sapphire
#

but this sounds like its comming out of star trek

#

ok ill google it

#

thanks

vale wing
#

No really need to google, you'll break your brain if you're inexperienced with that. I have a guide 😉

cursive nova
#

@faint sapphire isolated environment where you can run python stuff

faint sapphire
#

then u need to have the computer on yh

#

ill just look on yt

cursive nova
#

i have this server on 24/7

faint sapphire
#

i see

vale wing
faint sapphire
#

yes

vale wing
#

Then just use it

faint sapphire
#

i often dont have wifi, thats why i was opting for a website

#

also waiting to receive a cooler

#

cause cpu be getting hot

#

i also make it run code where i use pynput

#

for things that cant be done through script alone

cerulean shale
#

i have async praw installed and yet i am getting this error, pls help ;-;

silk fulcrum
cerulean shale
#

@silk fulcrum

silk fulcrum
cerulean shale
#

from pypi 💀

silk fulcrum
#

do python --version

cerulean shale
#

@silk fulcrum

silk fulcrum
#

hmmm

cerulean shale
#

hmmm

#

still waiting

silk fulcrum
#

hmmmm

#

actually no idea

cerulean shale
#

.

silk fulcrum
#

pip show asyncpraw

cerulean shale
silk fulcrum
#

huh

slate swan
silk fulcrum
#

!dashmpip

unkempt canyonBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

silk fulcrum
#

yeah thought of that

slate swan
#

pip is registered for 3.9, py and python are registered for 3.10

#

windows moment

silk fulcrum
#

well for me pip is for 2.8

#

pip3 is for 3.8

#

pip310 is for 3.10

paper sluice
#

linux moment

silk fulcrum
#

lmao

slate swan
#

when was the last time you updated your distro

silk fulcrum
slate swan
#

arch, manjaro, kali, ubuntu, etc all use only 3.10 or atleast 3.9 atm

slate swan
silk fulcrum
#

no

#

2.8 and 3.8 are just saved in memory

#

i dont use them and my PC neither

#

maybe i should delete them

silk fulcrum
#

probably someone out there uses 3.8

#

or 2.8 😳

slate swan
#

meh i installed some apt package called python3.9-is-python or something and now python is used for 3.9

silk fulcrum
#

i think that is not necessarily to install some packages

slate swan
#

did that a year ago, don't care to boot into that distro now

paper sluice
#

just sudo mv /usr/bin/python3.10 /usr/bin/python

silk fulcrum
#

i remember managing versions with php, there was some command where I could manage which php version will php command use, there were php 7.4, 8.0 and 8.1

#

idk

cerulean shale
#

Cool 🤡

slate swan
#

hey guys, i recently switched to dpy 2.0 and is currently trying to get slash commands to work

import discord
from discord import app_commands
from discord.ext import commands

class MyCog(commands.Cog):
  def __init__(self, bot: commands.Bot) -> None:
    self.bot = bot
    
  @app_commands.command(name="command-1")
  async def my_command(self, interaction: discord.Interaction) -> None:
    """ /command-1 """
    await interaction.response.send_message("Hello from command 1!", ephemeral=True)

  @app_commands.command(name="command-2")
  @app_commands.guilds(discord.Object(id=962001190558769182))
  async def my_private_command(self, interaction: discord.Interaction) -> None:
    """ /command-2 """
    await interaction.response.send_message("Hello from private command!", ephemeral=True)

async def setup(bot: commands.Bot) -> None:
  await bot.add_cog(MyCog(bot))``` i've used this code from a git rep for base understanding, but this doesn't seem to work(i have other commands that are not slash commands, can this be the reason?)
winged coral
#

You need to sync them

silk fulcrum
#

!d discord.app_commands.CommandTree.sync

unkempt canyonBOT
#

await sync(*, guild=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Syncs the application commands to Discord.

This also runs the translator to get the translated strings necessary for feeding back into Discord.

This must be called for the application commands to show up.
winged coral
#

Don’t sync automatically

#

Make a sync command which registers as a message intent command or some kind of external listener to do it when you like

#

Sync when commands are modified, added, removed

winged coral
#

Tangent

slate swan
#
async def on_ready(self):
        await self.wait_until_ready()
        if not self.synced:
            await app_commands.sync(guild = discord.Object(id =962001190558769182))
            print('Synced')```
it's still not syncing for some reasons
#

dunno why but after switching to dpy 2.0 i don't get errors for things i should, like if the bot edits a message that doesn't exist it should throw an error but in 2.0 it doesn't anymore

sick birch
#

Maybe you have a faulty error handler

silk fulcrum
#

NOOOO

sick birch
#

Those cause a lot of errors

silk fulcrum
#

nooway there are not only lot of errors

#

they synced in on ready

#

thats so shitttttty

#

it says to do it in setup_hook

#

but at least not in on_ready

slate swan
#

im really sorry mate just trying to get to 2.0

silk fulcrum
#

i think i've gotta play more minecraft

quaint epoch
silk fulcrum
#

this channel still shows me some shit

quaint epoch
#

python -m pip install discord.py --upgrade

slate swan
#

no, i've updated and i am now understanding the basics

slate swan
quaint epoch
#

kk

junior verge
#
await tree.load_extension(f"cogs.{filename[:-3]}")
``` What should this be?
silk fulcrum
#

where did you see that?

junior verge
#

look

#

client = aclient()
tree = app_commands.CommandTree(client)

#

just trying to load cogs :(

silk fulcrum
#

client.tree is already a CommandTree

junior verge
#

So how would I load cogs

silk fulcrum
#

what is tree = app_commands.CommandTree(client)

junior verge
#
class aclient(discord.Client):
    def __init__(self):
        super().__init__(intents=intents, command_prefix="!")
        self.synced = False

    async def on_ready(self):
        await self.wait_until_ready()
        if not self.synced:
            await tree.sync(guild=discord.Object(id=867086205182017536))
            self.synced = True
        print(f"Daxbot is ready")

    async def setup_hook(self):
        for filename in os.listdir("./cogs"):
            if filename.endswith(".py"):
                try:
                    await client.load_extension(f"cogs.{filename[:-3]}")
                    print(f"Loaded {filename}")
                except Exception as e:
                    print(f"Failed to load {filename}")
                    print(f"[ERROR] {e}")


client = aclient()
tree = app_commands.CommandTree(client)
silk fulcrum
junior verge
silk fulcrum
junior verge
#

oh

silk fulcrum
#

y'all guys gonna kill me

junior verge
#

I am just trying to switch to slash commands atm

#

the slash commadn that I did with the tree it works fine

#

just trying to load cogs atm that's all

silk fulcrum
junior verge
#

yeah I edited it

#

I dont know what it should be

silk fulcrum
#

and still wrong

junior verge
#

I know..

silk fulcrum
#

I should also add syncing there

slate swan
silk fulcrum
#

or not... syncing is better in command

#

not in on_ready or setup_hook neither

slate swan
#

people are still adapting to 2.0

junior verge
#

I don't know, trying to get used to dpy 2.0 and use slash commands

silk fulcrum
#

(most people I see are using pycord)

#

that is soo bad

slate swan
#

wtf is wrong with you? if you have problem just ignore it others can help

junior verge
#

yeah lol

sick mulch
#

how to make the ticket system in a bot

silk fulcrum
#

bruh, now I'm getting humiliated like im toxic :blobpain:

junior verge
silk fulcrum
#

that is still not the best option, but at least something

junior verge
#

Yeah I know I am doing it now

silk fulcrum
#

ok

split nest
#

how can i get a notification when a user joins a specific call

#

pls help

silk fulcrum
#

wdym joins a specific call

#

voice channel you mean
?

quaint epoch
#

i forget the exact event

split nest
#

an event that checks if someone joins a talk

silk fulcrum
unkempt canyonBOT
#

discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceState "discord.VoiceState").

The following, but not limited to, examples illustrate when this event is called...
silk fulcrum
#

this?

leaden cosmos
quaint epoch
#

yes

quaint epoch
silk fulcrum
split nest
silk fulcrum
#

why r u reading such old msgs

glad cradle
#

you're a bad guy

silk fulcrum
#

:(

slate swan
#

ImportError: can not import name ‘menus’ from ‘discord’ (/home/runner/giveaway/venv/lib/python3.8/site-packages/discord/__init__.py)

silk fulcrum
#

you need to install them manually

#

discord-ext-menus

#

recommended from github repo

#

to get the newest ones

dry marsh
#

I've made a discord bot using discord.py in python and have been running it for some time. while it's running I get this message : WARNING discord.gateway Shard ID None heartbeat blocked for more than 170 seconds. Can someone tell me what does this mean?

silk fulcrum
#

it could be blockingio or time.sleep for example

dry marsh
silk fulcrum
#

(blockingio is when you use something like with open to open json files that is not async so it blocks io async event loop)

#

that's not only cus of with open

#

it could be not async connection to db

waxen ruin
#

Hello. Is it possible for my bot to say something on call? Like tts but the output is said on call. For example, I say .tts hello , the bot speaks Hello if connected to a vc

silk fulcrum
junior verge
#
@app_commands.event
``` How do you use an event with discord.py 2.0?
silk fulcrum
#

use asyncio.sleep() instead

#

!d asyncio.sleep

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.

Example of coroutine displaying the current date every second for 5 seconds:
dry marsh
junior verge
waxen ruin
junior verge
#

but client is not defined

waxen ruin
#

then u have to define it

#

check if uve made the bot client or bot

#

client = commands.Bot(command_prefix='.')

junior verge
#

Yeah I know how that works

waxen ruin
#

client = commands.Bot(command_prefix='.')

#

thats how a client variable is defined

junior verge
#

ik

silk fulcrum
# dry marsh why

it blocks your whole code, so for example if you use it in one command like tempmute it will sleep for 10 minutes but not only for that command but for the whole code, so no commands will work till it's sleeping

waxen ruin
#

make sure you have discord and discord.ext commands imported also

silk fulcrum
#

so consider using asyncio.sleep() to not block your code

junior verge
#
class Daxbot(commands.Bot):
    session: aiohttp.ClientSession

    def __init__(self):
        intents = discord.Intents.default()
        intents.members = True
        intents.message_content = True

        super().__init__(command_prefix=["!"],intents=intents,)

    # This is asynchronous!
    async def setup_hook(self):
        # Creating aiohttp ClientSession
        self.session = aiohttp.ClientSession()

        # Loading cogs
        for filename in os.listdir("./cogs"):
            if filename.endswith(".py"):
                try:
                    await self.load_extension(f"cogs.{filename[:-3]}")
                except Exception as e:
                    print(f"Failed to load {filename}")
                    print(f"[ERROR] {e}")

        await self.tree.sync()
        print("Successfully synced commands")

async def main():
    client = Daxbot()
    await client.start("token")
``` what would I do then as client.event?
silk fulcrum
waxen ruin
#

Hello. Is it possible for my bot to say something on call? Like tts but the output is said on call. For example, I say .tts hello , the bot speaks Hello if connected to a vc

silk fulcrum
#

like this py class MyBot(Bot): async def on_message(self, message): ... @junior verge

#

for any event

junior verge
#

can you still do it outside of an class

#
@client.event
async def on_command_error(interaction, error):
``` like what should this be now
silk fulcrum
#

i dont exactly know how that is done

junior verge
silk fulcrum
#

but im sure you'll need ffmpeg or smth like that

waxen ruin
silk fulcrum
junior verge
silk fulcrum
#

then it is not possible

junior verge
#

ah

#

so it should be in the bots subclass

waxen ruin
#

well my first choice for stack overflow ofc so i got that i need to use pyttsx for it

silk fulcrum
#

as long as you use start to start the bot that is impossible. and do not switch back to run, start is just way better, at least cus its async

#

just do it in subclass or in cogs

#

what's the problem with that

junior verge
#

!paste

silk fulcrum
junior verge
waxen ruin
silk fulcrum
#

i dont think tutorials are good for this

#

but idk

waxen ruin
#

ty

#

alr

#

ill check it out, tyy

silk fulcrum
#

i cant help you anymore @waxen ruin cus im not into voice bots

silk fulcrum
tawdry tendon
silk fulcrum
#

and you need to take self first

junior verge
silk fulcrum
#

(self, ...)

junior verge
silk fulcrum
#

as an arg

#

its still a method

junior verge
#

so that stays the same?

#

!paste

silk fulcrum
#

user.auhor :lmao:

junior verge
#

user is discord.Member

silk fulcrum
#

actually

#

what is wrong

#

user.auhor

#

nothing wrong absolutely

junior verge
#

erm

silk fulcrum
#

wops

junior verge
#

idk how it works

silk fulcrum
#

actually this whole code is so... weird

junior verge
#

its from 1.7.3

#

@silk fulcrum any idea

silk fulcrum
#

a lot of ideas

tawdry tendon
silk fulcrum
#

and first is that you need to rewrite that code

tawdry tendon
#

please
i have this code

adminembed = discord.Embed(title = "Administrator Commands:", description = ".kick kicks a mentioned user (could add reason at the end)\n.ban bans a mentioned user (could add reason at the end)\n.kick kicks a mentioned user (could add reason at the end)")

class MyView(discord.ui.View):
    @discord.ui.select(
        placeholder="What do you need help with?",
        min_values=1,
        max_values=1,
        options=[
            discord.SelectOption(label="Math Command", description="View math commands", value="value1"),
            discord.SelectOption(label = "Server Info", description = "View Server Information", value = "value2"),
            discord.SelectOption(label="Administrator Commands", description="View Administrator Commands", value="value3")

        ]
    )

    async def select_callback(self, interaction, select):
        if select.values[0] == "value1":
            await interaction.response.send_message(
                "Math Commands:\n\n Addition command:\n.add adds two numbers together, eg: .add 2 2 will output 4")
        if select.values[0] == "value2":
            await interaction.response.send_message(
                "Server Information:\n\n Member Count:\n.ServerInfo shows things about the server")
        if select.values[0] == "value3":
            await interaction.response.send_message(
                ctx.send (embed = adminembed))

without the embed it works
but with embed it allways tells me interaction failed

#

any help on this??

winged coral
#

Get an error handler

#

Catch the error and print it

#

I can’t help much without an exception

silk fulcrum
silk fulcrum
#

do you even understand what yo're doing?

tawdry tendon
#

im new to this

tawdry tendon
silk fulcrum
tawdry tendon
winged coral
tawdry tendon
#

and kind of new to python

junior verge
#
nteraction.response.send_message(
                ctx.send (embed = adminembed))
``` what is this
tawdry tendon
#

its been like 3 months or more

junior verge
silk fulcrum
tawdry tendon
junior verge
#

what are you doing here then

winged coral
#

ctx isn’t defined in this scope at all, let alone passing ctx.send to another send function

silk fulcrum
#

dpy is not beginner friedly

winged coral
#

you need to rethink the logic in this section

slate swan
winged coral
#

i sometimes still see people using pass_context

silk fulcrum
#

kill my self, why minecraft is lagging, chess.com is inaccessible and there is no other games I can play, because wine doesnt work

slate swan
#

well that comes from stackoverflow and tutorials

robust fulcrum
#

How can I delete the message on btn click?

winged coral
#

!d discord.Message.delete

unkempt canyonBOT
#

await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
silk fulcrum
robust fulcrum
winged coral
#

You said delete a message

empty aspen
#

Hoi

silk fulcrum
robust fulcrum
silk fulcrum
silk fulcrum
robust fulcrum
silk fulcrum
silk fulcrum
#

im not fun of shooters at all

empty aspen
#

Great game

silk fulcrum
slate swan
silk fulcrum
#

im on linux, i need wine to run games like this

silk fulcrum
slate swan
#

make ur own game with your discord bot kek

silk fulcrum
#

id better play somethng like tankionline or slither.io

silk fulcrum
empty aspen
silk fulcrum
#

well minesweeper i have by default

slate swan
#

go play dat and find bugs

silk fulcrum
#

but its boring

empty aspen
#

Though his video editing skills need work

silk fulcrum
#

there is no bugs in that commands

slate swan
#

you can use stream on linux though

junior verge
#

!paste

silk fulcrum
empty aspen
#

Stream poggers

slate swan
silk fulcrum
#

hwow

slate swan
#

perks of being a nerd

silk fulcrum
#

even my dad plays games

#

well, actually, once a month

#

or even more rare but still he plays some games

silk fulcrum
#

ill search again

#

maybe i missed something

slate swan
silk fulcrum
#

the same problem as with wine

#

:evenmorepain:

#

im completely gameless

#

i think i've gotta work on my bot and a gist

#

and get ready to school

#

and for PyWeek

slate swan
#

go make Minecraft in python

silk fulcrum
#

idk how am i gonna participate in pyweek

#

wth, there just was flash in my room

#

like someone took photo of me?

#

etsap!

junior verge
#

I got the avatar to work

silk fulcrum
#

i'd just recommend to just... just... reqrite the code

junior verge
#

Yeah but idk how in 2.0 code

#

like thats the problem lol

silk fulcrum
#

readthedocs?

#

there is not like EVERYTHING changed

junior verge
#

I am sure there is not that much wrong in the code

silk fulcrum
#

same schema, read the docs, do things

silk fulcrum
junior verge
#

hm ok

silk fulcrum
#

i can count if you want

junior verge
#

sure go ahead

silk fulcrum
junior verge
#

ah nice

#

fixed 2/8

silk fulcrum
junior verge
#

response.defer and user.author

silk fulcrum
#

ok

junior verge
#
member = interaction.author if not member else member 
``` should be that yeah?
silk fulcrum
#

no

junior verge
#

what then

#

user.author?

silk fulcrum
#

your member is not even defined

junior verge
#

it should be user I fixed that

vocal snow
#

just do user or interaction.author!

spring flax
silk fulcrum
primal token
silk fulcrum
#

if that is pycord

#

im just gonna be completely slaughtered

#

that will be the most pointless rate of his code ever

#

oh no wait he was using app_commands

#

nvm im gud

junior verge
#

..

slate swan
tawdry tendon
#

hello

silk fulcrum
#

hello

tawdry tendon
#

how can i make it so if someone mentions the bot, the bot mentions them back

silk fulcrum
tawdry tendon
#

how do i check if the bot is mentioned?

silk fulcrum
unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

tawdry tendon
#

ok

#

can i do mention_author=True

silk fulcrum
tawdry tendon
#

or would that reply

#

oh it replies

#

nvm then

silk fulcrum
#

you can only do that in replies

tawdry tendon
#

ok

silk fulcrum
#

you have to do .send(member.mention)

tawdry tendon
#

ok

#
    if client.user.mentioned_in(message):
        await message.channel.send("yes?").send(member.mention)```
#

something like this?

silk fulcrum
#

hm

#

!d discord.ClientUser.mentioned_in

unkempt canyonBOT
silk fulcrum
#

that actually exists

tawdry tendon
#

oh

cold sonnet
#

it's Member.mentioned_in

silk fulcrum
#

what do you think you are doing .send(...).send(...)?

tawdry tendon
silk fulcrum
#

no prob with that

cold sonnet
silk fulcrum
cold sonnet
#

sensemakeok

silk fulcrum
#

they're just all in abc.User

tawdry tendon
#

it doesnt work

silk fulcrum
tawdry tendon
#
@bot.listen()
async def on_mention(message):
    if client.user.mentioned_in(message):
        await message.channel.send("yes?").send(member.mention)```
silk fulcrum
#

on_mention :blobpain:

#

dude its on_message

tawdry tendon
#

it was from nefore

silk fulcrum
#

and what do you think you are doing with .send(...).send(...) @tawdry tendon?

quaint epoch
#

also why is there a client AND bot?

silk fulcrum
#

oof that also this

quaint epoch
#

just do py @bot.listen('on_message') async def on_message(message: discord.Message): if bot.user.mentioned_in(message): print('i was mentioned!')

silk fulcrum
#

'on_message'

tawdry tendon
#

i dont want it to say "i was mentioned"

#

i want it to mention them back @quaint epoch

silk fulcrum
#

that was just an example

tawdry tendon
#

what?

silk fulcrum
#

do await message.channel.send(whatyouwant) then

quaint epoch
unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").

Example...
silk fulcrum
quaint epoch
#

lemme give an example

silk fulcrum
quaint epoch
#
@bot.listen('on_message') # looks for on_message event
async def on_message1(message):
  ...

@bot.listen('on_message') # also looks for on_message event
async def on_message2(message):
  ...```
#

with bot.listen you can have multiple listeners

#

the event type has to be specified though

silk fulcrum
#

yes but who ever needs that and for what reason

quaint epoch
#

why else would that be added

silk fulcrum
#

to name functions as you want

tawdry tendon
#

ive done it now

sonic flax
#

How do i make it so someone can only do a command every 30 minutes, with an error message

quaint epoch
unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
quaint epoch
#

!d discord.ext.commands.BucketType

unkempt canyonBOT
slate swan
#

ephemeral = True i can use onli in slash command and buttons?

sonic flax
slate swan
silk fulcrum
slate swan
#

ctx is not an interaction

#

any "interaction"

slate swan
#

ohh

#

sorry true

silk fulcrum
#

:smart:

left idol
#
@commands.command(pass_context=True)
@commands.has_role("Council")
async def massrole(ctx, role: discord.Role, *members: discord.Member):
    guild = bot.get_guild(GUILDID)
    rnames = [role.name for role in player.roles]
    for member in members:
        if str(role) in rnames:
            await ctx.respond(f"<@{member.id}> already in {role}")
        else:
            await member.add_roles(discord.utils.get(ctx.guild.roles, name=str(role)))
            await ctx.respond(f":white_check_mark: {role} added to <@{member.id}>")
@massrole.error
async def massrole_error(ctx, error):
    if isinstance(error, commands.MissingRole):
        await ctx.send("aaaa", ephemeral = True)
    else:
        raise error

I have a command that isn't returning any issues nor is it sending anything, it was working just fine the last time I was working on it, did I overlook something?

slate swan
potent spear
slate swan
left idol
potent spear
slate swan
#

also your code seems to be a mix of discord.py rewrite branch and pycord

slate swan
silk fulcrum
#

oh

slate swan
#

I've only seen it in pycord's app context in all the forks

silk fulcrum
#

saem

slate swan
#

why it isnt working?

#

I want to do something like that if you type $ say, it will send a message that I did not give you the message you want to send

silk fulcrum
#

it's required argument

#

you need to make it Optional then

#

text: typing.Optional[str]

#

and import typing for that

cerulean shale
tawdry tendon
#

hello

cerulean shale
#

@silk fulcrum i got voice verified :)

tawdry tendon
#

is there a way to add an image to an embed

silk fulcrum
silk fulcrum
cerulean shale
tawdry tendon
#

ok

silk fulcrum
cerulean shale
tawdry tendon
#

thanks

slate swan
# silk fulcrum `text: typing.Optional[str]`

how to do it in code?

@bot.command(name="say", description="bot wysyła wiadomość napisaną przez administratora")
@has_permissions(administrator = True)
async def say(ctx, *, text):

    if text == None:
        await ctx.send("U dont send value!")
    
    else:

        message = ctx.message
        await message.delete()
        await ctx.send(text)```
cerulean shale
silk fulcrum
cerulean shale
#

How old are you btw?

cerulean shale
#

Sensei

silk fulcrum
#

typehint the text with Optional[str]

silk fulcrum
cerulean shale
#

Nah that's cap

silk fulcrum
#

nop

cerulean shale
#

I am 14 btw

silk fulcrum
#

im actually 13

cerulean shale
#

Cool

silk fulcrum
#

but my voice became deep at 12, and noone believed im 12 when heard it

tawdry tendon
#

@cerulean shale

swift pumice
silk fulcrum
#

lmao

cerulean shale
tawdry tendon
#

like this:

mathembed = discord.Embed(title = f"Math Commands:", description = "Addition command:\n.add adds two numbers together, eg: .add 2 2 will output 4\n\nMultiplication command:\n.mult multiplies two numbers together, eg: .mult 2 2 will output 4\n\nDivision command:\n.div divides two numbers, eg: .div 4 2 will output 2\n\nSubstraction command:\n.sub subtracts two numbers, eg: .sub 4 2 will output 2\n\nRandom command:\n.rand randomises a number from 1 number to the other, eg: .rand 5 9 will randomise a number from 5-9", colour = discord.Colour.magenta())
mathembed.set_image(url='https://www.sparklebox.co.uk/2361-2365/sb2363.html')```
slate swan
#

lmao

tawdry tendon
cerulean shale
#

YAAAAAAY I HELPED SOMEONE

silk fulcrum
slate swan
tawdry tendon
silk fulcrum
cerulean shale
tawdry tendon
#

no error

silk fulcrum
cerulean shale
#

Bruh html doesn't work

#

Jpeg, jpg, png or gif

silk fulcrum
cerulean shale
#

Only these work

slate swan
tawdry tendon
#

it is a jpg file

silk fulcrum
slate swan
#

where i have to paste it

tawdry tendon
#

idk why it says html

cerulean shale
#

It ain't reading the picture

cerulean shale
silk fulcrum
#

am i being IP grabbed or what? why isnt that link even loading

cerulean shale
#

Lmfaoooo

slate swan
silk fulcrum
#

that ends with html

cerulean shale
#

BREAKING NEWS

Master32 been kidnapped and found dead

cerulean shale
tawdry tendon
silk fulcrum
#

good news

cerulean shale
#

🥲

silk fulcrum
#

by the way okimii was saying that he'll kidnap my cat and now he left discord

cerulean shale
#

Ig that's what you should do

tawdry tendon
#

what if it doesnt have anything at the end of the url

slate swan
silk fulcrum
#

you typehint arguments

unkempt canyonBOT
#

Type Hints

A type hint indicates what type a variable is expected to be.

def add(a: int, b: int) -> int:
    return a + b

The type hints indicate that for our add function the parameters a and b should be integers, and the function should return an integer when called.

It's important to note these are just hints and are not enforced at runtime.

add("hello ", "world")

The above code won't error even though it doesn't follow the function's type hints; the two strings will be concatenated as normal.

Third party tools like mypy can validate your code to ensure it is type hinted correctly. This can help you identify potentially buggy code, for example it would error on the second example as our add function is not intended to concatenate strings.

mypy's documentation contains useful information on type hinting, and for more information check out this documentation page.

silk fulcrum
#

and make it optional

cerulean shale
#

So choose a pic that ends with either of them

silk fulcrum
cerulean shale
#

@silk fulcrum sensei kinda feels good helping people

cerulean shale
cerulean shale
silk fulcrum
#

but sometimes you can get f***ed by some very not smart guys

#

which for example dont know python

#

and annoy veryyy much

cerulean shale
#

Like me 💀

#

Jk jk

cerulean shale
#

Btw is profanity blocked or something?

silk fulcrum
#

what the heck

silk fulcrum
#

rules say everything i guess

cerulean shale
#

Oh lol 🤣

glad cradle
#

🦆

silk fulcrum
#

sometimes i can get frustrated and do some weird shit like calling someone silly and being a bit toxic...

#

right now already an hour my smart watches are shouting at me that they're low and battery and i just ignore them

#

already 0% btw

cerulean shale
#

💀

cerulean shale
#

Btw you can't say others to read the manual if they ask for help in here 💀

silk fulcrum
#

why can't you?

#

if their knowledge is too low just do !resources

#

and if problem is solvable by docs link them by !d something

gloomy field
#

anyone have a doc to link to that explains creating slash commands with discord.py? i've been searching google and the docs but a lot of old results on google before slash commands were available and not finding much when searching slash commands on the docs

cerulean shale
#

Idk the code of conduct says it 🤣

gloomy field
#

ty

cerulean shale
silk fulcrum
cerulean shale
silk fulcrum
#

actually there is a pin with that gist

#

its second iirc

cerulean shale
#

I will sleep in like an hour or so...... That's why didn't ask about it lol

cerulean shale
silk fulcrum
#

im trying my best to go sleep at 10:30 PM but still can't follow my sleep schedule

#

but I have like a habit or idk so I just always wake up at 6:30

#

nomatter if I got to bed at 3 AM

#

ill wake up at 6:30

cerulean shale
silk fulcrum
cerulean shale
#

Oh-

#

You from Australia?

silk fulcrum
#

no

cerulean shale
#

Or Europe

silk fulcrum
#

russia 😭

cerulean shale
#

Noice

silk fulcrum
#

exenfix is from there too btw

grim oar
#

cyka

cerulean shale
#

Dk who that is 💀 but ok

silk fulcrum
cerulean shale
#

Cyka

#

Vladimir Putin

silk fulcrum
#

and last

silk fulcrum
cerulean shale
#

Caught in 4k

silk fulcrum
cerulean shale
zealous path
#

hi

silk fulcrum
grim oar
cerulean shale
silk fulcrum
cerulean shale
#

Nova, reminds me of a friend 💀

#

Who died last year 🥲

silk fulcrum
#

rip

cerulean shale
#

RIP

#

He got into an accident

silk fulcrum
#

my chess coach's dad died last month

cerulean shale
#

And yeah

cerulean shale
silk fulcrum
cerulean shale
silk fulcrum
cerulean shale
#

He was on cycle and a truck hit him and he died on spot

silk fulcrum
#

this channel is never on top... oh wait im in ot3

cerulean shale
#

Ot3?

silk fulcrum
cerulean shale
#

💀

cerulean shale
silk fulcrum
#

it will be renamed soon

cerulean shale
#

Oh-

silk fulcrum
#

:lmao:

cerulean shale
#

Anyways ima sleep now, peace out master

silk fulcrum
#

gn

austere vale
#

how do i use aiosqlite to delete an entry from a table? im using it for my leveling code and one of my members has a double entry

austere vale
slate swan
#
@bot.command(name="say", description="bot wysyła wiadomość napisaną przez administratora")
@has_permissions(administrator = True)
async def say(ctx, *, text = None):

    if text == None:

        await ctx.send("wpisz wartość")

    else:

        await ctx.send(text)```




when I send the $ say command without the message value, I get a message asking me to enter the value. However, when I type $ say text, it doesn't work. Will someone help me?
#

you can correct the code for me

silk fulcrum
#

try removing the else and doing return at the end of that if

#

so it would look like py if ...: await ctx.send(...) return await ctx.send(text)

slate swan
#

this?

silk fulcrum
#

yes

slate swan
#

wait lets try

tawdry tendon
#

Hello

silk fulcrum
#

hi

tawdry tendon
#

I have this code

#

@has_permissions(kick_members=True)
@bot.command()
async def kick(ctx, kick_member:discord.Member, *, reason = None):
if kick_member == bot.user:
await ctx.send("You can't kick me 🤣")

elif kick_member.top_role >= ctx.author.top_role:
    await ctx.send("This person's role is higher or equal to yours!")

else:
    await kick_member.kick(reason = reason)
slate swan
slate swan
tawdry tendon
# tawdry tendon I have this code

How can I make it so if they don’t have the permission kick_members it sends a message saying that they don’t have the permission to

potent spear
#

you need an error handler

tawdry tendon
potent spear
#

I suppose you already get a message / traceback when the member doesn't have perms?

silk fulcrum
slate swan
silk fulcrum
slate swan
#

and i'm to 13yo

#

now im learning python

torn sail
tawdry tendon
slate swan
#

and i will learn backend but idk what language. Maby php or node.js

tawdry tendon
#

@potent spear I made this, would it work

#

@kick.error
async def kick_error(ctx, error):
if isinstance(error, MissingPermissions):
await ctx.send("You don't have permissions to kick, you need to have the kick member permission")
else:
print(error)

potent spear
silk fulcrum
tawdry tendon
#

Ok

silk fulcrum
silk fulcrum
slate swan
slate swan
silk fulcrum
silk fulcrum
silk fulcrum
#

no

slate swan
#

wait i have last question

torn sail
#

HTML css and js are so annoying compared to python

silk fulcrum
#

laravel 😎

torn sail
#

What’s laracel

#

Laravel

silk fulcrum
#

for sites

slate swan
#

yes

#

@silk fulcrum is it possible to do somehow that I have a config.py file and in it I keep all messages that are displayed in other files. I just mean that in main.py I have all the commands and ctx.send (a message that can be set in config.py)

torn sail
#

What’s Django (I’ve heard of it but idk what it is)? Is it web framework

silk fulcrum
torn sail
unkempt canyonBOT
#

The page contains all information about aiohttp Server API:

silk fulcrum
#

probably, no idea, I like laravel for web

slate swan
#

ok wait i send images

torn sail
#

Assign to a var in config then import config

slate swan
#

are u know now?

silk fulcrum
#

@torn sail hey, i remember there was something like case in python, like a replacement to py if name == "smth": ... elif name == "sfhtg": ...

#

do you know what it is?

#

or match

slate swan
silk fulcrum
silk fulcrum
torn sail
#
foo = 0

match foo:
    case 0:
        print("foo is 0")
    case 1:
        print("foo is 1")
    case _:
        print(“foo is not 1 or 0")
#

!match

silk fulcrum
#

yeah match and case breh

torn sail
#

!case

#

!d match

unkempt canyonBOT
#

8.6. The match statement

New in version 3.10.

The match statement is used for pattern matching. Syntax:


match_stmt   ::=  'match' subject_expr ":" NEWLINE INDENT case_block+ DEDENT
subject_expr ::=  star_named_expression "," star_named_expressions?
                  | named_expression
case_block   ::=  'case' patterns [guard] ":" block
```...
slate swan
silk fulcrum
slate swan
#

so if i will have await ctx.send(message)

config

message = "hello"

#

It will work?

silk fulcrum
#

yes?

slate swan
#

and to get all the objects from config.py, I have to give it from config import *

#

i know this from css

silk fulcrum
#

or import config and use config.something

slate swan
#

okay thanks

quaint epoch
#

but wild cards are usually discouraged

slate swan
quaint epoch
#

you can use it

slate swan
quaint epoch
#

idk

junior verge
#

Whats the both slash command and normal commands called

#

hybrid?

torn sail
#

Yep

junior verge
# torn sail Yep

Will you stay be able to use it after after message commands get removed?

#

With a verified bot

silk fulcrum
#

not without a permission for message_content

junior verge
#

So it's possible?

#

I have the message content intent on

silk fulcrum
#

you can use message commands with message_content permission

junior verge
#

On a verified bot too?

silk fulcrum
#

discord gives it

junior verge
#

hm?

slate swan
#

Who can say how to change this line here grole = discord.utils.get(ctx.message.guild.roles, name = ':male_sign:') if grole in ctx.author.roles and grole in member.roles: embed = discord.Embed(description = 'Вы не можете использовать данную команду на участниках с ролью :male_sign:', colour=0xF1C40F) await ctx.send(embed=embed) return in the code, so that command works without errors. The command code is below

sick birch
slate swan
# sick birch Shouldn't it already work without errors?
Traceback (most recent call last):
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 113, in wrapped
    ret = await coro(arg)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 762, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "c:\Users\ToxicPenguin\Desktop\проекты на Python\disocrd bot python\cogs\fun.py", line 62, in __kiss__
    role = discord.utils.get(interaction.message.guild.roles, name = '♂️')
AttributeError: 'NoneType' object has no attribute 'guild'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\bot.py", line 755, in process_application_commands
    await ctx.command.invoke(ctx)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 312, in invoke
    await injected(ctx)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 119, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'guild'```
#

I 'm just using it interaction: discord.Interaction not ctx. Since I have a slash command

#

@sick birch just replace ctx with interaction with works

slate swan
#

@silk fulcrum yes

silk fulcrum
#

yes

slate swan
#

@silk fulcrumBut here writing in other languages is generally prohibited

silk fulcrum
silk fulcrum
#

!d discord.Interaction.message

unkempt canyonBOT
slate swan
#

@silk fulcrumthis error is due to the fact that I am not using ctx and this interaction

silk fulcrum
#

oh the message is None

#

not guild me dumb

#

actually, why can't you just use interaction.guild? @slate swan

#

same with ctx

slate swan
#

@silk fulcrum OMG how do you understand this documentation

slate swan
#
Traceback (most recent call last):
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 113, in wrapped
    ret = await coro(arg)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 762, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "c:\Users\ToxicPenguin\Desktop\проекты на Python\disocrd bot python\cogs\fun.py", line 62, in __kiss__
    role = discord.utils.get(interaction.guild, name = '♂️')
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\utils.py", line 461, in get
    for elem in iterable:
TypeError: 'Guild' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\bot.py", line 755, in process_application_commands
    await ctx.command.invoke(ctx)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 312, in invoke
    await injected(ctx)
  File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\core.py", line 119, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: 'Guild' object is not iterable```
silk fulcrum
#

the heck

slate swan
#

I have slash commands

silk fulcrum
#

why did you remove .roles

torn sail
silk fulcrum
#

why dont i?

torn sail
#

The guy that called Danny a bastard

silk fulcrum
#

i would remember every single russian

torn sail
#

Toxic penguin

slate swan
torn sail
silk fulcrum
torn sail
#

Oop didn’t see

slate swan
torn sail
#

👍

tawdry tendon
#

Hello

torn sail
#

Hi

tawdry tendon
#

I need help

#

one sec

silk fulcrum
tawdry tendon
#
@bot.commands()
async def permissionpurge(ctx, perm):
  await (f"You have chosen to use {perm} as the permission to use the purge command")

@has_permissions(perm=True)
async def purge(ctx, amount = 1):
  await ctx.channel.purge(limit=amount+1)
  await ctx.send(f"{amount} messages have been purged!")```
#

thats the code

tawdry tendon
#
Traceback (most recent call last):
  File "main.py", line 156, in <module>
    @bot.commands()
TypeError: 'set' object is not callable```
tawdry tendon
silk fulcrum
#

and what the heck is that

#

why you have a function splitting 2 decos

torn sail
#

perm is not a valid permission

tawdry tendon
#

ye

silk fulcrum
#

and that too this

tawdry tendon
#

i want it to get the users input with a command

#

and use it as the permission

silk fulcrum
#

and typehint amount as int to have no problems

tawdry tendon
#

how can i do that?

silk fulcrum
torn sail
tawdry tendon
#

i dont know how to use sql

silk fulcrum
#

or json is enough if that's private bot

tawdry tendon
#

no

#

im going to publish it

silk fulcrum
tawdry tendon
#

fr

#

fat F for me

silk fulcrum
#

publishing a bot without database

slate swan
tawdry tendon
#

huh

torn sail
silk fulcrum
tawdry tendon
silk fulcrum
#

but noone told me about blockingio

white citrus
#

He did not send the view

torn sail
white citrus
#
class settings_document_admin_view(nextcord.ui.View):
    def __init__(self, ctx, settings_data, *, timeout=20):
        super().__init__(timeout=timeout)
        self.ctx = ctx
        self.settings_data = settings_data
        
    
        async def unset_admin_role(self, interaction: nextcord.Interaction):
            await self.bot.setiings.unset(self.settings_data)
                
        @nextcord.ui.button(
        label="Delete the Role",
        style=nextcord.ButtonStyle.danger)
        async def del_admin_role(self, button, interaction):
            await unset_admin_role(interaction)
            
        @nextcord.ui.button(
        emoji=config.gf_delete_emoji,
        style=nextcord.ButtonStyle.grey,
        )
        async def delete_button(self, button, interaction):
            await self.handle_delete_message_and_output(self.ctx, interaction)```
silk fulcrum
#

so i used not async db till this summer

torn sail
#

I would take a look at a website called sqlbolt

tawdry tendon
slate swan
white citrus
tawdry tendon
#

for databases do i have to use another file?

silk fulcrum
tawdry tendon
#

just asking

white citrus
slate swan
torn sail
#

!pypi aiosqlite

unkempt canyonBOT
torn sail
#

SQLite is good to start with

tawdry tendon
#

oh so its built with python

#

?

silk fulcrum
#

not aiosqlite

#

sqlite3 is

tawdry tendon
#

ok

silk fulcrum
#

but use aiosqlite

tawdry tendon
#

why?

silk fulcrum
#

async

torn sail
tawdry tendon
#

whats the difference

slate swan
#

@silk fulcrum and where can I see how to properly export a database to a discord bot ?

silk fulcrum
#

no blockingio

tawdry tendon
silk fulcrum
torn sail
# tawdry tendon huh?

sqlite3 module is blocking so it slows down ur bot a bit but aiosqlite is async so it won’t

#

!blocking

unkempt canyonBOT
#

Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.

What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:

import discord

# Bunch of bot code

async def ping(ctx):
    await ctx.send("Pong!")

What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.

async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!

tawdry tendon
#

@torn sail what sql would u recommend

tawdry tendon
#

ok

slate swan
silk fulcrum
slate swan
vernal glen
#

hi I wanted to make a registration system for my discord server can someone help me

silk fulcrum
#

what 😳

vernal glen
#

????????

silk fulcrum
#

maybe you mean use database in bot?

subtle orbit
#

can

subtle orbit
#

someone help me

silk fulcrum
slate swan
subtle orbit
vernal glen
tawdry tendon
#

Bro I hardly even started and I’m stuck

torn sail
unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

silk fulcrum
# slate swan yes

well, that's just a mean of what database you use, you will need a specific lib for it
for sqlite - aiosqlite
for mysql - aiomysq
for postgresql - asyncpg

tawdry tendon
#

I hardly started and I’m struggling

torn sail
slate swan
tawdry tendon
#

I have

silk fulcrum
silk fulcrum
#

you are saying too hard words for my brain

vernal glen
#

???????

torn sail
tawdry tendon
#

The fact that I was actually about to do that

silk fulcrum
slate swan
silk fulcrum
#

you have to think how to make it your self

#

we can help with an error or smth like that

silk fulcrum
#

omg internet just crushed right now for me

#

i scared so much

junior verge
#

What does this mean?

subtle orbit
junior verge
#

I am trying to transfer my help command from 1.7.3 to 2.0, sadge

torn sail
#

Use None instead

silk fulcrum
junior verge
#

erm

#

but I'm using pag

silk fulcrum
torn sail
junior verge
#

oh

torn sail
#

You could modify the code for it

junior verge
#

How idk

#

Like the command was so good

torn sail
#

Well what’s ur editor?

junior verge
#

But just trying to transfer it to 2.0

junior verge
torn sail
#

Ok are u using venvs

junior verge
#

don't think so no

torn sail
# junior verge don't think so no

Then open up file explorer or something then navigate to the python section then find site packages then find ur lib then modify. Or u can just fork on GitHub and install from there

tawdry tendon
#

I’m having trouble understanding this

junior verge
#

I got no clue what to do

torn sail
junior verge
#

@sick birch I fixed the issue btw with the vps

#

I am switching to 2.0 and like editing/transferring all commands

sick birch
unkempt canyonBOT
#

@sick birch :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | True
002 | True
torn sail
torn sail
#

I would recommended forking