#discord-bots

1 messages ยท Page 731 of 1

cold sonnet
#

fetch the message

brazen raft
#

And make sure it doesn't fail to do so

cold sonnet
#

try to fetch the message

#

if it's None, it failed

#

it doesn't exist

brazen raft
#

Pretty sure all fetch_ methods raise an exception when what they're supposed to be fetching doesn't exist

oblique adder
#

do i need to use try except or is there a method which return none ?

#

if there is none

cold sonnet
#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

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

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
brazen raft
#

And it's a coroutine

cold sonnet
#

raises NotFound

#

you have to use try except

oblique adder
#

try:
except discord.NotFound ?

#

ok thx

grim oar
#

!d inspect.getfullargspec

unkempt canyonBOT
#

inspect.getfullargspec(func)```
Get the names and default values of a Python functionโ€™s parameters. A [named tuple](https://docs.python.org/3/glossary.html#term-named-tuple) is returned:

`FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)`
oblique adder
#

I saved channel_id and message_id in an database and I wanted to use add reaction to start a task. I want to be able to still use it after I close and run the script. I know I can use on_raw_reaction_add and check the message id but is there a alternative way to do this without on_raw_reaction_add ?

potent spear
oblique adder
#

similar but no I am making a music bot

#

I want to press on any reaction and it will do what I want it to do. But if i use something like menus ? if I close the script it will broke right ? I want it to check if someone have added a reaction but without raw_reaction_add

potent spear
#

how long do you want these "buttons" to work?

oblique adder
#

forever

oblique adder
#

I dont want to take risk of server going down and broke this in every server

brazen raft
#

What

potent spear
# oblique adder forever

is that the only message in that channel? because else, I'd be hard to find once people type under it

brazen raft
#

Oh you mean the one hosting your bot

oblique adder
#

any other message auto delete

potent spear
oblique adder
potent spear
oblique adder
#

yes

potent spear
#

they can only "request" music in that channel?

oblique adder
#

the first one who request/admins perm will be the dj

#

they will be the one able to use the reaction

#

but any other can request song

potent spear
#

why would this break, you think?
the bot will just have to refresh that message in the db... since it's not playing anything anymore ofc

#

you just need a startup task which loads everything back in (the asked music etc)
unless you just say "fuck it, whenever the bot restarts, the music gets deleted"
the buttons will still work fine if you use an event AND store the messageID's in your db...

oblique adder
potent spear
oblique adder
#

just asking

#

there might be easier and more efficiennt way

potent spear
#

there is, but what you mentioned is the most efficient way...

#

just store everything in a musicCog, so you can organize it...

oblique adder
#

Hmm so I should use on_raw_reaction_add only right as it is the most efficient way

slate swan
#

buttons arent that hard lol

#

its just subclassing View

oblique adder
slate swan
#

just update the view with new buttons lol

oblique adder
slate swan
#

Edit the message with a new view.

#

^

#

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

Or use the interaction event.

oblique adder
#

ok ok I think I got a rough idea I should get working. thx all

slate swan
#

!d disnake.on_interaction

unkempt canyonBOT
#

disnake.on_interaction(interaction)```
Called when an interaction happened.

This currently happens due to application command invocations or components being used.

Warning

This is a low level function that is not generally meant to be used.

New in version 2.0.
slate swan
#

If you're using disnake, which is recommended.

#

And it's an event, just like on_raw_reaction_add

#
await interaction.edit_original_message(view=self)

something like this

oblique adder
#

ok ok thx

slate swan
#

yw

#

theres examples in disnake git btw

spring flax
#
default_value = inspect.getfullargspec(error.param)```
raises ```py
    await Missing_Args(ctx, error)
  File "c:\Users\tenuk\Desktop\Coding\bot_2\Error_Embeds.py", line 11, in Missing_Args
    default_value = inspect.getfullargspec(error.param)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\inspect.py", line 1171, in getfullargspec        
    raise TypeError('unsupported callable') from ex
TypeError: unsupported callable```
tiny ibex
#

How to colour the text

slate swan
slate swan
tiny ibex
slate swan
#

It's for file difference

tiny ibex
#

And how many of these colours exist??

slate swan
#

Therefore the name

#

plus is green and red is negative right

#

It's based on programming languages and other things, you can't choose the language you want.

tiny ibex
slate swan
#

There are very limited colors since they are code blocks.

#

ahhh ic

tiny ibex
slate swan
#

Yes it is

#

its a codeblock ofc it is

tiny ibex
slate swan
#

No

tiny ibex
#

If in an embed

#

Oops

slate swan
#

is it a programming language?

tiny ibex
slate swan
#

since its in a code block

#

You can put some orange I think

#
# Orange maybe?
tiny ibex
#

???

tiny ibex
slate swan
#
[ Blue? ]
#
+ green
- red
# orange
tiny ibex
slate swan
#

yo thats cool

#

For orange it's not diff, but cs

slate swan
#

And for blue it's not diff, but ini

#

ic

#
Some Yellow?
tiny ibex
#
[ Is it blue? ]```
#

Cool

tiny ibex
slate swan
#

ml

tiny ibex
#

Hella cool

slate swan
#

That's pretty much all I know, maybe you can find more on internet

tiny ibex
#

I'll try to

slate swan
#

Will go back at coding some stuff, see you around sh_anidance

#

cya

maiden fable
slate swan
#

Meta Language

#

