#discord-bots

1 messages ยท Page 798 of 1

sick birch
#
message.author.add_roles(...)
#

And also, if you are getting a role by it's ID, you can just do:

guild.get_role(id)
slate swan
#

hmm

sick birch
#

Which is faster (O(1)) and also much simpler

slate swan
#

yeah it is

#

let me try fixing

quick gust
#

!d disnake.Guild.get_role || for reference

unkempt canyonBOT
sick birch
#

I need to learn to use the !d haha

quick gust
#

same lmao

sick birch
#

!d discord.Guild.get_role

unkempt canyonBOT
quick gust
#

pseudocode is confusing to me

sick birch
#

I wonder

#

!d nextcord.Guild.get_role

unkempt canyonBOT
sick birch
#

hehe

slate swan
#

neat

quick gust
#

it supports 41 packages/docs, nice

reef trail
#

i was making a nuke channel command and i was just doing it incorrectly, i figured it out but what does the error its self mean? ive never seen it before

manic wing
#

the point of pseudocode is you just do random shit to convey your point

neat tartan
sick birch
manic wing
#

pseudocode just explains what you're doing

sick birch
#

json can only store primitive types unless you're employing pickling but I won't go into that

quick gust
manic wing
#

not really

#

theres nothing to remember

#

you literally just code

quick gust
#

for me everuththing is hard to remember

quick gust
reef trail
tacit token
#

hello guys, anybody knows whats the hours / days ? {'s': 1,'m':60}

slate swan
#

I've been at this for 30 mins

quick gust
#

shouldn't be, its a simple error

#

bot.guilds returns a list

#

u need a guild object to get the role

sick birch
slate swan
#

ah

quick gust
#

also while defining role2 you uesd dguild, I'm assuming that's a typo

cold sonnet
#

add_roles also really wrong

slate swan
#

oufe

cold sonnet
#

why you gotta look at old youtube videos

quick gust
slate swan
warm forum
#

Hey guys if i post anything on my fb page can my discord bot give the link to that post in discord? Is it possible?

quick gust
#

well

slate swan
#

[role, role2]

quick gust
#

its not a kwarg

#

i think

cold sonnet
#

add_roles only takes one positional argument

