#discord-bots

1 messages · Page 741 of 1

slate swan
#

use a fork like disnake

#

which has slash commands

green bluff
#

so the only way i can create ephermal messages r through buttonsa

slate swan
#

!pypi disnake

unkempt canyonBOT
green bluff
#

oh so i can?

slate swan
#

so yes buttons and slash commands and i think drop downs as well

green bluff
#

yea so can i make it with disnake

slate swan
#

yeah

green bluff
#

and can ephermal messages contain buttons

slate swan
#

no

#

you can send a ephemeral msg on a interaction so on a button press yes you can send a msg

green bluff
#

so when i do a / command

#

an ephermal message pops up and it contains its own buttons for other ephermal messages is that allowed

slate swan
#

yes its possible

green bluff
#

yeah good

#

is there a tutorial on how to use disnake

#

cause i cant rlly find one rn

slate swan
#

for buttons and slash commands the git repo has it

green bluff
#

oh okay so i just search up tutorial on disnake

slate swan
green bluff
#

oh so in async def u write everything u want in the function

#

async def autocomplete(
inter: disnake.CommandInteraction,
language: str = commands.Param(autocomplete=autocomplete_langs),
):

slate swan
#

its just like a command yes but with different arg and a different decorator

#

and youll have to add application commands to your bot perms

green bluff
#

my bot has admin

#

or is it in dev portal

#

application commands

slate swan
#

in the dev portal

#

yes

green bluff
#

oh ok then

slate swan
#

and is it for a plublic bot?

green bluff
#

nope private

slate swan
#

because global slash commands take 1day iirc to register in all guilds if its private use the test_guilds kwarg and add the guild id or guilds

#

!d disnake.ext.commands.Bot

unkempt canyonBOT
#

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