the colorspithink

#

Pretty much all I know, maybe there are more.

tiny ibex
slate swan
#

But haven't seen any other colors

slate swan
#

feel free to bm guys

slate swan
maiden fable
#

@spring flax u fixed the error?

honest vessel
#
disnake/client.py", line 515, in _run_event
    await coro(*args, **kwargs)
TypeError: on_member_join() takes 1 positional argument but 2 were given

``` huh?
maiden fable
maiden fable
#

Ah cool

honest vessel
#

    @commands.Cog.listener("on_member_join")
    async def on_member_join(member : disnake.Member):
honest vessel
#

yeah i realised that ๐Ÿ™‚

#

thanks tho

oblique adder
#
if payload.emoji in ["โฏ","โญ","โน","๐Ÿ”‚","๐Ÿ”","๐Ÿ”ˆ","๐Ÿ”Š","๐Ÿ”‡"]:```

why doesnt this get executed when i use one of the emoji in the array ?
honest vessel
#

how i change discord.py ```py
@tasks.loop(seconds=120)
async def service(self):

#

aparently wasnt easy as just do from disnake.ext import task, commands

#

aparently no task

slate swan
#

It's tasks

#

!d disnake.ext.tasks.loop

unkempt canyonBOT
#

disnake.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://docs.disnake.dev/en/latest/ext/tasks/index.html#disnake.ext.tasks.Loop "disnake.ext.tasks.Loop").
ruby flame
#

Wtf is disnake

slate swan
#

!pypi disnake

unkempt canyonBOT
ruby flame
slate swan
ruby flame
#

cool

#

do you still code it the same way as discord.py or?

#

what has changed?

slate swan
#

There is a list of change logs.

slate swan
#

But since it's a discord.py fork there is almost nothing to change.

#

disnake will be the best fork trust me

ruby flame
slate swan
#

Besides replacing all discord imports and usages to disnake

#

#we love Equenos

ruby flame
slate swan
#

!d discord on_kick

unkempt canyonBOT
#

To work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

slate swan
#

how do i check if a member in the on_member_remove was kicked?

#

Use the audit logs.

#

!d discord.Guild.audit_logs

unkempt canyonBOT
#

async for ... in audit_logs(*, limit=100, before=None, after=None, oldest_first=None, user=None, action=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the guildโ€™s audit logs.

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

Examples

Getting the first 100 entries:

```py
async for entry in guild.audit_logs(limit=100):
    print(f'{entry.user} did {entry.action} to {entry.target}')
```...
slate swan
#

thank you!

tribal pivot
#

Hello to all. Tell me please. I wrote a music bot and everything works fine, but the sound quality is lame, is there any way to fix it?

slate swan
#

can anyone help me out with the mute command code in python?

#

?

#

pls help someone

hexed turtle
#

hi

slate swan
slate swan
#

!rule 5

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
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
slate swan
#

Music bots breaches the terms and conditions of YouTube.

slate swan
#

wdym by nope

#

Nothing about youtube_dl

#

๐Ÿšถ

slate swan
#

Therefore rule 5 is more accurate since it applies to music bots in general.

slate swan
#

And not just music bots using youtube_dl and similar

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

thnx a lot

#

yw

#

what should I write with the async def? @slate swan

tribal pivot
slate swan
#

like

#

its a coro not a function

#

i mean yeah it is a function

#

not the point

#
async def timeout(????)
#

like in the place of ???? what should I write

potent spear
#

also, the decorator is @client.command()

slate swan
#

kk

#

args?my args?

#

means what?

potent spear
#

that's optional

#

you can just do ctx

#

!timeout will run that command if ! was your prefix

slate swan
#
@bot.command()
async def ban(ctx, member: disnake.Member=None,time: int=None, *, reason=None) -> None:
    if not member:
        return await ctx.send("specify the member")
    await member.timeout(duration=time, reason=reason)

the spoonfeed smh

#

my prefix is %

#

%ban

potent spear
slate swan
#

ya

potent spear
slate swan
#

i just go by what pylance says lol

slate swan
#

and why can i not follow pep 484 lol

#

ya lemme see

potent spear
#

it can be none OR the message object, but ok

slate swan
#

my bot is online

slate swan
#

doesnt any get set as None?

potent spear
slate swan
#

ig not i think it gets set as Any

slate swan
#

if it can return nothing as well?

potent spear
slate swan
#

i just set as none if it can return anything lol

potent spear
#

that would be incorrect then xd

slate swan
#

let me check docs

potent spear
#

but yeah, that doesn't throw errors... it's just to help devs...

slate swan
#

yeah ik

#

ive read pep484

potent spear
#

I only use the typehinting for args and help functions, not commands, since I'll never use whatever they return

pliant gulch
#

None isn't the same as Any

slate swan
#

Using None
When used in a type hint, the expression None is considered equivalent to type(None).

#

smh how did i not see that

exotic kite
#

any cool suggestions for a discord bot?

potent spear
#

do you want to make it useful? implement other API's

exotic kite
#

hmm i wanna make like an arcade bot ig

#

yk like tictactoe, snake, hangman, all in one

solar anchor
#
@bot.command()
async def balance(ctx):
    await open_account(ctx.author)

    user = ctx.author

    users = await get_bank_data()

    wallet_amt = users[str(user.id)]["Wallet"]
    bank_amt = users[str(user.id)]["Bank"]

    em = discord.Embed(title=f"{ctx.author.name}'s balance.", color=discord.Color.teal())
    em.add_field(name="Wallet Balance", value=wallet_amt)
    em.add_field(name="Bank Balance", value=bank_amt)
    await ctx.send(embed=em)```