quick gust
#
message.author.add_roles(role)```
slate swan
#

so i cant assign random roles this way

#

๐Ÿค”

cold sonnet
#

message.author.add_roles(random.choice([role1, role2]))

slate swan
#

IT WORKED

#

THANKS

#

๐Ÿ˜ญ

cold sonnet
gaunt ice
#

i hab a doubt

quick gust
#

ask

slate swan
#

no friggin way it worked โ˜ ๏ธ

gaunt ice
#

is there a event where we can find when a user starts

quick gust
#

what's surprising about it

gaunt ice
#

an activity

cold sonnet
#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

โ€ข nickname

โ€ข roles

โ€ข pending...
gaunt ice
#

hmmm

slate swan
cold sonnet
#

wait that might not be it

gaunt ice
#

oki

quick gust
#

!d disnake.on_presence_update

unkempt canyonBOT
#

disnake.on_presence_update(before, after)```
Called when a [`Member`](https://docs.disnake.dev/en/latest/api.html#disnake.Member "disnake.Member") updates their presence.

This is called when one or more of the following things change:

โ€ข status

โ€ข activity

This requires [`Intents.presences`](https://docs.disnake.dev/en/latest/api.html#disnake.Intents.presences "disnake.Intents.presences") and [`Intents.members`](https://docs.disnake.dev/en/latest/api.html#disnake.Intents.members "disnake.Intents.members") to be enabled...
slate swan
#

im sorry for being annoying

gaunt ice
#

TYSMM

cold sonnet
slate swan
#

its just that i've seen some videos and didn't really get around it

#

started learning how to make bot last night

quick gust
quick gust
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.

gaunt ice
cold sonnet
quick gust
cold sonnet
quick gust
#

!d discord.on_presence_update

unkempt canyonBOT
#

discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their presence.

This is called when one or more of the following things change:

โ€ข status

โ€ข activity

This requires [`Intents.presences`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.presences "discord.Intents.presences") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled...
gaunt ice
#

hmm

#

okkkk

quick gust
#

i shud probably use discord's docs lol

gaunt ice
#

oof

#

tysm again

sick birch
slate swan
sick birch
#

That's awesome!

slate swan
#

now im trying to find a way to make sure that this command can't be used a second time

#

once the user has one of the roles from the list

cold sonnet
#

if role1 in message.author.roles or role2 in message.author.roles

#

don launch

brave vessel
#

or since it's a list of roles, you could go through each role in the list then check if that role is in the roles of the author, and if so don't use the command so

for role in list_of_roles:
  if role in message.author.roles:
    # code goes here to prevent the command from launching
cold sonnet
#

that's not so necessary when you have two roles in the list, but when adding more, it's practical

slate swan
#

if any(role in message.author.roles for role in role_list):

#

Or use the commands.has_any_role

void mist
#

that I what I was gonna ask but i guess it's pre answered

pliant gulch
#

You can use sets here cause you know that the roles won't appear twice

#

And this would also be O(n) where N is the lowest set's element amount

slate swan
#

I get this traceback when I run channel.purge:

    if l is None or l > 100:
TypeError: '>' not supported between instances of 'str' and 'int'

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

Traceback (most recent call last):```
#

code:

@commands.command()
    @commands.has_role("System Admin")
    async def clearall(self,ctx):
        await self.bot.get_channel(938455981145329706).purge(limit="99")
pliant gulch
slate swan
#

oh

#

Lmfao i'm stupid asf

void mist
#

How do I crash my bot's discord?

manic wing
#

?

void mist
#

like to stop my bot proccess

manic wing
#

await bot.close()

void mist
#

thanks

manic wing
#

!d discord.ext.commands.Bot.close

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
gaunt ice
#

this presence update thingy aint workin for me

cold sonnet
gaunt ice
#

bro

#

@cold sonnet

#

halp

cold sonnet
#

well ask

gaunt ice
#
async def on_presence_update(member,before,after):
  channelA = await bot.get_channel(938849319782588486)

  
  print(before)
  await asyncio.sleep(5)
  print(after)```
cold sonnet
#

never said member as argument

gaunt ice
#

hmm

#

okk

cold sonnet
#

!d discord.on_presence_update

unkempt canyonBOT
#

discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their presence.

This is called when one or more of the following things change:

โ€ข status

โ€ข activity

This requires [`Intents.presences`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.presences "discord.Intents.presences") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled...
gaunt ice
#

oki

#

wait it still doesnt work

#

@cold sonnet sry for annoying

#

i assume ur pro

cold sonnet
#

not a problem

cold sonnet
gaunt ice
#

am a newbie

#

why aint it working

cold sonnet
#

is there an error?

gaunt ice
#

no error

cold sonnet
#

This requires Intents.presences and Intents.members to be enabled...
This true?

gaunt ice
#

yes

#

i enabled

cold sonnet
#

everywhere?

gaunt ice
#

yes

#

everywhere

cold sonnet
#

just do intents = discord.Intents.all()

gaunt ice
#

okk

cold sonnet
#

and you did it in the dev portal

gaunt ice
#

yes

#

everything except code grant

cold sonnet
#

I don't see a reason for it to not work

gaunt ice
#

hmm

thin kelp
#

I have having some trouble with tasks loop

#
@tasks.loop(seconds=3)
async def counting():
    num = 0
    print(num)
    num+=1```
#

This should be looping every 3 seconds and printing the number

#

but its not doing anything

cold sonnet
#

you started it?

thin kelp
#

yeah

cold sonnet
#

where

thin kelp
#

wait

#

you mean the task?

gaunt ice
#

counting.start()

slate swan
#

can someone help me with d-components rq?

thin kelp
#

hold on

gaunt ice
cold sonnet
#

never used it

#

don't see a reason to

gaunt ice
#

hm

slate swan
thin kelp
#

Forgot to start the task

slate swan
#

you are flaming me for what?

thin kelp
#

works now thank you

slate swan
#

i asked a question so people will help me and not blame me

#

by the way your answer wasnt helpful

#

๐Ÿฅฐ

#

how am I blaming or flaming you?

gaunt ice
hearty steppe
#

Hi there, sorry for intruding.
I was trying to add a functionality of my discord bot that is formatting messages into some colour.
Like this

Text
``` So I need to make up a mark-up syntax of some sort. (The above is with help of ANSI colour codes).
slate swan
gaunt ice
#

hm

#

u need css ig

slate swan
#

I'm not here to help someone specifically either, I just said what any general person here would.

gaunt ice
#

hm

slate swan
#

The first one, by Krypton

thin kelp
#

Running

@tasks.loop(seconds=3)
async def counting():
    num = 0
    print(num)
    num+=1
    me = client.fetch_user(321675286108307456)
    await me.send(f"{num}")``` 
is giving me an error
#

TypeError: can't send non-None value to a just-started coroutine

slate swan
#

fetch_ methods need to be awaited

thin kelp
#

fuck

cold sonnet
#

use get_

gaunt ice
#

ye

#

get better

thin kelp
slate swan
#

If you don't have member cache, fetch once and store it to use again later

gaunt ice
#

bro meh

slate swan
#

use bot.get_user(id) or await bot.fetch_user(id) so if the user is not in the cache, you fetch it

gaunt ice
#

on_presence_update aint working

manic wing
slate swan
gaunt ice
#

i did

thin kelp
#

Its just a dummy code

gaunt ice
#

all the ones

thin kelp
#

i am not running the loop every 3 seconds

acoustic ermine
#

anyone?

gaunt ice
#

sry i never used d buttons in my life

gaunt ice
slate swan
#

That'll only take long if you're doing other stuff first or have bad latency

#

it's maybe because of your internet connection depending on the time the bot takes to make the request to the discord Api and it edits the message

acoustic ermine
slate swan
# gaunt ice i did

Did you try adding a print() statement on first line to see if it even gets fired at all?

acoustic ermine
slate swan
gaunt ice
#

no response

#

no error

#

):

slate swan
gaunt ice
#

i did ;-;

slate swan
#

And presence intents

gaunt ice
slate swan
#

With .all you don't need the other 2 lines btw

#

oh, did you pass it to the bot class?

haughty quartz
#

i need you guys help, my bot is growing very fast and will soon reach 100 servers, i currently host it on repl.it but I assume it will not perform well, is heroku better?

gaunt ice
#

hm

#

oki

haughty quartz
#

should i get a raspberry pi running?

gaunt ice
#

why advert

gaunt ice
slate swan
#

A pi is good

#

A vps is better

cold sonnet
#

heroku's better and still not even close to enough

haughty quartz
gaunt ice
haughty quartz
#

on my pc?

slate swan
#

Virtual Private Server

haughty quartz
#

i dont wanna let my pc run 24/7

slate swan
#

It's basically a pc in the cloud to put it very simply

slate swan
#

You don't need any device running to use a vps

haughty quartz
#

great

slate swan
#

But it does cost a few bucks per month

haughty quartz
#

i see

hearty steppe
slate swan
#

But with a $3/month vps you can get pretty far in this beginning stage

gaunt ice
haughty quartz
#

quite a success

hearty steppe
#

no

haughty quartz
#

thanks @slate swan

slate swan
gaunt ice
slate swan
hearty steppe
haughty quartz
gaunt ice
#

i started a music in spotify and it doesnt work

#

umm

quaint epoch
#

the fuck is this?

slate swan
#

This what though?

quaint epoch
#

how mobile status?

slate swan
#

Ah, they modified the websocket

sick birch
slate swan
#

Mobile status is a discord issue which officially isn't allowed but they're too lazy to fix

gaunt ice
#

oof

sick birch
#

Don't know if it violates TOS or not, it shouldn't since it's more of less just a visual thing

quaint epoch
slate swan
gaunt ice
#

dms?

slate swan
#

Remove token tho

gaunt ice
#

oki

slate swan
sick birch
slate swan
#

Duh, gonna make it send teletubby nudes everywhere

slate swan
#

hot

#

I remember lucas showing his token and not resetting it in a video, someone used it :lolol:

gaunt ice
#

that dood

#

cool tutorial

slate swan
#

creepy no hate pls

slate swan
gaunt ice
#

lmao

slim whale
#

is there a way to know the status of someone? like to give a role if someone has the url of the server

slate swan
#

should I incorporate in my bot?

unkempt canyonBOT
#

property status: discord.enums.Status```
The memberโ€™s overall status. If the value is unknown, then it will be a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") instead.
gaunt ice
slate swan
gaunt ice
#

i would like to order lol

#

from discord

slate swan
slim whale
slate swan
unkempt canyonBOT
slim whale
tacit token
#

hello guys, whats the problem?

@client.command(aliases=["Report"])
async def report(ctx,member:discord.Member,*,report=None):
    report_channel = discord.utils.get(ctx.guild.channels, name = "reports")
    if member is None:
        return await ctx.send("Please include a user you want to report.")
    if report is None:
        return await ctx.send("Please include information about the report")
    else:
        embed=discord.Embed(title="Report", description=f"{ctx.author.mention} has reported {member}",color=0x34568B)
        embed.set_thumbnail(url="")
        embed.add_field(name="More Info:",value=f"{report}")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"React with the โœ… if the situation has been dealt with.")
        report_message= await report_channel.send(embed=embed)
        await report_message.add_reacion('โœ…')
        await ctx.send(f"{ctx.author.mention} Your report has been sent to the staff team!")

        try:
            def check(reaction,user):
                return user==ctx.author and str(reaction.emoji) in ["โœ…"]

            reaction, user=await client.wait_for("Reaction_add", timeout=604800,check=check)
            if str(reaction.emoji) == "โœ…":
                await ctx.author.send("Your report has been looked into and dealt with. Thank you for reporting!")
            
        except Exception as e:
            print(e)

Error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'

slate swan
slate swan
slim whale
#

ohh, okayy

slate swan
#

You can use in to check if your string is inside that string

slim whale
#

thank u :D

slate swan
slate swan
slate swan
tacit token
slate swan
slate swan
hoary cargo
slate swan
slate swan
grim oar
#

get can work both ways

slate swan
#

very helpful, thanks

slate swan
#

@maiden fable btw, command ideaaaa

#

for me I use this method and it works perfectly

slate swan
slate swan
slate swan
slate swan
slate swan
maiden fable
slate swan
maiden fable
vocal snow
slate swan
#

Should i still use on_ready() or on_message?

tacit token
slim whale
#

is there a way to check when someone updates this? (the a)

boreal ravine
#

on_member_update probably

slim whale
#

i'm going to check, thanks

#

on presence update i think

grim oar
slim whale
#

is that the activity?

#

like the a

maiden fable
slate swan
#

also so, how do I get the status code?

#

otherwise my bot will just die out without any response ;-;

grim oar
#

Response.status_code iirc

slate swan
#

.status

slate swan
grim oar
#

Yeah sorry

slate swan
#

aiohttp uses .status

slate swan
grim oar
#

I always confuse between them ๐Ÿ˜ฉ

slate swan
#

Oh someone already answered

slate swan
#

Same

honest copper
#

if I put this line:
@commands.has_any_role('BotMaster', 'Moderator')
in front of the class/cog declaration, only members with the roles BotMaster and Moderator will be able to use the commands in the cog, right? Or does it have to be in front of every command?

slate swan
#

It's per command

#

If you want a check easily for all commands, use cog_check

honest copper
#

oh, that's why it didn't work, thanks!

tacit token
#

ok so i make the bot create the "reports" channel but nothing sended. Code

@client.command(aliases=["Report"])
async def report(ctx,member:discord.Member,*,report=None):
    guild=ctx.guild
    report_channel = discord.utils.get(ctx.guild.channels, name = "reports")
    if report_channel==None:
        await guild.create_text_channel('reports')
    else:
        embed=discord.Embed(title="Report", description=f"{ctx.author.mention} has reported {member}",color=0x34568B)
        embed.set_thumbnail(url="")
        embed.add_field(name="More Info:",value=f"{report}")
        embed.set_footer(icon_url=ctx.author.avatar_url, text=f"React with the โœ… if the situation has been dealt with.")
        report_message= await ctx.report_channel.send(embed=embed)
        await report_message.add_reacion('โœ…')
        await ctx.send(f"{ctx.author.mention} Your report has been sent to the staff team!")

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'

#

and I would like to ask how the bot could send the message there even if it was renamed? Right now, he's just doing another one.

slate swan
#

You're doing ctx.report_channel.send

dire folio
#

^

#

Remove ctx.

tacit token
# dire folio Remove ctx.

same error:discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'

slate swan
#

You're not setting the report_channel again after creating it

tacit token
#

How can I do that?

slate swan
#

x = await create()

tacit token
#

it is good?

slate swan
#

You're not using x, replace it with the var name you used

#

Aka, report_channel

tacit token
#

its is good?

#

now nothing error but nothing message

slate swan
#

Yes, but also use report_channel with the create line

tacit token
#

opps bad screen

#

but nothing errors, 0 message

flat solstice
#

can anyone see why this task isn't working? It just stopped setting the status one day and it's had lots of reloads since then but it's never come back```py
class Events(commands.Cog):
def init(self, bot):
self.bot = bot
self.statuses = []
self.status.start()

@tasks.loop(minutes = 5) # seconds = 10
async def status(self):
    await self.bot.change_presence(activity = discord.Game(next(self.statuses)))

@status.before_loop
async def before_status(self):
    await self.bot.wait_until_ready()
    data = await self.bot.get_data(448405740797952010)
    users = sum(await self.bot.comm.handler("user_count", self.bot.cluster_count))
    self.statuses = cycle([f'/help | {self.bot.config.default_prefix}help', f'{self.bot.config.activity}', f'{data[13]} is the current count', f'RaidMode is {"Enabled" if data[14] is True else "Disabled"}', f'{data[15]} is the required age for new accounts when raidmode is enabled.', f'Latency: {round(self.bot.latency * 1000, 2)}ms.', f'CPU Usage: {psutil.cpu_percent(interval=None)}%', f'RAM Usage: {psutil.virtual_memory().percent}%', f'I can see {str(users)} users', f'Python Version: {platform.python_version()}', f'Discord.py Version: {discord.__version__}', 'I support slash commands', ])```
tacit token
slate swan
slim whale
#
@bot.command()
async def vip(ctx):
  if ctx.author.id == 626127081419571206:
    a = ctx.guild.members
    c = bot.get_channel(938873521952677891)
    r = ctx.guild.get_role(938873620531392543)
    for b in a:
      if "/club" in b.activity.name:
        await b.add_roles(r)
        await c.send(f"Le he dado el rol vip a {b}. ![24m](https://cdn.discordapp.com/emojis/923888553405075476.webp?size=128 "24m")")
      else:
        pass
  else:
    pass```
I'm trying to make a command to check if someone has a vanity url in status, if the user has the vanity it gives him the vip role. I get this traceback:

Ignoring exception in command vip:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 44, in vip
if "/club" in b.activity.name:
AttributeError: 'NoneType' object has no attribute 'name'

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

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'name'

slate swan
#

so add a conditional to check if the activity is none or not

slim whale
#
@bot.command()
async def vip(ctx):
  if ctx.author.id == 626127081419571206:
    a = ctx.guild.members
    c = bot.get_channel(938873521952677891)
    r = ctx.guild.get_role(938873620531392543)
    for b in a:
      if b.activity is None:
        pass
      else:
        if "/club" in b.activity.name:
          await b.add_roles(r)
          await c.send(f"Le he dado el rol vip a {b}. ![24m](https://cdn.discordapp.com/emojis/923888553405075476.webp?size=128 "24m")")
        else:
          pass
  else:
    pass```
#

so like this?

tacit token
slate swan
#

lmao

tacit token
#

aaand I would like to ask how the bot could send the message there even if it was renamed? Right now, he's just doing another one.

slate swan
slim whale
#

tnx!

slate swan
#

Changing == None to is None here changes nothing

slate swan
tacit token
slate swan
#

Literally never had that warning zeroshrug

pliant gulch
#

I don't think python gives you that warning, that would be your linter

pliant gulch
#

It's still ideal to use is when checking None though

slate swan
#

How do I mention the role that was picked

tacit token
slate swan
#

so, use an embed, and var.mention

boreal ravine
slate swan
#

Yeah will use embed

slate swan
unkempt canyonBOT
#

class discord.AllowedMentions(*, everyone=True, users=True, roles=True, replied_user=True)```
A class that represents what mentions are allowed in a message.

This class can be set during [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") initialisation to apply to every message sent. It can also be applied on a per message basis via [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for more fine-grained control.
slate swan
#

oh wow

#

oof it worked

#

thanks yo

slim whale
#

@slate swan sorry for ping, but there is a way to check the about me and also give the role?

slate swan
#

About me is not accessible by the API yet

slim whale
slate swan
#

How can the bot detect what role I have?

#

How do I make the bot do that I mean?

#

Fixed

#

good grief python is starting to feel like instinct rn

#

โ˜ ๏ธ

neat tartan
#

Something ive found useful in my learning journey is creating things similar to each other but slightly different so i can essentially reuse code ive already written and just modify it for the new need and add in the new stuff required for that function. It helps me to understand what my previous code is actually doing without fully having to memorize how to do it every time

neat tartan
#

When i approach something completely new i can take the parts i understand and cherry pick for things i know it will need and then just learn the new stuff in between. Learning music integration is a little daunting though

hybrid harbor
#

!d discord.AllowedMentions

slate swan
#

What should i use for sending a embeded message to a channel

dire folio
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if itโ€™s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
neat tartan
#

i need to learn to use the bot more lol, i was gonna type it out

slate swan
#
import discord
from discord.ext import commands

class Citizenship(commands.Cog):

    def __init__(self, bot):
        self.bot = bot

    @client.event    
    async def on_message(message):
        guild = message.guild
        if message.content == "citizenship":
        #all citizenships citizenships
            role1 = guild.get_role(938834958124978247)
            role2 = guild.get_role(938834984515555458)
        #
            list_of_roles=[role1, role2]
            citizenship=random.choice(list_of_roles)
        #gce = grant citizenship embed
            gce=discord.Embed(Title="Congratulations", description=f"You have been granted {citizenship.mention} citizenship")

            if role1 in message.author.roles:
                return await message.channel.send(f"Sorry you already have {role1.mention} citizenship")
            elif role2 in message.author.roles:
                return await message.channel.send(f"Sorry you already have {role2.mention} citizenship")
            else:
                await message.author.add_roles(citizenship)
            await message.channel.send(embed=gce)



def setup(bot):
    bot.add_cog(Citizenship(bot))
#

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.Citizenship' raised an error: NameError: name 'client' is not defined

neat tartan
#

try changing client.event to bot.command

slate swan
#

hmm

neat tartan
#

i dont fully get it but it seems like using bot.command is better to use than client.event because it causes issues with on_message

slate swan
#

this file is in a cog

neat tartan
#

next guess is an import error. i dont know much about cogs because that was my next step of learning

slate swan
#

oof

manic wing
#

but inside a cog you use @commands.Cog.listener()

slate swan
#

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.Citizenship' raised an error: NameError: name 'bot' is not defined

manic wing
#

and because async def on_message is inside a class you pass self as an arg

slate swan
#

bot is not defined

manic wing
#

replace @bot.command with @commands.Cog.listener()

#

because a) its in a cog, and b) on_message is an event not command

