#discord-bots

1 messages · Page 449 of 1

waxen granite
#

the cog isnt loading due to the error :3

slate swan
#

Just comment out the lines giving the error and then print it

full lily
#

^

slate swan
waxen granite
#

figured

#

ty

full lily
high flame
#

or a part of your code

opaque trail
#

» this might by a non utf-8 for example

high flame
#

!charinfo »

unkempt canyonBOT
high flame
#

nvm

slate swan
#

!charinfo・

#

!charinfo ・

unkempt canyonBOT
broken turtle
#
@bot.event
async def on_member_join(member):
    await member.guild.get_channel(868696187497234435)
    embed = discord.Embed(
        title=('welcome to aurora {member.mention}') ,
        description= ('Pls read #|rules, #|self-roles, #|roles-info') ,
        colour= discord.Colour.dark_green()
        )
    await ctx.send(embed=embed)

This is my eroor

#

its supposed to be a welcome message with an embed

#

i know its the await member.guild.get_channel

#

wait

#

let me try soemthing

#

im moving the await to the bottom

manic wing
#

its await for fetch because fetch is api call

opaque trail
#
@bot.event
async def on_member_join(member):
    channel = member.guild.get_channel(868696187497234435)
    embed = discord.Embed(
        title=('welcome to aurora {member.mention}') ,
        description= ('Pls read #|rules, #|self-roles, #|roles-info') ,
        colour= discord.Colour.dark_green()
        )
    await channel.send(embed=embed)
manic wing
#

get just searches cache, no await needed

broken turtle
#

so replace await with get?

opaque trail
manic wing
#

bye 👋

broken turtle
#

@opaque trail i got this error

slate swan
#

!charinfo ⏮

unkempt canyonBOT
opaque trail
broken turtle
#

ctx isnt defined

slate swan
#

!charinfo ◀️

unkempt canyonBOT
broken turtle
#

im gonna define it real quick and try

opaque trail
broken turtle
#

i did

opaque trail
#

the whole code

broken turtle
#

I did

opaque trail
#

no you didnt

broken turtle
slate swan
#

!charinfo ⏹

unkempt canyonBOT
opaque trail
#

copy my code and replace it by yours.

broken turtle
#

i did

slate swan
#

!charinfo ▶️

unkempt canyonBOT
slate swan
#

!charinfo ⏭

unkempt canyonBOT
broken turtle
#

can you read?

opaque trail
blissful lagoon
#

do not use ableist language or insult other users

opaque trail
#

spot the difference

blissful lagoon
hasty iron
#

also on_member_join takes a single argument

manic wing
blissful lagoon
#

please DM @novel apex if you have any questions or comments about moderation

manic wing
#

each admin gives different punishments i guess

#

/moderator

tight obsidian
#

We always take people's history into account. But yeah, message modmail if you think some moderation action is unfair.

manic wing
#

well the mutes already been given lol

#

and often when people make decisions they tend not to change their mind

slate swan
#

!charinfo 〢

unkempt canyonBOT
forest blade
#

Do that in #bot-commands

violet lintel
#

can I run my own instance of the Python bot in my own server? I've cloned the github repo but I can't find where to add my own token for my own bot account

#

nvm, there's a ton of extra code in there, I'll just look into using the same snekbox api

polar dirge
#

i have a setup command and am trying to check if the bot has perms.

so far i have something like

  if ctx.guild.me.has_permissions(administrator=true):
    print("has admin")
  else:
    print("doesnt")```
manic wing
#

=True

#

you can just do if ctx.guild.me.guild_permissions.adminisrator:

blazing beacon
#

on_member_join has ctx?

hasty iron
#

no

compact field
#

guys how can i get message with message id ?

#

<@&267630620367257601>

zinc reef
shy schooner
unkempt canyonBOT
slate swan
#
def h(ctx):
    if ctx.message.guild == 883762260059754516:
        return True

@commands.check(h)
@client.command()
async def test123(ctx):
    await ctx.reply('good')

returns
Ignoring exception in on_command_error
discord.ext.commands.errors.CheckFailure: The check functions for command test123 failed.

any clue what's wrong?

covert igloo
#

whats wrong here

#

nvm indent error

dapper cobalt
#

Make it ctx.guild.id instead.

slate swan
#

whoops rookie mistake

lofty heron
#

hi can somebody help? idk what's wrong with this embed

embed = discord.Embed(
        title="Here's your link",
        description=(f"click the link not the green play button\n{link}"),
        set_footer(text=('beano')),
        color=0x69dab4
    )
    await ctx.send(embed=embed)  
dapper cobalt
lofty heron
#

hmm so discord.Embed.footer?

spark dragon
#

Heya, I try to do @quaint axle.event and @quaint axle.command but it doesnt work

lofty heron
#

or just footer="

spark dragon
#

How do I fix it?

spark dragon
#

Ty

covert igloo
#

another else error, im guessing im indenting something wrong

#

fixed smh

lofty heron
#

File "/Users/dumb_boi/Desktop/discord activities/hax.py", line 33
)
^
SyntaxError: positional argument follows keyword argument

embed = discord.Embed(
        title="Here's your link",
        description=(f"click the link not the green play button\n{link}"),
        embed.set_footer(text="im stonk"),
        color=0x69dab4
    )
    await ctx.send(embed=embed)

hi i'm not sure why it returns this error can somebody help fix? Sadge

stark hearth
lofty heron
#

hmm so do i make a variable and do footer=(ufweafsde)

stark hearth
lofty heron
#

oh

#

ok tenks :DDDDDD

stark hearth
#

np

#

embed is a variable for embed.set_footer

lofty heron
#

oh

opaque trail
#

Set_footer is an attr?

slate swan
covert igloo
#

i get this error message when a mute command doesnt have a reason

#

how can i make it so it send the commands.MissingRequiredArgument error instead of printing that in the output

slate swan
#

make a error handler

hollow hemlock
#

how to set an image of an embed as an image located in a directory instead of url?

#

nevermind

slate swan
#

😶

covert igloo
fair rose
#

is it possible to make it so a discord bot can delete the server avatar then replace it with another image?

hybrid fjord
#

can i get an image attachment from a message using wait_for? if so, how?

#

i need to convert it to a url so i can store it in a database

fair rose
slate swan
#

it's uhh possible but sadly I don't remember how because i never had to use it

#

theres a thing called read the docs

fair rose
#

;/

slate swan
#

yes

#

it has almost everything

#

:)

#

but the person doesn't know what to search there

#

isnt it like umm guild.change or something i also forgot lol

fair rose
#

rip

slate swan
#

haha since most people use it for nuking

#

thats why the docs are here for ppl to read em

#

!tag

#

!tag guild.change

fair rose
#

amogus

slate swan
#

!tag guild

#

🥲

fair rose
#

?

dapper cobalt
unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a “server” in the official Discord UI.

`x == y` Checks if two guilds are equal.

`x != y` Checks if two guilds are not equal.

`hash(x)` Returns the guild’s hash.

`str(x)` Returns the guild’s name.
slate swan
#

🙂

#

@fair rose keyerror can help you with your question

fair rose
#

op

slate swan
#

ohh its guild.edit()

clever wind
#
@client.command(pass_context=True)
async def update_ovr(ctx, member: discord.Member, updated_ovr):
    updated_ovr = int(updated_ovr)
    cursor.execute("SELECT user_ovr FROM main WHERE user_id = (?)",
                   (member.id, ))
    old_ovr_list = cursor.fetchall()
    old_ovr = old_ovr_list[0][0]
    cursor.execute("UPDATE main SET user_elo = (?) WHERE user_id = (?)",
                   (int(updated_ovr), member.id))
    db.commit()
    embed = discord.Embed(
            title=f'Ovr Updated!', description = f'{member.mention}, your OVR has been updated!')
    embed.add_field(name="Before", value = f'{old_ovr}', inline=True)
    embed.add_field(name="Updated", value = f'{updated_ovr}', inline=True)
    await ctx.send(embed = embed)
Ignoring exception in command update_ovr:
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 128, in update_ovr
    old_ovr = old_ovr_list[0][0]
IndexError: list index out of range

i dont get this

dapper cobalt
#

Or old_ovr_list does not have anything in the first list.

#

Try to print old_ovr_list.

clever wind
#
#Update Ovr
@client.command(pass_context=True)
async def update_ovr(ctx, member: discord.Member, updated_ovr):
    updated_ovr = int(updated_ovr)
    cursor.execute("SELECT user_ovr FROM main WHERE user_id = (?)",
                   (member.id, ))
    old_ovr_list = cursor.fetchall()
    
    print(old_ovr_list)
    cursor.execute("UPDATE main SET user_elo = (?) WHERE user_id = (?)",
                   (int(updated_ovr), member.id))

doesnnt do anything

#

@dapper cobalt

dapper cobalt
clever wind
#

aight

slate swan
#

hmm

boreal ravine
#

@clever wind why pass context

slate swan
#

how do i implement slash commands in a discord.py bot

boreal ravine
#

@slate swan use 3rd party libs

slate swan
#

like?

#

dislash

clever wind
slate swan
#

dislash provides buttons context menus slash commands and that other one

atomic onyx
#

Not really discord.py related but for a bot. Wondering if anyone knows how to get the time left until a datetime timestamp has passed?

lime palm
#

hi

clever wind
#

is there a way to get multiple line cmds?

dapper cobalt
visual island
reef trail
#

can someone make me a regex for a specific word

atomic onyx
dapper cobalt
somber musk
#

How can copying a user's Id help with a bot

slate swan
#

it can be used to find the user

somber musk
#

Oh how?

slate swan
#

bot.get_user(the id)

reef trail
#

would this regex work for just looking for the word "halloween" while ignoring caps and like numbers that might replace a letter? Like using 1's for L's and whatever

^halloween$```
slate swan
#