I copied this code and i dont have errors, i just dont know what to type in doscord, anyone knows?
exotic kite
potent spear
exotic kite
#

put a : after the data

solar anchor
exotic kite
#

dayum

solar anchor
#

i did

#

but idk what to type in doscord to activate it?

exotic kite
#

.

slate swan
#

@potent spear how can i learn more about typing and optional return types?

potent spear
potent spear
# slate swan a bit

Union can be one of 2 datatypes
Union[int, str]
if it were to be like this
Union[None,int]
then that basically is this
Optional[int]

#

the typing lib is full of examples etc

slate swan
#

ah i see so as it says it can be optional and its expecting a int?

exotic kite
#

anyone has python tic tac toe bot code?

potent spear
slate swan
exotic kite
#

!disnake

potent spear
exotic kite
#

help

#

where can i find disnake

potent spear
#

in google

maiden fable
unkempt canyonBOT
fluid spindle
#

Hi, is there a method to restart a loop like we start or stop it with myLoop.start()
Something like... myLoop.restart()

magic ore
#

!d discord.ext.tasks.Loop.restart

unkempt canyonBOT
#

restart(*args, **kwargs)```
A convenience method to restart the internal task.

Note

Due to the way this function works, the task is not returned like [`start()`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop.start "discord.ext.tasks.Loop.start").
slate swan
#

mods pin this please^

slate swan
potent spear
#

better option is to make a command out of it

slate swan
#

.bm

slate swan
potent spear
#

true

slate swan
#

could u include yaml yaml green text
, ```ini
[ini cool blue text]

#

See other pinned messages ^^

#

ah ini is already there

#

Added green, thanks ^^

potent spear
#

I'd prefer you to put this line

This one is special, all words need to start with an upper case.
Under Yellow instead of above Dark Grey
it's confusing

dusky pelican
#

whats the code to check if a user dmed you a certain message

slate swan
#

@tiny ibex ^

dusky pelican
#

ok thanks

slate swan
tiny ibex
#

Tysmn bro

slate swan
#

Back at coding beergopher

potent spear
#

nvm, it's not consistent

slate swan
#

how do you guys know so many jeez

#
xl is default color
tiny ibex
#

.bm

dusky pelican
slate swan
#

no

honest vessel
#

why my slash commands nvr shows up after made a newserver or cant have slash commands now cus bot owner of server?

dusky pelican
#

no? shit me

tiny ibex
cloud dawn
tiny ibex
#

BTW why not make it just like this

@client.command()
@commands.dm_only()โ€Š
async def suggest(ctx):
    #do something ```
stray thistle
#

Yeah making commands with startswith is pretty much not it

cloud dawn
dusky pelican
#

idk im still tryna learn how to do anything

cloud dawn
tiny ibex
cloud dawn
tiny ibex
#

They can just use the decorator....

cloud dawn
#

!d discord.ext.commands.dm_only

unkempt canyonBOT
#

@discord.ext.commands.dm_only()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a DM context. Only private messages are allowed when using the command.

This check raises a special exception, [`PrivateMessageOnly`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.PrivateMessageOnly "discord.ext.commands.PrivateMessageOnly") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

New in version 1.1.
cloud dawn
#

!d discord.ext.commands.PrivateMessageOnly raises this

unkempt canyonBOT
#

exception discord.ext.commands.PrivateMessageOnly(message=None)```
Exception raised when an operation does not work outside of private message contexts.

This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
steady thicket
#

Hi, I've been having this issue when starting the bot. I'm hosting on cubes.host

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

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

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swan
#

guys, ;-; how do I check if anyone is mentioned in a message?

velvet tinsel
slate swan
velvet tinsel
#

google is amazing

slate swan
#

hard luck welp

velvet tinsel
#

pip install?

#

have you tried to pip install it?

slate swan
#

imagine doing that-

velvet tinsel
#

most importantly which IDE are you using, it depends quite a lot

velvet tinsel
#

then do it

#

that's the reason

fluid spindle
#

How can I immediately start a task when the bot comes online?

velvet tinsel
#

without learning python basics

#

๐Ÿ˜ญ

fluid spindle
velvet tinsel
#

do you....understand python basics?

velvet tinsel
#

cool, now pip install it

slate swan
velvet tinsel
#

don't mess with me.

#

or else I will sacrifice you.

fluid spindle
#

My task is a loop, so... yeah

cloud dawn
#

Start your loop in the cog init lol

velvet tinsel
velvet tinsel
velvet tinsel
potent spear
fluid spindle
#

So should I just run the loop in the cog init?

potent spear
slate swan
viral nymph
fluid spindle
#

I've been calling task.loop for a loop called checkTime

#

Sorry if that caused any confusion

#

It's something like this...

@tasks.loop(seconds=1)
async def checkTime(self):
  #Does some stuff...```
slate swan
#

doesnt the decorator get imported with ext?

#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
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/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
slate swan
#

maybe to not import many stuff

#

!args-kwargs @hidden hazel

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
#

people do it not to import everything for faster speeds

#

or less storage iirc

#
from lib import something

your only importing something from the lib

#

in what

#

i dont think thats how it works