slate swan
#

ooh

#

now it worked

median flint
#

How can I DM a user if I only have their ID?

final iron
median flint
#

how tho

final iron
#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.
median flint
#

thx

neat tartan
#

!d discord.DMChannel

unkempt canyonBOT
#

class discord.DMChannel```
Represents a Discord direct message channel.

x == y Checks if two channels are equal.

x != y Checks if two channels are not equal.

hash(x) Returns the channelโ€™s hash.

str(x) Returns a string representation of the channel
neat tartan
#

think you should be able to use this for creating a dm

slate swan
#

who knows any command that need presence intents ๐Ÿคฆ๐Ÿพโ€โ™‚๏ธ๐Ÿคฆ๐Ÿพโ€โ™‚๏ธ need it really fast

neat tartan
#

Like things that use rich presence?

echo rover
silent portal
#

Is there a way to get all the badges a user has?
Like

for badge in user:
  print(badge)```
cold sonnet
#

you use <prefix>plays <game> and the bot searches everyone whose activity is that game

slate swan
#

Can anyone help?

cold sonnet
#

python server

#

lucky you

slate swan
#

Soooo. no1 here knows js

#

:/

silent portal
#

Wrong server

cold sonnet
slate swan
#

ty

#

How do I create a command where the bot sends the role ID?

