#discord-bots

1 messages ยท Page 107 of 1

outer flint
#

when I make a command can I make so [let's say the command is +abc find]
if there's no string after find [so it's just +abc find] it will do X
if there is an argument after [like +abc find dsadas dasdas] it will do Y

? thinko

onyx lark
#

i dont know what to do here now

#

bc its not working

glad cradle
onyx lark
outer flint
#

niceping noted noted

glad cradle
# onyx lark

this should work, are you using a venv?

btw don't make Api calls on on_ready event, don't load extension inside it too, on_ready is an event that could be dispatched multiple times so you'll probably get an error while loading the extensions (like extension already loaded)

onyx lark
#

its says env

#

so idk

glad cradle
#

where it says env

onyx lark
#

oh dotebv

fading marlin
# onyx lark

Don't change presence in on_ready. Use the activity kwarg in your bot constructor instead

onyx lark
#

dotenv*

glad cradle
#

dotenv is another thing

onyx lark
fading marlin
brazen raft
#

You should be able to instantiate the bot with a presence

fading marlin
onyx lark
#

ok i have used the same code in an other bot and that worked but the terminal is not working tho

slate swan
#

what am i doing wrong ๐Ÿค” I am pretty much trying to get the forbidden error to work but it doesn't send the message so um yeah hdsahdhsahdahsd

@bot.event
async def on_command_error(ctx, event, *args, **kwargs):

  if isinstance(event, discord.errors.Forbidden):
    msg = "The bot requires some of the permissions to execute this command!"
    asyncio.create_task(ctx.author.send(msg))
    return await ctx.channel.send(msg)
hushed galleon
#

if the error occurs inside your command itself, its wrapped into a commands.CommandInvokeError so retrieving the underlying exception (i.e. Forbidden) requires accessing the .original attribute

fading marlin
slate swan
#

ah alr

#

personally think using create_task ( or swapping the order of sending messages to channel and user ) is better than a direct await ctx.author.send .... the user might have their dms closed.

winged coral
#

How is using create task going to change the fact that their DMs are closed?

#

The error can* be handled the same regardless

slate swan
#

as i mentioned in the bracket, or swapping the order...

hushed galleon
#

if you did care about the exception then try/excepting it would be a better idea, to avoid the noise of an uncaught task exception

winged coral
#

Yeah ^ I don't think shoving the error into a different context is the best way to ignore it

hushed galleon
#

as for sending both messages at the same time i guess that's fine if you want to do so

slate swan
#

How can I except invalid form body?

winged coral
#

In an embed?

#

That's a class of HTTPException

slate swan
#

what are some good coding platforms for a bot? ๐Ÿ’€ i use replit but i keep getting rate limit

slate swan
#

@sick birch

pastel basin
#

Any webhook's code or bot's code to clear messages of a specific channel?

#

instantly

slate swan
#

how can we use asynchronous functions for dynamic cooldowns? i tried using asyncio.run() too, but it gave me some event loop error

async def nuke_cooldown(ctx):
        premium_check = await db.check_premium(ctx.guild.id)
        if premium_check == True:
            return None
        else:
            return commands.Cooldown(1, 60)

i am using asyncpg so i must use await for running the check, but then this function is completely non asynchronous and doesnt support asyncio.run

#

and btw this code is of pycord

winged coral
unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=None, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") to delete messages even if they are your own. Having [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting botโ€™s messages...
onyx lark
slate swan
slate swan
#

these exist

#

just use the decorator

slate swan
#

i tried running my asyncpg command with asyncio.run() too, but that didnt work it gave me event loop errors

#

i mean you could use a role

#

for premium and make the bucketype role specific

slate swan
onyx lark
#

yes or no

#

read the yellow

slate swan
#

probably should

onyx lark
#

so yes

slate swan
#

using cooldownmapping

#

are those possible in pycord?

onyx lark
slate swan
silk fulcrum
silk fulcrum
onyx lark
silk fulcrum
onyx lark
silk fulcrum
onyx lark
silk fulcrum
#

it says that your app that you are trying make requests to, doesn't exist

onyx lark
silk fulcrum
# onyx lark

Well, I guess a Discord application with such token doesn't exist. Also why would you create a variable DISCORD_TOKEN = ... and then not use it?

onyx lark
#

and i have only this code that works

silk fulcrum
#

What do you mean "the terminal is not working"? It's working perfectly

onyx lark
#

when i do python main.py or python3 main.py its not logging me in on the bot as it shulde

silk fulcrum
#

Did you check that your token inside of the .env file is valid? And for extra sure, you could reset it.

onyx lark
silk fulcrum
#

So you are sure it's valid?

onyx lark
#

do you have a code i can test?

primal token
onyx lark
primal token
primal token
onyx lark
silk fulcrum
onyx lark
primal token
silk fulcrum
#

bro dont say you didnt paste it into your .env file

slate swan
#

also how do u have it pasted in ur .env
No
TOKEN="sasdhfajsdf"
Yes
TOKEN=aherguhodfgsdfjgs

silk fulcrum
#

yeah...

onyx lark
#

like this

slate swan
#

no

#

TOKEN=aherguhodfgsdfjgs

onyx lark
#

no what?

#

still not working

onyx lark
slate swan
#

Well, you've got to install Python before trying to run py

onyx lark
#

how do i install tho?

slate swan
#

The issue here is not your code or anything else, it's you not having it installed.

onyx lark
#

how do install?

slate swan
onyx lark
#

like this? pip install python?

slate swan
#

Remember that coding a bot is not meant for beginners. The library is made for advanced users, that is explicitly written.

onyx lark
#

well i like starting hard ๐Ÿ˜„

slate swan
#

Well, maybe install Python before doing anything

nocturne cypress
#

wow i cannot believe i walked into this

#

feel like im say the same thing again, or ask for the same thing again. Please helpe kings and queens