i mean, ignoring caps you need the re.I flag, but no, that wont see numbers as letters, ya gotta make that yourself

reef trail
#

I have no idea how

#

Regex's dont make sense to me at all

#

Can you help me make it?

atomic onyx
slate swan
#

like, just the word halloween or, i mean this isn't really discord bot related, could've ask in #python-discussion

reef trail
#

I mean it is kinda dpy related since im using an on_message event for just this word

dapper cobalt
slate swan
# reef trail would this regex work for just looking for the word "halloween" while ignoring c...

if this is just for a single word, you would use | which means or, such as this,

h(a|4)(l|1)(l|1)(o|0)w(e|3)(e|3)n

this regex basically see if there is 4 or a, and l or 1 etc, which results in hal1ow3en being match

You then can use this in re.search where it will search for this pattern and with re.I as the flag for ignoring case ```py

re.search(r"h(a|4)(l|1)(l|1)(o|0)w(e|3)(e|3)n", "hal1ow3en", re.I)
<re.Match object; span=(0, 9), match='hal1ow3en'>

reef trail
#

yeah i would have never figured that out

#

Thank you stella

#
self.halloween_re = re.compile(r"h(a|4)(l|1)(l|1)(o|0)w(e|3)(e|3)n", re.IGNORECASE)```
 is re.IGNORECASE needed now?
slate swan
#

yea, re.I is just an alias of re.IGNORECASE

reef trail
#

ah cool

#

thanks again

slate swan
#

sure

#

who wanna collab in my bots rewrite?

#

im just starting to rewrite it rn

#

depends what are you trying to rewrite

#

eh, an economy bot

clever wind
#

if someone's nick is [0] ign and i wanna edit the 0 to 5 how would i do that

slate swan
#

im gonna use mongodb

#

for the database

#

sure ill help

#

do you have vscode?

#

go to dm

vale pendant
#

lemme join too

slate swan
#

sup @vale pendant

sage pivot
#

the error?

fair axle
maiden fable
#

No

sage pivot
#

oh

maiden fable
#

only message

fair axle
#

i am dumb don't listen to me

sage pivot
#

lmao ok

maiden fable
#

You get context by await client.get_context(message)

fair axle
#

uhh isn't it message.context

maiden fable
unkempt canyonBOT
#
No way, José.

No documentation found for the requested symbol.

maiden fable
#

See, nothing like that :D

fair axle
#

hmm

maiden fable
#

It is context.message

fair axle
#

ok

maiden fable
#

!d discord.ext.commands.Context.message

unkempt canyonBOT
novel rampart
#

how will my bot get message athour name like this Aamil ᓚᘏᗢ#0419

slate swan
#

if its in a on_message event do message.author.name or msg.author.name depends on what you put

stark bobcat
#

hlo

#

does anyone know a chat bot api or module

somber musk
#

What's a good software too code it on that is not too complicated to figure out

lofty heron
#

hi does anybody know which free platforms i should use to host my bot?

somber musk
#

Are you a begginer?

lofty heron
#

yeee

somber musk
#

@lofty heron

lofty heron
#

i can host on my computer but it's slow enough

#

without running a bot

somber musk
#

Oh ok then use replit just search up python how to make discord bot and click the tutorial about replit

lofty heron
#

i tried replit

somber musk
#

No downloads + 24/7

somber musk
lofty heron
#

hold on lemme show you

#

i'm trying to import a module but it says it doesn't exist

somber musk
#

Use this

#

Super simple tutorial

#

Any help needed, go to the comment sections

lofty heron
#

ok