sick birch
#

but to point you in the right direction, it's most likely a syntax error

sick birch
slate swan
formal pewter
#

what is the command for getting owner's name?

silent portal
#
async def role(ctx, role: discord.Role):
  try:
     await ctx.send(role.id)
  except:
      await ctx.send("Role is not found.")
#

@slate swan

sick birch
#

if that's what you mean yes

silent portal
formal pewter
sick birch
silent portal
# formal pewter yes
async def owner(ctx):
  await ctx.send("The Owner is " + ctx.guild.owner.name)```
silent portal
#

sorry

#

Isn't this a helping channel?

sick birch
#

No problem but refrain from spoonfeeding code in the future ๐Ÿ™‚

sick birch
spark wigeon
#

i found this template online, is the @tasks.loop a library or discord import?

async def changeStatus():
    await client.change_presence(status=discord.Status.do_not_disturb, activity=discord.Activity(type=discord.ActivityType.playing, name=next(status)))```
cold sonnet
#

don't do that

sick birch
final iron
#

from discord.ext import tasks

silent portal
#

Well spoonfeeding is a way of learning aswell

spark wigeon
final iron
sick birch
silent portal
#

You can see the code and understand what it does and implement it in your own concept

sick birch
#

Let's be honest most people aren't going to do that when they can fix their problem in 2 keystrokes and move on