#

I have also tried removing the curly brackets

onyx lark
slate swan
#

VSC uses your system installed interpreter or the virtual environment you're currently in

onyx lark
#

oh ok but the website did not help tbh

slate swan
#

Well, you don't have Python installed - which has nothing to do with discord bot development. So it's better using am appropriate channel --> #โ“๏ฝœhow-to-get-help

prisma prism
#

Hi guys! Regarding discord bots,
does message.author.id mean the ID of the person who sent the message?

slate swan
#

Correct, you can always try it and see

prisma prism
#

thank you

onyx lark
nocturne cypress
#

Krypton can you help me? I dont wanna chug bleach on saturday

slate swan
#

whats ur issue tho

glad cradle
#

wth delete this message

nocturne cypress
#

i did delete it

slate swan
#

it had ur token

nocturne cypress
#

yea i changed it

#

some madeup number

slate swan
#

hm so basically the environment is not loading for you?

#

!pip python-dotenv

unkempt canyonBOT
slate swan
#

install this library

#

and then use ```py
import dotenv
dotenv.load_dotenv()

#

it will load all the environment variables from your .env file in the code

nocturne cypress
#

ur gonna hate me for such plebian questions

#

i have python installed

slate swan
#

you should use python -m pip instead of pip

#

!dashpip

nocturne cypress
#

is saying python not found

slate swan
#

are you on windows?

nocturne cypress
#

yea

slate swan
#

use py instead of python

nocturne cypress
#

zomg

#

the future is Sarth

slate swan
#

๐Ÿข a useless future is something that shouldn't exist

#

anyways did it work?

nocturne cypress
#

which part

slate swan
#

the whole process

nocturne cypress
#

py -m pip

slate swan
#

installing library and calling that function

nocturne cypress
#

this did

#

im tryna do the second part senpai

slate swan
#

ywah so now you'll install the library using py -m pip install python-dotenv

#

other things stay same

nocturne cypress
#

import dotenv dotenv.load_dotenv() after that?

#

i installed it

slate swan
#

may i know whats the name or ur env file?

nocturne cypress
#

name is config.env

slate swan
#

if its anything other than .env you will ne doing dotenv.load_dotenv("filename")

#

yeah so instead of filename,you enter config.env there

nocturne cypress
#

shud i just call it .env

#

make it easy

#

rename

slate swan
#

yes that won't need to provide that argument inside load_dotenv

nocturne cypress
#

si senpai

#

my env file shud use curly brackets or no?

#

this the template

#

ENVIRONMENT={dev_or_prod}
BEARER_TOKEN={obtained_from_twitter_api}
USER_ID={user_id_of_burner_twitter_account_which_would_be_following_relevant_people_to_track_their_followers}
DATABASE_URL={postgres_database_connection_url}
TARGET_CHANNEL_ID={channel_id_in_which_you_want_to_periodically_send_messages}
TOKEN={discord_bot_token}

#

pleasse dont hate me for how dumb I am

#

and ty for ze patience

nocturne cypress
#

oki ty Robin

#

any idea why this happens?

#

im on windows

slate swan
#

Isn't it under venv\Scripts\activate.bat?

#

what does this mean and how do i fix it?

nocturne cypress
wary shadow
wary shadow
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

slate swan
wary shadow
nocturne cypress
#

on windows again

#

it is some syntax thing like the above

wary shadow
#

!minusmpip

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.

wary shadow
#

For windows it's usually just easier to use py -m pip

nocturne cypress
#

it worked ya wizard

#

think i follwed the op correct directions

#

and the bot is online - its also online in my server but there was a wall of read in the terminal

#

maybe it hasnt found the data yet?

cold sonnet
nocturne cypress
#

bot is online an active in discord channel

#

but no working

#

btw in the .env file - shud use @ or no? for username for twitter bot

#

please dont hate for my plebian ways

glad cradle
#

in a variable

nocturne cypress
slate swan
#

it shouldn't

#

async def balance(ctx, user: discord.Member):

can 'user' be used for the ctx.author ?

#

user: discord.Member = commands.Author

#

this will default the user to ctx.author if no user was provided

#

oh thanks ! it worked

#

CODE:

from discord.ext import commands




bot = commands.Bot(command_prefix='.', intents=discord.Intents.all())```

**ERROR I KEEP GETTING**
```AttributeError: module 'discord.ext.commands' has no attribute 'Bot'```
#

what library are you using? when did you update discord.py for the last time

slate swan
winged coral
#

What command did you use

slate swan
winged coral
#

Copy paste it, also are you using a venv?

slate swan
#

venv?

#

like i said im new ion really know what that is

winged coral
#

If you don't know what one is it probably isn't an issue. How are you running python?

slate swan
#

im coding it in vscode

#

thats all i know lol

winged coral
#

When you press the run button, there should be a line in the console that is the actual python invocation

#

might look like /usr/bin/python3 main.py

#

Or something like that, do you see it?

slate swan
#

will that show in the terminal?

winged coral
#

It might, not sure if VSCode displays it or not

#

Basically I want to make sure your pip and python versions aren't mismatched

slate swan
#

if you'd be using a venv, the name of it would show up before the folder 's name in terminal

#

thats what pops up in the terminal

wary crystal
#

ForceSelfBot ๐Ÿ‘€

winged coral
slate swan
#

isn't discord lib updated to dpy 2.0?

#

!pip discord

unkempt canyonBOT
slate swan
#

yeah, not latest tho

#

for my community server

wary crystal
#

It got fixed after they uninstalled and re-installed discord.py

slate swan
#

Should I try/

#

oh maybe, never used that package

#

pip uninstall discord

wary crystal
#

Well first check your pip freeze

#

To see if there is any conflicting packages

slate swan
slate swan
#

also lookup for forks like pycord, nextcord etc

#

