#discord-bots

1 messages · Page 612 of 1

lone aurora
#

idk if i understood that right

#

but in what you said

sullen shoal
#

the argument could be an id, the name of it or mention

lone aurora
#

it would work like -role @hi and not like -role hi, right?

sullen shoal
#

it will work by both ways

lone aurora
#

i see

sullen shoal
#

even by putting the ID

lone aurora
#

so i make it async def role(ctx, role: discord.Role):?

sullen shoal
#

yes

full valley
#

by coding it again, you mean all the variables used?

slate swan
#

instead of role try role id

sullen shoal
lone aurora
# slate swan instead of role try role id

i changed it to

@client.command()
async def role(ctx, role: discord.Role):
    guild = ctx.author.guild
    role1 = discord.utils.get(ctx.author.guild.roles, name= role)
    if role1 not in ctx.author.roles:
        await ctx.author.add_roles(role1)
        await ctx.send(f'Gave Role : **{role}**.')
    elif role1 in ctx.author.roles:
        await ctx.author.remove_roles(role1)
        await ctx.send(f'Took role : **{role}**')
    elif role not in guild.roles:
        await ctx.send('This role does not exist.')``` but it still sends an error if i enter a non existent role
#

discord.ext.commands.errors.RoleNotFound: Role "hi" not found.

sullen shoal
#

you dont need to use utils.get

#

role is now the discord.Role object

lone aurora
#

ah i see

#

still same

sullen shoal
#

because that role doesnt exist

slate swan
sullen shoal
#

try putting the id or mentioning it

slate swan
lone aurora
#

that's the thing

#

i want to make it so that if the role does NOT exist

slate swan
maiden fable
sullen shoal
#

so you want to do stuff if the role doesnt exist

maiden fable
#

Wrong message but who cares

maiden fable
#

Tf 😐

slate swan
maiden fable
#

Tf, no I ain't lmao

sullen shoal
#

now the person disappeared

#

maybe wondering what they actually want to do

slate swan
#

Goodmorning guys

sullen shoal
#

gm

maiden fable
#

What did they even mean by the role not exist

sullen shoal
#

idk never saw someone creating a command to see if a role exists or not

#

too useless to exist

quick gust
#

idk if it actually is for that

#

yeah

sullen shoal
#

theyre checking the list twice, they could just use else

slate swan
quick gust
#

and giving/removing i guess

slate swan
#

Yeah i see that

#

Idk what for

quick gust
#

if u are gonna write a whole command with 2 args, why not just click on the user's profile and give them the role

sullen shoal
#

some people prefer keyboard

quick gust
#

actually, in this case only for themself

slate swan
sullen shoal
#

yes they can

slate swan
#

Bruh

quick gust
#

lmao

sullen shoal
#

it will be a bit better because python wont check for the item again

slate swan
#

Yeah

#

@sullen shoal does this basically means its a discord member that has not been given?

(member: discord.Member = None)
#

Im kinda confused about it

sullen shoal
#

if the argument wasnt provided the value of it would be the default value

slate swan
#

Oh

sullen shoal
#

which is None in the snippet

slate swan
#

Bruh

#

I see thx

sullen shoal
#

!e

def func(arg="hello world"): print(arg)
func()
func("hello oki")```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

hello world
slate swan
#

Yeah i know about kwargs

vale wing
#

Is there a way to stream video into voice chat LennyThink

sullen shoal
#

its a positional argument but with a default value

slate swan
#

How isnt it a kwarg?

#

Is there a way I can cooldown an event per user and not per server?

sullen shoal
#

it can be a kwarg too,
you can also do, func(arg="hello world")

sullen shoal
#

for keyword only arguments

slate swan
quick gust
#

an event, oh

slate swan
#

yea

sullen shoal
#

!e

def func(*, arg): print(arg)
try: func("h")
except Exception as e: print(e)
func(arg="hello world")```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

001 | func() takes 0 positional arguments but 1 was given
002 | hello world
rare saddle
#

The team reacts if no argument is specified or the person does not have a support role, but if the command was entered correctly, then nothing happens and there are no errors

sullen shoal
#

it is useful in some functions

slate swan
sullen shoal
#

yes, its a keyword only argument, meaning it can only be passed as a kwarg

#

because i added an * before it

slate swan
#

Curiosity question, how many instances of a bot do u reckon u can run on same token

#

(arg) is a positional argument because its default value is None correct?

sullen shoal
#

nope

#

default value can also be provided to a keyword only argument

slate swan
#

Ima just read the py docs rl again

sullen shoal
#

i think youre pretty confused with these stuff

slate swan
#

Nah i just forgot them let me check them out again

sullen shoal
#

im on phone rn otherwise i would have typed longer explanation

#

yeah check

slate swan
#

Alr i got it now

glass rock
#

pls .add_role(role) adds role right?

sullen shoal
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
slate swan
#

Yeah

#

But with a s

glass rock
#

ohhh its a coroutine

glass rock
slate swan
#

Cause its a list of roles you want to add

glass rock
#

ty

slate swan
#

Yw

sullen shoal
slate swan
sullen shoal
#

nope

#

keyword arg

quick gust
#

keyword arg?

stiff nexus
#
    async for message in channel.history(limit=1):
      m = message.content
    news = m or "No updates!"
    newmbed = bot.embed(ctx.author,title="Latest News",description=news)
``` the channel has no message. its raising `local variable 'm' referenced before assignment` but its not sending **No updates!**
quick gust
#

yeah