final iron
#

^

#

People always move on

sick birch
#

And overtime that's only going to cause them more issues and they'll be back here with more questions since they copy pasted, and won't know what to do

silent portal
#

Well that's what I did
But ofc not only. But when I got a piece of code I implemented in my own concept and try to understand it. Ofc not everyone does this.

sick birch
#

No, which is why we should refrain from spoonfeeding code since 90% of people won't stop and thinking why or how something works if the solution is given to them in such an easy manner

silent portal
#

ok, chef no problem

sick birch
#

Thanks for your understanding ๐Ÿ™‚

silent portal
#

sure

manic wing
#

theoretically why do we have to help

#

cant we just spoonfeed and let them fall flat on their face

sick birch
#

And then we have to deal with that

#

oop

sick birch
#

๐Ÿค” Don't know how effectively it would work in practice. Either way understanding something is always better than taking what someone else said for granted

worn tapir
#

My bot has been rate-limited. What does that mean? My bot hasn't made more than 50 requests to the API, as far as I'm aware. Now when I try to run the bot again, it pops up with a "You are being rate-limited" screen. When can I run it again without the error?

final iron
#

Are you using replit?

manic wing
worn tapir
#

Yes.

manic wing
#

F

final iron
#

Don't use it

worn tapir
#

Oh. Where else can I host my bot, then?

#

I can't keep my computer online 24/7.

final iron
#

Buy a VPS

#

Or use an old ass laptop

#

There is most likely a laptop that you might think is junk but would work fine for hosting

slate swan
final iron
#

Parents or eBay

slate swan
final iron
#

Raspberry pi is also an option

worn tapir
#

Is there a reason it is breaking now? It has worked fine for the past month.

cerulean olive
#

can somone help me

final iron
slate swan
slate swan
final iron
slate swan
final iron
#

Okay

spark wigeon
sick birch
cerulean olive
cerulean olive
#

yea

slate swan
#

py what?

cerulean olive
#

python

slate swan
wooden furnace
#

how do you make it possible for several commands to be put in

#

one resonse commands

sick birch
slate swan
wooden furnace
#

no

#

several different commands with their own responses

final iron
#

You add them

#

That's the whole point of async programming

wooden furnace
#

i know how to make one of them but not multiple and have more than one work

slate swan
unkempt canyonBOT
#

class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.

These are not created manually, instead they are created via the decorator or functional interface.
sick birch
#
@ command decorators
def command():
  do one thing

@ command decorators
def command2():
  do something else
#

If that's what you mean

sullen linden
#

im seeing alot of:
WARNING:discord.http:http:We are being rate limited. Retrying in 11.70 seconds. Handled under the bucket "[redacted]:None:/channels/{channel_id}/messages/{message_id}"
from a long running task that updates some messages every 5 mins with a few second sleep between updates to each message, i didnt think that was too fast to hit a rate limit

sick birch
#

Increase your time between requests, Discord isn't too clear about what exactly triggers the ratelimits

sullen linden
#

ok

wooden furnace
#

if i do one or two spaces it doesnt work

sick birch
#

You mean indentation?

#

Your commands should be on the indent level

slate swan
#

Learn python?

sick birch
#
def command1(): 
| # stuff
|
|
|
def command2():
  # stuff
wooden furnace
#

oh three lines

sick birch
#

If they're not on the same indent level, one function will be a nested function of another

wooden furnace
#

ig

#

i made sure they are on the same level its just that I guess I wasnt putting enough lines between

sick birch
#

The amount of lines in-between shouldn't matter

wooden furnace
#

wth

#

it wasnt working for me

sick birch
#

Though you should still try to stay consistent with those just for readability and organization

sick birch
neat tartan
#

Can you send the code? I have a feeling you have everything currently in one file and using client.<...>

wooden furnace
#
@client.event
async def on_message(message):
  if message.author == client.user:
    return

  if message.content.startswith('.info'):
    await message.channel.send('info')
#

that was what it said

#

response altered though

sick birch
#

You should use the commands extension

#

This is the old way of doing it and heavily outdated

wooden furnace
#

oh

#

i put one space in between and it didnt let two commands work

sick birch
#

Using the commands extension would solve that problem

wooden furnace
#

ok

#

btw I was using repl.it if that makes any difference

#

website instead of downloading something

sick birch
#

No it doesn't, but you should avoid using repl.it for anything other than quick and dirty testing

wooden furnace
#

ok

bold surge
#

replit is big sus

sick birch
#

Agreed

spark wigeon
#

my website is hosted on it๐Ÿ˜ฌ

wooden furnace
#

i just downloaded python win10

slate swan
bold surge
sick birch
#

AWS also works, I've a Next.js app in production hosted on aws

slate swan
sick birch
#

but they're a bit more expensive

slate swan
cerulean olive
#
  File "c:\Users\jackr\Downloads\DUMP\REDX PUBLIC BOT\bot.py", line 51, in <module>
    intents = discord.Intents.all()
AttributeError: module 'discord' has no attribute 'Intents'
PS C:\Users\jackr\Downloads\DUMP\REDX PUBLIC BOT> 
sick birch
#

But I think it's worth it since they have a bunch of other services that all integrate nicely

sick birch
cerulean olive
slate swan
#

it come in terminal

bold surge
#

._.

slate swan
#

what do

cerulean olive
velvet tinsel
#

๐Ÿคฆโ€โ™‚๏ธ

spark wigeon
sick birch
cold sonnet
#