#

what lib?

#

so dpy?

#

dpy doesnt have timeout lol

fluid spindle
#

Because I wrote checkTime in another Cog, and I wanted it to run when the bot started, and since there was already an on_ready in the main.py file, I thought I'd just import the checkTime loop to main.py and run it from there...

slate swan
#

any fork tbh

#

i use disnake

#

!pypi disnake

unkempt canyonBOT
slate swan
#

i think their is

#

i mean it is good ofc

#

ยฏ_(ใƒ„)_/ยฏ

#

im not hear to argue either

stray thistle
#

what library should i use to create timeouts commands

slate swan
#

disnake is good

slate swan
stray thistle
#

hmm

slate swan
#

how do I get the channel id on message event?

slate swan
stray thistle
slate swan
slate swan
stray thistle
#

aww

slate swan
slate swan
#

pip install or are they there by default

slate swan
slate swan
stray thistle
#

but it doesn't seem to work for forks

slate swan
#

oof

slate swan
stray thistle
#

lemme try pip install with disnake rq

slate swan
#

I don't need the channel object I need the channel id when someone sends a message

slate swan
honest vessel
slate swan
#

on_message

#

lmfao

#

no context questions arent easy

slate swan
slate swan
slate swan
honest vessel
#

yup

slate swan
#

alright, thanks

#

thats not on msg???????????????

#

are you ok?

#

lol

steady thicket
slate swan
#

thats a command you can clearly see context

honest vessel
#

but if its on the event on_message(message)

slate swan
#

yes

slate swan
slate swan
slate swan
honest vessel
#

@steady thicketyou dont import it

slate swan
#

or docs?

slate swan
#

yes but I saw this

slate swan
steady thicket
#

oh

honest vessel
#

@steady thicket```py
intents = discord.Intents.all()
intents.guilds = True
intents.members = True
intents.presences = True
intents.typing = True

bot = commands.Bot(.., intents=intents)

steady thicket
#

i see.ext

honest vessel
#

you do like that

slate swan
#

looks better

slate swan
honest vessel
#

@slate swanmaybe he dont want all ๐Ÿ˜„

slate swan
#

stop being annoying, read messages too

slate swan
honest vessel
#

yup

slate swan
stray thistle
#
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents ,case_insensitive=True,  strip_after_prefix=True)``` or like this, and you turn intents on on the bot's dev page
honest vessel
#

@stray thistleexactly

slate swan
#

on message doesnt take context smh

slate swan
slate swan
honest vessel
#

@steady thicketbut u have 2 diffrent intents ๐Ÿ˜„

slate swan
honest vessel
#

and two diffrent bot

slate swan
#

yeah

honest vessel
#

yes like that

steady thicket
#

now I'm confused

stray thistle
#

yeah copy mine

#

since it's obviously the best

slate swan
#

shouldnt tbh

stray thistle
slate swan
#

has kwargs that maybe he wouldnt like

#

ยฏ_(ใƒ„)_/ยฏ

stray thistle
#

still the best to use ngl

steady thicket
#

all of this

stray thistle
#

nah just the intents part

steady thicket
#

okay

slate swan
stray thistle
#
intents.members = True
bot = commands.Bot(intents=intents)```
#

basically this @steady thicket

#

and you have to turn all intents on on your bot's builder page

slate swan
#

the ones you need

#

if all just have .all()

stray thistle
#

yeah

stray thistle
#

and delete those 2 dots and comma

slate swan
#

yeah ofc

stray thistle
#

lol i saw that you kept 'em

slate swan
#

LMAO

#

ima dip cya

stray thistle
stray thistle
slate swan
steady thicket
stray thistle
slate swan
#

is that what your doing?

#

Guys how do I give permission to use the command only to certain roles?

steady thicket
honest vessel
#

@commands.has_roles() ?

steady thicket
#

yeah

slate swan
unkempt canyonBOT
#

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

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

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

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

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

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
slate swan
stray thistle
#
@commands.has_role(Role_id)``` @slate swan
slate swan
#

gtg later

stray thistle
#

i think

slate swan
stray thistle
#

i forgot the s tho

#

in commands

slate swan
#

LOL

steady thicket
#

I have it like this as you said

potent spear
steady thicket
#

but not really

#

like coded

potent spear
slate swan
steady thicket
#

I'll try reinstaling dpy

slate swan
#

how do i convert #252525# (hex) into something that discord.py supports so i can use the hex as the embed color

slate swan
#

that?

#

0xhexcode

#

always like that

steady thicket
slate swan
steady thicket
#

okayyy

#

And reinstall it, right?

slate swan
#

no

steady thicket
#

okay

slate swan
#

no need

steady thicket
#

okay so what next

slate swan
#

not sure

#

well im not sure

#

i dont think so

bitter perch
slate swan
bitter perch
#

the python one + extra for your config file

slate swan
#

dpy use the word discord

bitter perch
slate swan
#

how

bitter perch
#

the discord package from pypi is an outdated mirror

steady thicket
#

Thx, it's working now

slate swan
#

?

#

their the same thing dpy in pypi is version 1.7.3 and the one in git is 2.0

bitter perch
#

no

slate swan
#

yes

bitter perch
#

is usually an outdated mirror

#

it looks like he pushed 1.7.3, but usually it is outdated

slate swan
#

ic

#

but does it still get accessed with the word discord?

bitter perch
#