somber musk
#

Comment section has a lot of help

#

DM me for help

#

If you need

lofty heron
#

ok

stark bobcat
lofty heron
#

how?

#

i did pip install discord-activities in the console but still doesn't work

stark bobcat
#

do it in shell

lofty heron
#

um the shell yeah wrong thing

#

said wrong thing but still doesn't work

stark bobcat
lofty heron
#

yee ik

stark bobcat
#

what does the module do

#

isn't discord together a js module?

lofty heron
#

uh no

#

phttps://pypi.org/project/discord-together/

#

this

lime palm
#

hi

#

TypeError: 'int' object is not iterable

#

whats does it mean

#

can you tell me

#

guys

stark bobcat
#

@lofty heron import is like this from discordTogether import DiscordTogether

lofty heron
#

yeah

stark bobcat
lofty heron
#

i got this for my imports

stark bobcat
#

from discordTogether import DiscordTogether

#

d should be capital

lofty heron
#

oh

#

hmm thonk

stark bobcat
lime palm
#

this is it

fast quest
#

Hi, how to make inventory for a card game

slate swan
#

!e

#

!e phonenumbers

slate swan
#

random.randint(1, 10)
will give 1 random number not couple

#

any good audio filters module for music?

#

idk i use youtubedl its ok

#

but i want more features, like bass boost pitch control and more

#

you could probably search for a music lib on github

lofty heron
#

hi does anybody know how to add a cooldown to a command?

reef shell
lofty heron
#

discord activities

reef shell
unkempt canyonBOT
#

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

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

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

A command can only have a single cooldown.
lofty heron
#

tenks

reef shell
#

use this decorator

lofty heron
#

ok

reef shell
lofty heron
#

no

#

lemme send a pic real quick

reef shell
#

alr

lofty heron
#

@reef shell here

reef shell
#

oh

#

great

lofty heron
#

doesn't look like replit can do it lol

#

the module

reef shell
#

so it does detects user activities?

lofty heron
#

hmm

#

no those are games you can play

reef shell
#

oh

lofty heron
#

hmm idk why it's not working inreplit

heavy folio
#

how do i add a bot ban command?

slate swan
#
@bot.command()
async def ban(ctx):
  ....
#

or client depends on what you set it to

lofty heron
#
@client.command()
async def ping(ctx):
    latency = bot.latency
    await ctx.send(latency)

hmm when i do this the bot returns not a number idk why

#

wait hold on nvm found it

slate swan
#

it should send a number

maiden fable
lofty heron
#

lol changed bot to client

heavy folio
#

not server ban command

slate swan
#

ohh that

#

ive tried to do it before

#

sorta worked

heavy folio
#

wdym

slate swan
#

i worked for a while then it broke

crisp pine
#

why when i try add other pages to this it gives error i am trying to add 7 but it only goes to 3