do we have a disnake dev here

slate swan
#

and then it returns value via await

velvet tinsel
slate swan
unkempt canyonBOT
#
NEGATORY.

No documentation found for the requested symbol.

bold surge
# slate swan

well you using the input function to grab the data, so i suggest just adding an arg in the command itself to grab the persons "nambor"

velvet tinsel
#

shit

cold sonnet
#

you were here

velvet tinsel
#

!d discord.ext.commands.Bot.wait_for

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.9)"). 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.9)") 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.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/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
wooden furnace
#

what is a good code editor

velvet tinsel
#

@slate swan

spark wigeon
velvet tinsel
slate swan
velvet tinsel
velvet tinsel
slate swan
cold sonnet
#

yes

#

i need

#

a calendar

slate swan
cold sonnet
#

like right fkin now

bold surge
#

well the max is 30 afaik

velvet tinsel
#

31 buttons?

cold sonnet
velvet tinsel
#

what the fuck

bold surge
#

ah

cold sonnet
#

no, not buttons, options

bold surge
slate swan
cold sonnet
#

yeah but the maximum amount of options is still 25

bold surge
#

well you cant change the max...

slate swan
#

Oh lol yeah

cold sonnet
#

how do I set 31 options if the max is 25

slate swan
#

You cant

sick birch
#

You don't

bold surge
#

thats the neat part, ya cant

velvet tinsel
cold sonnet
#

any ideas on calendar picker then?

bold surge
#

you can make two selects and like a button to filter through them

sick birch
velvet tinsel
#

wait wtf are you doing

cold sonnet
#

I'd... hate that

#

birthday reminder

sick birch
#

Unless you do some nasty un-user friendly stuff

velvet tinsel
#

nvm

sick birch
#

Why not a month/day selector?

#

just over text i guess

cold sonnet
slate swan
#

Lmao

cold sonnet
velvet tinsel
cold sonnet
#

who make those

spark wigeon
velvet tinsel
#

wait

slate swan
bold surge
# cold sonnet birthday reminder

just have the person enter their bday in an arg something like !setbday 12-1, it makes the code a lot simpler and more easy to use for the end user

velvet tinsel
#

Does dpy specify that we canโ€™t make more than 25 options?

cold sonnet
#

yo why is everyone just keep replying counter arguments to me, stop

velvet tinsel
#

Like in their code or is it discord?

bold surge
#

its discord

cold sonnet
#

throws an http error

velvet tinsel
#

Canโ€™t we change the code?

cold sonnet
#

lemme show it, wait

velvet tinsel
#

In our files?

cold sonnet
bold surge
velvet tinsel
velvet tinsel
slate swan
cold sonnet
#

tho in the source code, I couldn't find anything that said 25

velvet tinsel
#

How about two drop downs

cold sonnet
#

weird af

velvet tinsel
#

Or something

velvet tinsel
cold sonnet
#

but it's okay sadcat

spark wigeon
#

since when was competing a thing

slate swan
bold surge
cold sonnet
#
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options: Must be between 1 and 25 in length.
bold surge
slate swan
cold sonnet
#

but this code of mine looks literally insane

#

even tho it doesn't work, I love it

bold surge
#

big code is big annoying

cold sonnet
#

unreadable code, much better

slate swan
bold surge
slate swan
cold sonnet
#

it's like the dpy source code, nobody understands it

cold sonnet
bold surge
#

dpy source code tbh its just very poorly developed tbh

slate swan
shrewd inlet
#
Ignoring exception in command help:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 125, in help
    embed = discord.Embed(title="**commands**", description="the prefix for this bot is `;`\n\n`cover` - sends a random project cover\n`discography` - sends gracie's discogrpahy\n`gif` - sends a random gif of gracie\n`img` - sends a random image of gracie\n`instagram` - sends gracie's instagram\n`intro` - sends introductory playlist\n`lyric` - sends random lyric\n`mv` - sends a random music video\n`ping` - send ping latency\n`project` - sends a random project\n`say` - sends what user says\n`startchain` - sends a lyric to start a chain\n`unreleased` - sends an unreleased song",color=0x2f3136)
AttributeError: 'Command' object has no attribute 'Embed'

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'Embed'
cold sonnet
#

wait that's not even it

bold surge
shrewd inlet
#
@bot.command()
async def help(ctx):
  embed = discord.Embed(title="**commands**", description="the prefix for this bot is `;`\n\n`cover` - sends a random project cover\n`discography` - sends gracie's discogrpahy\n`gif` - sends a random gif of gracie\n`img` - sends a random image of gracie\n`instagram` - sends gracie's instagram\n`intro` - sends introductory playlist\n`lyric` - sends random lyric\n`mv` - sends a random music video\n`ping` - send ping latency\n`project` - sends a random project\n`say` - sends what user says\n`startchain` - sends a lyric to start a chain\n`unreleased` - sends an unreleased song",color=0x2f3136)
  await ctx.send(embed=embed)
#

why did i get that error?

slate swan
#

You probably have a variable named discord in your code

cold sonnet
#

like this part more

final iron
shrewd inlet
velvet tinsel
#

We can see

shrewd inlet
cold sonnet
velvet tinsel
#

phone problems, seems like you sent it twice

cold sonnet
velvet tinsel
bold surge
final iron
#

I assumed it was an issue with the default help command

spark wigeon
#

homie likes gracie

tidal hawk
#