shouldn't exist

wary crystal
#

pip freeze into the terminal

slate swan
#

Nvm

still elbow
#

netcord, wouldn't matter

slate swan
#

Disnake is the best

slate swan
#

idk how i have those installed

still elbow
#

Only extension that should matter would be pycord, disnake, pycord, hakira all use there own

slate swan
#

I never installed them

still elbow
#

pycord, you can say import discord, but every other such as nextcord it would be import nextcord

slate swan
wary crystal
#

discord.ext.context?

still elbow
#

No it doesnt, not from my experience at least

winged coral
#

!pypi discord.ext.context

unkempt canyonBOT
slate swan
still elbow
#

Are you sure they arent using import nextcord as discord?

slate swan
#

my friend told me to install it

wary crystal
#

I would get rid of it, because your not using it anyways

slate swan
#

cus hes python coder

wary crystal
#

And it might be the offending package

slate swan
#

Ok

winged coral
still elbow
#

That would be

winged coral
#

globally accessibly context ๐Ÿค”

slate swan
wary crystal
# slate swan Ok

To summarize, pip uninstall discord.py, pip uninstall discord.ext.context then pip install discord.py

slate swan
winged coral
#

๐Ÿ˜ญ ๐Ÿ˜ญ

slate swan
#

done

#

ill test right now

wary crystal
winged coral
wary crystal
#

Just won't always be a valid context

slate swan
#

The discord.ext.context

#

it works

wary crystal
still elbow
slate swan
#

it wont let my bot login so i gotta reset token

still elbow
#

Ah

winged coral
#

๐Ÿ’€

slate swan
slate swan
winged coral
#

yes please thank you

#

i want to use context before i run the bot too

still elbow
#

Oh yeah, i forgot about my own issue

slate swan
#

we can call it RunFunctionCalledContext ez

winged coral
#

actually just add it to my python too then i can use it in other projects too

slate swan
#

sure omw with my pr to cpython

winged coral
#

<3

still elbow
#

Im running a file that would run multiple bot instances at once. However im running the code and I come across Missing Acess error, the code runs both bots prefix command perfectly but fails to load the slash commands

winged coral
#

That doesn't happen when you run them individually?

still elbow
#

No

slate swan
#

load as in respond to interaction or registering them?

still elbow
still elbow
slate swan
still elbow
#

show code

slate swan
#

why 2 instances tho ๐Ÿ—ฟ

still elbow
#

I plan on it to be at least way more than 2

slate swan
#

i can't even get done with one instance

slate swan
wary crystal
#

Are you sure your not self-botting....?

#

You are 100% suspicious right now

still elbow
#

Its the type of bot, So I make private bots for servers known as leagues, each and every bot does the same thing. There is no need for me to create a new file for each

slate swan
#

yes its bannable

#

show code

winged coral
#

What are you setting it to?

slate swan
#

i was copying a youtube tutorial for this

winged coral
#

You setting it True or False?

wary crystal
#

Okay, so why is your dir name something self-bot, and you are also using run(bot=...) I'm assuming False as well...?

#

There is no reason to do either of this unless you are self-botting

slate swan
#

welp, i saw may people using bot=True for no reason at all

winged coral
#

^

still elbow
#

^

slate swan
#

just search for bot=True in this channel itself

still elbow
#

@slate swan Send code

slate swan
#

im not using bot=True

#

is it False?

#

you gotta show ur code if you want proper help man

#

ik im getting my bot token rn

still elbow
#

Why are you getting your bot token..?

slate swan
#

moderation bot???

still elbow
#
Ignoring exception in on_connect
Traceback (most recent call last):
  File "/home/mee/rewrite/venv/lib/python3.8/site-packages/discord/client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "/home/me/rewrite/venv/lib/python3.8/site-packages/discord/bot.py", line 1054, in on_connect
    await self.sync_commands()
  File "/home/mee/rewrite/venv/lib/python3.8/site-packages/discord/bot.py", line 657, in sync_commands
    app_cmds = await self.register_commands(
  File "/home/mee/rewrite/venv/lib/python3.8/site-packages/discord/bot.py", line 485, in register_commands
    prefetched_commands = await self._bot.http.get_guild_commands(self._bot.user.id, guild_id)
  File "/home/mee/rewrite/venv/lib/python3.8/site-packages/discord/http.py", line 353, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
#

@slate swan thats the error

slate swan
still elbow
#

It was, i thought that was the issue too, I deleted the bot from the database re-added it

slate swan
#

nvm i found a solution on github why my bot wouldnt work

#

well it does say Missing Access with a 403 error code, so its either permissions or scope

slate swan
still elbow
#

Selfbotting more than likely

nocturne cypress
#

whats the correct syntax to enter postgres url in my .env file?

still elbow
nocturne cypress
#

is this correct DATABASE_URL=postgres://XXXXXXX

slate swan
winged coral
nocturne cypress
#

do i need to add https:// or something, please senpai be kind

slate swan
still elbow
#

Yes, it runs perfectly

#

One bot is my actual bot that loads my token, guild id, botid into the database the other is testing

winged coral
slate swan
#

thats the issue then, two instances overriding each other

still elbow
slate swan
#

do they have same commands by any chance?

winged coral
#

You missed the ql which may be the issue

still elbow
#

No, i have a check. If the server id = my operation server it loads a different cog

#
    if var.owner:
        Owner.addbot.guild_ids = [var.guild]
        bot.add_cog(Owner(bot))
    else:
        bot.add_cog(Background(bot))
slate swan
#

why not use a single instance tho?

#

any specific reasons?

still elbow
#
def setup(bot):
    var = fetch_client(bot.description)
    if var:
        commands = dir(Background)
        for command in commands:
            command = getattr(Background, command)
            if hasattr(command, 'description'):
                command.guild_ids = [var.guild]

    if var.owner:
        Owner.addbot.guild_ids = [var.guild]
        bot.add_cog(Owner(bot))
    else:
        bot.add_cog(Background(bot))
#

This is how the guild id gets selected

simple kettle
#

where do i create this invite link?

wicked atlas
simple kettle
#

yeah i just found it

#

did not know i had to make a tos

#

dont even know where to start with that

slate swan
still elbow
#

Thank you so much

still elbow
slate swan
#

is this all on one bot?

still elbow
#

Should i check the guild ids?

#

instead

slate swan
#

if so you can't load cogs per guild. all cogs will be registered to every guild no matter what. what you can do inside the cog is set those commands to one guild using guild_ids=[] so the commands arent regsitered globally

still elbow
#

This is hard to explain

#

This code is running multiple bot instances at once

slate swan
#

then you can use default_member_permissions=discord.Permissions(administrator=True) so only ppl in ur server with admin perm will see the cmds

slate swan
still elbow
#

Its so i wont have to create a new file each time I make the bot

#

Every bot that gets added is a private bot for another server

slate swan
#

that just complicates things and i don't even think that is reliable

still elbow
#

they all run the same code

slate swan
#

yeah but that won't work

still elbow
slate swan
#

yea because u have multiple bots running

still elbow
#

I have decided to not do that

#

I am now running the same file, but different bot instances

slate swan
#

well apparently you can run multiple bots in one file lmao.

#

but again i think you are better off runing different instances

still elbow
#

Id prefer running multiple bots, since Im using a command to addthe bot

slate swan
#

because it doesn't do anything other than load a cog

still elbow
#

thats part of it. Its way more too it

slate swan
#

if var.owner: this will always be executed becuz their is always a guild owner so you will always load the Owner cog

still elbow
#

Should I check if the guild.owner is me instead?

slate swan
#

yup

#

if var.owner_id == your_id:

still elbow
#
def fetch_client(id):
    for i in range(0, len(clients)):
        if int(clients[i].bot.description) == int(id):
            return clients[i]

    return None
slate swan
#

bot instance

#

still var.owner_id will work

still elbow
#

yeah

#

ok one second

#

@slate swan it says client has no attriubte to owner_id

#

used dir(var)

#

oh wait

#
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'bot', 'bot_id', 'guild', 'load_extensions', 'owner', 'start', 'token']
#