packages don't have to provide a namespace with the same name that they have

slate swan
#

yes ik

#

thats why im asking

vast gale
bitter perch
#

yes... i know

slate swan
#

dang

vast gale
#

so discord is not usually an outdated mirror if referring to the last 6 months as there haven't been any updates and they're both technically outdated

slate swan
#

prize should be before channel

cold sonnet
#

channel should have a default value

vast gale
cold sonnet
#

or that

vast gale
#

what I or @cold sonnet said will fix it

slate swan
vast gale
cold sonnet
vast gale
#

it'll change prize being a keyword argument to a positional or keyword argument

slate swan
vast gale
#

OR channel would need to become a keyword only argument

cold sonnet
#

there would still be a non-default argument after a default one

vast gale
#

hmm does that apply for KW only args?

slate swan
#

its a needed kwarg

vast gale
#

!e ```py
def func(a, b=False, *, c): ...

unkempt canyonBOT
#

@vast gale :warning: Your eval job has completed with return code 0.

[No output]
slate swan
#

wut

vast gale
slate swan
#

wait nvm

cold needle
#

how can i set the profile picture of a webhook

#

?!?!?

dense coral
#

hello @slate swan lol

slate swan
#

Hi ! My server is getting raided by some bots, and I noticed that almost all of them have some keywords in their name. let's say bot1 and bot2.
I am currently trying to ban members on join, like this ```py

blacklisted_words = ['bot1', 'bot2']

@commands.Cog.listener()
async def on_member_join(self, member):
    await self.bot.wait_until_ready()
    logs_channel = self.bot.get_channel(logs_channel_id)
    if blacklisted_words in member.display_name.lower():
        try:
            blusremb = #some text
            await member.send(embed=blusremb)
        except:
            pass
        await asyncio.sleep(0.2)
        await member.ban(reason="Blacklisted word")
        blemb = #some text
        await logs_channel.send(embed=blemb)

How can I, instead of defining the `blacklisted_words` list have a command, like `.blword add bot1`...and store them in something simple, like a `blacklisted_words.txt` file that would look like: ```txt
bot1
bot2

?

#

can you show the code.. ?

#

are you using something like pycord or disnake ?

cold sonnet
#

why

#

and that wasn't the question

slate swan
#

yea..but..you still need a discord py library

cold sonnet
#

mixed with dpy

#

because in my experience, people use those together

slate swan
#

i'm using a free host for one of my side bots rn..not really powerfull but works for text-bots. if you want i can send you the link in dm

#

sadly, due to having a lot of work 4 school, i haven't been coding so much since summer, so i don't know how to use buttons either :(

#

wdym ?

#

yea, but it's still being updated

#

and has a lot of new features

#

it's the same as discord.py, just uninstall discord.py and install py-cord

#

what is the function for member join event?

shut ocean
#

discord.py died, a lot of other libraries are taking place

shut ocean
shut ocean
slate swan
shut ocean
#

the author of discord.py library decided to quit updating the library

#

so it is recommended that you find another library

cold sonnet
#

to this day I believe that it will just respawn

#

disnake

slate swan
slate swan
#

takes only one arg thats member

boreal ravine
#

@slate swan ot but u dont talk in jss anymore?

manic wing
#

okimii is inactive

#

just like hunter

#

they are poor examples of upstanding discord bot coders

cold sonnet
#

what's jss

manic wing
#

css but for javascript

cold sonnet
#

huh

gusty horizon
#

Looking for a bit of help

potent spear
#

just print your banList and you'll see that it doesn't have the "included" key

slate swan
#

I have such an erorr when I try to download npm i quick.db

#

I'm a beginner so a little unattended like something

#

This is not the JavaScript Discord server :p

#

how download discord_components? modul

dapper cobalt
slate swan
unkempt canyonBOT
slate swan
#

Click on the link and you will see a command to execute at the top :)

slate swan
#

So I don't know :(

dapper cobalt
slate swan
#

Yep

dapper cobalt
slate swan
#

You will have higher chances of getting answers.

nova mantle
#

hello

slate swan
nova mantle
#

are there any Turkish people?

slate swan
#

I'm pretty sure there are, however this server is English only.

polar ice
#

Is it possible to have more then 3 fields inline with discord embeds?

nova mantle
#

I came because I have an interest in coding

slate swan
#

That's nice :D

nova mantle
#

I can improve my English more thanks to this server.

slate swan
#

I'm sure you will find lots of people to talk to in #python-discussion or some of the off topic channels.
This channel is mainly for asking help ^^

nova mantle
#

I am very sorry

slate swan
#

It's okay don't worry, you're new so we can guide you :p

final iron
#

How would I add roles to a member inside a on_raw_reaction_remove?

slate swan
#

smh

slate swan
final iron
#

member is None. That's my issue

#

Works fine for my on_raw_reaction_add event so its not intents

polar ice
#

Is it possible to have more then 3 fields inline with discord embeds?

final iron
#

I personally don't understand it

#

As they are extremely similar

#

Anyone got any ideas?

honest vessel
#
GLOBAL COMMANDS
===============
| NOTE: global commands can take up to 1 hour to show up after registration.
|
| Update is required: False
| To upsert:
|     -
| To edit:
|     -
| To delete:
|     -
| Type migration:
|     -
| No changes:
|     -

COMMANDS IN 0000000MYGUILDID
==============================
| Update is required: True
| To upsert:
|     <SlashCommand name='afk'>,
|     <SlashCommand name='invite'>
| To edit:
|     -
| To delete:
|     -
| Type migration:
|     -
| No changes:
|     -

/bot-env/lib/python3.9/site-packages/disnake/ext/commands/interaction_bot_base.py:746: SyncWarning: Failed to overwrite commands in <Guild id=000000MYGUILDID> due to 403 Forbidden (error code: 50001): Missing Access
  warnings.warn(
DEBUG: Command synchronization task has been finished

``` huh?
final iron
#