Is it possible to change Discord bot handle (the hashtag part #0001)

cold sonnet
#

now I'm gonna make two dropdowns

slate swan
shrewd inlet
spark wigeon
#

i can tell

shrewd inlet
#

fixed

#

thanks

slate swan
bold surge
#

ez

slate swan
#

Lol

bold surge
#

their using bot

slate swan
#

put this at the top of the script

spark wigeon
slate swan
cold sonnet
#

can you put two dropdowns to one message?

slate swan
bold surge
slate swan
slate swan
bold surge
#

that code scares me ._.

final iron
shrewd inlet
final iron
#

Also requests is blocking

shrewd inlet
#

i just changed it to server instead of discord

final iron
#

Use aiohttp

slate swan
slate swan
#

ikr

sick birch
bold surge
#

^^

shrewd inlet
slate swan
bold surge
#

y e s

sick birch
#

commands.Bot is a subclass of discord.Client, which means it's a superset of discord.Client

slate swan
sick birch
#

commands.Bot can do everything discord.Client can, but not vice-versa

slate swan
sick birch
#

You need to decide, depending on the complexity and use case of your bot, if you want to have commands.Bot or discord.Client

final iron
sick birch
#

ah

#

okay yeah you don't need 2

spark wigeon
#

is this cool or no i cant decide

slate swan
bold surge
#

you may want to add a bit more info but its a good start

slate swan
#

Is it possible to use the server avatar in the footer? if so, how?

sick birch
#

You can use any image in the footer

final iron
#

!d discord.Embed.set_footer

unkempt canyonBOT
#

set_footer(*, text=Embed.Empty, icon_url=Embed.Empty)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style chaining.
slate swan
final iron
#

icon_url kwarg

sick birch
slate swan
#

Ok

slate swan
bold surge
dry kelp
#

@sick birch

dry kelp
#

ong bro i just have a dumb issue rn

velvet tinsel
dry kelp
#
    @commands.Cog.listener()
    async def on_guild_emojis_update(self, guild, before, after):

        async for t in guild.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.emoji_delete):

            with open(channel_path, "r") as f:
                config_channel = json.load(f)
                
            try:
                channel_config = config_channel[str(guild.id)]
                channel_id = channel_config[0]
            except:
                pass

            with open(enable_path, "r") as f:
                enabled = json.load(f)

            if not str(guild.id) in enabled:
                return

            with open(whitelist_path, "r") as f:
                whitelisted = json.load(f)

            if str(t.user.id) in whitelisted[str(guild.id)]:
                return

            remove_emoji = [r for r in before if r not in after]

            for em2 in remove_emoji:
                before_emoji = await em2.read()
                if remove_emoji:
                    await guild.ban(t.user, reason="Anti-Nuke: Deleting Emojis")
                    try:
                        emoji_display = await guild.create_custom_emoji(name=em2.name, image=before_emoji)
                        if str(guild.id) in config_channel:
                            try:
                                log_channel = self.angel.get_channel(int(channel_id))
                                embed = discord.Embed(title="![security](https://cdn.discordapp.com/emojis/907074407808241746.webp?size=128 "security") Anti-Nuke ![security](https://cdn.discordapp.com/emojis/907074407808241746.webp?size=128 "security")", description=f"**EMOJI LOGS**\n\n**__NON TRUSTED MEMBER__**\n\nMember: `{t.user}`\nID: `{t.user.id}`\nPing: {t.user.mention}\n\n**__ABOUT__**\n\nNon-Trusted member deleted a emoji!\n\n**__BEFORE__**\n\nEmoji Name: `{em2.name}`\nID: `{em2.id}`\n\n**__AFTER__**\n\nEmoji Name: `{emoji_display.name}`\nID: `{emoji_display.id}`\nEmoji: {emoji_display}\n\n**__ACTIONS__**\n\n![boop](https://cdn.discordapp.com/emojis/929782990618378341.webp?size=128 "boop") Non-Trusted member has been banned out of the server!\n![boop](https://cdn.discordapp.com/emojis/929782990618378341.webp?size=128 "boop") Emoji has been replaced! (If asset was found!)", color=discord.Color.from_rgb(black1, black2, black3))
                                await log_channel.send(embed=embed)
                            except:
                                pass
                    except:
                        pass
                    continue

        async for i in guild.audit_logs(limit=1, after=datetime.datetime.now() - datetime.timedelta(minutes = 1), action=discord.AuditLogAction.emoji_create):

            with open(whitelist_path, "r") as f:
                whitelisted = json.load(f)

            if str(i.user.id) in whitelisted[str(guild.id)]:
                return

            add_emoji = [r for r in after if r not in before]

            for em1 in add_emoji:
                if add_emoji:
                    await guild.ban(i.user, reason="Anti-Nuke: Creating Emojis")
                    await em1.delete()
                    if str(guild.id) in config_channel:
                        try:
                            log_channel = self.angel.get_channel(int(channel_id))
                            embed = discord.Embed(title="![security](https://cdn.discordapp.com/emojis/907074407808241746.webp?size=128 "security") Anti-Nuke ![security](https://cdn.discordapp.com/emojis/907074407808241746.webp?size=128 "security")", description=f"**EMOJI LOGS**\n\n**__NON TRUSTED MEMBER__**\n\nMember: `{i.user}`\nID: `{i.user.id}`\nPing: {i.user.mention}\n\n**__ABOUT__**\n\nNon-Trusted member uploaded a emoji!\n\n**__BEFORE__**\n\nEmoji Name: `{em1.name}`\nID: `{em1.id}`\n\n**__AFTER__**\n\nNone\n\n**__ACTIONS__**\n\n![boop](https://cdn.discordapp.com/emojis/929782990618378341.webp?size=128 "boop") Non-Trusted member has been banned out of the server!\n![boop](https://cdn.discordapp.com/emojis/929782990618378341.webp?size=128 "boop") Uploaded emoji has been deleted!", color=discord.Color.from_rgb(black1, black2, black3))
                            await log_channel.send(embed=embed)
                        except:
                            pass
bold surge
dry kelp
#

the 2nd part of the code

#

is going to stop if the channel id is not in the guild id

#

how can i pass that?

bold surge
#

you could do uwuContext : commands.Context also

velvet tinsel
unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
final iron
#

I don't think you do

spark wigeon
#

how would i create a catch exception for this error (person used command incorrectlty) discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'avatar_url'

slate swan
velvet tinsel
velvet tinsel
bold surge
velvet tinsel
dry kelp
#

the 2nd part of the code
is going to stop if the channel id is not in the guild id
how can i pass that?

#

check that code

bold surge
dry kelp
slate swan
# velvet tinsel I'm gonna have nightmares tonight smh
import disnake as discord
import discord as nextcord
import nextcord as disnake
from disnake.ext import commands
from discord.ext.commands import Bot
from nextcord.ext.commands import Intents

bot, client = Bot(command_prefix="uwu", intents=Intents.all())

@bot.event
async def on_ready():
     await client.close()

client.start(nextcord.Generate_very_much_random_token)
dry kelp
#

@velvet tinsel i uploaded it here

slate swan
bold surge
#

||atleast you didnt use pycord||

slate swan
bold surge
#

wait- i forgor the namespace change but we will never know what lib you installed

#

cuz pycords namespace is also discord

slate swan
velvet tinsel
#

I wanna fucking murder myself