should i do var.guild?

slate swan
#

there is owner attr

#

so owner.id

#

but that would be owner of the bot

still elbow
#

i just did var.guild ot check the guild to see if its my primary server

still elbow
slate swan
still elbow
slate swan
#

but it's multiple bots no?

#

so yoiu need to readd all of them

#

with the correct scope and permissions

still elbow
#

@slate swan

#

Ok so, I just verified and It still returns the error

#

Earlier a guy said I was overriding it, i have no idea what he meant by that

#

thats the issue then, two instances overriding each other

slate swan
#

What's the problem?

dull terrace
#

came up with the start of a new bot idea

#

a mostly social survival game, most commands require someone else from the server to interact in some way. then the results would be something like your friend in the server finds food and can decide whether to eat it all or share it 7739monkathink

#

then people from other servers can randomly show up and impact your game somehow

pearl fjord
#

how do i trigger something when any exception is raised anywhere while the bot is running even if it's not totally fatal?

#

@slate swan yo

fading marlin
#

you can handle exceptions using the on_command_error event

vocal willow
#

what's the typical way to use some event based messaging in combination with disnake?

#

say redis/zeromq/rabbitmq

slate swan
#

does anyone have code for something that if you do /{cmd} {duration} it will show different embeds if it has a name on it?

#

hm?

keen talon
upbeat gust
#

you really need to elaborate

#

also, I don't think you're gonna just get code, we'll help you but you need to do it yourself

slate swan
#

What does this mean and how do I fix it

upbeat gust
slate swan
#

?

slate swan
upbeat gust
slate swan
#

idk tbh\

upbeat gust
#

how do you not know what you installed

upbeat gust
#

"application.commands"

agile folio
#

nvm

#

Show me the bot.run() line

#

@slate swan

upbeat gust
#

Pycord automatically tries to sync on connect

#

but the correct scope isn't enabled here

slate swan
#

It prolly uses application commands but he hasn't enabled

hallow kernel
#

Hmmm
So messaging in discord by sending raw network requests from command line against ToS?

meager chasm
#

But if bot account or webhook then not

slate swan
#

flags is a string, why would it have a contrast property

slate swan
#

any idea why this is happening?

unkempt canyonBOT
slate swan
slate swan
#

note: I use nextcord

#

wait nvm

#

im just dumb

#

should be str not string

upbeat gust
#

just read the error lol

upbeat gust
#

what's flags?

#

uh huh so why would flags.contrast be a thing

#

why are you trying to use flags anyway? This is a slash command, use optional arguments

#

You aren't parsing that though

#

..parse the flags..?

#

Naming a string 'flags' doesn't magically do flag parsing

#

this is bad design anyway

shrewd apex
#

u either take in a string parse using
regex easiest method

upbeat gust
#

flags are ok for text commands, but why would you want this for a slash command

#

that's just unintuitive af

shrewd apex
#

^^

#

if there are a lot of options it might be fine ig

upbeat gust
#

Stop what you're trying to do with flags. Use optional arguments

#

like the ones you already have? User and flags

shrewd apex
upbeat gust
#

Yes

shrewd apex
#

u could even use the discord commands.Converter to create a neat custom convertor

upbeat gust
#

channel is not what you think it is

#

maybe yk, figure out what channel is

#

bruh that's a completely different function

near glen
upbeat gust
#

Why are you using after.channel everywhere, but just channel in that line

#

probably

near glen
#

i read it

upbeat gust
near glen
#

:/

near glen
#

o

#

i see

upbeat gust
#

:/

#