@client.command()
async def embedpages(ctx):
    page1 = discord.Embed (
        title = 'Page 1/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )
    page2 = discord.Embed (
        title = 'Page 2/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )
    page3 = discord.Embed (
        title = 'Page 3/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )
    
    pages = [page1, page2, page3]

    message = await ctx.send(embed = page1)
    await message.add_reaction('⏮')
    await message.add_reaction('◀')
    await message.add_reaction('▶')
    await message.add_reaction('⏭')

    def check(reaction, user):
        return user == ctx.author

    i = 0
    reaction = None

    while True:
        if str(reaction) == '⏮':
            i = 0
            await message.edit(embed = pages[i])
        elif str(reaction) == '◀':
            if i > 0:
                i -= 1
                await message.edit(embed = pages[i])
        elif str(reaction) == '▶':
            if i < 2:
                i += 1
                await message.edit(embed = pages[i])
        elif str(reaction) == '⏭':
            i = 2
            await message.edit(embed = pages[i])
        
        try:
            reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
            await message.remove_reaction(reaction, user)
        except:
            break

    await message.clear_reactions()```
slate swan
#

das big

crisp pine
slate swan
#

the code is quite big

hasty loom
#

anyone know how i can format this better?

maiden fable
spring flax
spring flax
#

exceeding character limit

maiden fable
spring flax
#

you don't need to be printing the guild object

maiden fable
#

Yes

hasty loom
#

if the output exceeds the char limit it sends in file i think

spring flax
#

you can index which value you want

#

use the name and/or id i guess

slate swan
maiden fable
slate swan
#

true

maiden fable
#

Cz that would make two API calls on every loop (one to fetch and one to send)

solemn ocean
maiden fable
#

?

lime palm
#

hi

#

why its only generating any single number multiples time

#
while (True):
    a = random.randint(1, 40)
    Data.append(a)
    for x in Data:
        if len(Data) == 10:
            break
        else:
            Data.append(a)
    print(Data)
keen talon
#

cause the value of a is constant for one loop

lime palm
#

wdym

boreal ravine
#

How do I return a users custom status?

spring flax
unkempt canyonBOT
#

activity```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.

Note

Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.

Note

A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member.activities "discord.Member.activities").
boreal ravine
#

not the activity

#

the status like "[Python] Do not DM for help - please ask publicly."

spring flax
#

yes i know

spring flax
boreal ravine
#

okay

#

@spring flax thx

crisp pine
#

how can i add a thumbnail tho this?

    page1 = discord.Embed (
        title = 'Santana Introduce Help',
        description = f"",
        colour = 0x2f3136,```
spring flax
unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
crisp pine
#

so where the url goes?
@spring flax

spring flax
crisp pine
spring flax
#

no use the url kwarg

#

kwarg is key word argument

crisp pine
#

i wanna put the guild icon for the thumbnail how i do that?

spring flax
#

then you can use this

#

!d discord.Embed.set_author <-- use the icon_url kwarg.

unkempt canyonBOT
#

set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.

This function returns the class instance to allow for fluent-style chaining.
spring flax
#

and for guild icon

#

!d discord.Guild.icon

unkempt canyonBOT
boreal ravine
stark bobcat
#

hlo

#

when i run my repl in replit

#

it just stops

#

after 1 second

crisp pine
#

prob cause an error

stark bobcat
#

after i click it

stark bobcat
#

nothing on console

crisp pine
#

it shows the error?

boreal ravine
#

@stark bobcat did your code even have client.run?

stark bobcat
spring flax
spring flax
#

!d discord.Guild.icon_url

unkempt canyonBOT
stark bobcat
#

mb sry

spring flax
#

or you can use set_author too

crisp pine
#

yeah but how i add a thumbnail to it its a embed page command

#

so do i do

slate swan
#
@client.command(administrator = True)
async def ticketsetup(ctx):
    guild = ctx.guild
    tick = discord.Embed(title= "KATSA TICKETS!", description = "React with 🎫 to create a ticket!", color = 0x00F3FA)
    tick.set_footer(text="Ticket system created by katsa")
    tick.set_thumbnail(url=ctx.guild.icon_url)
    clos = discord.Embed(title = "Your ticket is being closed", color = discord.Colour.random())
    clos.set_footer(text="Ticket system created by katsa")
    await ctx.send(
        embed = tick,
        components = [
            Button(style = ButtonStyle.blue, label = "🎫")
        ]
      )
      
    while True:
          
          event = await client.wait_for("button_click")
          label = event.component.label

          overwrites = {
        guild.default_role: discord.PermissionOverwrite(read_messages=False),
        guild.me: discord.PermissionOverwrite(read_messages=True),
        event.author: discord.PermissionOverwrite(read_messages=True)
    }

          if label == "🎫":
               channel = await guild.create_text_channel(f"{event.author.name} `s ticket",overwrites = overwrites)
               await event.respond(type = 4, content = f"Your ticket has been created at {channel.mention}")
               clo = discord.Embed(title= "Welcome to katsa tickets!", description = f" Hello {event.author.mention} Support will be with you shortly!", color = discord.Colour.random())
               clo.set_footer(text="To close this ticket click the 🔒")
               await channel.send(
                   embed = clo,
                   components = [
                       
                       Button(style = ButtonStyle.red, label = "🔒"),
                       

                       ]
                    
                   )

               event = await client.wait_for('button_click')
               label = event.component.label

               if label == "🔒":
                    await event.respond(type = 7, embed = clos)
                    await channel.delete()``` please someone help . sometimes it creates the channel in another server
spring flax
crisp pine
#

embed.set_thumbnail(url= f"{ctx.guild_icon}")

#

can that work?

spring flax
#

Guild.icon_url

crisp pine
#

ok lemme try

crisp pine
spring flax
stone palm
spring flax
crisp pine
#

alright

#
embed.set_thumbnail(url= f"{ctx.guild_icon_url}")
        colour = 0x2f3136,```
spring flax
#

comma

slate swan
spring flax
#

i honestly dont believe that

crisp pine
slate swan
crisp pine
spring flax
#
embed=discord.Embed(title=..., description=..., thumbnail=...., color=....)```
crisp pine
#

so how ima put the guild icon if there no f""

#

?

spring flax
#

why do you need an f string?

crisp pine
#

to put the guild icon for the thumbnail ig

spring flax
#

you don't have to use an f string

crisp pine
#

what can i use

spring flax
#

wow i messed it up

ripe cedar
#

Hii

spring flax
#

example = "test"
this: ```py
x = f"{example}"

is the same as ```py
x = example
#

@crisp pine ^

crisp pine
#

lemme try

ripe cedar
#

Helo bro

spring flax
ripe cedar
#

Bro where is project section

crisp pine
#
        thumbnail= f"{ctx.guild.icon_url}",``` 
gives no error but the icon would not show
stark bobcat
#

why error

spring flax
crisp pine
spring flax
#

wdym the icon won't show?

stark bobcat
#
@bot.event 
async def on_message(message):
  if bot.user == message.author:
    return
  if message.channel.id==862612779664015373:
    response = await rs.get_ai_response(message.content)   
    await message.reply(response["message"])

  await bot.process_commands(message)  ```
#

response is a dict

crisp pine
#

the guild icon would not show

spring flax
#

and the code?

#

full embed*

crisp pine
#

lemme send it on my atl cause its long

lyric moat
#

ok here

#
@client.command()
async def embedpages(ctx):
    page1 = discord.Embed (
        title = 'Santana Introduce Help',
        description = f"",
        thumbnail= f"{ctx.guild.icon_url}",
        colour = 0x2f3136,
    )
    page2 = discord.Embed (
        title = 'Page 2/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )
    page3 = discord.Embed (
        title = 'Page 3/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )
    
    pages = [page1, page2, page3]

    message = await ctx.send(embed = page1)
    await message.add_reaction('⏮')
    await message.add_reaction('◀')
    await message.add_reaction('▶')
    await message.add_reaction('⏭')

    def check(reaction, user):
        return user == ctx.author

    i = 0
    reaction = None

    while True:
        if str(reaction) == '⏮':
            i = 0
            await message.edit(embed = pages[i])
        elif str(reaction) == '◀':
            if i > 0:
                i -= 1
                await message.edit(embed = pages[i])
        elif str(reaction) == '▶':
            if i < 2:
                i += 1
                await message.edit(embed = pages[i])
        elif str(reaction) == '⏭':
            i = 2
            await message.edit(embed = pages[i])
        
        try:
            reaction, user = await client.wait_for('reaction_add', timeout = 30.0, check = check)
            await message.remove_reaction(reaction, user)
        except:
            break

    await message.clear_reactions()```
boreal ravine
#

ctx.guild.icon_url whats so hard?

lyric moat
#

i did but it anit working

#
        thumbnail= f"{ctx.guild.icon_url}",

gives error

#

Yes i am @crisp pine

boreal ravine
spring flax
#

!d discord.Embed.set_thumbnail

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
spring flax
#

url

spring flax
boreal ravine
crisp pine
#

ima try remove url

spring flax
boreal ravine
#

show code

#

@crisp pine

crisp pine
#

this gives the error mostly

boreal ravine
#

put the hex code in that

spring flax
#

bruh

boreal ravine
#

or just remove it?

spring flax
#

the parts where i put ... were placeholders

boreal ravine
#

^

spring flax
#

you have to fill it

crisp pine
#

still error

boreal ravine
#

man

spring flax
#

code?

boreal ravine
#

show the full code

crisp pine
#

alright

#
@client.command()
async def onlyus(ctx):
    page1 = embed=discord.Embed(title=..., description="", thumbnail={ctx.guild.icon_url}, color= 0x2f3136)
    )```
boreal ravine
#

u dont need the extra )

crisp pine
#

alright

spring flax
#

you don't need the }

#

or {

#

and if you dont want the kwarg remove it

boreal ravine
spring flax
#

I assume you dont want a title so remove that kwarg

#

and what do you want for description? Nothing?

boreal ravine
#

Also why did you make a variable inside the embed variable u already made

spring flax
#
page1=discord.Embed(description="Description", color= 0x2f3136)
page1.set_thumbnail(url=ctx.guild.icon_url)
spring flax
#

you have to set it

boreal ravine
#

mb

spring flax
#

@crisp pine reading this about embeds would help

boreal ravine
#

mhm

#

rtfm

crisp pine
#

How can i add a footer

#

now?

stiff nexus
#

how do i get the users banner??

slate swan
#

hmmm

slate swan
#

Only in v2.0

boreal ravine
stiff nexus
#

!code

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.

stiff nexus
#

i mean its not making the the codeblock

boreal ravine
stiff nexus
#

see

#

its turning into a codeblock

stark bobcat
#

why i get this error

reef shell
#

response(your var. name) isn't a dict

#

it's a list

stark bobcat
#

oh

#

when i just do message.reply

#

@reef shell

boreal ravine
#

wut did u mean lol

stiff nexus
reef shell
crisp pine
#

i tried

        set_footer = 'Pages 1/5',

but the footer would not show

reef shell
#

the snippet

stiff nexus
stark bobcat
reef shell
boreal ravine
#

e

reef shell
#

of where you defined the response var

boreal ravine
reef shell
#

lol

reef shell
#

they don't even read the docs

crisp pine
#

can i tried and it did not work

boreal ravine
#
embed.set_footer(text='testing', icon_url=ctx.author.avatar_url)
#

try that

crisp pine
#

"embed." does not work

reef shell
#

then you should use embed.set_footer(text= "ur text", icon_url = url_u_want)

boreal ravine
reef shell
#

did you make an instance at the first place tho

boreal ravine
#

he did I think

#

@crisp pine show code

crisp pine
#

alright

reef shell
#

embed = discord.Embed(title = "title blah", description = "des", color = 0x00FF00)

#

like this

crisp pine
#
@client.command()
async def earlycode(ctx):
    page1 = discord.Embed (
        title = 'Title',
        description = "Description,
        embed.set_footer(text='testing', icon_url=ctx.author.avatar_url)
        colour =0x2f3136, 
    )
    page2 = discord.Embed (
        title = 'Page 2/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )
    page3 = discord.Embed (
        title = 'Page 3/3',
        description = 'Description',
        colour = discord.Colour.orange()
    )```
#

btw

#
        embed.set_footer(text='testing', icon_url=ctx.author.avatar_url)

gives error

boreal ravine
#

why not just make single line embeds

crisp pine
#

its page embed

#

thats why

reef shell
#

...

boreal ravine
#
@client.command()
async def earlycode(ctx):
    page1 = discord.Embed(title = 'Title', description = "Description", color=0x2f3136)
    page1.set_footer(text='testing', icon_url=ctx.author.avatar_url)
slate swan
reef shell
boreal ravine
#

also I don't make embeds like that have several lines because it's like confusing for me lmao

stark bobcat
# reef shell the code snippet
import discord
from discord.ext import tasks, commands
from prsaw import RandomStuff
import os
TOKEN = os.getenv("TOKEN")
CHAT_KEY = os.getenv("CHAT_KEY")
 
bot = commands.Bot(command_prefix='-', help_command=None)
rs=RandomStuff(async_mode=True, api_key=CHAT_KEY)

@bot.event
async def on_ready():
  print("Bot ready!")

@bot.event 
async def on_message(message):
  if bot.user == message.author:
    return
  if message.channel.id==862612779664015373:
    response = await rs.get_ai_response(message.content)   
    await message.reply(response("message"))

  await bot.process_commands(message)  

bot.run(TOKEN)```
crisp pine
#

Thanks it worked

boreal ravine
reef shell
slate swan
thick sigil
#

he gets a list of dict

#

so response[0]["message"]

slate swan
#

change the default help command or just make a command with the name help

gritty flame
#

why doesnt invoke without subcommand work

spring flax
jagged root
#

how to send a embed and a image on it.

#

can someone help me with it

slate swan
jagged root
#

thats it?

reef shell
slate swan
#

Yes

jagged root
#

i need to add more things to the code or not?

#

so it works

reef shell
#

!d discord.Embed.set_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
slate swan
#

Other than that no afaik

jagged root
#

how should i create it

reef shell
#

embed = discord.Embed(titile= "title", description = "des", color = 0x00FF00)

jagged root
#

ooh

reef shell
jagged root
fresh granite
#

hi

jagged root
#

like this?

reef shell
#

yup

jagged root
#

testing

reef shell
#

ctx.channel.send tho

jagged root
#

it doesnt work

reef shell
slate swan
#

that is possible

reef shell
#

if it is on_message(message) then message.channel.send

jagged root
slate swan
#

but i have no motivation to help you rn lol

hasty iron
#

subclass commands.HelpCommand

jagged root
hasty iron
forest spear
#

Is there a way to give members a role if they have a custom status? I know member.activity can do it but how do I define the role which bot would give?

hasty iron
#

use Guild.get_role if you have the role id

#

or you could use discord.utils.get if you have the name

forest spear
#

So discord.utils.get(name="role name") correct?

hasty iron
#

no

#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
hasty iron
#

you need an iterable

#

which is the guild's roles

#

!d discord.Guild.roles

unkempt canyonBOT
#

roles```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of the guild’s roles in hierarchy order.

The first element of this list will be the lowest role in the hierarchy.
forest spear
#

Is there any way you can use it in an example please?

hasty iron
#

there are examples in the doc page

forest spear
#

Like discord.utils.get(guild.roles="role name")

forest spear
#

Ah yeah nvm got it

#

Gives me an error guild is not defined

hasty iron
#

define it then

#

you can use bot.get_guild if you have the guild id

forest spear
#

Now it says "NoneType object has no attribute to get_roles"

hasty iron
#

the guild id is wrong

#

or the guild isn't cached

forest spear
#

But the bot is in the guild and I copied it I don't understand

hasty iron
#

can you send the full code

fresh granite
#

guys can someone suggest me some games which i can make useing discord.py

#

???

forest spear
#
    role = discord.utils.get(guild.get_roles, name="yes lol")
    [await member.add_roles(role) for member in client.get_all_members() if 'test lol' in member.activity]```
forest spear
#

It looks unindented but is it

forest spear
#

It is*

hasty iron
#

i told you it takes in an iterable

#

and i sent the doc page which contains examples

forest spear
#

Yeah sorry changed it to guild.roles but still same error

hasty iron
#

are you sure you copied the right id

forest spear
#

Yes

#

It's a new server maybe that's effecting

hasty iron
#

also where are you doing that, inside an event?

forest spear
hasty iron
#

is the bot in that server?

forest spear
hasty iron
forest spear
#

No event just task.loop

hasty iron
#

oh

#

do you have something like

@task.before_loop
async def before_loop():
  await client.wait_until_ready()
#

if you dont, add it and replace task with the name of your task function

fresh granite
#

guys can someone suggest me some games which i can make useing discord.py
???

forest spear
#

No it's this lemme copy and paste the entire thing

fresh granite
boreal ravine
forest spear
#
@tasks.loop(seconds=120)
async def check_activity():
    guild = client.get_guild(883990864026796063)
    role = discord.utils.get(guild.roles, name="yes lol")
    [await member.add_roles(role) for member in client.get_all_members() if 'test lol' in member.activity]

check_activity.start() 
fresh granite
boreal ravine
#

eh

hasty iron
#

make chess

forest spear
fresh granite
#

yo can someone tell me

#

please

hasty iron
#

it should work now

forest spear
#

Still same error tho

hasty iron
#

where did you put it

#

make sure its before the start

forest spear
#

It gave me another error that discord.ext.tasks has no attribute to check_activity_loop

#

Should I just change this to an event

hasty iron
#

subclass commands.HelpCommand

forest spear
# hasty iron show code
@tasks.check_activity_loop(seconds=120)
async def check_activity_loop():
    guild = client.get_guild(883990864026796063)
    role = discord.utils.get(guild.roles, name="yes lol")
    [await member.add_roles(role) for member in client.get_all_members() if 'test lol' in member.activity]

check_activity_loop.start()```
hasty iron
#

what

#

i didnt tell you to do that??

forest spear
#

Oh yeah I'm just dumb

boreal ravine
fresh granite
#

guys can someone suggest me some games which i can make useing discord.py

forest spear
#

Gives no error but doesn't add the role too also changed it to event

hasty iron
#

it does

#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=0, minutes=0, hours=0, count=None, reconnect=True, loop=None)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/stable/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
boreal ravine
#

are you mad?

#

@fresh granite do you wanna make games using python or discord.python?

fresh granite
hasty iron
#

no

boreal ravine
#

No, it's just a gist about help commands

hasty iron
#

for slash commands you'll have to make it yourself

boreal ravine
#

use dislash

stiff nexus
boreal ravine
forest spear
#
@client.event
async def check_activity():
    guild = client.get_guild(883990864026796063)
    role = discord.utils.get(guild.roles, name="yes lol")
    [await member.add_roles(role) for member in client.get_all_members() if 'test lol' in member.activity]```
stiff nexus
#

thx

hasty iron
#

why did you change it to an event??

boreal ravine
#

Yes that works too

languid jungle
forest spear
hasty iron
#

check_activity is not a valid event

#

ofc it wont work

craggy cloak
#

This is my error

hasty iron
#

install git

craggy cloak
#

pip install git?

hasty iron
fresh granite
craggy cloak
hasty iron
#

yes

#

if moderation is inside that new folder then yes

dawn lion
#

How do I make a user verification. I need to return an error if there is already such a table with the same name, and if not, create it, how can this be done

#

How do I make a user verification. I need to return an error if there is already such a table with the same name, and if not, create it, how can this be done?

boreal ravine
#

Bruh

#

No spamming please

dawn lion
#

Sorry

#

yes

#

in*

#

sqlite3

#

no

forest spear
dawn lion
#
@commands.command()
    @commands.cooldown(1, 3, commands.BucketType.user)
    async def create_mods(self, username, password):

        conn = sqlite3.connect('moderators_check.db')
        cur = conn.cursor()

        if cur.execute(f"""SELECT * FROM {username};""")

        cur.execute(f"""CREATE TABLE {username}(
            password TEXT""")

        cur.execute(f"""INSERT INTO {username}(password) VALUES('{password}')""")
        conn.commit()

        cur.execute(f"""SELECT * FROM {username};""")
        password = cur.fetchone()
hasty iron
#

oh no

dawn lion
#

No, this work

hasty iron
#

sql injection

dawn lion
#

What?

hasty iron
#

Do not:
cursor.execute("SELECT * FROM table_name WHERE value = {}".format('peepeepoopoo'))
Do:
cursor.execute("SELECT * FROM table_name WHERE value = ?", ('peepeepoopoo',))

Consider: if a command accepts user input, and they input True; DROP TABLE table_name- The resultant query with format is:
SELECT * FROM table_name WHERE value = True; DROP TABLE table_name which has obvious results.
Utilizing your SQL library's sanitization methods prepares the statement and exclusively inserts the values, without editing the query.
Note postgresql uses $1, $2, ... for value substitution, mysql, %s, so make sure you know your DB!
https://xkcd.com/327

slate swan
dawn lion
#

what

hasty iron
#

google what an "sql injection" is

slate swan
#

This will kill your whole database, atleast one table

hasty iron
#

and read what i sent

forest spear
dawn lion
#

okay

slate swan
#

what is check_activity?

dawn lion
#

But still how do I check if this table exists with this name

forest spear
#

Check_activity

slate swan
#

C is capital here, python is case sensitive

forest spear
forest spear
slate swan
#

share your code

forest spear
#
@check_activity.before_loop
async def before_loop():
    await client.wait_until_ready()

@task.loop(seconds=120)
async def check_activity():
    guild = client.get_guild(883990864026796063)
    role = discord.utils.get(guild.roles, name="yes lol")
    [await member.add_roles(role) for member in client.get_all_members() if 'test lol' in member.activity]
check_activity.start()```
lament mesa
forest spear
#

Now it shows @task.loop isn't defined

slate swan
#

tasks.loop

forest spear
lament mesa
#

try str(member.activity)

forest spear
lament mesa
#

👍

forest spear
#

One last question is there a way to add an else statement and remove the role if member doesn't have the custom status anymore?

lament mesa
gritty flame
#

im working on modmail

#

i have a list of guild ids

#

how would i make something like

#

guild1 = x
guild2 = x

hasty iron
#

sql?

gritty flame
#

what

hasty iron
#

are you using sql

gritty flame
#

no im using a dict

hasty iron
#

ok, then store guild ids inside that dict?

gritty flame
#

what i have so far

hasty iron
#

then what is your question?

gritty flame
#

this is where im confused

#

i want them to choose from reactions like

#

if they choose x it will send it to the guilds modmail channel

hasty iron
#

why are you casting it to a list

gritty flame
#

dk

hasty iron
#

doing if message.guild.id in ... works

gritty flame
#

both

#

work

hasty iron
#

and why are you checking it twice

#

casting to a list is slower

vagrant brook
#

What's the point of checking if something is None after you have used it

gritty flame
#

ok ok

hasty iron
#

oh right

hasty iron
#

you are using message.guild.id and the checking if message.guild is None

gritty flame
#

im checking if its a fucking dm channel

hasty iron
#

???

void dew
#

I need help. I have a levelling system. It just gives my level. Whenever someone else pings anyone then the bot shows what I set in except Exception or KeyError but if I don't ping anyone it shows my level

gritty flame
hasty iron
#

message.guild inside a dm is None

#

you are using message.guild.id

#

it will throw an error

gritty flame
#

where bruh

void dew
#

Like when I ping someone to see their level then it shows that your request failed but it shows the authors level if the author doesn't ping anyone

gritty flame
hasty iron
gritty flame
#

bruhhh

#

whereee is guild.idd

#

wtf

#

oh

#

ohoh oh im dumb

#

@hasty iron sorry removed it

dawn lion
#
Command raised an exception: OperationalError: near "<": syntax error

CODE:

sql_test = '''CREATE TABLE {}(password)'''.format(us)

        cur.execute(sql_test)

WHY? and how correct

#

Help me

lone aurora
#

is there any documentary on how i could make all msgs in a specific channel embedded?

steady flume
#

when a member has created a ticket, he can close it, and then everything will be ok, but if someone else closes the ticket, well, for example, an admin, then this error is displayed

#

pls help

dawn lion
#
Command raised an exception: OperationalError: near "<": syntax error

CODE:

sql_test = '''CREATE TABLE {}(password)'''.format(us)

        cur.execute(sql_test)

WHY? and how correct

lone aurora
#

adios im too dumb for this

steady flume
#

or any another language

lone aurora
#

no

gritty flame
lone aurora
#

aight i got it

#

its too much for my brain

shy schooner
#

can i use sqlite instead of postgresql for my dsc bot database?

void dew
#

Stop blaming me

boreal ravine
#

geno helped

void dew
boreal ravine
#

check TCA again

shy schooner
kindred epoch
spark dragon
#

So I have a problem

#

when I for example ban someone with my boy

#

bot

#

the reason only is one word in the audit log

#

Even when I write like 5 word reasons

slate swan
#

show code

spark dragon
#

Hang kn

#

On

#

There

#

Ohhh

#

thanks

#

will test it

slate swan
#

yeah add the astric

spark dragon
#

Will test

#

brb

#

Thank you

slate swan
#

Anyone knows what to do? I've tried to run my discord.py bot today, but I for some reason I'm receiving error (described below), I made some research but the only thing that I found is that the token is invalid, but it's not. I tried to run it on multiple bots, regenerating tokens and it didn't help (most of people that had this issue had it even after they did what I did so) but I didn't find a solution.

Error: https://pastebin.com/3THmD25w
Code:

import discord
import random
import json
import time
import os

from discord.ext import commands, tasks

client = commands.Bot(command_prefix = "$", help_command = None)

@client.event
async def on_ready():    
    print("Bot is Ready")

client.run("<token>")
boreal ravine
#

@slate swan Try to regenerate your token and run it

slate swan
#

I also tried to use another bot (like another app)

boreal ravine
#

Are u sure u ran ur token and not "<token>" ?

slate swan
boreal ravine
#

o

fast quest
#
     await open_account(ctx.author)
     users = await get_inv_data()
     user = ctx.author
     global photo_url

     option_genshin = ['Albedo', 'Lisa', 'Aloy','Barbara', 'Beidou', 'Bennett', 'Chongyun', 'Diluc', 'Diona', 'Eula', 'Ganyu', 'Hutao', 'Jean', 'Kazuha', 'Kaeya', 'Ayaka', 'Keqing', 'Klee', 'Sara', 'Mona', 'Ningguang', 'Noelle', 'Qiqi', 'Baal', 'Razor', 'Rosaria', 'Sayu', 'Sucrose', 'Tartaglia', 'Lumine', 'Aether', 'Venti', 'Xiangling', 'Xiao', 'Xingqiu', 'Xinyan', 'Yanfei', 'Zhongli', 'Amber']
     roll_genshin = random.choice(option_genshin)
     users[str(user.id)]= defaultdict(list)
     
     users[str(user.id)]["Genshin Cards"].append(roll_genshin)
     
     
     
     with open("inv.json","w") as f:
        json.dump(users,f)
     
     embed = discord.Embed(
        title="\n",
        description= f'You rolled a {roll_genshin}',
        color=discord.Color.red())
     embed.set_footer(text="Genshin Card rolled by: {}".format(ctx.author.display_name))
     embed.set_author(name="Genshin Imapct", 
       icon_url = "https://media.discordapp.net/attachments/883776600460648479/883792924037484595/download_7.jpeg")
     embed.set_image(url=photo_url[roll_genshin])
     await ctx.message.reply(embed=embed)```
#

while i do the inventory function, it only shows the recent roll, not all,pls help

#

pls help 😦

fast quest
vestal owl
#

How do I get my bot on those discord bot websites?

slate swan
#

Anyone knows what to do? I've tried to run my discord.py bot today, but I for some reason I'm receiving error (described below), I made some research but the only thing that I found is that the token is invalid, but it's not. I tried to run it on multiple bots, regenerating tokens and it didn't help (most of people that had this issue had it even after they did what I did so) but I didn't find a solution.

Error: https://pastebin.com/3THmD25w
Code:

import discord
import random
import json
import time
import os

from discord.ext import commands, tasks

client = commands.Bot(command_prefix = "$", help_command = None)

@client.event
async def on_ready():    
    print("Bot is Ready")

client.run("<token>")
hasty iron
#

discord.errors.LoginFailure: Improper token has been passed.

slate swan
#

maybe sure the token is correct

vestal owl
#

go to the 'bot' page on the developer portal

#

and then go to the token and regenerate it

slate swan
#

Yeah it's correct, y'all reading what I said?

vestal owl
#

and just re paste it inside the client.run() function

slate swan
#

😳

#

The token is correct.

#

It works with another bot

#

But no clue why it doesn't work with this one

hasty iron
#

is it a selfbot

graceful gulch
waxen granite
#

for msgs before the boot , old msgs. works fine for recent msgs

hasty iron
#

why are you doing msg = await applicationchannel.fetch_message(id)

#

you already have a message object

#

also the bot can't see old messages

#

iirc the message converter pulls from cache only, let me check

#

ok no it doesnt

void mortar
#

bot.help_command.show_hidden=False is not working for commands.HelpCommand, can anyone help me with that please

#

i wanna hide some commands but its not working

hasty iron
#

it doesnt show hidden by default

waxen granite
hasty iron
#

im saying that its pointless, you already have a message object

waxen granite
#

yes ik but the error keeps popping

waxen granite
void mortar
slate swan
#

are you the owner of the bot?

tough wagon
#

Is there any way to fetch command cooldown?

tough wagon
#

then how?

spring flax
tough wagon
#

uhm, yes

#

im using @commands.cooldown(0, 10, BucketType.user)

spring flax
#

get a command object, let's say you put a variable x as the command object, then you would do

x._buckets._cooldown.per```
tough wagon
#

or smthing like this

spring flax
#

Get the command using this

#

!d discord.ext.commands.Bot.get_command

unkempt canyonBOT
#

get_command(name)```
Get a [`Command`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") from the internal list of commands.

This could also be used as a way to get aliases.

The name could be fully qualified (e.g. `'foo bar'`) will get the subcommand `bar` of the group command `foo`. If a subcommand is not found then `None` is returned just as usual.
tough wagon
#

I have a command, but how to get it's cooldown?

#

not command

spring flax
#

i just said above.

tough wagon
#

<commands.Command>._buckets._cooldown.per

#

like that?

#

ok, lemme try..

spring flax
tough wagon
#

oof I can't send an image

#

bug

#
print('here')
print(command._buckets._cooldown.per)
print('here2')```
#

prints only 'here'

spring flax
#

which command do you want to print cooldown of

tough wagon
#

what user said

#

omfg discrod bug

#

im making HelpCommand

spring flax
#

so ctx.command?

tough wagon
#

async def send_command_help(self, command):

spring flax
#

error?

tough wagon
#

no, but i have an error handler

#

well, i will delete it

spring flax
#

show the error handler

tough wagon
#
    async def on_help_command_error(self, ctx, error):
        emb = Embed(
            title="Something went wrong!",
            description="`Error found, if you are sure that this error"
                        "not caused by you, and must be fixed, - inform my dev`",
            color=Color.red(),
            timestamp=ctx.message.created_at
        )
        emb.set_author(name=ctx.author, icon_url=ctx.author.avatar.url)
        emb.set_thumbnail(url=ctx.bot.user.avatar.url)
        emb.set_footer(text="Help command error.", icon_url=ctx.bot.user.avatar.url)
        if isinstance(error, CommandInvokeError):
            return
        emb.add_field(name="Help command raised an error", value=f"'''{error}'''")
        await ctx.send(embed=emb)```
spring flax
#

okay remove that yeah

tough wagon
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'per'
#

uh, this command has no cooldown

hasty iron
#

the command probably doesn't have a cooldown

tough wagon
#

@spring flax thanks it's working

visual island
#

no

#

it's required (discord's limitation)

spring flax
#

it can't be empty

#

can use an invisible char

#

huh

#

ss?

visual island
#

They probably uses title and description

slate swan
#

!e raw_reaction_add

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'raw_reaction_add' is not defined
slate swan
#

!e raw reaction add

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     raw reaction add
003 |         ^
004 | SyntaxError: invalid syntax
slate swan
#

?

visual island
slate swan
#

!e 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/stable/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/stable/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'on_raw_reaction_add' is not defined
slate swan
visual island
#

it's a description?

vagrant brook
#

!d discord.Embed.set_author

unkempt canyonBOT
#

set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.

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

!raw json 884078219890941982

unkempt canyonBOT
#
== Raw embeds (1/1) ==

{'description': '`​`​`​py\n'
                '\n'
                'set_author(*, name, url=Embed.Empty, '
                'icon_url=Embed.Empty)`​`​`​\n'
                'Sets the author for the embed content.\n'
                '\n'
                'This function returns the class instance to allow for '
                'fluent-style chaining.',
 'title': 'discord.Embed.set\\_author',
 'type': 'rich',
 'url': 'https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.set_author'}
slate swan
#

title also supports urls?

visual island
#

sure

still kernel
#

So I made a withdraw command for a discord bot, and the error message for not entering an amount works, but the actual withdraw command and the error messages for withdrawing invalid amounts doesn't work. I am following a tutorial and I did everything the tutorial said, and repl.it isn't citing any reasons for why this isn't working. Are there errors in this code that I don't see?

@client.command()
async def withdraw(ctx, amount = None):
  await open_account(ctx.author)

  if amount == None:
    await ctx.send("Enter the amount stupid")
    return
    
  bal = await update_bank(ctx.author)

  amount = int(amount)
  if amount>bal[1]:
    await ctx.send("You don't have enough funny points")
    return
  if amount<0:
    await ctx.send("The amount must be positive, dumbass")
    return

  await update_bank(ctx.author, amount)
  await update_bank(ctx.author, -1*amount, "bank")

  await ctx.send(f"You withdrew {amount} funny points!") 
sweet pilot
#

doesn't the message deleting of a bot have a audit log event?

#

when I check for an event where my bot delete a message, the audit log has none

#

how to solve this issue

pliant gulch
#

Audit logs for deleting messages only appear when someone who isn't the author of the message deletes the message

#

If I deleted my own message it wouldn't go to the audit logs. And if someone else deleted my message it would

sweet pilot
plucky goblet
#

how does the * in adding a command work ?

pliant gulch
slate swan
#

If I'm running a task every 5 mins and it takes 10 secs to complete, something like ```py
@tasks.loop(minutes=5)
async def foo():
await asyncio.sleep(10)

The docs says that "`.stop()` waits for the current iteration to be completed".
Which is this iteration, the 5 mins one or the 10 secs one?
#

I need it like, if there's 2 minutes left for the next loop to be called, I need to wait for 2 mins, but I guess this cancels that notlikeblob

pliant gulch
#

It waits for the logic inside of the task to finish

#

then it stops

manic wing
#

that is the current iteration

slate swan
#

Ah I see, any way to make it wait for the next iteration to occur? Or atleast some fallback function to call when it gets stopped?

#

when is after_loop called? After every 5 mins or just after the cancellation of task?

hasty iron
#

after the cancellation iirc

slate swan
#

That'll work then. Thanks

sweet pilot
#

why is that happening

#

is that auditlog event different for bots?

round yarrow
#
import discord
import random
from random import choice
from discord.ext import commands
from keep_alive import keep_alive
import os
import aiohttp
import asyncio
from discord.ext.commands import CommandNotFound

bot = commands.Bot(command_prefix="^")
@bot.event
async def on_ready():
  print(f"{bot.user} is now ready!")
  await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=("Test bot to delete old server")


@bot.command()
async def delchannelsSERIOUSCMND(ctx):
  for c in ctx.guild.channels:
    await c.delete()
#

syntax error ^^^

#

checked every bracket...

polar dirge
#

i have an embed like

description=':emoji: text\n   :2emoji: 2text'```
and it is supposed to look like

:emoji: text
   :2emoji: 2text

but it looks like 

:emoji: text
:2emoji: 2text
slate swan
#

How do I fix this error?

asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "users_pkey"```
kindred epoch
valid niche
#

very very bad

slate swan
#

Hey, anyone knows a way how to fetch likes, follows and followers from tiktok? Like I'd select username and I'd receive amount of likes, follows and followers. I don't know which api should I use or where to request. Thanks for any help!

unkempt canyonBOT
#

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

slate swan
#

How does it break laws

#

LMAO

valid niche
boreal ravine
#

@slate swan Whats funny?

valid niche
#

wait for works like an event like @bot.event, just once in this case and not multiple times

boreal ravine
#

He's telling the truth.

slate swan
#

iq users.