I'm using disnake btw

dapper cobalt
cold sonnet
#

in the remove event

#

!d discord.RawReactionActionEvent

unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
cold sonnet
#

but you have an user_id

#

and a guild_id

#

so you get the guild by the guild_id

#

and get the member by user_id in the guild

dense coral
#
  embed=discord.Embed(title=f"{prize}", description=":tada: reaction to enter!", color=0x00e1ff)
  time_numbers = {"s" : 1, "m" : 60, "h" : 3600, "d" : 86400}
  give_time = int(time[0]) * time_numbers[time[-1]]
  embed.add_field(name="Ends:", value=f"{time}", inline=False)
  embed.add_field(name="Hosted by:", value=ctx.author.mention, inline=False)
  give_msg = await ctx.send(":tada: **GIVEAWAY** :tada:", embed=embed)
  await give_msg.add_reaction(":tada:")
  await asyncio.sleep(give_time)
  new_msg = await ctx.channel.fetch_message(give_msg.id)
  users = await new_msg.reactions[0].users().flatten()
  users.pop(users.index(bot.user))
  winners = random.choice(users)
  await ctx.send(f":tada: Congratulations, {winners.mention} You won **{prize}**!")
  em_end=discord.Embed(title=f"{prize}", color=0x00e1ff, timestamp=ctx.message.create_at)
  em_end.add_field(name="Hosting By:", value=ctx.author.mention, inline=False)
  em_end.add_field(name="Winner(s):", value=winners.mention, inline=False)
  em_end.add_field(text="Ended at")
  await give_msg.edit(":tada: **GIVEAWAY ENDED!**:tada:", embed=em_end)```
Anyone know why this does not edit my post?
final iron
#

See the issue here?

dense coral
lapis breach
#

does any1 know how to make buttons using disnake?

final iron
#

Well I guess back to my original question then

#

How would I add roles to a member inside a on_raw_reaction_remove?

slim ibex
#

donโ€™t use discordโ€™s docs. Itโ€™s In JS not Python

lapis breach
manic wing
slim ibex
#

oh I didnโ€™t see that. I legit just opened the link LMAO

#

my fault bro

manic wing
#

user_id*

slim ibex
#

Because someone earlier was saying it was in JS and I told them to use the librariesโ€™ docs instead

final iron
#

Whats the difference between fetch and get?

lapis breach
#

ima ask again

#

does any1 know how to make buttons using disnake?

slim ibex
#

no

final iron
#

member_ = self.bot.get_user(payload.user_id)

#

Is this correct?

slim ibex
#

You should probably check the docs before asking @lapis breach

slim ibex
#

Do you get any errors?

dense coral
final iron
#

created_at

#

Not create_at

slim ibex
#

^

dense coral
#

But it does not seem to me to be related to the editing of the post

final iron
#

Did you fix it?

dense coral
#

Fix now

slim ibex
slate swan
#

and get is async so no need for await while fetch needs to be awaited

final iron
#

Alright

slate swan
# final iron Alright

and another one which disnake has is getch() which it tries to get the obj and if its not found it will fetch it

#

but thats exclusive to disnake afaik

final iron
#

Is it not called get_or_fetch?

untold token
untold token
#

get isn't async afaik

#

Lemme see

slate swan
#

weird people here say it is

#

but it really doesnt make sense

#

since coros always need to be awaited

untold token
#

!d disnake.Guild.get_member

unkempt canyonBOT
final iron
#

Lemme ask my question again, how would I add roles to a member inside a on_raw_reaction_remove event?

unkempt canyonBOT
#

disnake/guild.py line 712

def get_channel(self, channel_id: int, /) -> Optional[GuildChannel]:```
untold token
#

Yeah it's not asynchronous

#

That's why you do not await it

slate swan
#

idk why people say its async smh

slate swan
#

was weird to me cuz how can a function be async and when called they dont await it

untold token
untold token
#

You are using discord?

desert heart
#

The payload has a user and guild ID. First get the guild from the ID, then get the member from the guild using the ID in the payload.

#

relevant functions are get_guild and get_member

final iron
untold token
#

Ah okay

final iron
#

That's what I was trying to do. I guess I was doing it wrong then

untold token
#

Actually

desert heart
#

If you share that code then someone might find what is wrong

#

The member attribute will not work since it's a removal event

final iron
#

I deleted the code and closed my ide

untold token
#

!d disnake.RawReactionActionEvent.member

unkempt canyonBOT
untold token
#

There, the .member attribute returns the Member object who reacted

desert heart
#

Only available if event_type is REACTION_ADD and the reaction is inside a guild.

untold token
#

You can add your roles to that

untold token
final iron
#

Nope

untold token
#

Oh I see, then I misinterpreted

final iron
#

Thanks for the suggestion

#

I'll test it out in a bit

desert heart
# final iron I deleted the code and closed my ide