What's "the interface"

near glen
upbeat gust
#

yes that's exactly where the problem is

near glen
#

like this?

upbeat gust
#

look at what that's doing

vocal snow
# near glen like this?

in python, if you declare a variable of the same name twice in the same scope, the second definition overwrites the first

upbeat gust
near glen
upbeat gust
#

L5345

near glen
#

i am a newbie man

vocal snow
#

it's recommended to know atleast basic python before using discord.py

upbeat gust
upbeat gust
#

I alr said

near glen
#

error

upbeat gust
#

and the msgs after that

upbeat gust
#

what is channelID and voiceID supposed to be

#

The what channel

#

Text channel? Voice channel?

#

your variable and column names are really confusing

#

voice, channel, interface

#

???

#

might wanna fix up those names so anyone looking at your code doesn't spend all their time figuring out names

#

likee createdtext, createdvc, jointocreatevc

upbeat gust
#

Everywhere

#

Your variables, db

#

this is why we name things properly

slate swan
#

what part of "flags is a string, why would it have a contrast property" do you not understand?

#

Is there a way to get the original bot role

upbeat gust
#

You tell me

#

It's your editor

#

Read the error/warning

#

Hover over it

vocal snow
#

maybe you mixed spaces and tabs

slate swan
vocal snow
#

run your code, send the traceback and see whats wrong

#

no point in speculating

upbeat gust
unkempt canyonBOT
#

is_bot_managed()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.10)"): Whether the role is associated with a bot.

New in version 1.6.
upbeat gust
#

loop through guild.roles

#

Find ones which share the same name as the bot

slate swan
unkempt canyonBOT
#