bold surge
slate swan
bold surge
#

pycord uses the discord namespace

velvet tinsel
dry kelp
#

does anyone know how to fix that bruh?

bold surge
#

thats why you have to uninstall discord.py before you use pycord

slate swan
bold surge
#

nc and dislash have their own

bold surge
slate swan
slate swan
bold surge
#

tyty

velvet tinsel
#

I don't wanna die alone

dry kelp
#

@velvet tinsel do u know how to fix?

velvet tinsel
#

even though I might pithink

velvet tinsel
slate swan
dry kelp
cold sonnet
#
TypeError: __init__() takes 2 positional arguments but 3 were given```how do I find out which __init__ did this to me
velvet tinsel
dry kelp
#

that thing is literally stopping

#

so the 2nd part of the code

cold sonnet
#

what

dry kelp
#

is stopping there's no channel in the guild id

cold sonnet
#

so which one

velvet tinsel
bold surge
dry kelp
#

huh

#

no dude

cold sonnet
#

I didn't pass any positional argument to edit so that can't be it

dry kelp
#

i have to check if a channel is there.. if is not to pass

#

how can i do tha?

cold sonnet
#

and I only passed two to my own class

dry kelp
#

cuz like if a channel is not there it has to stop sending the logs messages not the LOOP

bold surge
#

if channel == None: idk do something else?

dry kelp
#

nope

velvet tinsel
dry kelp
#
            try:
                channel_id = config_channel[str(guild.id)][0]
            except:
                pass
#

this will try to get the channel id

velvet tinsel
dry kelp
#

ong

#

the code stops here

cold sonnet
dry kelp
#

how do i continue it?

bold surge
velvet tinsel
dry kelp
bold surge
#

well is there an error?

dry kelp
#

no

velvet tinsel
dry kelp
#

i said it stops

cold sonnet
#
        await interaction.message.edit(content="Your birthday is...", view=View(Day(value, newOptions[0:15]), Day(value, newOptions[-(days-15):])))

class Day(ui.Select):
    def __init__(self, month, options):
        self.month = month

        super().__init__(
            placeholder=f"Choose your birthday...",
            min_values=1,
            max_values=1,
            options=options
        )
    
    async def callback(self, interaction: disnake.MessageInteraction):
        await interaction.response.defer()
        await interaction.send(f"Your birthday is the {self.values[0]}st/nd/rd/th of {self.month}.")

class View(ui.View):
    def __init__(self, menu):
        super().__init__()
        self.add_item(menu)
```what about this
velvet tinsel
dry kelp
velvet tinsel
#

see which one it prints and where it stops

#

like print(1) and then print(2)

cold sonnet
#

you like that don ya

velvet tinsel
bold surge
#

sus

cold sonnet
#
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\disnake\ui\view.py", line 367, in _scheduled_task
    await item.callback(interaction)
  File "c:\botok\Clanbot\cogs\cogbirthday.py", line 70, in callback
    await interaction.message.edit(content="Your birthday is...", view=(View(Day(self.values[0], newOptions[0:15]), Day(self.values[0], newOptions[-(days-15):]))))
TypeError: __init__() takes 2 positional arguments but 3 were given
velvet tinsel
#

oksir

dry kelp
#

@velvet tinsel

dry kelp
#

it stops at that exact line

#

no prints

velvet tinsel
#

it's the Day __init__

cold sonnet
velvet tinsel
dry kelp
#

so that is stopping

velvet tinsel
dry kelp
#

how do i continue the loop?

#

somehow i gotta continue it

cold sonnet
#

wait I edited that so it spares memory

spark wigeon
#

how to mention user ```@client.command()
async def troll(ctx, *, member : discord.Member=None):
try:
userAvatarUrl = member.avatar_url # to check if user was mentioned
troll_message = await ctx.message.channel.send(f"Trolling {member}...")

except AttributeError:
    error_em = discord.Embed(title=f"Error Using That Command", colour=0xFFFFFF)
    error_em.add_field(name="Error:", value=f"Invalid/No User Mention", inline=False)
    error_em.set_footer(text="https://github.com/zoaq1")
    await ctx.message.channel.send(f"{ctx.message.author.mention}", embed=error_em)```
cold sonnet
#
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\disnake\ui\view.py", line 367, in _scheduled_task
    await item.callback(interaction)
  File "c:\botok\Clanbot\cogs\cogbirthday.py", line 71, in callback
    await interaction.message.edit(content="Your birthday is...", view=View(Day(value, newOptions[0:15]), Day(value, newOptions[-(days-15):])))
TypeError: __init__() takes 2 positional arguments but 3 were given
spark wigeon
cold sonnet
#

but those are still only 2

velvet tinsel
velvet tinsel
#

crazy

dry kelp
#

anything?

flat solstice
#

This error means I don't have perms to use the command right?py ERROR:cogs.error_handler:Forbidden: 403 Forbidden (error code: 50013): Missing Permissions (In mentionable) Traceback: File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/home/modmail/cogs/moderation.py", line 179, in mentionable await role.edit(reason = f"{ctx.author} made {role.name} pingable.", mentionable = mentionable) File "/usr/local/lib/python3.8/dist-packages/discord/role.py", line 349, in edit data = await self._state.http.edit_role(self.guild.id, self.id, reason=reason, **payload) File "/usr/local/lib/python3.8/dist-packages/discord/http.py", line 248, in request raise Forbidden(r, data)

velvet tinsel
cold sonnet
kindred epoch
velvet tinsel
#

errrr

slate swan
#

What do i use to just send a message to the server

velvet tinsel
slate swan
#

i mean here def on_message

bold surge
velvet tinsel
cold sonnet
#
class Day(ui.Select):
    def __init__(self, month, options):
        self.month = month

        super().__init__(
            placeholder=f"Choose your birthday...",
            min_values=1,
            max_values=1,
            options=options
        )
``` don't think I have to set self.options
slate swan
#

on_message waits for a message right?

velvet tinsel
#

it's message.channel.send() iirc

velvet tinsel
cold sonnet
#

use what

cold sonnet
#

lemme do it and see

spark wigeon
bold surge
#

if i remember correctly; iirc

velvet tinsel
#

maybe in the Super do self.options=options instead of options=options?

flat solstice
velvet tinsel
kindred epoch
#

its options not self.options

velvet tinsel
#

I'm having sleep demons

kindred epoch
#

go to sleep