slate swan
#

how can I do the wait_for button click?

#

A Positional args value is always given when you call a function so its a keyword because the reason is None?

sullen shoal
#

nope that is because, *roles will eat all the positional arguments

slate swan
#

Wait nvm

sullen shoal
#

!e

def func(*args, r=None):
    print(args, r, sep="\n")
func("hejej", "jeje", "jsjs")
func("jsjs","jsjs","sksk", r="oof")```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

001 | ('hejej', 'jeje', 'jsjs')
002 | None
003 | ('jsjs', 'jsjs', 'sksk')
004 | oof
sullen shoal
#

that is the reason

slate swan
#

Ahhh i see now🤔

slate swan
#

Right?

vale wing
#

It will print the default value

sullen shoal
#

yes because the default value is None

slate swan
#

Yeah i see that

vale wing
#

If you don't provide a default value to function at all the code won't work as it is syntax error

slate swan
#

Yeah ik

vale wing
#

You want arguments to be roles, reason, right?

slate swan
slate swan
stone moon
#

how do I add a role to a user

quick gust
vale wing
unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
slate swan
#

No right cuz its unknown cause of the *

vale wing
#

If you provide no args the list of them will just be empty

sullen shoal
#

if the function accepts an arg and it doesnt have a default value, it will raise TypeError

vale wing
#

!e def f(*args): print(args)
f()

unkempt canyonBOT
#

@vale wing :white_check_mark: Your eval job has completed with return code 0.

()
sullen shoal
#

or maybe some other error

slate swan
#

I see

sullen shoal
#

otherwise the default value will be used

#

!e
def f(a): pass
f()

unkempt canyonBOT
#

@sullen shoal :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | TypeError: f() missing 1 required positional argument: 'a'
sullen shoal
#

yeah TypeError

slate swan
#

🤔

sullen shoal
#

!e

def f(a="default value 6969420"): print(a)
f()```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

default value 6969420
slate swan
#

Thats a kwarg right

sullen shoal
#

it can be a kwarg

slate swan
sullen shoal
#

it is a positional argument with a default value

slate swan
#

Isnt a kwarg a keyword arg?

sullen shoal
#

it is

slate swan
#

Oh ok i thought i was tripping

sullen shoal
#

!e

def f(a="default value 6969420"): print(a)
f()
f(a="hello world") ```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

001 | default value 6969420
002 | hello world
slate swan
#

Makes more sense🤔

#

How can I completely remove a user permission in text channel?

sullen shoal
#

!e

def func(*args, **kwargs): print(args, kwargs)
func("oof", "hello", "okimii", confused="okimii", with="function arguments")```
unkempt canyonBOT
#

@sullen shoal :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     func("oof", "hello", "okimii", confused="okimii", with="function arguments")
003 |                                                       ^^^^
004 | SyntaxError: invalid syntax
sullen shoal
#

oops

slate swan
slate swan
sullen shoal
#

gotta fix it later

slate swan
slate swan
sullen shoal
#

im still confused why it raised the error

brittle ingot
#

\👀

sullen shoal
#

!e

def func(*args, **kwargs): print(args, kwargs)

func("oof", "hello", "okimii", confused="okimii", with="function arguments") ```
#

oh

#

lol

#

!e

def func(*args, **kwargs): print(args, kwargs, sep="\n")

func("oof", "hello", "okimii", confused="okimii", _with="function arguments") ```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

001 | ('oof', 'hello', 'okimii')
002 | {'confused': 'okimii', '_with': 'function arguments'}
slate swan
sullen shoal
#

slightly wrong

brittle ingot
#

i feel the same 😂

sullen shoal
#

the positionals are arguments that are passed by just the value not with the name, it is not unknown

slate swan
#

isnt that what i saidjam_cavedude

sullen shoal
#

oh yes

slate swan
#

Then i am rightbrainmon

sullen shoal
#

yes youre right

slate swan
#

You're wrong

#

Yeah so guys im moving to js👍

#

Lol

sullen shoal
#

js also have that stuff

slate swan
#

I wanna learn go

sullen shoal
#

atleast es6 does

slate swan
#

Python dodo js better

#

Python is for babies, why dont u learn a real langauge

slate swan
sullen shoal
#

good luck

slate swan
#

No need

sullen shoal
#

but you said youre moving

slate swan
sullen shoal
#

oh

#

i see

slate swan
#

Im jk @sullen shoal thx for explaining got it now👍

sullen shoal
#

np

#

my phones battery lasted the entire day nice

slate swan
sullen shoal
#

nah

slate swan
#

Flip phone?

sullen shoal
#

that would have lasted longer than my life

slate swan
#

True🤷‍♂️

sullen shoal
#

an android

slate swan
#

Noice

slim whale
#

how i can put a timestamp in an embed?

sullen shoal
#

i think theres a method for it i gotta check

slim whale
#

okk

slate swan
#

There is like <time.time>

#

Or something

#

Wait nvm

brittle ingot
#

either with

embed.timestamp = #datetime object

or in the embed constructor:

embed = discord.Embed(
    title="title",
    url="title URL"
    description="description",
    color = #color str / hex
    timestamp = #datetime obj
)
slim whale
#

tnxxxx

brittle ingot
#

np

brittle ingot
#

no

slate swan
brittle ingot
#

!d discord.Embed.timestamp

unkempt canyonBOT
#

The timestamp of the embed content. This is an aware datetime. If a naive datetime is passed, it is converted to an aware datetime with the local timezone.

silk mauve
#