property self_role```
Gets the role associated with this clientโ€™s user, if any.

New in version 1.6.
upbeat gust
#

Ah didn't know about that

slate swan
slate swan
#

Hello so Iโ€™m coding something where you have 2 users answering in 2 different modals. Is it possible to add both the results into 1 embed?

keen talon
#

!code share code blocks instead

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

pastel basin
#

Any guide tfor ban and kick commands?

#

Like @unkempt canyon has.

#

!ban @somone 2hr he is bad guy duh

#

I also want the staff using only {prefix}mute and {prefix}ban command. I don't want them to give the permission of kick and ban in guild. Like ban\mute others indirectly.

slate swan
#

Hello so Iโ€™m coding something where you have 2 users answering in 2 different modals. Is it possible to add both the results into 1 embed?

sick panther
sick panther
#

or maybe roles, there are a lot ways to do it

slate swan
keen talon
#

Many people don't wanna open photos

sick panther
latent ocean
#

Anyone know how to list subcommands of a hybrid_group in discord.py 2.0?

slate swan
#

should be <group>.commands

#

!d discord.ext.commands.Group.commands

unkempt canyonBOT
slate swan
#

yeah, its not a list but a set

latent ocean
#

thank you

pastel basin
pastel basin
sick panther
# pastel basin Yes I was thinking that too

If you would go for user ids, the best you could do is storing them in a database, and removing/adding them everytime something changes. Then just well yes, check if they're in the database inside the specific command (you could also make a separate function for that).

slate swan
#

so ive added user ids to a database but when i try to send the ids it sends as "(713579531935416331,)" , why?

#

Those are tuples, get the valid index - t[0]

tough lance
#

How much does aws cost after free trial?

rugged shadow
#

a lot

tough lance
#

Talk in numbers

naive briar
#

That question was answered

slate swan
#

its cheaper + lasts longer

#

!pastebin

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

Maybe read duh

#

If you don't read answers don't expect others to help you later on kryptonShrug

#

createdvc is he ID of the interface channel, and not the one owned by the user

#

Well the voice channel you're creating afterwards

#

In the code you showed you only create two channels, interface and "Join to Create"

#

Somewhere you create a channel with the user's name

#

ID of that channel should be saved in the DB as createdvc

#

Right, so output.id you need to save it in the DB somewhere, and then use that ID when selecting to change the channel's name in callback

#

Well, I'd rename the field to interfaceid and not createdvc

#

And then here, you replace createdvc with output.id

#

Keep this like that

#

But rename the column from createdvc to interfaceid

#

Since you store the interface channel ID

#

Then in here, you add a new SQL query to store output.id in createdvc column

#

You'll need a interfaceid and createdvc column

#

Yeah that's fine

#

Nah output.id is not defined there

#

You need to set to something like 0

#

Then when you create a voice channel, it will be saved

#

In that part you only save the interfaceid and jointocreatevc

#

Then in here you save the createdvc

#

Yeah you need to set a default value for createdvc in the database settings, can be something like 0

nova mauve
#

Anyone got any good resources / videos for creating buttons?

verbal hawk
hushed galleon
#

are you using any library in particular?

verbal hawk
#

does anyone have a good idea for measuring time between interactions with buttons? (user specific)

slate swan
unkempt canyonBOT
slate swan
#

you can subtract 2 datetimes to get a timedelta

nova mauve
verbal hawk
slate swan
#

You can put 0

#

Or just go in the settings of the table

#

You can set a default value for a column

slate swan
#

Default/Expression I suppose or Default at the bottom right

#

Never used that interface

austere herald
#

REPLACE INTO ๐Ÿ‘€

#

Is this a MySQL upsert operation?

dusky rock
#

i'm making a bot i've run out of ideas ๐Ÿ˜‚

keen talon
dusky rock
#

๐Ÿ‘€

pastel basin
#

is it possible to run a same bot with two diffferent codes?

#

like executing two with same bot token

vocal snow
#

sure

pastel basin
#

what are the cons?

slate swan
#

That's what happens when people forget to shut down one instance of the bot and then wonder why it's replying twice crabRave

pastel basin
#

ye

slate swan
#

The main con is that it's not handy to get an overview of your code if some things are in one file and others are in another and you run them separately.
And can lead to your bot replying twice if you've done it incorrectly

pastel basin
#

i m doing something bad tho... i dont know "js" and im thinking to copy paste someone's code and i dont know how to combite it with py

#

i know you shouldnt copy paste

slate swan
#

Don't copy paste, instead try to understand the code they made and convert it yourself in Python

pastel basin
#

I dont know js

slate swan
#

Then try to think about how the command can be done in python

glad cradle
#

wouldn't having two scripts using the same token also lead to an easier hit of a "429 too many requests"?

slate swan
#

Use the command you want to have and then think about how a Python implementation can be done

pastel basin
#

oh okay

pastel basin
#

im curious how people combie different languages together in one folder to run their bot

honest shoal
#

They are mostly extensions for something else

pastel basin
#

oh

honest shoal
#

Like writing a game in C++ as an extension and then using in a discord bot which is written in python

pastel basin
#

ye

stuck wharf
#

Hello, I am getting this error while trying to run commands on my bot. Anybody know the fix / issue?

maiden fable
maiden fable
#

Change the name

stuck wharf
#

that doesnt fix it

slate swan
#

yep looks right

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
#

Remove createdvc from your query

#

Remove 0 as well

#

anyone here experienced with mongodb?

#

No that was correct before

slate swan
#

What you need is a new statement to insert the createdvc in the database

#

lmao

#

Yeah thay was correct

#

After output = ... you make a new query and get output.id in the createdvc column

#

Imma watch a movie kryptonEating

pastel basin
#

Are there any legal ways to create music bot?
Since many famous bots were banned who used youtube api

slate swan
#

That doesn't UPDATE, that's a SELECT - check some documentation to see how to update data

slate swan
pastel basin
#

that wont happen

slate swan
#

Then your question is answered

#

Don't make a music bot, as it's not allowed

pastel basin
#

sad

#

@slate swan deservers @copper yarrows role. my guy helping people day and night without any break

slate swan
pastel basin
#

whoops... pinged someone

slate swan
#

Kind of made a break of helping here and came back at helping here again

sick birch
#

Is the helpers role pingable?

#

I don't really wanna find out ๐Ÿ‘€

shrewd apex
sick birch
#

Looks like role pings are off.. thank goodness

slate swan
shrewd apex
#

lmfao

slate swan
#

<@&267630620367257601> mentionable but not pingable

#

Anyways, heading to my movie

sick birch
feral timber
#

@sick birch is pinging me

sick birch
#

right back at you buckaroo

lilac sandal
#

Hey how do I disconnect the a discord bot

#

like

sick birch
lilac sandal
#

when it is connected how can i disconnect it without closing the script

sick birch
#

Would be nice to have some UI option to do that as well

shadow vigil
lilac sandal
#

without exiting the script

sick birch
unkempt canyonBOT
#

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

Closes the connection to Discord.
slate swan
sick birch
#

Your script won't close but the bot will go offline

lilac sandal
shadow vigil
slate swan
#

Not able to sorry

feral timber
sick birch
lilac sandal
#

should work..

fading marlin
#

fwiw the second nested try/except isn't necessary

primal token
feral timber
primal token
#

reasons why dogs are mid

#

๐Ÿ˜Ž

nova mauve
#

is this a code related issue?

sick birch
nova mauve
# sick birch yes

only thing i think of is that ctx isnt there so it has no context to send so it errors?

sick birch
#

Not sure if I can help then, sorry.

nova mauve
#

I mean I'd prefer to make the buttons in discord.py

#

If you point on me on the right path perhaps

sick birch
#

It might as well be a library error since these 3rd party component libraries aren't built very well

nova mauve
sick birch
#

of course

#

there are more in that same folder

naive briar
#

Do you have a slash command named channel

primal token
nova mauve
#

looks a bit confusing tbh

sick birch
#

At first yeah, spend some time getting to know how it works and it'll get easier ๐Ÿ˜„

glad cradle
#

perms

silent portal
#
await channel.set_permissions(guild.default_role, overwrite = None)
#
await channel.set_permissions(guild.default_role, view_channel = True)
silent portal
#

exactly

#

yw

slate swan
#

the insert happens properly but when i check the table associated instead of the whitelist_roles having the role id it just contains {}

@inviteblocker.command(description='Manage the inviteblocker whitelist')
    async def whitelist(self, ctx, action: Option(str, 'Whether to add or remove a role from the whitelist', choices=['add', 'remove'], required=True), role: Option(discord.Role, 'The role you want to add / remove from the whitelist', required=True)):
        await ctx.defer()
        check = await db.run_query(f'select exists(select * from inviteblocker where guild_id = {ctx.guild.id})')
        if check[0]['exists'] == True:
            await db.run_query("update inviteblocker set whitelist_roles = whitelist_roles || '{{}}'".format(role.id))
            ibwembed = discord.Embed(description='The role has been added to the whitelist successfully', colour=discord.Colour.green())
            await ctx.respond(embed=ibwembed)
        else:
            ibwembed = discord.Embed(description="Couldn't set the whitelist role since inviteblocker is current disabled.\nEnable it by using **/inviteblocker toggle**", colour=discord.Colour.red())
            await ctx.respond(embed=ibwembed)
#

can someone help please

#

i am using postgres with asyncpg and the discord lib is pycord

upper berry
#

Give me a second to look at your code

#

What Are you using to make the db connection?

#

Also for the record I'm not sure what one would expect from table inviteblocker; .... Is that the same as SELECT * from inviteblocker; ???

slate swan
upper berry
#

Sorry what is alr?

#

In any case I'm 99% sure you need to commit somewhere

slate swan
#

Depends if you have auto commit enabled kryptonShrug

upper berry
#

Assuming alr supports it, use it to parameterise your SQL. Don't use f-string.

#

And honestly, using a sub-query to find out if the entry exists feels wrong. Perhaps there's some Postgres optimisation, but unless you have a very specific need, just select count(*), or better select for update in a transaction

slate swan
#

all i had to do was a bit of concatenation or whatever they call it:

await db.run_query('update inviteblocker set whitelist_roles = whitelist_roles || '+"'{"+str(role.id)+"}'")
upper berry
#

That is bad

#

Use the parameterisation

#

Don't use f-strings, or concatination.

#

So something like this:

#

db.run_query('update inviteblocker set whitelist_roles = whitelist_roles || {?}', str(role.id))

#

But this assumes that "alr" supports this kind of thing. It it does not, you don't want to use it.

#

@slate swan perhaps ask your question a a free channel?

slate swan
#

hey need some help

#

how do i get the

#

this thing on my discord bot

#

Just like you do now

#

Simply send a message like

> A message
#

ty

dusky rock
#

I donโ€™t know why but Iโ€™m having this sudden urge to watch yt tutorials just to see how awful they are

slate swan
#

mmh?

#

If you need to find a bot for a specific purpose I recommend you to search on the internet, you will find lots of them.

austere vale
#

im running a loop to check a json file i have, but i get the error Error checking user: 'data' at every loop. does anyone know what this means?

random saffron
#

Well that's just your opinion buddy

primal token
#

You're late to the party buddy

random saffron
latent ocean
#

Anyone know how I'd format a command like !slowmode 1h30m20s (h = hour, m = minutes, s = seconds)

lilac sandal
#

@willow sky

willow sky
lilac sandal
#

oh um..

#

hi

willow sky
#

whats up

lilac sandal
#

can you maybe..

#

Well..

#

do you want to work on a project with me?

#

@willow sky

willow sky
#

uh what kind? and why me..?

lilac sandal
#

Message me in dm

silent portal
#

but idk if it's the best solution, not quite efficient

slate swan
#

Well you could go with this horrible regex

#

!e

import re

r = "[0-9]+[hmsd]"
t = "1h30m20s"
print(re.findall(r, t))
unkempt canyonBOT
#

@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.

['1h', '30m', '20s']
slate swan
# slate swan Well you could go with this horrible regex

cc @latent ocean if you haven't found a good way until now.

Maybe not the best but might be worth the try as it works and can be easily parsed. I used to use that regex before. Otherwise there probably are some libraries around you can search for.

unkempt canyonBOT
shrewd apex
#

!pip time-str or this

unkempt canyonBOT
slate swan
#

(Sadly) libraries for everything these days

lucid kite
#

which saves time

slate swan
#

Correct me if I'm wrong, never said the opposite

vale wing
#

I wonder what would copilot give if you entered "free bobux generator" prompt

vale wing
#

Timedelta converter is fun to make by yourself imho

slate swan
#

stops giving output after that

#

try creating a function named free_bobux_generator

paper sluice
#

future of ai

slate swan
slate swan
#

Where can I learn how to make a discord currency bot? with slash commands, using pycord, and using sqlite3

#

The documentation of relevant libraries along with brainstorming how it can be done

#

Can I get a sample code of a currency bot, made using pycord?

#

you're basically being asked to read the docs and begin with it

slate swan
#

Internet is your friend though

#

what

humble gyro
#

use brain

slate swan
#

There is a documentation for almost every single library

#

!d sqlite3

unkempt canyonBOT
#

Source code: Lib/sqlite3/

SQLite is a C library that provides a lightweight disk-based database that doesnโ€™t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. Itโ€™s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.

The sqlite3 module was written by Gerhard Hรคring. It provides an SQL interface compliant with the DB-API 2.0 specification described by PEP 249, and requires SQLite 3.7.15 or newer.

This document includes four main sections:

slate swan
#

Think about how you would save the data, etc.

#

The documentation helps you get it solved

slate swan
humble gyro
#

I will use mysql

slate swan
#

Everything, think about how you can make commands based on how you need them

#

you'll first need to learn how create a bot instance and running it

#

there's a guide in the docs iirc

slate swan
slate swan
#

You won't have code to copy pasta, you will need to be creative and think about how to do it yourself.

#

That will get you a base bot ^^

#

To make economy commands, you will need to use your brain and think more about it 3HC_smile

#

In other words: use your brain

humble gyro
#

its all about how you implement your idea to bot using docs

slate swan
#

it teaches you how to make a bot
integrating the bot with a database and making an economy system would be your brain job

#

Think about how you can use database to make currency commands etc.

humble gyro
#

Learn basic python, then implement your idea

slate swan
#

You will need to brainstorm how these functions can be done and then implement them by yourself

shrewd apex
#

dw just go sleep ๐Ÿ‘

slate swan
#

wut

shrewd apex
#

lmao

humble gyro
#

lmao

slate swan
#

Deleting everything KEKW cringe

shrewd apex
#

sussy

humble gyro
#

ye

#

gimme some cool idea to code tho

slate swan
#

We won't forget you @slate swan no worries bravemmlol

shrewd apex
shrewd apex
humble gyro
slate swan
humble gyro
#

lmao

slate swan
#
@bot.slash_command(name="register")
async def register(ctx):
    db = sqlite3.connect("userinfo.db")
    cursor = db.cursor()

    cursor.execute("INSERT INTO userinfo(userid, balance) VALUES(?,?)", (ctx.author.id, 0))
    
    db.commit()
    db.close()

    await ctx.respond("Registered!")

is it like this?

shrewd apex
#

make a chat group or chatting platform ig

slate swan
slate swan
shrewd apex
#

that like 4 lines of code there is useless which u will have ti repeat every command with economy stuff

slate swan
#

ok

slate swan
#

We're not interpreters

#

oh wait... i forgot to create a database ๐Ÿ˜„

shrewd apex
#

imagine

#

so table where?

slate swan
#

imagine imagining

shrewd apex
#

sarth lurking ๐Ÿ‘€

#

or is it under the desk chupke phone?

slate swan
#

am sitting on the last seat so noone cares

shrewd apex
#

noice

slate swan
#

ok now i created the database

#
@bot.slash_command(name="register")
async def register(ctx):
    db = sqlite3.connect("userinfo.db")
    cursor = db.cursor()

    cursor.execute("INSERT INTO userinfo(userid, balance) VALUES(?,?)", (ctx.author.id, 0))
    
    db.commit()
    db.close()

    await ctx.respond("Registered!")


@bot.slash_command(name="bal")
async def balance(ctx):
    db = sqlite3.connect("userinfo.db")
    cursor = db.cursor()

    await ctx.respond(cusor.execute("SELECT * FROM userid WHERE balance=?", (balance,)))

    db.commit()
    db.close()

is this correct now?

#

why don't u run and see

vale wing
#

Sqlite3 in async app ๐Ÿ˜ฉ

#

Your code will be blocking real hard

slate swan
#
# Mute user
time.sleep(duration)
# Unmute user

PES_Smart

primal token
#

just smack a await asyncio.sleep(0) and you'll be good

#

๐Ÿ˜Ž

slate swan
#
for i in range(duration):
   await asyncio.sleep(1)
primal token
slate swan
#

How do i wait for response in slash commands? for pycord

#

wait_for

#

ok thanks

#

is it possible to convert message.content.lower into slash commands?

#

Absolutely useless as you have parameters but sure

#

Ah you mean a message to a slash command, no

#

Make the slash commands correctly and how they are meant to be done

#

sO iF the User TypE like THis

for input in option of slash command, will it work?

#

Yeah you said it wrongly above, you can lower that in the code, yes

#

Would be arg.lower()

slate swan
#

In your slash command code

#

!d discord.StageChannel.members

unkempt canyonBOT
slate swan
#

check if the member object is in the return value @slate swan

slate swan
brazen raft
slate swan
#

is this possible?

@bot.slash_command(name"testcommand", description="Test")
async def test(ctx):
#if user respond = hi
await ctx.respond("hello")
#if user respond = test
await ctx.respond("test")

something like this is possible?

brazen raft
#

Just saying

#

Also you should only connect to the database once in the start up of the bot

slate swan
#

ok

slate swan
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
slate swan
#

wait for "message"

#

async def test(ctx:discord.ext.commands.Bot.wait_for):

#

Maybe you want to learn python, at least the basics, before doing a bot

#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

or you can ask asher to code for u, he's a nice person

upbeat gust
#

sqlite doesnt have connection pools

slate swan
#

they actually mean having a single connection throughout the bot ig

upbeat gust
slate swan
#

yeah and that explains the "why", creating connections inside the commands may cause multiple connections writing in the file at the same time, since sqlite databases are just files and not actual database servers

upbeat gust
slate swan
shrewd apex
#

just use asyncpg make life easier

slate swan
quick ice
#

Does anyone have a discord bot code? For reaction roles i can read and learn? Im using replit (python)

slate swan
#

You're just one google search away to finding that

ionic edge
#
class Memebut(discord.ui.View):
    def __init__(self , msg):
        super().__init__(timeout=60.0)
        self.value = None
        self.msg = msg

    @discord.ui.button(label="Meme", style=discord.ButtonStyle.blurple)
    async def Next(self, interaction: discord.Interaction,button: discord.ui.Button):
        r = requests.get("https://meme-api.herokuapp.com/gimme")
        data = r.json()
        embed = discord.Embed(title=data["title"], color=discord.Color.blurple())
        embed.set_image(url=data["url"])
        await self.msg.edit(embed=embed)
        await interaction.response.send_message("wtfshrike", ephemeral=True)

    @discord.ui.button(label="Stop",style=discord.ButtonStyle.red,emoji="๐Ÿ’ฅ") # or .danger
    async def stop(self,interaction:discord.Interaction,button:discord.ui.Button):
        return await interaction.response.send_message("Stopped",ephemeral=True)```