Okay, it's basically member = client.get_guild(payload.guild_id).get_member(payload.user_id). However, note that both those function calls may return None since they rely on the cache. get_member is more likely to fail for that reason, and also because the member might have left the guild.

#

To get around the cache issues, there's fetch_member and fetch_guild which you could fall back to if the get_ methods return None

untold token
#

They are API calls and need to awaited

final iron
#

By that I'm referring to calling the API if fetching the member fails

vital badge
#

Hello!! newbie here... im looking for a script that can sent a text line from a file to discord.. everything i try failed sofar.. can anyone point me in the right direction

unkempt canyonBOT
#

class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.

Note

File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
untold token
#

when you call getch method, it first looks up in cache and if that returns None

#

It makes an API call using fetch

final iron
#

I need to remember the difference between fetch and get

#

!d disnake.Client.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.
final iron
#

!d disnake.Client.get_or_fetch_user

unkempt canyonBOT
#

await get_or_fetch_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.
final iron
#

Whats the difference between these 2?

untold token
#

Same thing

#

getch_user is just an alias

untold token
kindred drum
#

yo why doesn't this return any output? py @commands.Cog.listener() async def on_reaction_add(self, reaction, user): if user == bot.user: #returning if the bot reacts return else: if reaction.emoji == "โœ…": #checking if there is reaction print("hello")

desert heart
sage ferry
#

How would I add a counter to this to post how many minutes the bot has been up for? I'm not very familiar with running synchronous functions

Wondering if i can just add this somehow

counter = 0 
while true:
  counter+=1
  print(counter)
  time.sleep(60000)```  


```python
import os
import discord
from discord.ext import commands
import random

bot = commands.Bot(command_prefix = '.')

@bot.event #posts that bot is running
async def on_ready():
    print('We have logged in as {0.user}'.format(bot))

emojis =[
"\u0033\u20E3",
"\u0031\u20E3",
"\u0039\u20E3"]

dan = redacted

@bot.event
async def on_message(message):
    if(message.author.id == dan):
            for emoji in emojis:
                    await message.add_reaction(emoji)
    else:
        pass

bot.run('redacted')```
slate swan
#

fully

#

youll have to add a task loop

sage ferry
#

Oh as simple as this?

@tasks.loop(seconds = 10) # repeat after every 10 seconds
async def myLoop():
    # work```
slate swan
#

idk im not very familiar with them either

sage ferry
#

I'll give it a try tyty

slate swan
#

kinda confused

#

cuz if you want to keep track of your bots run time idk if a task can help

kindred drum
#

how do I read information on an embed?

cold sonnet
#

embed.title

#

embed.description this

#

embed.color

#

embed.fields

slate swan
#

embed.footer

cold sonnet
#

yes

#

embed.fields[0].name

#

embed.fields[0].value

#

done bruhkitty

slate swan
#

i dont think thats what he wants do

cold sonnet
#

idk

#

I didn't really understand what he meant

slate swan
#

i think he wants to check text in a embed

cold sonnet
#

reading information on an embed

slate swan
#

lol

kindred drum
slate swan
#

with your eyes

kindred drum
#

How would I read the discord id off an embed my bot creates

kindred drum
#

yeah

slate swan
#

im confused

kindred drum
#

ill show you

blazing lynx
#

how to check if member is mentioned or not? (for a ban command)

kindred drum
#

how would I read the id

slate swan
#

you mean set the id?

blazing lynx
#

<@id>?

slate swan
#

and thats a user id iirc

kindred drum
#

no like get the id off that

#

it is

slate swan
#

you take it out?

kindred drum
#

like how do I get the user id of that embed

#

no just like get it assigned to a variable

blazing lynx
#

how to check if member is mentioned or not? (for a ban command)

blazing lynx
#

oh*

kindred drum
blazing lynx
#

may u explain more pls im kinda brain dead rn

#
        if member.mentioned == True:
          <code here>
#

?

final iron
#

No

#

if member is short hand for if member == True

blazing lynx
#

so

slate swan
blazing lynx
#
if member:
<code here>
```?
kindred drum
final iron
#

Can I see your code?

slate swan
final iron
#

Why would you want to do that?

kindred drum
#

done

#

now what do I do with it

slate swan
#

you check the msgs content

kindred drum
#

okay how do I find the field

final iron
#

You can just type hint it to a discord.Member object

blazing lynx
#
 @commands.command()
    async def ban(self, ctx, member: disnake.Member):
        if ctx.message.author.guild_permissions.administrator == False:
            embed = disnake.Embed(title="You can't use this command!", description=":cancel: Only **Admins** and up can use this command!")
            await ctx.send(embed = embed)
        if ctx.message.author.guild_permissions.administrator == True:
            embed = disnake.Embed(title="Ban Result:", description="")
            await ctx.send("In Development")
        if member.mentioned == True:
            
#

code

slate swan
final iron
#

^

slate swan
#

since it takes the id from the mention

unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

pliant gulch
slate swan
blazing lynx
#

im just using the other way it works

pliant gulch
#

!e ```py
foo = 100

if foo:
print("A")

if foo == True:
print("B")

unkempt canyonBOT
#

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

A
final iron
blazing lynx
#

to make a invalid usage code

#

itll tell them how to use the command if they dont mention a user

pliant gulch
#

!d discord.Member.mentioned_in

unkempt canyonBOT
final iron
blazing lynx
#

is there a easier way?