This class is a subclass of [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") and as a result anything that you can do with a [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.GroupMixin "disnake.ext.commands.GroupMixin") to provide the functionality to manage commands.
slate swan
#

should be there

#

its in options but just press the link and youll see the kwarg

green bluff
#

should i do pip install disnake

slate swan
green bluff
#

disnake is installed but

slate swan
#

restart your vsc

green bluff
#

ok nice

slate swan
green bluff
#

find and replace?

slate swan
#

yes in your vsc

green bluff
#

wdym rewrite

slate swan
#

like change all the keywords discord to disnake

green bluff
#

wait i have to do that

slate swan
#

to not do it manually just use find and replace which is in the edit tab in vsc

slate swan
green bluff
#

im not making all of my commands / commands

#

im just making one a / command

slate swan
#

if its

discord.Embed()

in disnake its

disnake.Embed()

that easy

#

in everything btw

green bluff
#

oh so do i even have to do that with commands that do not use disnake

slate swan
#

What is my Trouble?

slate swan
green bluff
#

@slate swan do i have to change it to disnake in this command

#

which doesnt use disnake

slate swan
#

no ofc not

green bluff
#

oh okay

#

so no rewrite

#

just add disnake to the new / commands

slate swan
#

ok wait

hoary cargo
#

you will need to rewrite it for some parts though

green bluff
#

like?

slate swan
#

if the slash command will be in the same file or bot as that command yes

green bluff
#

i have to rewrite all of the command

#

*S

slate swan
#

just change discord to disnake and your done

green bluff
#

oh ok

#

how do i change all of them at the same time

slate swan
#

i gave an example

hoary cargo
slate swan
#

find and replace

green bluff
#

how

slate swan
green bluff
hoary cargo
#

PopcornPepe today imma switch to disnake too ig, i hate rewritting over 10k lines of code

green bluff
#

done changed it

#

that was easier than i thought it was

hard trail
#

I still need assistance with this. All methods given to me didn't work

hoary cargo
# slate swan use find and replace smh😠

yeah but i don't have the message intent, so i will need to switch to full slash commands + buttons, better rewrite it from the ground than replacing stuff here and there, but ofc, mostly it will be kinda copy paste but in a new fashion kek

green bluff
#

ok so i did what u said

#

now can i create a command

#

using /

slate swan
#

all my bots are unverified so idrc about slash commandspithink

green bluff
#

im just doing it for the ephermal messages lol

slate swan
green bluff
#

yes

slate swan
green bluff
#

so can i just do it

hoary cargo
slate swan
#

i hate when i get ignoredpithink

green bluff
#

can i send ephermal messages just like this

green bluff
#

or do i have to do like interaction.response

slate swan
#

slash commands dont have context

#

they have interactions

#

READ THE GITHUB EXAMPLE I GAVE

green bluff
#

SORRT

slate swan
green bluff
#

which ONE THERE ARE like 5 different files

slate swan
hoary cargo
#

too much spoonfeeding already WhenS6SeesMikeGqScore

green bluff
#

i do not know what converters injecting n stuff means BRUH I HAVE NO CLUE WHATS HAPPENING

slate swan
slate swan
hoary cargo
#

gonna become rich with your idea thank you

slate swan
green bluff
#

bruh

slate swan
# green bluff bruh

here a basic command

@bot.slash_command()
async def greet(interaction: disnake.CommandInteraction):
    await interaction.send("hello", ephemeral=True)
#

cant spoonfeed you morepithink

green bluff
#

i agree

green bluff
#

ok finally some doc to read

slate swan
#

i gaved you examples lemon_pika

green bluff
#

yea that basic command was a good exampl

slate swan
green bluff
#

but the dcument u gave me with words written everywhere

slate swan
green bluff
#

@hoary cargo one was good aswell

hoary cargo
green bluff
#

i mean its just one page to follow

hoary cargo
#

simple and on point ez

slate swan
hoary cargo
slate swan
#

nope

#

i only give the best examples aka the most complicated onespithink

hoary cargo
#

i don't agree sadgebye

slate swan
hoary cargo
#

what's the point in giving an example if the person who needs it don't understand nothing from it Hmm

green bluff
#

can i do @commands.has_permissions(manage_messages=True)

#

for the slash command

slate swan
slate swan
#

since its a slash command

green bluff
#

ok nice

slate swan
green bluff
hoary cargo
green bluff
#

omg thats so cool now i could mute people without doing !mute and no-one would even know

slate swan
#

coolpithink

hoary cargo
#

StareW they will know though

hoary cargo
#

if you really want to mute without no one knowing about, just use the timeout thing

slate swan
#

or use a private channel😱

hoary cargo
#

AYS_pepebigbrain fair

green bluff
#

wait to use buttons do i need to download discord.ui or something

slate swan
#

!d disnake.ui.View

unkempt canyonBOT
#

class disnake.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
slate swan
#

you just need to subclass View

green bluff
green bluff
#

lol

slate swan
green bluff
#

and for other stuff

#

like retrieve userinfo

#

anything that i want done in secret

slate swan
#

thats just creepy🚶

green bluff
#

no its not

slate swan
#

yes it is🏃

green bluff
#

ok

#

but what else would u use only you can see this for

slate swan
#

like timeouts and bans and others

green bluff
#

just use audit log

slate swan
#

no

green bluff
#

yes

slate swan
green bluff
#

bruh

slate swan
#

you said it yourself

#

¯_(ツ)_/¯

green bluff
#

thats probably why everyone invented !mute

#

i mean someone*

slate swan
#

¯_(ツ)_/¯

hoary cargo
#

inter in disnake is basicaly ctx in dpy AShmm

hoary cargo
#

wdym no, they act as context

slate swan
#

interaction is the interaction of the command and ctx is the context of the command

hoary cargo
#

first 2 minutes into disnake, all good until now

slate swan
#

why

hoary cargo
#

wdym why, why it should be bad

slate swan
#

wdym by until now

hoary cargo
#

because basically it's a new library apart from dpy, meaning it still has some particularities even if it's a fork, since i will code mainly slash, buttons and stuff, it's new thing to learn

final iron
#

getch is a pretty nice feature of disnake

slate swan
#

only new things are buttons, slash commands, dropdowns and timeout and more which arent that hard to learn

#

maybe buttons can be difficult and dropdowns the others are easy

hoary cargo
slate swan
hoary cargo
slate swan
#

!d disnake.ext.commands.Bot.getch_user

unkempt canyonBOT
#

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

Tries to get the user from the cache. If fails, it tries to fetch the user from the API.
slate swan
#

what does getch do?

Tries to get the obj from the cache. If fails, it tries to fetch the obj from the API

vague grove
#

let's say someone does a command with a file attached to it, is there a way for me to potentially download that?

#

or view the contents of it

#

(file as in like a txt or an exe)

magic ore
#

!d discord.Message.attachments

unkempt canyonBOT
magic ore
#

!d discord.ext.commands.Context.message

unkempt canyonBOT
slate swan
#

hey guys,i need help(

#

with?

#

wait pls

unkempt canyonBOT
slate swan
#

!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.

slate swan
#

use the pasting service or the format option

#

My code is 11K characters ...

#

any error?

#

wait

#

its just a syntax error?

#

maybe (, but I don't understand where to fix it (

#

whats your version of dpy?

slate swan
slate swan
hoary cargo
#

Coding on the phone damn sadgebye sadgebye

slate swan
#

i think it was in 2.0 which is avater.url not sure

slate swan
slate swan
#

iirc

slate swan
#

a... wait

#

in another file

hoary cargo
slate swan
#

🚶

#

yes yes ... I'm stupid, don't judge strictly ..

hoary cargo
#

That's phone coding for you

slate swan
slate swan
slate swan
hoary cargo
slate swan
slate swan
slate swan
#

what?

#

alright

slate swan
slate swan
#

yeah dpy 1.7.3 is avatar_url

hoary cargo
somber crown
#

say a user has 2 mutual guilds with a bot, but is not in the guild the command is ran in. if i were to do (prefix)userinfo (user id of user not in this guild but shares mutuals with the bot), how can i have the bot get the user information from any of the mutual guilds (preferably one they are boosting, if any)? ive already constructed a way to tell if a user is a member or user, not exactly sure how id put that to work however in this instance

green bluff
#

hello

hoary cargo
#

Or just discord

green bluff
#

so ive created an on_message command but my other commands arent running

hoary cargo
slate swan
somber crown
slate swan
slate swan
hoary cargo
green bluff
#

so ive created an on_message command but my other commands arent running

green bluff
slate swan
slate swan
somber crown
hoary cargo
slate swan
somber crown
#

would i use a for loop?

slate swan
#

just get the guild

green bluff
#

@hoary cargo on message delete word basically banned words

slate swan
#

!d discord.ext.commands.Bot.get_guild

unkempt canyonBOT
slate swan
green bluff
slate swan
#

@slate swan pls accept invite friends(

#

sorry i mostly dont accept friend requests :((

slate swan
#

i'm send my code( as a file, I just don't think I can handle ((I ask you for help (

green bluff
#

and what r you trying to acheive by doing this

slate swan
slate swan
slate swan
hoary cargo
#

sadgebye this chat so confusing

slate swan
hoary cargo
#

Don't say it

slate swan
#

🚶

#

@slate swan


@client.command()
async def reg(ctx, id:int = None):
    if id is None or id < 1000000000 or id > 999999999:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: Используйте команду в формате {prefix}reg [ID].\nP.S. ID должен состоять из 8 символов.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
    elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() is None and c.execute(f"SELECT idd FROM faceit WHERE idd = {id}").fetchone() is None:
        c.execute(f"INSERT INTO faceit VALUES ({ctx.author.id}, {id}, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)")
        conn.commit()
        guild = client.get_guild()
        tolvl = guild.get_role(930244338481520640)
        try:
            await ctx.author.add_roles(tolvl)
        except:
            pass
        embed = discord.Embed(title='Вы успешно зарегистрировались!', color = 0xfffafa, description=f'Ваш ID в игре Standoff 2 - {id}.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed = embed)
    elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() != None:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: Вы уже зарегистрированы под ID - {c.execute(f"SELECT idd FROM faceit WHERE id = {ctx.author.id}").fetchone()[0]}'
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
    elif c.execute(f"SELECT idd FROM faceit5 WHERE idd = {id}").fetchone() != None:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: На данный ID уже зарегистрирован пользователь {client.get_user(c.execute(f"SELECT id FROM faceit WHERE idd = {id}").fetchone()[0])}.\nЕсли этот ID принадлежит вам, то сообщите в администрацию.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @green bluff until <t:1641863245:f> (9 minutes and 59 seconds) (reason: discord_emojis rule: sent 42 emojis in 10s).

slate swan
daring olive
#

!unmute 735757517765869589

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @green bluff.

green bluff
#

ok sorry never knew that was rule

daring olive
#

easy on the emotes

#

lol yeah

#

i also got muted once

slate swan
hoary cargo
#

Damn

green bluff
#

ah i see

slate swan
green bluff
#

@slate swan why do u always use pithink

slate swan
#

@slate swan well, what is there (?

hoary cargo
slate swan
slate swan
slate swan
slate swan
hoary cargo
#

But why the bot would say a banned word though

slate swan
slate swan
slate swan
slate swan
slate swan
#

like in the file of the bot

hoary cargo
#

Check line 183 I guess Suschamp

slate swan
#

maybe theres something wrong above it

slate swan
slate swan
#

does your editor underline syntax errors?

#

no. Unfortunately

#

ic

#

let me see it again

green bluff
#

help?

slate swan
#

your saying if list in message

final iron
slate swan
green bluff
#

nope

slate swan
#

@slate swan

green bluff
#

but how do i send message

slate swan
#

then why do it?

final iron
#

You need a special attribute to see the content (wink wink) of a message

green bluff
slate swan
#

cause of your pfp

#

btw no offense

final iron
#

sus

slate swan
#

🚶

lime gazelle
#

hi

final iron
#

Nah im fine

green bluff
slate swan
green bluff
#

what do i do now

slate swan
slate swan
final iron
slate swan
green bluff
#

how do i send the message

lime gazelle
#

see

final iron
lime gazelle
#

@lime gazelle

#

i can ping myself

green bluff
#

LMAO I THOUGHT OKIMII SENT IT

slate swan
green bluff
#

what type of name is that

lime gazelle
#

my name is pingable right?

final iron
slate swan
lime gazelle
#

a canary

#

Isnt that a head accesory

slate swan
#

they can still ban you with your id lol

lime gazelle
#

duck

green bluff
#

@slate swan can i do message.sned

#

send

slate swan
lime gazelle
#

technically, it isnt invisible

final iron
lime gazelle
#

its a bunch of question marks

slate swan
#

<@&831776746206265384> ^nick name

final iron
#

Theres no point arguing about this

lime gazelle
slate swan
#

!ot

unkempt canyonBOT
lime gazelle
#

it not invisible

slate swan
#

keep it ot please

lime gazelle
#

Its question marks in boxes

final iron
blissful lagoon
#

!superstar 742545653028225035

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied superstar to @lime gazelle until <t:1641867237:f> (59 minutes and 59 seconds).

#
Superstarified!

Your previous nickname, ᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼᲼, was so bad that we have decided to change it. Your new nickname will be Adele.

You will be unable to change your nickname until <t:1641867237:f>. If you're confused by this, please read our official nickname policy.

blissful lagoon
#

please change it to something visible

lime gazelle
#

yay im adele guys

#

Im a greaaat singer

lime gazelle
slate swan
lime gazelle
#

its a bunch of question marks

final iron
slate swan
lime gazelle
#

pls dont say i have to change my pfp now

blissful lagoon
#

it renders differently on different platforms, we can continue in a @novel apex if you have further questions

hoary cargo
slate swan
slate swan
slate swan
final iron
#

@slate swan Can you send the code?

lime gazelle
#

I cant change my nickname

#

into a name

#

bro

final iron
#

Read this

slate swan
unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
lime gazelle
#

Bro im not going to make it invisible, according to you

slate swan
lime gazelle
#

:/

final iron
#

So, the new timeout feature, what does it do?

lime gazelle
#

It is kind of like this

#

so

#

Its just a mute for an amount of time basically

slate swan
slate swan
#

!d disnake.Member.timeout

unkempt canyonBOT
#

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

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
final iron
#

Thank you

slate swan
#

disnake has it already

final iron
#

Disnake on top

slate swan
#

ofcpithink

hoary cargo
#

We will see

slate swan
#

¯_(ツ)_/¯

#

Hikari noises

#

🏃

final iron
#

How would I allow the user to input minutes and hours instead of seconds in a timeout command?

slate swan
#

1 will do 1min

slate swan
# final iron <@456226577798135808> Can you send the code?
@client.command()
async def reg(ctx, id:int = None):
    if id is None or id < 1000000000 or id > 999999999:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: Используйте команду в формате {prefix}reg [ID].\nP.S. ID должен состоять из 8 символов.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
    elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() is None and c.execute(f"SELECT idd FROM faceit WHERE idd = {id}").fetchone() is None:
        c.execute(f"INSERT INTO faceit VALUES ({ctx.author.id}, {id}, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)")
        conn.commit()
        guild = client.get_guild()
        tolvl = guild.get_role(930244338481520640)
        try:
            await ctx.author.add_roles(tolvl)
        except:
            pass
        embed = discord.Embed(title='Вы успешно зарегистрировались!', color = 0xfffafa, description=f'Ваш ID в игре Standoff 2 - {id}.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed = embed)
    elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() != None:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: Вы уже зарегистрированы под ID - {c.execute(f"SELECT idd FROM faceit WHERE id = {ctx.author.id}").fetchone()[0]}'
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
    elif c.execute(f"SELECT idd FROM faceit5 WHERE idd = {id}").fetchone() != None:
        embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: На данный ID уже зарегистрирован пользователь {client.get_user(c.execute(f"SELECT id FROM faceit WHERE idd = {id}").fetchone()[0])}.\nЕсли этот ID принадлежит вам, то сообщите в администрацию.')
        embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
        await ctx.send(embed=embed)
        try:
            await reg.reset_cooldown(ctx)
        except:
            pass
#

?

#

and please dont say that :))

hoary cargo
quaint epoch
slate swan
#

yes

final iron
slate swan
#

nice(

slate swan
green bluff
#

this command stops my other commands

slate swan
#

or use if arg.endswith("")

#

commands do not react at all to functions ((

quaint epoch
# green bluff

at the end do py await client.process_commands(message)

slate swan
final iron
quaint epoch
slate swan
green bluff
#

how

slate swan
#

🚶

final iron
#

I know how to use split

#

!d split

unkempt canyonBOT
#

On a CV splitter (not an estimator), this method accepts parameters (X, y, groups), where all may be optional, and returns an iterator over (train_idx, test_idx) pairs. Each of {train,test}_idx is a 1d integer array, with values from 0 from X.shape[0] - 1 of any length, such that no values appear in both some train_idx and its corresponding test_idx.

slate swan
#

no

pliant gulch
#

!d str.split

unkempt canyonBOT
#

str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).

If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.

For example:
slate swan
#

that

quaint epoch
#

how

final iron
#

Anyway I know how to use split

quaint epoch
#

!d str.split

slate swan
quaint epoch
#

listeners never worked for me

final iron
hoary cargo
final iron
#

I like code that isn't buggy

slate swan
green bluff
final iron
green bluff
#

regex

#

?

final iron
#

Yes

slate swan
final iron
#

Regular expressions

green bluff
#

ok can u give me like a repo on that or something

final iron
green bluff
#

ok

final iron
#

There are tons of guides everywhere

quaint epoch
final iron
#

Maybe I should just not make moderation commands

green bluff
#

oh nice

quaint epoch
green bluff
#

but i want to try make my own lol thats the only reason i am asking help

final iron
slate swan
#

no spoonfeedingpithink

green bluff
#

there r tons of bots like censor bot and stuff but i want to make mine custom

final iron
#

Spoonfeeding yert

green bluff
final iron
#

Conversion is hard

slate swan
final iron
#

I'm just not going to do moderation commands

green bluff
#

can u atleast give me an article that makes sense

final iron
#

Not sure if its good

hoary cargo
quaint epoch
#

essentially, create a big set of swears, create a copy of the message by py test = message.contentand run it through filters, like any(i in test for in set_with_swears)

final iron
#

Regex is superior

slate swan
hoary cargo
final iron
#

I haven't even tried to learn it

#

My brain

slate swan
#

you have a whole module for regular expressions use it

quaint epoch
#

i also ran mine through filters that changed words and characters incase users did smth like f*&k

slate swan
#

me not knowing regex: 🏃

final iron
quaint epoch
slate swan
#

@slate swan my full code to github

hoary cargo
#

i hate regex but it's useful

slate swan
final iron
#

I can also hard code a help command, whats your point?

slate swan
final iron
slate swan
#

stop

final iron
slate swan
final iron
#

Interesting

slate swan
#

this repository private

#

is it a private repo?

#

LMAO called it

#

@final iron have you subclassed the bot classlemon_pika

slate swan
final iron
#

I am avoiding it

slate swan
#

its pretty easy

final iron
#

I'm making trivia commands

slate swan
# final iron I'm making trivia commands

isnt this beautiful?

import disnake
from disnake.ext import commands
from disnake import Intents

import os
import datetime

from riashidden import TOKEN

class Rias(commands.Bot):
    def __init__(self) -> None:
        super().__init__(
            command_prefix=commands.when_mentioned,
            intents=disnake.Intents.all(),
            help_command=None,
            status=disnake.Status.online,
            activity=disnake.Game(name="!help")
            )

    def setup(self) -> None:
        for filename in os.listdir("C:/Users/okimii/Downloads/rias/cogs")
            if filename.endswith("py"):
                self.load_extension(f"cogs.{filename[:-3]}")


    def run(self) -> None:
        self.setup()
        super().run(TOKEN, reconnect=True)

    async def on_ready(self) -> None:
        print("Rias is online")

    async def on_command_error(self, ctx, error):
        embed = disnake.Embed(
            title="Command Error",
            description=f"``{error}``",
            color=0xffffff,
            timestamp=datetime.datetime.utcnow()
            )

        await ctx.send(emebd=embed)
hoary cargo
#

No

final iron
slate swan
final iron
#

🏃

slate swan
final iron
#

Can you like explain

slate swan
#

sure

final iron
#

Can I literally just put the events in there without the decorator?

slate swan
#

yes

final iron
#

How would I put a check

slate swan
#

but no

slate swan
#

use a cog 🧠

final iron
#

For events?

slate swan
#

be smort and use a cog smh🧠

final iron
#

So just shove all my events in to a cog?

slate swan
#

sureyert

final iron
#

Yes sir!

slate swan
final iron
slate swan
#

i can see it

#
@client.event
async def on_ready():
    print(f"[SYSTEM] Start working {time.asctime()} |\n[SYSTEM] Bot online!                            |\n[SYSTEM] Name - {client.user}                           |\n[SYSTEM] ID - {client.user.id}                |\n[SYSTEM] Bot working!                           |\n-------------------------------------------------")  
    while True:
        await client.change_presence(status = discord.Status.dnd, activity = discord.Game('Elite Ranked'))
        await asyncio.sleep(15)
        await client.change_presence(status=discord.Status.dnd, activity=discord.Activity(name='за своим создателем Vinki', type=discord.ActivityType.watching))
        await asyncio.sleep(15)
qiwicheck.start()

what is this🧍‍♂️

#

you want to get limited from discords api or something🧍‍♂️

slate swan
slate swan
#

oh

#

this full+ code

green bluff
#

so all the commands work fine

#

except this one

#

it doesnt send the embed

#

it just clears the messages

slate swan
#

thats what i doespithink

final iron
#

It should be working

green bluff
#

ik but its not

#

working

final iron
#

Remove the delete_after kwarg

green bluff
#

thanks it works

#

also what does a kwarg even mean

final iron
unkempt canyonBOT
#

*args and **kwargs

These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.

Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.

Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.

Use cases
Decorators (see !tags decorators)
Inheritance (overriding methods)
Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
Flexibility (writing functions that behave like dict() or print())

See !tags positional-keyword for information about positional and keyword arguments

slate swan
final iron
#

Just subclassing

slate swan
#

🏃

final iron
#

🧍‍♂️

slate swan
#

read now🚶

final iron
#

Fine

#

Okay also

#

How would I add a global check

#

In a cog

green bluff
slate swan
#

how is a global check done im not sure

green bluff
#

why cant python be simple

final iron
#

@slate swan dont give answer

slate swan
slate swan
final iron
slate swan
unkempt canyonBOT
#

add_check(func, *, call_once=False)```
Adds a global check to the bot.

This is the non-decorator interface to [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.check "discord.ext.commands.Bot.check") and [`check_once()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.check_once "discord.ext.commands.Bot.check_once").
green bluff
final iron
slate swan
slate swan
# green bluff

message is a object. To get it's content use message.content

final iron
green bluff
#

oh ok

slate swan
#

Oh , you want a check for a single cog?

slate swan
slate swan
#

@bot.check()

final iron
#

🏃

slate swan
final iron
#

Where would I add it

slate swan
#

super().__init__()
in the init you add all the kwargs you would use in the constructor

#

make sense?

final iron
#

No

slate swan
final iron
#

Wait so do I do the add_check in my main file?

slate swan
#

inside the __init__ just self.add_check(your function)

#

add_check method takes an function as argument

#

subclassing is so lovely and easypithink

final iron
#

This is hard

slate swan
#

your intentions is to add a check on all bot commands right?

final iron
#

Correct

slate swan
#

Yea so the add_check thing will work

final iron
#

So in my cog's init statement add self.add_check(my_function())?

slate swan
#

its a dunder/magic method

final iron
#

...

slate swan
#

Why in the cog?

final iron
#

Because I don't know what I'm doing

slate swan
#

good point

#

you'll be doing it inside the bot's class

#

Or , if you really want to do it inside the cog , I'm sure you would have passed bot to your cog's __init__ , just do bot.add_check from there

#

no

#

i think hes trying to subclass Bot

hoary cargo
#

FiaWTF subclass this subclass that just let the dude learn on its own

final iron
slate swan
final iron
#

Because before, I just did the check in my bots init statement

slate swan
#

🚪🚶

final iron
#

I was told nesting functions is bad practice or smth

hoary cargo
slate swan
final iron
#

Alright it functions

#

Thanks pithink

hoary cargo
#

FiaWTF you will need to ask what da dog doin soon before he eats your ass

slate swan
#

i see no dog in your house

#

🧍‍♂️

hoary cargo
final iron
#

Bro I follow pep8 I swear

#

🙏

slate swan
final iron
hoary cargo
slate swan
#

:3

final iron
#

I removed it

#

:trol:

hoary cargo
#

pepesensei now solve the peps

slate swan
#

lol

final iron
#

Its literally my command description

hoary cargo
#

Just break it down to 2 lines instead of one long ass stuff

final iron
#

No

#

How does wait_for work?

#

Does it just wait until it finds a message satisfying the check?

#

hehe

slate swan
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

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

always forget commands

slate swan
#

waits for a event

final iron
#

Thats what I meant

#

If it a message event

slate swan
#

use the check kwarg

final iron
#

I know...

#

I'm making a trivia command

slate swan
#

then wdym

glass quarry
#

im trying to make a banned words command and if i say one word but if i say something then the banned word or the banned word thens something it doesnt work

#

@client.event
async def on_message(message):
if message.content in banned_words:
embed = disnake.Embed(title="Inappropriate language", description=f"{message.author.name} said {message.content} in {message.channel.name}")
await message.author.send(embed=embed)
channel = client.get_channel(928380965787676804)
await channel.send(embed=embed)
await message.delete()
await client.process_commands(message)

final iron
#

And I want my bot to search through what people say for the correct answer

green bluff
#
async def on_message(message):
    if message.content in banned_words:
        embed = disnake.Embed(title="Inappropriate language", description=f"{message.author.name} said **{message.content}** in ```{message.channel.name}```")
        await message.author.send(embed=embed)
        channel = client.get_channel(928380965787676804)
        await channel.send(embed=embed)
        await message.delete()
    await client.process_commands(message)```
#

like this

slate swan
#

welp im going to play some games laterpithink🚶

green bluff
#
@client.event
async def on_message(message):
    if message.content in banned_words:
        embed = disnake.Embed(title="Inappropriate language", description=f"{message.author.name} said **{message.content}** in {message.channel.name}")
        await message.author.send(embed=embed)
        channel = client.get_channel(928380965787676804)
        await channel.send(embed=embed)
        await message.delete()
    await client.process_commands(message)
      ```
green bluff
#

pls help

#

i can bypass banned word by doing

hoary cargo
#

Damn
Everyone wants to do banned word stuff

final iron
#

Use regex

green bluff
#

by adding a letter

slate swan
green bluff
#

ok

slate swan
hoary cargo
#

People be like use regex but they also don't know regex

slate swan
#

🏃

final iron
slate swan
#

not me ofc🏃

final iron
#

🏃

hoary cargo
slate swan
final iron
#

Lets go

slate swan
slate swan
hoary cargo
final iron
slate swan
hoary cargo
final iron
slate swan
hoary cargo
slate swan
#

bye guyspithink

hoary cargo
#

sadgebye goodbye

final iron
#

Chat gonna die now

hoary cargo
#

Chat gonna return to dust pepesensei

glass quarry
#

does anyone know how to make it so that the banned words will be triggered no matter if its upper case or lower case

unkempt canyonBOT
#
Nope.

No documentation found for the requested symbol.

final iron
#

Heh

#

Autocorrect

#

I stg

#

!d str.lower

unkempt canyonBOT
#

str.lower()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) converted to lowercase.

The lowercasing algorithm used is described in section 3.13 of the Unicode Standard.
final iron
#

Finally

glass quarry
#

so where do i put in in my code

#

@client.event
async def on_message(message):
if any(word in banned_words for word in message.content.split()):
embed = disnake.Embed(title="Inappropriate language", description=f"{message.author.name} said {message.content} in {message.channel.name}")
await message.author.send(embed=embed)
channel = client.get_channel(928380965787676804)
await channel.send(embed=embed)
await message.delete()
await client.process_commands(message)

final iron
#

You would make the message.content lowercase

glass quarry
#

how

final iron
#

Have you learnt python yet?

glass quarry
#

a bit

final iron
#

mmm

jade tartan
#

Can someone help with something real quick

final iron
#

You would create a variable

jade tartan
#

please

final iron
#

i.e var = message.content.lower()

#

@glass quarry

glass quarry
#

thx

final iron
jade tartan
#

ok well am trying to make a discord bot dashboard for my server and am having trouble with it

slate swan
final iron
jade tartan
slate swan
final iron
jade tartan
#

ok

jade tartan
#

I have a server as in ip address where it will take me to login to discord

#

but unfortnately after i login

#

this is what i recieve

#

Does that make sense?

final iron
#

Can't someone log in to your server?

#

Cause you showed everything?

jade tartan
#

well no they cant

slate swan
#

pretty sure its a local thing

final iron
#

As this has nothing to do with discord bots

soft lynx
#

how can i fix this error?

#

the error is specifically occurring here

final iron
#

!d disnake.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://docs.disnake.dev/en/latest/api.html#disnake.Role "disnake.Role")s.

You must have the [`manage_roles`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_roles "disnake.Permissions.manage_roles") permission to use this, and the added [`Role`](https://docs.disnake.dev/en/latest/api.html#disnake.Role "disnake.Role")s must appear lower in the list of roles than the highest role of the member.
final iron
#

Alright so not 100% sure but I think country1 is None

#

Can you print it?

soft lynx
slate swan
#

How would i write this:

final iron
#

this:

soft lynx
final iron
#

There you go pithink

soft lynx
#

i can try printing country1

final iron
#

Try

slate swan
#

if not (message.author has higher role than 'staff'):
soft lynx
#

also i know i didnt need to use a f string for that

#

@final iron it prints None as you suggested

#

why is that, though?

soft lynx
#

i set the country value equal to something

slate swan
#

if not (message.author has higher role than 'staff'):
final iron
#

!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/master/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...
final iron
#

It should work

soft lynx
#

thats odd, because using slash commands, only values that match the attributes can be passed

final iron
#

But I never use utils.get so idk

soft lynx
#

what do you use?

final iron
#

I have no situations like that

#

Where I need to fetch a role object by name

#

Only thing I could think of is that country isnt a role

#

Can you verify there are no spelling mistakes?

#

And iirc its case sensitive

soft lynx
#

yeah, its typed correctly

final iron
#

hmm

#

It should work

#

Maybe it has something to do with slash commands

#

I don't use them either

soft lynx
#

o

frank tartan
#

how can i delete my message? Like when i run !ping, how can i make it so the bot deletes that message?

final iron
#

Use the delete_after kwarg in the send() function

frank tartan
final iron
#

Then its ctx.message.delete()

frank tartan
#

kk

final iron
#

Spoonfeeding at its finest

glad thicket
#

Hey can anyone help

#

me

final iron
#

Fetch the channel

glad thicket
#

my bot was running yesterday with the threading server

#

so uptimerbot could ping it

final iron
#

!d discord.ext.commands.Bot.fetch_channel

unkempt canyonBOT
#

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

Retrieves a [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel"), [`abc.PrivateChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.PrivateChannel "discord.abc.PrivateChannel"), or [`Thread`](https://discordpy.readthedocs.io/en/master/api.html#discord.Thread "discord.Thread") with the specified ID.

Note

This method is an API call. For general usage, consider [`get_channel()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_channel "discord.ext.commands.Bot.get_channel") instead.

New in version 1.2.
glad thicket
#

now it doesn't work

#

Hey @final iron

#

can you help me

#

My bot is online but the bot is unresponsive

#

yesterday everything worked

slate swan
#

if not (message.author has higher role than 'staff'):
#

Or would I have to list every single role's ID above Staff?

final iron
#

!d discord.Member.roles

unkempt canyonBOT
#

property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.

These roles are sorted by their position in the role hierarchy.
final iron
#

Note: These roles are sorted by their position in the role hierarchy.

#

!d discord.Guild.roles

unkempt canyonBOT
#

property roles: List[discord.role.Role]```
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.
final iron
#

Note: Returns a list of the guild’s roles in hierarchy order.

#

Maybe you can do something with that

#

But its probably a bad idea

slate swan
final iron
pliant gulch
#

You can just use top_role

#

!d discord.Member.top_role

unkempt canyonBOT
#

property top_role: Role```
Returns the member’s highest role.

This is useful for figuring where a member stands in the role hierarchy chain.
pliant gulch
#

You then would compare the roles position to the staffs role position

#

!d discord.Role.position

unkempt canyonBOT
#

The position of the role. This number is usually positive. The bottom role has a position of 0.

Warning

Multiple roles can have the same position number. As a consequence of this, comparing via role position is prone to subtle bugs if checking for role hierarchy. The recommended and correct way to compare for roles in the hierarchy is using the comparison operators on the role objects themselves.

final iron
#

I knew it was a bad idea

slate swan
#

Hello!

#

if not message.author.bot:
        if (('help' in message.content.lower() or 'assist' in message.content.lower() or 'aid' in message.content.lower() or 'assistance' in message.content.lower()) and (message.channel.id == 892880535918096405 or message.channel.id == 892880558751879208 or message.channel.id == 892877273311641622 or message.channel == 899846459405533235 or message.channel.id == discord.ChannelType.private)):
#

How do i check if the message.channel is in DMS with the bot?

unique tendon
#
async def verify(ctx):
    await ctx.message.delete() # deletes the message the author sent
    if str(ctx.guild.id) in verify_roles:
        verify_role = ctx.guild.get_role(verify_roles.get(str(guild.id)))
        # check if the role is not in the author's current roles
        if verify_role not in ctx.author.roles:
            await ctx.author.add_roles(verify_role)
            await ctx.send("You have been verified!")
        else:
            await ctx.send(f"You already have {verify_role.name}")```
#

I found this code online for a verification code im and I want to add, where am I supposed to put the ID or name of the role?

#

Can someone help?

slate swan
#

The role ID as integer, not string.

#
....get_role("585529568383860737") # Won't work
....get_role(585529568383860737) # Will work
unique tendon
#
@client.command()
@commands.has_permissions(kick_members=True)
async def verify(self, ctx, member: discord.Member, *, reason=None):
        guild = ctx.guild
        TrialStaff = discord.utils.get(guild.roles, name="Trial Staff")

        if not TrialStaff:
            mutedRole = await guild.create_role(name="Trial Staff")
            await ctx.send("New role created!")

            for channel in guild.channels:
                await channel.set_permissions(mutedRole, speak=False, send_messages=False, add_reactions=False, view_channel=True)
        else:
            await member.add_roles(mutedRole, reason=reason)

        await ctx.send(f"Verified {member.mention} for reason : {reason}. Welcome to the Staff team!")
        await member.send(f"**Congratulations! You are now a Trial Staff member in {guild.name}.**")
@verify.error
async def verify_error(self, ctx, error):
        if isinstance(error, commands.MissingRequiredArgument):
            await ctx.send('mention someone.')
        elif isinstance(error, commands.BadArgument):
            await ctx.send('member not found')
        elif isinstance(error, commands.MissingPermissions):
            await ctx.send('You do not have the required permissions!')
        else:
            raise error
#

@slate swan whats this error

grim oar
#

Nice bear

unique tendon
grim oar
#

Remove self from verify_error

unique tendon
#

Okay

#

@grim oar

#

Now this is showing

#

@slate swan

#

Can u help?

grim oar
#

Remove self from verify too

unique tendon
#

It works now ty

grim oar
#

np

slate swan
#

its ctx.message.content.lower() and it will always say its wrong

#

You're checking if Captcha is in a lowered string. It will never be true.

#

^

#

Either remove .lower() or check with captcha.

#

and why the member var no need for it

#

and no need for return

#

since nothing else will happen i suppose

spring flax
#

does dpy v2 have app commands?

slate swan
#

@unique tendon set the nick kwarg to None and use on msg so you can store ids in a list or a db and if the id is in the list remove it

slate swan
spring flax
#

also, why does my bot.get_emoji(id) not embed an emoji? it just shows :checmark: instead

#

what is the code?

#

what is ctx.content?

slate swan
#

wont work

spring flax
#

ctx doesn't have an attribute of content

#

and?

#

what are you even trying to do?

#

how's that even going to work

slate swan
#

your doing this

user: !verify
bot: Type Captcha to get verified!

and it would be done should wait for a msg

slate swan
#

i love getting ignored

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

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

dont really know why that order

#

your checking the content when the user probably doesnt know what to do?

#

first make the command give instructions and then wait for captcha

tiny ibex
#

Is there a way for a non-onwer to use jsk

slate swan
tiny ibex
slate swan
#

¯_(ツ)_/¯

tiny ibex
slate swan
#

You should have a random letter combination as captha

#

that aswell

#

How to make a cooldown

slate swan
slate swan
slate swan
#

you can have multiple owners tho....

slate swan
slate swan
unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/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/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

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

A command can only have a single cooldown.
slate swan
#

where do I type @discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)

vale wing
#

You decorate the command with it

vale wing
#
@bot.command()
@commands.cooldown(1, 15, commands.BucketType.user)
async def cmd(...)```
For example
vale wing
vale wing
slate swan
#

not preference but you get what i mean

slate swan
vale wing
#

I don't think it's necessary since it's not keyword-only argument

slate swan
slate swan
slate swan
vale wing
slate swan
vale wing
slate swan
#

lmao

slate swan
slate swan
vale wing
#

Ah so you meant for example

slate swan
vale wing
#

OMG

slate swan
vale wing
#

No way you are doing it like that

#

Don't

slate swan
vale wing
slate swan
#

and why are you doing it like that

slate swan
#

was outdated

#

really outdated

vale wing
#

Maybe because there's weird quickstart in docs

vale wing
slate swan
#

probably a yt tutorial

vale wing
#

Not probably, it is totally wrong

#

You shouldn't make commands like this

slate swan
#

crazy how it doesnt have the pass_context kwarg pithink

#

not a song bot

#

ok?

vale wing
#

It doesn't matter, just check that tutorial, it is for every bot

#

You make commands like

@bot.command()
async def cmd(ctx):
   ...```
(for cogs it's a bit different)
#

Not put the content check into on_message

slate swan
#

yeah and mostly dont name your bot constructor clientpithink

slate swan
#

🧍‍♂️

#

But you use client = ...Bot()

tender estuary
#

the "Bot" is never used in my code

slate swan
#

Then you don't have commnads.

slate swan
tender estuary
#

You sure about that

slate swan
#

Client doesn't support commands