@commands.hybrid_command(
    name="meme",
    description="Get a random meme from reddit.",)
@checks.not_blacklisted()
async def meme(self, context: Context) -> None:
    req = requests.get("https://meme-api.herokuapp.com/gimme")
    embed = discord.Embed(color=discord.Color.blue())
    embed.set_image(url=req.json()["url"])
    embed.set_footer(text=f"Requested by {context.author.name}" , icon_url=context.author.avatar)
    msg = await context.send(embed=embed)
    view = Memebut(msg)
    await msg.edit(view=view)
#

how to disable the buttons

#

as i presss the stop button

shrewd apex
#

requests

shrewd apex
slate swan
#
import discord
import os

client = discord.Client()

@client.event
async def on_read():
  print("We have logged in as {0.user}".format(client))

@client.event
async def on_message(message):
  if message.author == client.user:
    return
  if message.content.startwith("!hello"):
    await message.channel.send("Whats good!")

client.run(os.environ('TOKEN'))
#

just started making a bot, this comes up with an error when i run it (im using replit)

#
Traceback (most recent call last):
  File "main.py", line 4, in <module>
    client = discord.Client()
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
paper sluice
#

!intents

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.

velvet compass
#

Is the client.user part normal?

paper sluice
#

misspelled on_ready

slate swan
#

Yeah that seems normal, though I'd rather use message.author.bot to ignore bots

slate swan
slate swan
#

In that case you haven't added it properly.

#

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

#

For you it will be needed in discord.Client(intents=intents)

#

Finally fixed the error and moving on to the next one

#

Best feeling of coding

#

How would I get the author of a messageโ€™s id?

#
m = channel.fetch_message(id)
m.author
slate swan
#

How would I get the author of a messageโ€™s id?
That implies you have the ID

slate swan
#

???