How can I code that just people with for example the booster role can use !!snipe or !!avatar

quick gust
#

@has_role decorator

sullen shoal
#

it will not help to put timestamps in an embed

brittle ingot
#

!d discord.ext.commands.has_role

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
sullen shoal
#

@slate swan did you get the answer

silk mauve
#

@discord.ext.commands.has_role("Booster")?

#

Like that

sullen shoal
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.9)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
brittle ingot
slate swan
slate swan
#

<t:1618953630:d>

silk mauve
stone moon
slate swan
#

<t:99999999:d>

sullen shoal
slate swan
#

<t:9999999999:d>

sullen shoal
#

it will not exist at all

sullen shoal
#

however, {} can be considered None

#

just gotta make your mind clear

slate swan
#

Yea ik

pliant gulch
#

{} Is not considered None

#

None is None, {} is just not truthy

brittle ingot
#

its considered a dict right

pliant gulch
#

It's an empty dict

slate swan
#

Im having a stroke

brittle ingot
#

yeah

sullen shoal
#

yes its still a empty dict

pliant gulch
#

!e ```py
print({} is None)

sullen shoal
#

just not truthy

slate swan
#

I see

unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

False
slate swan
#

If a kwarg isnt given will it send a type error?

sullen shoal
#

if it doesnt have a default value, yes

slate swan
#

Alr makes sense

#

@sullen shoal thx broyert

sullen shoal
#

np

slate swan
#

Get it way better now

sullen shoal
#

however i still have a feeling that you have some wrong information about function arguments

silk mauve
#

@bot.command() @discord.ext.commands.has_role("912010635431260210") async def snipe(ctx): channel = ctx.channel try:

#

discord.ext.commands.errors.MissingRole: Role '912010635431260210' is required to run this command.

#

This is my error

pliant gulch
#

You're passing the role id as a str to has_role

#

You should pass it as an int

stone moon
#

how do i add a role to a user

brittle ingot
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
sullen shoal
#

!d discord.Member.add_roles

stone moon
#

ive done add_role(name of role) and (id of role)

brittle ingot
#

oop

stone moon
#

but it returns an attribute error

sullen shoal
#

roles*

brittle ingot
#

you need a role object

stone moon
#

wdym

brittle ingot
#

fetch or get the role from the guild

sullen shoal
#

you need an instance of discord.Role

brittle ingot
#

!d discord.Guild.get_role

unkempt canyonBOT
slate swan
pliant gulch
#

I don't think you really need to do all the get_role nonsense here tbh

#

The docs say roles is a list of Snowflakes

#

Just make a discord.Object and pass the ID

pliant gulch
#

Because get_role is gonna require an ID either way, this is just faster

brittle ingot
#

true you could type hint it too if its a command

slate swan
#

Finally i can graduate joe_salute

sullen shoal
#
def func(a, b, c, *, d, e, f, g): ...

all the arguments after the * are keyword only arguments

slate swan
#

I see🤔

full valley
#

Yo @sullen shoal, I found kind of what was going on, if you remember me

cloud dawn
#

And if you don't put a=None it's a optional arg/kwarg else it's not.

full valley
# sullen shoal yeah i remember

so I added a print(e) to the exception

        try:
            player_ids = games[game_id][:]
            print(player_ids)
            random.shuffle(player_ids)
            team1 = player_ids[:qsize / 2]
            team1_ids[game_id] = team1
            team2 = player_ids[qsize / 2:]
            team2_ids[game_id] = team2
        except Exception as e:
            print('didnt work lul')
            print(e)
            raise e
cloud dawn
pliant gulch
#

a, b ,c can all be passed as kwargs. If you truly want it to be pos only you can add / to the function signature

full valley
#

and it gives the game_id +1 as an integer in the output

full valley
sullen shoal
#

lol

slate swan
#

I get it now

full valley
#

So is it a key error, whatever it is isnt showing as an error

stone moon
full valley
#

But would you know how to fix this?

brittle ingot
# stone moon gotcha

read after that too because we discussed it a bit, i may have mislead you unintentionally.

dusk dust
#

any1 can help me to solve this error?

sullen shoal
#

another name for "arg/kwarg with a default value" is "optional arg/kwarg"

stone moon
#

right

sullen shoal
#

kinda weird

full valley
cloud dawn
dusk dust
slate swan
sullen shoal
#

extreme amount of knowledge

brittle ingot
#

alright im done procrastinating 😂

cloud dawn
slate swan
full valley
#

This is going to haunt me

full valley
#

I cant solve it

sullen shoal
#

even more than freecodecamp's misguided kids

full valley
slate swan
full valley
#

yeah OMEGALUL

cloud dawn
cosmic frost
#

im making a discord.py function that counts numbers of messages posted each day then at the end of each day it resets to 0 and pastes what it got onto a graph

@client.command()
async def heyy(ctx):
    await asyncio.sleep(86400)
    global xmes
    dmes = xmes
    xmes = 0
    while 1 == 1:
        print('day complete')
        print('messages sent: ', dmes)

        await heyy(ctx)
```  I have an on_message function that adds 1 ton xmess every message that is sent but im having a problem getting dmes(final value from day) into a list
cloud dawn
cosmic frost
#
import plotly.graph_objects as go
import time
xmes = 0
def onm():
    global xmes
    bumby = input('say 1: ')
    if bumby == '1':
      xmes += 1
      print(xmes)
      heyy()