final iron
#

I don't see how thats difficult

pliant gulch
#

Oh, didn't know the context here

#

but your in a command so

#

Just give member a default value, E.g None

#

Inside of the command's callback check if member is None

#

If it is, they didn't mention or supply a member

blazing lynx
#

cant i just do

slate swan
blazing lynx
#
if ctx.message.mentions:
  <code here>
slate swan
#

you want to check all mentions in a message?

#

!d discord.Message.mentions

unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

pliant gulch
#

typehinted to Member

#

So if you give it a default value, and they don't pass a member arg

#

It will be None, so just check

slate swan
#

I got my bot to join my vc, is there a way to make it infinitely repeat a voice clip?

pliant gulch
#

You could put your play inside a loop where you check if VoiceClient.is_playing() is True, if it is continue the loop. Otherwise if is_playing() is False that would mean the bot has stopped playing the clip, so just do play again if it is False

slate swan
#

yea i was just gonna do a while loop

#

but how do you even make the bot play something?

#

whether it be a youtube video, or a voiceclip saved locally on your pc?

pliant gulch
#

!d discord.VoiceClient.play

unkempt canyonBOT
#

play(source, *, after=None)```
Plays an [`AudioSource`](https://discordpy.readthedocs.io/en/master/api.html#discord.AudioSource "discord.AudioSource").

The finalizer, `after` is called after the source has been exhausted or an error occurred.

If an error happens while the audio player is running, the exception is caught and the audio player is then stopped. If no after callback is passed, any caught exception will be displayed as if it were raised.
pliant gulch
#

Try not to play youtube videos though

slate swan
#

Why?

pliant gulch
#

That's against Youtubes ToS

#

A few big bots that have that feature have been taken down via DMCA

slate swan
#

Oh dang, it can play a voiceclip saved locally on your pc right?

pliant gulch
#

Depends ยฏ_(ใƒ„)_/ยฏ

#

If its a locally downloaded music you need the licensing

#

If it's just a voice clip you should be fine, might need permission from the person who the voice clip is from though

feral lantern
#

no as long as your bot doesn't get popular you're perfectly fine

#

if it does then take precautions

pliant gulch
#

Basically saying, "lets break the law we won't get in trouble if no one finds out"

feral lantern
#

you're breaking TOS not the law

pliant gulch
#

ToS is an agreement/contract you agree to

#

Isn't that legally binding?

#

Otherwise if it isn't against the law, they will just sue you or send a DMCA

feral lantern
#

usually it's DMCA

#

and yeah

#

ive never done it before but im sure there's a way around

pliant gulch
slate swan
#

relax it'll be a voiceclip of me

pliant gulch
#

So yes if you break ToS your breaking the law

feral lantern
#

through remixes etc

feral lantern
slate swan
#

I power my bot through a virtual machine though. I can't save the voiceclip locally and use it. I'll have to save it on the virtual machine itself somehow and link if from there

pliant gulch
#

Upload the voice clip to a file host and download it from the virtual machine

feral lantern
#

you can use a VPS for that

pliant gulch
#

Otherwise use a file transport protocol

feral lantern
#

no just put the mp3 in a folder along with your bot source

pliant gulch
#

Yea, so you'd need to put it on a file host or ftp it

outer violet
#

to get a bot to respond to you when you mention it, its commands.when_mentioned_or in dpy but what is it in hikari-lightbulb?

pliant gulch
#

You don't magically pop it into the VM

#

Lmao???

feral lantern
#

a VPS

#

you dont need to use a VM to host your bot

pliant gulch
#

They said VM not VPS so I'm going off what they said

#

Either way to transfer your mp3 to the VPS you need to file host it or ftp it again lmao

pliant gulch
lapis breach
#

how do i call that start() thing? i dont rrl know what i am doing

lapis breach
#

k then...

lapis breach
#

doesnt work?

#

just says star()

heavy radish
#

Heyy, I'm trying to make a somewhat useless BOT and need some help with how. I want the BOT to just count endlessly, How can I do so?

slate swan
#
@bot.command()
async def timeout(ctx, member: disnake.Member, time: float = None, *, reason=None) -> None:
    await member.timeout(duration=time, reason=reason)
slate swan
#

yw

heavy radish
heavy radish
slate swan
heavy radish
#

yes

slate swan
#
a = range(1, 100000001)
for b in a:
    await ctx.send(b)
    await asyncio.sleep(1.5)
#

or add it to a while loop and add a int to a var

#

which is probably better

#
a = 0
while True:
    await ctx.send(a)
    a += 1
    await asyncio.sleep(5.0)
pliant gulch
#

This would not count at all

slate swan
#

wdym

pliant gulch
#

It would always make a 0 at the start then 1

#

Then restarting a back to 0

heavy radish
#

Oh heyy, I'm back

slate swan
heavy radish
#

Oh dam. How can I do it then Andy? or Okimii

slate swan
#

kinda confused

pliant gulch
slate swan
potent spear
heavy radish
#

So what should I do?

slate swan
#

i added allot of time lol

pliant gulch
#

You should never hardcode ratelimits

#

They are dynamic

slate swan
#

explain?

pliant gulch
#

One time they could be 5/5s, another time they can be 10/5s

heavy radish
slate swan
pliant gulch
#

a is a local var now

heavy radish
#

done

pliant gulch
#

Unless that's what you want

slate swan
#

why make it a global var