def heyy():
    time.sleep(10)
    global xmes
    dmes = xmes
    fig = go.Figure(data=go.Scatter(x=['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'],
                                    y=[dmes,dmes1,dmes2,dmes3,dmes4...dmes7?])
    fig.show()
    while 1 == 1:
        print('day complete')
        print('messages sent: ', dmes)
        onm()
onm()
``` example here of what im trying to get at
full valley
dusk dust
cosmic frost
dusk dust
slate swan
dusk dust
#

from decouple import config

dusk dust
slate swan
full valley
cloud dawn
cosmic frost
#

ohh

dusk dust
slate swan
#

Is there a way I can delete this message that comes when a message is pinned?

cloud dawn
slim whale
#
snipe_message_author = {}
snipe_message_content = {}

@bot.event
async def on_message_delete(message):
     snipe_message_author[message.channel.id] = message.author
     snipe_message_content[message.channel.id] = message.content
     snipe_message_time[message.channel.id] = datetime.datetime.utcnow()

@bot.command(name = 'snipe')
async def snipe(ctx):
    channel = ctx.channel
    try:
      embed = discord.Embed(color = 0x87CEEB,
        title=f"{snipe_message_content[channel.id]}"
        )
      embed.set_author(name=f"{snipe_message_author[channel.id]}")
      embed.timestamp = snipe_message_time[message.channel.id]
      embed.set_footer(text=f"#{channel.name}")
      await ctx.send(embed=embed)
    except:
     await ctx.reply("¿Que buscabas?")
dusk dust
slim whale
#

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 762, in on_message_delete
snipe_message_time[message.channel.id] = datetime.datetime.utcnow()
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'

cloud dawn
slate swan
dusk dust
cloud dawn
slate swan
slim whale
slate swan
slate swan
slate swan
#

thx

dusk dust
cloud dawn
#

Also note that the auto message isn't a user or bot so you would be deleting blindly.

unkempt canyonBOT
flint cosmos
#

Hi does anyone know how I can make it so when a user who is hosting a discord bot types something in the terminal it will send something in the discord server?

cloud dawn
silk mauve
#

Is it possible that for example we got a new person who got the Owner role, and the bot updates it by himself

silk mauve
#

We got one Person in Role Owner

#

And we getting a new Owner

silk mauve
#

and the bot will add the person himself to the embed

cloud dawn
flint cosmos
#

You can use input() to type in a terminal??

silk mauve
cloud dawn
silk mauve
#

Like, I dont need to change soemthing with the code

#

something*

#

on*#

#

?

cloud dawn
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...
cloud dawn
#

Is this enough info?

silk mauve
#

Not really

cloud dawn
#

So you first need to check if the role that got added to the user is the owner role. If it is update it.

#

before and after are member objects.

silk mauve
#

ye

cloud dawn
#

You get it?

silk mauve
#

nah

silk mauve
cloud dawn
#

Idk what more to tell, do you not understand the explanation or how to code it?

silk mauve
#

How to code it

#

Should I send you my code?

cloud dawn
#

Well you need to event and create an if statement and compare the 2 member objects. If the role that got changed is the owner role, update the embed by getting the message object and then resending it.

#

Well you could be the if condition isn't that long.

flint cosmos
cloud dawn
cloud dawn
silk mauve
#

@cloud dawn , could you look in dm's?

slim whale
#

can some1 help me with a timestamps for a snipe command?

silk mauve
quick gust
#

elaborate?

cloud dawn
slim whale
silk mauve
cloud dawn
silk mauve
#

okay

slim whale
#
snipe_message_author = {}
snipe_message_content = {}
timestamp = {}

@bot.event
async def on_message_delete(message):
     snipe_message_author[message.channel.id] = message.author
     snipe_message_content[message.channel.id] = message.content
     timestamp[message.channel.id] = datetime.datetime.utcnow()

@bot.command(name = 'snipe')
async def snipe(ctx):
    channel = ctx.channel
    try:
      embed = discord.Embed(color = 0x87CEEB,
        title=f"{snipe_message_content[channel.id]}"
        )
      embed.set_author(name=f"{snipe_message_author[channel.id]}")
      embed.timestamp = timestamp[message.channel.id]
      embed.set_footer(text=f"#{channel.name}")
      await ctx.send(embed=embed)
    except:
     await ctx.reply("¿Que buscabas?")```
#
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 763, in on_message_delete
    timestamp[message.channel.id] = datetime.datetime.utcnow()
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'```
#

i have this

fast tree
#

IndentationError: expected an indented block

#

Welp?

cloud dawn
unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

quick gust
#

indent the block

slim whale
#

no1 can help me?

quick gust
#

import datetime

#

didn't direct towards you @silk mauve

silk mauve
#

ok

cloud dawn
unkempt canyonBOT
fast tree
quick gust
quick gust
cloud dawn
fast tree
cloud dawn
quick gust
#

paste your code and send it

#

!paste

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.

cloud dawn
fast tree
#

!codeblock

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.

quick gust
#

yeah I've faced it quite some times

fast tree
#
async def test(ctx):```
quick gust
#

some of my commands take in different indentation than others

quick gust
#

its not in a cog is it

cloud dawn
quick gust
fast tree
#
async def hanamiteam(ctx):```
#

Like this?

quick gust
#

should work if the rest of the indentation is correct

cloud dawn
#

Devkid i recommend learning some python first since this library is not beginner friendly.

fast tree
stone moon
#

if i have 5 roles (1,2,3,4,5) can i consecutively give a member a role for every message they say

cloud dawn
# fast tree Okay

But Let's do solve this so you can see what is going wrong, send more code.

cloud dawn
quick gust
#

?

silk mauve
fast tree
#

uhm yes?

#

How u know lol

quick gust
#

and the error it gives, if any

quick gust
#

okay

fast tree
#
async def on_member_update(before, after):


@bot.command()
async def test(ctx):
quick gust
#

uhh

cloud dawn
#

Well the event has to contain actual code.

sullen shoal
#

so code

cloud dawn
#

So...? Why do you have an event that does nothing.

fast tree
#

It needs to do something

slate swan
#

How can I check if a user has access to a text channel with an if statement?

cloud dawn
#

Define "something"

cloud dawn
fast tree
#

Oh wait

fast tree
#

So the member will be in the embed

#

Like:

@winged charms(Role)

-Devkid

#

Etc..

cloud dawn
#

I'm very confused lol

slate swan
pure cape
#

Selam

fast tree
fast tree
cloud dawn
sullen shoal
#

```py
code here
```

slate swan
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.

slate swan
#

Doesnt ping anyone

fast tree
#

Ye

#

I know

slate swan
#

Then use it

sullen shoal
#

then use the knowledge next time

slate swan
#

^

cloud dawn
#

You can also use inline code @pandabweer

slate swan
#

^

sullen shoal
#

ok lets get rid of that

#

why are you asking for help if you dont even know what you need help with

sullen shoal
#

someone cant even spoonfeed you rn

slate swan
#

Read the docsyert

cloud dawn
sullen shoal
#

ok that person disappeared

#

good for my brain

slate swan
cloud dawn
slate swan
#

I don't have nitro so thats why i want it here

sullen shoal
#

you may use,
🚫 🥣
till then

dusk dust
#

how can i download the git?

slate swan
sullen shoal
#

\🚫 \🥣

slate swan
#

🚫 🥣

dusk dust
sullen shoal
#

could have googled tbh

dusk dust
#

i arl searched

slate swan
#

Bro people get basic syntax errors and they come here when you can fix it yourself or read the docs if you get a attr error jam_cavedude

dusk dust
sullen shoal
#

doesnt exist

slate swan
#

This should be your last optionjam_cavedude

dusk dust
#

like this dude

#

don't exactly that

sullen shoal
#

either github knows how dumb some of their users who use their os are and created a specific site for them to download git or someones trying to spread malware

slate swan
#

🤔

cloud dawn
cloud dawn
#

This took me to at least 3 nested objects lol

cloud dawn
# slate swan thxx

I recommend looking into the attributes of member and channel most answers are lying just there.

slate swan
#

Bro i did

print("print('hello world')")

And my computer diedyert

#

Okay I will thank you

sullen shoal
#

my computer died when i did,

from itertools import count
list(zip(count(), count()))```
#

not joking tho

cloud dawn
slate swan
slate swan
#

Omgbrainmon

dusk dust
#

why dude

slate swan
sullen shoal
#

i always wanted to try

slate swan
sullen shoal
#

!e

from itertools import count
list(zip(count(), count()))```
unkempt canyonBOT
#

@sullen shoal :warning: Your eval job timed out or ran out of memory.

[No output]
dusk dust
sullen shoal
#

rip

cloud dawn
#

Appereantly it crushes your memory lol

sullen shoal
#

infinitely

slate swan
#

can i ask a question here?

cloud dawn
sullen shoal
#

by calling list, python will try to convert the yield'd values to a list, which will never happen

#

and our memory will run out

sullen shoal
#

unfortunately i didnt get the chance to close the script

#

i thought i would get atleast 3 seconds

slate swan
#

How do you print a str 5 times i kinda forgotbrainmon lemon_warpaint

sullen shoal
#

multiply

cloud dawn
#

well okay i know why it would freeze your pc lmaooo

slate swan
sullen shoal
#

!e print('okimii'*5)

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

okimiiokimiiokimiiokimiiokimii
slate swan
slate swan
slate swan
#

Forgot how you do it 🤷‍♂️

sullen shoal
#

didnt except it to be that powerful though

slate swan
sullen shoal
#

i was just checking out what would happen

cloud dawn
sullen shoal
#

uh

slate swan
#

@slate swan dont talk about freecodecamp tho you know whos hereyert

#

nah nah

sullen shoal
#

yep

slate swan
#

i need to know how to send webhooks with my bot as an event

#

like when someone types the command the bots send the webhook

#

Discord webhook or other webhook?

sullen shoal
#

looks like you have to subclass Context

#

and change the send method

slate swan
#

discord webhook

daring olive
sullen shoal
#

im sorry

slate swan
#

Use the discord.py webhook driver thingy, they have a pretty good example in the documentation also

#

like this

daring olive
#

appreciate it - thanks for understanding!

slate swan
#

see the last line?

cloud dawn
# slate swan like this

When making commands please use the integrated system, don't make an on_message command bot.

slate swan
#
from discord import Webhook, AsyncWebhookAdapter
import aiohttp

async def foo():
    async with aiohttp.ClientSession() as session:
        webhook = Webhook.from_url('url-here', adapter=AsyncWebhookAdapter(session))
        await webhook.send('Hello World', username='Foo')
cloud dawn
slate swan
#

So u wanna do webhooks like this

slate swan
#

It looks like an ip grabber

stone moon
slate swan
slate swan
#

Your wrong

orchid basin
#

hi , guys i want to build a discord bot that's he can talk with my language

slate swan
#

@slate swan Its not its one of the best tutorials out there thats up to date which is made by a helper in this server

orchid basin
slate swan
#

His name in the server is Alec but his discord is vcokltfre

#

I like how he says u need intermediate knowledge

#

I didnt have any python knowledge when i started

slate swan
#

I just had a bit of source code my friend gave me and i worked it out

#

Dpy isnt beginner friendly and you need knowledge of classes and asynchronous programming

#

Not beginner friendly^

sullen shoal
#

just putting your code on on_ready or on_message isnt enough

slate swan
#

I disagree u dont need knowledge of them really, u just need to know how to use them for discord.py

#

Which is pretty simple

sullen shoal
#

:/

slate swan
#

Which means you dont actually know it

#

Thats what im saying

#

You just know the syntax

sullen shoal
#

lets not talk with kids

slate swan
#

Yeah

sullen shoal
#

yes

#

completely right

slate swan
#

Which is simple

sullen shoal
#

yes

slate swan
#

I had 0 knowledge when i started

#

I was able to work it all out just looking at my friends code and then in a day i made like 10 new commands

#

Knowing syntax isnt knowing dpy

#

And most of the commands were interacting with restful apis

#

Its the kids like you that say they know it and then come here with a attr error

#

SyntaxError: invalid syntax how to fix this error?

#

So i feel a bit better than those kids

#

Im not saying your stupid,but im saying your actions arent correct

#

In that i was able to actually understand the errors

sullen shoal
slate swan
#

And use the errors to fix what went wrong

#

Like sometimes im surprised ppl just dont read the errors

#

And now i feel confident in using python to do basic stuff and interact with apis. I was even able to use the skills at work

#

@slate swan i dont recommend knowing dpy only its syntax because you will just not have a good time and not having good knowledge classes and asynchronous programming you will not have a good time or understanding of what your doing

slate swan
#

Still dont really know what a class is but my discord bot go brrrrrr

#

I remember when i first learnt how to use functions

slate swan
#

B4 that i would write my entire code as a script lol

#

I think my way translate to alot of what ppl want, which is to make stuff

#

And u should have a goal and learn as u go along making that goal

#

Its better knowing somethings deeply then knowing everything lightly

#

And then if u enjoy it. Start learning python properly

slate swan
slate swan
#

Im gonna do a proper python course soon, but me doing it now vs me doing it b4 when i knew nothing

#

Will result in me doing it now learning things more deeply i think

sullen shoal
#

basically waste of time if thats what you wanted to do later

slate swan
#

Not even

#

I have workable python skills now

#

I can make useful stuff in python

sullen shoal
#

it is, all this could have been covered in like 2 weeks if you had taken a good python course

slate swan
#

I liked learning it myself, its like an rpg, and when u gain a skill all these new stuff become available to you

#

Learned python basics in like a week but i know it deeply after 7months since i started

sullen shoal
#

you werent learning

slate swan
#

Like when i learnt about lists and dictionaries

#

Ngl best way to learn python is python docs

#

Once i learnt those i realised i can do alot of things with them

#

Good examples good explanations

slate swan
slate swan
sullen shoal
#

python docs are very detailed and good

slate swan
slate swan
#

I found them confusing especially right at the start

sullen shoal
#

because you looked at the wrong section

slate swan
sullen shoal
slate swan
#

My favourite is google

slate swan
#

Google is good. I learnt alot googling for similar things and then working out how to apply all the concepts to my end goal

sullen shoal
#

they will teach you how it will somehow work python docs will teach you how it works

slate swan
slate swan
#

Most stackoverflow stuff are outdated or are in 2.0

#

Python docs arent that great

#

If you actually read ityert

sullen shoal
slate swan
slate swan
#

Im not learning outdated stuff

slate swan
sullen shoal
#

okay tell me the difference between

class foo(object)```
and 
```py
class foo()```
the answer is very simple
slate swan
#

I told you i dunno what a class is

sullen shoal
#

thats it

#

thats not how it works

slate swan
#

I said that earlier

#

Conversation is over

#

I never needed classes

sullen shoal
#

LOL?

slate swan
slate swan
sullen shoal
#

every single damn thing of an object oriented programming language is a class

#

you always need them

slate swan
#

^

#

I dont need to know them for what im doing

sullen shoal
#

thats not how it works then

slate swan
sullen shoal
#

youre using it, not learning how it works

slate swan
#

Ok sure

#

Im learning what i need to know

#

And letting library do what i dont

slate swan
sullen shoal
#

okay im done with this kid

slate swan
#

Thats all i need to know

slate swan
#

I do though

#

What do i know about dpy ive only been on it for 7 months🤷‍♂️

#

Anything i dont know how to do

#

I will learn how to do it

#

If classes become important for me to learn

#

To do what im doing

#

I will learn classes

#

If you had education on your face would you reject it?

#

Thats a dumb question

slate swan
#

Not so polite

#

U getting triggered coz i found a way of learning that works for me

#

Seems like your the one whos triggeredyert

slate swan
slate swan
languid jungle
#

!mute 788098387354452060 1D That's not the way we expect members to behave in this server. Please re-read our #rules and #code-of-conduct .

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1637604281:f> (23 hours and 59 minutes).

languid jungle
slate swan
#

I think he misunderstood my point

#

I never tried to offend him in any way

sullen shoal
#

i've wasted my beginner days using the same stuff i know because i sucked at english which i still do, later as every other kid i tried discord.py, i wasted around 2 months on it doing the absolute basic commands then when it came to stuff like custom help commands, i looked up Stella's guide to subclassing HelpCommand then i came to know why i sucked at python, i didnt know about classes i spent like 2 months learning how classes work from that day im improving

#

eh rip

#

wrote that for him but rip

slate swan
#

Same i started not knowing anything but knowing syntax and it was a big waste of time

#

And i dont want any beginner to waste like a month and quit python or their dreams

sullen shoal
#

yeah its kinda hard when youre learning by yourself at first

slate swan
#

Yeah you just have to know that everything is up to you

sullen shoal
#

we dont know what skills we need and stuff and how to actually improve

slate swan
#

Yeah

#

Its unlike college in college you have everything to learn in your face unlike self programmers who need to search for it

#

Good thing of a self taught programmer is that everything is at your paste

sullen shoal
#

yeah

slate swan
#

I started 7 months ago cause i want to be ahead of my class when i got to college

#

So everyone is starting python when i have years of experience

sullen shoal
#

i wanted to be those people with green text on black screen

slate swan
#

Yeah same

#

Ive been inspired to programming cause ive always liked tech and stuff and i dont regret learning python

sullen shoal
#

oh yeah i liked
tech and stuff even when i used to play games on my dads nokia

#

those java games were fun

slate swan
#

Best games ever

sullen shoal
#

oh yeah

#

i had over 50 games

slate swan
#

I had only 4 it was the car game, snake,cards,and space shooter type of game

sullen shoal
#

just downloaded every damn game i could find on some sites that start with wap

slate swan
#

😭

#

Lmfaoo

#
@bot.command
async def guide(ctx):
    embed=discord.Embed(title = 'luxé helper' , description = 'under construction' , url = 'https://youtu.be/KLBWiXFLc_I' , color = 0xE6E6FA)
#

code not working? please

#

You have to send the embed

#

no url kwarg

#

in an embed

pliant gulch
#

There is a url kwarg iirc

slate swan
#

hmm

#

!d discord.Embed.url

unkempt canyonBOT
slate swan
#

question mark

#

hmm

slate swan
#

oh thx

rustic temple
#

hey

slate swan
sullen shoal
#

uh someone replied to my 3 years old youtube cringe comment

rustic temple
#

hope u guys are well

sullen shoal
#

yeah im doing well

slate swan
rustic temple
#

i check if the bot is in the same voice channel as the guy who sent the command

#

this should work but its not. am i doing something wrong?

slate swan
#

Dang idk about vc stuff so myxi you takeover

#

Or someone else

slate swan
#

I would check the guild.me.voice

#

instead of voice_client's

slate swan
rustic temple
sullen shoal
#

that should work

rustic temple
#

hmm still didnt work

sullen shoal
#

check if its None

slate swan
rustic temple
#

perhaps ctx.author.voice is not the same type of object as ctx.guild.me.voice?

sullen shoal
#

ctx.author is discord.Member

rustic temple
#

oh i see

sullen shoal
#

both return VoiceState

slate swan
sullen shoal
#

so you should check the channel attribute

#

!d discord.VoiceState.channel

unkempt canyonBOT
#

The voice channel that the user is currently connected to. None if the user is not currently in a voice channel.

rustic temple
#

ohhhh

#

intellectual mfer

#

harvard mfer over here

#

trying this rn

cloud dawn
slate swan
rustic temple
#

@sullen shoal it worked thank you

sullen shoal
#

👍

#

keep in mind, discord.Member.voice can be None

#

so check that first

rustic temple
#

how can it be none if its the author of the command?

sullen shoal
#

if its none, you will get that nonetype error

rustic temple
#

may as well add it

#

question - what other useful features do you guys regularly use bots for besides music

sullen shoal
#

!e None.channel

unkempt canyonBOT
#

@sullen shoal :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'channel'
sullen shoal
#

this one

rustic temple
#

or is music the most useful thing a bot could do

cloud dawn
#

moderation is prob the second most used.

sullen shoal
#

well i use it to check if theres any new python version available haha

slate swan
#

the most illegal one

#

😳

slate swan
rustic temple
slate swan
#

what the

rustic temple
#

lol

slate swan
#

what's that

#

Me with 2.0 like: shipit

sullen shoal
slate swan
#

and I still assume it downloads music from youtube

slate swan
rustic temple
#

uhhh

#

never that

rustic temple
#

okimii

#

do u have to pay for hosting ur bot?

slate swan
#

Not really but you can

sullen shoal
#

ah i just got warned for one thing gotta keep that in mind next time

cloud dawn
rustic temple
#

u just host it from ur pc ?

slate swan
#

Raspberry users

slate swan
cloud dawn
slate swan
#

well some sites

#

youtuben't

cloud dawn
#

yesn't exactly

sullen shoal
# slate swan What thing?

maybe because when a user here got syntaxerror i told him to learn python which was bad i realized

rustic temple
#

lol

leaden jasper
#

!d discord.Guild.create_custom_emoji

unkempt canyonBOT
#

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

Creates a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") for the guild.

There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.

You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
leaden jasper
#

what is roles in this

#
roles (Optional[List[Role]]) – A list of Roles that can use this emoji. Leave empty to make it available to everyone.
``` but how does that work>
slate swan
cloud dawn
leaden jasper
slate swan
slate swan
leaden jasper
#

When you add custom emojis yourself, there isn't an option to specify the roles that can use the emoji

sullen shoal
forest spear
#

@sullen shoal sorry for the ping, I managed to use deta database as you said above and stored some data there but how can I have multple data for specific user?

cloud dawn
forest spear
#

Can you maybe give me a little bit of example something like this?

user = ctx.author.id
db.put({"user" {"quote":message}})```
forest spear
sullen shoal
#

one sec i gotta be sure after checking the docs

slate swan
sullen shoal
#

yep

slate swan
#

I think it was cause of that maybe

#

Noobian never had a syntax error

cloud dawn
#

I would explain anything but i won't spoonfeed

sullen shoal
sullen shoal
slate swan
sullen shoal
#

Noobian knew what he was doing

slate swan
sullen shoal
#

he wasnt a beginner, the warn message included the user being beginner

slate swan
#

Makes sense

cloud dawn
sullen shoal
lucid iris
#

hey

slate swan
sullen shoal
#

hello

slate swan
# cloud dawn ```py if member in channel.members and channel.permissions_for(member).read_mess...
async def add(ctx, member : discord.Member):
    channel = ctx.channel
    if member in channel.members and channel.permissions_for(member).read_messages:
        await ctx.channel.set_permissions(member, read_messages=False)
        await ctx.channel.send(f"Removed {member.mention} from this channel.")
    elif member in channel.members and not channel.permissions_for(member).read_messages:
        try:
            await ctx.channel.set_permissions(member, send_messages=True, read_messages=True)
            await ctx.channel.send(f"Added {member.mention} to this channel.")
        except:
            await ctx.channel.send("Please provide a user.")```
For some reason this always has the first if statement true. No matter what perms the user has it always sends "Removed {member.mention} from this channel."
cloud dawn
slate swan
#

let me check

stiff nexus
#

help??```py
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/cogs/general.py", line 613, in _news
await ctx.reply(embed=newmbed, reference=ctx.replied_reference, view=LinkButton(links))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/context.py", line 400, in reply
return await self.message.reply(content, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/message.py", line 1564, in reply
return await self.channel.send(content, reference=self, **kwargs)
TypeError: send() got multiple values for keyword argument 'reference'

cloud dawn
#

Oh i see it,
from py if member in channel.members and channel.permissions_for(member).read_messages: to ```py
if channel.permissions_for(member).read_messages:

forest spear
slate swan
slate swan
slate swan
slate swan
#

ah i see. unfortunately the entire bot is written in it so i dont have much of a choice

cloud dawn
slate swan
slate swan
cloud dawn
slate swan
#

thats where i did the coding for the rest of the bot

cloud dawn
woeful crow
#

How can I have my bot do something when a specific reaction is clicked (on a message)

slate swan
#

!resources @slate swan read the link to learn python and after you learn python then you can learn discord.py

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.

sullen shoal
slate swan
slate swan
#

I knew enough to take the skeleton of the bot i was given and expand it

cloud dawn
slate swan
#

If i see one command i could replicate it basically infinite times

slate swan
slate swan
#

So i don't know python, but i have coded in it. I suppose

slate swan
slate swan
# cloud dawn Could you dir this object?
['__abstractmethods__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_abc_impl', '_client_status', '_copy', '_from_message', '_from_presence_update', '_get_channel', '_presence_update', '_roles', '_state', '_try_upgrade', '_update', '_update_from_message', '_update_inner_user', '_update_roles', '_user', 'activities', 'activity', 'add_roles', 'avatar', 'avatar_url', 'avatar_url_as', 'ban', 'block', 'bot', 'color', 'colour', 'create_dm', 'created_at', 'default_avatar', 'default_avatar_url', 'desktop_status', 'discriminator', 'display_name', 'dm_channel', 'edit', 'fetch_message', 'guild', 'guild_permissions', 'history', 'id', 'is_avatar_animated', 'is_blocked', 'is_friend', 'is_on_mobile', 'joined_at', 'kick', 'mention', 'mentioned_in', 'mobile_status', 'move_to', 'mutual_friends', 'mutual_guilds', 'name', 'nick', 'pending', 'permissions_in', 'pins', 'premium_since', 'profile', 'public_flags', 'raw_status', 'relationship', 'remove_friend', 'remove_roles', 'request_to_speak', 'roles', 'send', 'send_friend_request', 'status', 'system', 'top_role', 'trigger_typing', 'typing', 'unban', 'unblock', 'voice', 'web_status']```
slate swan
sullen shoal
forest spear
slate swan
cloud dawn
sullen shoal
slate swan
#

the bot has multiple py files

slate swan
#

what's "the function"?

cloud dawn
forest spear
#

Gotcha thanks lemme try it

slate swan
slate swan
#

i assume all dpy bots have a bot.py file

#

?

#

@cloud dawn Bruuh nevermind bro, the Person I used to test it out has admin perms. I thought that the if statement checks the perms for THAT SPECIFIC user. But no, it just checks if he has perms to see it in general. I'm sorry but I'm dumb ;(

slate swan
#

well that makes life harder

cloud dawn
slate swan
#

Thats just the name of the file🤷‍♂️

#

does every dpy boit have a cogs folder?

cloud dawn
#

I like how prob everyone here took the time to read my file name 😊

cloud dawn
slate swan
#

You pinged the wrong person panda

#

aight so what should the first thing i do be?

cloud dawn
slate swan
#

which py to open?

cloud dawn
slate swan
#

xdd

slate swan
#

Every bot isnt exactly the same

slate swan
woeful crow
#

How can I have my bot do something when a specific reaction is clicked (on a message the bot sends)

cloud dawn
#

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
slate swan