#discord-bots

1 messages · Page 974 of 1

slate swan
#

lemme read the issue

heady sluice
#

that bot > client

slate swan
#

i agree

slate swan
heady sluice
#

.

slate swan
#

whats the update_json function

heady sluice
#

actually, I could just make a commandtree and assign it to client

slate swan
pliant gulch
heady sluice
#

stop

pliant gulch
#

You can do it all from requests without any library abstraction

heady sluice
#

slash commands are cool

slate swan
#

andy go work on rin

pliant gulch
#

No

heady sluice
#

requests is blocking

pliant gulch
#

Request as in RESTful requests

heady sluice
#

nullptr = andy?

pliant gulch
#

I never said aiohttp nor requests etc

heady sluice
#

mmhmm

slate swan
#

😔 urllib requests !

pliant gulch
heady sluice
slate swan
slate swan
pliant gulch
#

Dropped

heady sluice
#

andy is this the correct way

slate swan
heady sluice
#

is this really what I wanna do

pliant gulch
slate swan
pliant gulch
#

No I have a secret project

heady sluice
#

this is enough info

slate swan
heady sluice
#

or I subclass CommandTree with the right error handling function, make an instance of it, then assign it to a discord.Client instance because I don't need bot anymore since I have a CommandTree instance already

slate swan
#

Use hikari and be cool

heady sluice
#

~~Use hikari and ~~be cool

slate swan
#

use hikari and be cool

#

i mean, you dont need to waste your time reading docs and experimenting stuff with that 😔

heady sluice
#

Use hikari~~ and be cool~~

slate swan
#

😔 its easier, and better and faster

#

and dont make me mention about the codebase

heady sluice
#

mention about the codebase

slate swan
#

hikari is much better typed

#

and makes sense

#

apart from that, it allows you to use the rest freely, and the http/rest client is documented as well Client.http never mentioned coughs

heady sluice
#

I'm happy to hear that

#

show me a bot you wrote in hikari now

#

I bet it's wonderful

slate swan
#

currently writing, check the url in my aboutme

#

started like 5-6 days ago mb

heady sluice
#

it's nice

winged bone
#

bump 👉👈

quaint epoch
#

!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 [`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.
quaint epoch
#

i don't actually know either

#

i don't change it tho

slate swan
dull terrace
#

How does discord work out API limits

#

Is it an average of minutes or each minute etc.

dapper geyser
#

hey is there some one that could help me ?

#

sorry

full lily
dapper geyser
#

i wanted to script a lil spammer fore anoying my friends but idk why its not working thats the video i used https://youtu.be/LMb5kfJAzws

Yo hows it going this is how to code a discord spammer tool in python, super easy and you can totally spam anything with it. be safe!

Understand that this is for entertainment purposes only! :)

NEW DISCORD: https://discord.gg/E8JJ8tjYfS​

Be wary its still being set up. no judgy judgy.
-------------------------------------------------------...

▶ Play video
#

im really bad at this sorry

full lily
dapper geyser
#

cause its a small thing and things that are productive are mostly bigger i guess

visual island
full lily
#

lemon_cop TOS police is not happy

dapper geyser
#

😦

dull terrace
maiden fable
dapper geyser
maiden fable
dull terrace
#

So if I wanted to code the bot to prevent rate limit it would have to cool down if it exceeds 50 in a second

maiden fable
#

@dull terrace he ratelimits are dynamic

dull terrace
#

Or 3000 in a minute

maiden fable
#

They change with each request u make

dull terrace
#

So how do I prevent the bot exceeding the limit

maiden fable
#

Prevent API calls

dapper geyser
#

does some one have time and could help me ?

dull terrace
#

My bot edits messages quite a lot for each user

slate swan
visual island
pliant gulch
#

Use a semaphore with 50 thread limit

#

You can also read request headers

dull terrace
#

Or 50 button uses

dapper geyser
#

i am tbh bad at this

slate swan
slate swan
dull terrace
slate swan
#

!e

for i in range(5): 
     print("uwu")```
visual island
# winged bone bump 👉👈

Setting the atomic keyword to False allows you to add multiple roles in one request. Otherwise, you will make more than 1 request depending on how many roles you're going to add.

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

001 | uwu
002 | uwu
003 | uwu
004 | uwu
005 | uwu
dapper geyser
dapper geyser
slate swan
#

well

dapper geyser
#

can i add u when i have more questions that i can finde u and dont need to spamm here if no its also okay sorry

winged bone
slate swan
dapper geyser
#

aight but still thanks

slate swan
#

its alright

dapper geyser
#

can i send in the code here i am making ?

slate swan
#

for

#

?

dapper geyser
#

the spammer cause there are more things not working 😂

slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

^^

dull terrace
#

Does disnake handle rate limits for me? froggy_chill

slate swan
#

yes

#

all libs do

#

mostly

dapper geyser
winged bone
#

Ok

slate swan
#

i'll go fail biology now, bai bai

slate swan
#

anyways, bye

placid skiff
#

good don't waste your time on biology, programming has a better future

slate swan
dapper geyser
lofty pecan
#

Howdy, I was wondering how I could change the discord name of my bot to display its prefix, is there a way to not use ctx? and could I put that on my on_ready function?

placid skiff
#

fun fuct: i didn't waste my time on Italian literatures and i've ended school with a score of 95/100

lofty pecan
#

that's pretty based

slate swan
dapper geyser
dapper geyser
#

sorry my englisch is bad

placid skiff
#

i hated my italian teacher too
she was a lot like to a thresh TV celebrity, and i hate thresh TV too lol

dapper geyser
lofty pecan
slate swan
lofty pecan
#

how so

placid skiff
lofty pecan
placid skiff
#

!d discord.Client.change_presence

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter...
lofty pecan
#

ha thank you

#

^^

#

but that changes its activity status not server nickname

#

Maybe I could use this command I already made:

async def get_prefix(bot, message):
    prefixes = fetch('prefixes')
    config = fetch('config')
    
    default_prefix = config["prefix"]
    guild = message.guild
    if guild:
        return prefixes[f'{guild.id}']
    else:
        return default_prefix
``` The problem is that it requires a message so not really possible
placid skiff
#

don't know if you can do that btw

#

!d discord.Member.display_name

unkempt canyonBOT
#

property display_name```
Returns the user’s display name.

For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.
lofty pecan
#

user = ctx.guild.me
user.edit(nickname=new nickname)
I saw this, but it uses ctx

placid skiff
#

You can't change the nickname of an user neither the display name in a server

lofty pecan
#

wait what

#

why?

placid skiff
#

better, in server you can

#

but you have to retrieve the Member object of the client

slate swan
lofty pecan
#

yeah but the only user I want to change the nickname is the bot

#

it's only that, in order to show the prefix in the nickname for each server

placid skiff
#

!d discord.Guild.get_member

unkempt canyonBOT
#

get_member(user_id, /)```
Returns a member with the given ID.

Changed in version 2.0: `user_id` parameter is now positional-only.
placid skiff
#

this is a stupid thing btw, when_mentioned_or exists

lofty pecan
#

like those two

slate swan
lofty pecan
#

my bot is the third one and I'd like to display its prefix

#

like mee6 or carl

placid skiff
placid skiff
slate swan
unkempt canyonBOT
#

property me```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
slate swan
#

^^

lofty pecan
#

I'm the owner...

#

I don't remember changing their name lol

placid skiff
#

uhm

slate swan
lofty pecan
#

wdym Ashley?

placid skiff
#

Well btw let's return to what you want to do

lofty pecan
#

ye

slate swan
placid skiff
#

probably it will be mostly impossible to do it in real time

winged bone
#

Do you have a different prefix for ever guild?

placid skiff
#

because you'll need a task loop

lofty pecan
#

yesh

#

every guild can set their own prefix

winged bone
#

so you could loop through all guilds on startup and see if the nickname already contains the prefix, if not change it

#

then every time someone changes a guilds prefix, you also update the nickname

placid skiff
#

doing on startup will not make any sense, he needs a loop task

winged bone
#

why so?

slate swan
lofty pecan
#

mmh

placid skiff
#

because if the bot will be added in another server his display_name will not change in the server where it is added

winged bone
#

oh yeab

#

so also when he gets added to a new guild, change the nickname

lofty pecan
#

or set nickname on guild_join, when prefix change command is ran add a line of code to update the bot nickname

lofty pecan
#

naisu

lofty pecan
#

yes he lol

winged bone
#

No it

lofty pecan
#

nah dude, french bot are he didn't you know

placid skiff
# slate swan "he"

Hey it's an english issue to have three third person, in italian it/he/she are the same thing D_D

lofty pecan
slate swan
#

if your bot joins a server, you most probably have a default prefix set to new servers, hence not making your nickname eligible for if in a change in the prefix

placid skiff
#

lol exactly

#

but if he has a change_prefix command he can change the name in that command

lofty pecan
#

? I have a default prefix, on join the nickname is by default with the default prefix, when change prefix is ran it updates the nickname

slate swan
#

right

lofty pecan
slate swan
#

you could do that

lofty pecan
#

yay

placid skiff
#

this is useless and when_mentioned_or is better~

lofty pecan
#

?

slate swan
#

just make slash commands

placid skiff
#

LOOOOOT Better

lofty pecan
#

???

slate swan
#

nothing lmao, you continue

placid skiff
#

And say that i've saw a lot of stupid ideas in this channel

placid skiff
#

my favorite pokemon is Darkrai your crying bayleef doesn't make me sad

lofty pecan
#

rude

placid skiff
slate swan
#

Hola

quaint epoch
#

here is command, here is the error,

#

and yes, i am an admin the server

#

any clue?

#

i tried to mute myself in a vc, while in it

slate swan
quaint epoch
placid skiff
quaint epoch
#

admin too

dull terrace
#

have you got members turned on here

quaint epoch
slate swan
placid skiff
#

and discord doesn't let mute or ban users with the same role level

quaint epoch
blissful sparrow
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

hm ic

slate swan
placid skiff
blissful sparrow
#

Im tryna convert requests into aiohttp for an ip lookup command, however when I run the command I get discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In message_reference: Unknown message

https://paste.pythondiscord.com/apahocukup

quaint epoch
#

the bottom admin role is mine, the top is the bot role

#

and the bot doesn't have the admin role

blissful sparrow
slate swan
dull terrace
#

is it possible to mute a server owner?

quaint epoch
blissful sparrow
slate swan
blissful sparrow
#

and i own a network

maiden fable
blissful sparrow
#

so its useful

maiden fable
#

@blissful sparrow u need to use an API

blissful sparrow
dull terrace
#

interesting froggy_chill

blissful sparrow
#

ip api

maiden fable
#

Then what is the issue

blissful sparrow
#

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In message_reference: Unknown message

slate swan
vale wing
#

Yes

quaint epoch
blissful sparrow
#

this is returned, it works when I used requests

#

so im assuming i put either too many awaits

#

or something else entirely

vale wing
#

Most likely

quaint epoch
#

okay but NOW, i tried to mute a random member, with no perms, still the same error

#

and the member is lower than me in roles and perms

#

?

vale wing
#

Is it lower in roles with bot

quaint epoch
pliant gulch
#

It depends on the hierarchy

quaint epoch
#

it has admin

pliant gulch
quaint epoch
#

it can ban the same member, but can't mute them

slate swan
quaint epoch
#

😔

blissful sparrow
slate swan
#
import geocoder

_ip = geocoder.ip('IP ADDRESS')
print(_ip)
vale wing
maiden fable
vale wing
#

!e
from asyncio import run
async def main():
await print("yes")

run(main())

unkempt canyonBOT
#

@vale wing :x: Your eval job has completed with return code 1.

001 | yes
002 | Traceback (most recent call last):
003 |   File "<string>", line 5, in <module>
004 |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
005 |     return loop.run_until_complete(main)
006 |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
007 |     return future.result()
008 |   File "<string>", line 3, in main
009 | TypeError: object NoneType can't be used in 'await' expression
slate swan
#

lmao

quaint epoch
#

or py import hitman hitman.pay_visit(ip=ip)

vale wing
#

@blissful sparrow see it is TypeError

vale wing
slate swan
blissful sparrow
#

thats my server btw

vale wing
#

@blissful sparrow just try to make the deletion delay lower

slate swan
#

how do you get the city

maiden fable
blissful sparrow
quaint epoch
#

👀

blissful sparrow
#

lol gl ssh aint even 22

vale wing
#

😳

quaint epoch
#

i know it's a joke but mods will 😡

slate swan
quaint epoch
blissful sparrow
#

and legit every port is almost whitelsited

slate swan
#

how do i dm a server member with just an ID?

slate swan
quaint epoch
slate swan
quaint epoch
#

or await user.create_dm()

maiden fable
#

No need

blissful sparrow
maiden fable
#

That is an unnecessary API call

blissful sparrow
#

they all closed by default

slate swan
#

user = client.get_user(payload.user_id)

quaint epoch
maiden fable
#

Yea

slate swan
quaint epoch
#

is client a discord.client or bot?

slate swan
#

bot

quaint epoch
#

!d disnake.ext.commands.Bot.get_user

unkempt canyonBOT
dull terrace
#

still thinking about rate limits froggy_chill libraries handle rate limits for you right? so i should just make a cooldown that prevents one individual using a too large share of resources?

quaint epoch
#

@slate swan, is this code in a on_raw_reaction event?

slate swan
#

what?

slate swan
quaint epoch
slate swan
#

How do you know?

quaint epoch
slate swan
#

Yeah.

#

on_raw_reaction_add

quaint epoch
#
user = await client.fetch_user(payload.user_id)
await user.send('thing')```
dull terrace
# slate swan how you gonna implement a cooldown, its nearly complicated
class cooldown:
    async def check(interaction):
        guild_id, send = interaction.guild_id, interaction.send
        if guild_id in guild_cooldown:
            if guild_cooldown[guild_id]:
                return True
            guild_cooldown[guild_id] = True
            guild_cd = random.uniform(0, round(len(guild_cooldown) / 50, 1)) + 3
            message = f"{cooldown_msg}\nPlease wait {guild_cd} seconds."
            await send(message, delete_after=guild_cd)
            first_call = False
            prints(guild_id, message)
        else:
            guild_cooldown[guild_id] = False
            guild_cd, discord_cooldown = 0.2, round((len(guild_cooldown)) / 50, 1)
            if discord_cooldown > guild_cd:
                guild_cd = discord_cooldown
            first_call = True
        asyncio.get_event_loop().create_task(
            cooldown.wait(first_call, guild_cd, guild_id)
        )
        return False

    async def wait(first_call, guild_cd, guild_id):
        await asyncio.sleep(guild_cd)
        if first_call and not guild_cooldown[guild_id]:
            del guild_cooldown[guild_id]
        elif not first_call:
            del guild_cooldown[guild_id]
            prints(guild_id, "cooldown expired " + str(guild_cd))```
#

this is how it's currently implimented

#

prevents more than 5 requests per second per guild and 50 across discord

slate swan
#

nvm, my brain isnt already working and you'll just kill it

#

Jeez.

quaint epoch
#

really?

#

okay fixed

slate swan
quaint epoch
slate swan
#

Ohhh.

vale wing
#

It's positional

quaint epoch
#

get didn't work

slate swan
maiden fable
#

user = get_user or fetch_user

quaint epoch
#

@slate swan , hold up

#

!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.
quaint epoch
#

there

maiden fable
#

He using disnake?

slate swan
#

What's wrong with my current code?

maiden fable
#

Same

quaint epoch
slate swan
#

I am?

quaint epoch
#

oh

maiden fable
#

Lol

slate swan
quaint epoch
vale wing
#

@dull terrace you could just make a dict like {guild_id: datetime}

slate swan
maiden fable
#

Yea

quaint epoch
#

who wants to use 50 list comps and lambdas to solve this problem?

slate swan
dull terrace
slate swan
#

This is a discord bot channel in a python server.

slate swan
#
user = await client.fetch_user(payload.user_id)```
worked
vale wing
#

You mean the thing I suggested is old or your current implementation is

slate swan
#

I know.

#

Just thought to make it clear.

quaint epoch
#

!d disnake.Guild.getch_member

unkempt canyonBOT
#

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

Tries to get a member from the cache with the given ID. If fails, it fetches the member from the API and caches it.

If you want to make a bulk get-or-fetch call, use [`get_or_fetch_members()`](https://docs.disnake.dev/en/latest/api.html#disnake.Guild.get_or_fetch_members "disnake.Guild.get_or_fetch_members").
quaint epoch
#

oh this exists too

dull terrace
dull terrace
#

i think the best way is per person if they're mashing buttons and then just consider what to do if i do end up getting time outs by discord when it happens

vale wing
#

Discord has protection from rapid buttons clicking on client side

dull terrace
#

froggy_chill so basically don't bother adding anything?

lofty pecan
#

Hello there it's me again hehe, I was wondering if with @commands.cooldown(rate=1, per=30, type=commands.BucketType.user) there was a way to send in the chat that the cooldown has been reached ?

vale wing
#

Just members clicking buttons can't cause your bot to get ratelimited but your bot responding can

dull terrace
#

technically someone could try to hack around the client side and get the bot timed out if they're malicious right?

vale wing
#

By client side I mean discord app

lofty pecan
vale wing
#

You meant that as well?

dull terrace
#

you mean the discord api or the actual app

vale wing
dull terrace
#

because if it's the app then it's definitely open to malicious people

lofty pecan
vale wing
#

You can do the cooldown ofc

pliant gulch
vale wing
dull terrace
vale wing
#

That's called decorating

lofty pecan
#

yes yes

vale wing
#

And you can add as many decorators as you'd like to but I think they execute from top to bottom

pliant gulch
#

And the global ratelimit is 50/1s

vale wing
#

And to the lower decorator the result of upper one is parsed

lofty pecan
#

or

#

should I create the async def

#

and then call the decorator from that command ?!

#

is that it ?!

dull terrace
#

hmm, still have no idea the best way to approach this froggy_chill

vale wing
#

If the command is decorated with cooldown and the cooldown for the function is hit, it raises CommandOnCooldown exception

pliant gulch
vale wing
#

And you can handle it in your global error handler

dull terrace
#

maybe just guild limits if their use gets insanely high like 25 per second

pliant gulch
pliant gulch
#

This overall is a non-problem

dull terrace
#

so just stop wasting my time on it

vale wing
#

I am not sure where exactly the button blocking for client happens

dull terrace
#

why does owobot and others even have cool downs then?

pliant gulch
vale wing
#

It is either the API request decline or client side blocking

vale wing
pliant gulch
#

Oh

dull terrace
#

or do they use cooldowns due to responding to message content

pliant gulch
#

Sending messages are 5/5s

#

If they are large bots you would need to compensate

vale wing
#

I mean what blocks the button clicking

#

The client or the API

pliant gulch
vale wing
#

Afaik verified bots' limits are higher by like a lot

dull terrace
vale wing
#

Lemme check the dev portal rq

blissful sparrow
#

has anyone got a really dumbed down way to convert normal commands in to / commands?

pliant gulch
blissful sparrow
#

I cant get my head around it

#

Still want to keep the regular prefixed cmds as well though

carmine pasture
#

What coding softwares are recommended for discord bots? Or is there anyway you can get the discord package on visual studio code?

dull terrace
#

hmm i might be overestimating how fast people will click, a quick test shows that i'm around 1 click per second or a little faster while i know exactly what thing i want to do next

carmine pasture
#

I spent 4 hours on a bot on replit got rate limited

dull terrace
#

replit uses shared ips doesn't it?

blissful sparrow
carmine pasture
#

I think so

blissful sparrow
blissful sparrow
#

ive not used any other fork

vale wing
#

Pycharm, vsc, etc.

carmine pasture
#

I use vsc

slate swan
blissful sparrow
#

same

vale wing
carmine pasture
#

Just can't get the discord package

#

Import discord does not work

vale wing
#

Cause I hate their implementation

#

@carmine pasture try launching the terminal inside the app and running pip install discord.py

blissful sparrow
#

shame discord-slash not compatible with dpy 2

vale wing
#

Disnake has much better slash commands implementation

dull terrace
#

didn't they drop support for discord-slash recently

blissful sparrow
#

they did

#

which is ass cos im a noob

dull terrace
#

i switched over to disnake and so far it's been very good

carmine pasture
dull terrace
#

discord-slash would give me rate limit errors when i started my bot a bunch

vale wing
#

Command not found?

blissful sparrow
vale wing
#

Install python interpreter from official site and during installation put on "Add Python to PATH" checkmark

#

Also install python extension for VSC

carmine pasture
#

Lemme see

#

pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • pip install d.py
  •   + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
#

thats the error message btw

vale wing
#

Do the steps I said

carmine pasture
#

alr lemme try that

vale wing
hushed galleon
dull terrace
#

the amount of times i've forgotten to check add python to path when installing on aws froggy_chill

blissful sparrow
carmine pasture
#

@boreal ravine Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

#

thats the error message

blissful sparrow
#

so prefix works and slash

carmine pasture
#

also i alr have the vsc python extension installed

blissful sparrow
#

im reading the example gist

lofty pecan
#

okay so in order to add a cooldown message if you're on cooldown i've added this line of code but the message is sent 4 times everytime for some reason and I don't understand if it's because the round function tries to round the number too many time:

@commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            await ctx.send(f"{round(error.retry_after)} seconds left")```
vale wing
hushed galleon
carmine pasture
vale wing
#

Ok

blissful sparrow
# hushed galleon both decorators work in your cog, the gist is just a bit out of date (inheriting...

so for example for my ban command, would I just do ?

@app_commands.command(name='ban', description='Ban a user')
    @commands.command(aliases=['beam'])
    @commands.check_any(
        commands.is_owner(),
        commands.has_permissions(ban_members=True)
    )
    async def ban(self, ctx, member: discord.Member, *, reason=None):
        if reason==None:
            reason=" No reason provided"
        
        embed = discord.Embed(title='![Verify](https://cdn.discordapp.com/emojis/963038610175688734.webp?size=128 "Verify") Successfully Banned!', description=f'{member.name}#{member.discriminator} has been Banned. Reason: `{reason}`.', color=0xff0000)
        embed.set_thumbnail(url=member.avatar)
        embed.set_footer(text="Requested by: {}".format(ctx.author.display_name), icon_url=ctx.author.avatar)
        await ctx.send(embed=embed)
        await ctx.guild.ban(member)

        if member ==None:
            embed = discord.Embed(title='![Invalid](https://cdn.discordapp.com/emojis/963038609181659156.webp?size=128 "Invalid") Error banning member!', description='Please provide a valid @mention/ID!', color=0xff0000)
        embed.set_footer(text="Requested by: {}".format(ctx.author.display_name), icon_url=ctx.author.avatar)
        await ctx.reply(embed=embed)
#

ignore the indent after app commands

#

its vsc being annoying

hushed galleon
#

oh no you cant combine both decorators, but you can write two functions and then a shared method they call

blissful sparrow
#

wish I could combine them lol

odd frigate
boreal ravine
#

yes

odd frigate
#

Okey

blissful sparrow
odd frigate
#

so My discord bot goes offline randomly even tho the machine is online

blissful sparrow
#

how big is the bot

odd frigate
#

tiny

#

shall i send src

blissful sparrow
#

cos my friend has a verified bot and it was a sharding issue

odd frigate
#

hmm

blissful sparrow
#

but since its small

#

it shouldnt do

odd frigate
#

I searched on google but it didn't help

jovial pilot
#
    async def remove(ctx, channel: discord.TextChannel):
        if ctx.author.guild_permissions.manage_channels:
            await channel.delete()

this command doesn't work when i try it

regal pulsar
#
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 169, in wrapped   
    ret = await coro(*args, **kwargs)
  File "c:\Users\\Desktop\Programming\PyScrap\cogs\core_cog.py", line 115, in start
    await ctx.channel.send(view=view_level, embed=embed)
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\abc.py", line 1504, in send
    data = await state.http.send_message(
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\http.py", line 420, in request
    raise HTTPException(response, data)
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.2: The specified option value is already used
#

anyone know the issue

odd frigate
#

wait I think I found the issue

regal pulsar
#
embed = disnake.Embed(
                            title="Welcome!",
                            description="""
Time To Begin Your Python Journey!
 How much experience do you have with python?       
""",
                            color=ORANGE,
                        )

                        select_level = Select(
                            placeholder="",
                            options=[
                                SelectOption(label="No knowledge of python at all", value="noob", emoji="😶"),
                                SelectOption(label="Slight experience with python", value="beginner", emoji="😮"),
                                SelectOption(label="I know basic python", value="beginner", emoji="😎"),
                            ],
                        )

                        view_level = View()
                        view_level.add_item(select_level)
                        await ctx.channel.send(view=view_level, embed=embed)
#

the code

real hatch
boreal ravine
#

read channel topic

odd frigate
#

Sorry :(_ _

regal pulsar
real hatch
odd frigate
blissful sparrow
#

tf is that

odd frigate
#

why?

odd frigate
#

computer

blissful sparrow
#

im just running my test bot off my laptop kek

odd frigate
#

It is not test

blissful sparrow
#

no venv or anything

odd frigate
#

shall i explain why i made it

#

(minecraft smp)

blissful sparrow
#

get a 3 euro server from 100up

regal pulsar
#
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.2: The specified option value is already used
real hatch
jovial pilot
#

it does nothing at all when i run it

steady flume
#

how to make cogs after update in v2 ?

regal pulsar
#

do you have channel delete perms

vagrant brook
#

just a reminder in a cog you need self

jovial pilot
#

it has

real hatch
odd frigate
#

woah ton of messages

jovial pilot
#

would administrator perms count

#

or do i just change the perm to administrator

odd frigate
# real hatch Sorry?

I wanted to do a project than buy it for 3$, If I sold my solution it wud be like 7000$

lofty pecan
#

Hello hello, I have a small issue with a command to display the cooldown it might have, everytime, the bot sends the message several time and I have no idea why it does that, here is the problematic code:

@commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            retry = error.retry_after
            remaining_time = str(datetime.timedelta(seconds=int(retry)))
            embed = discord.Embed(title=":clock1: Slow Down!!", description=f'{ctx.author.mention}, you can use this command again in ' + str(remaining_time), color=0xE74C3C)
            await ctx.send(embed=embed)```
real cedar
#

Can Anyone help Me With Just filling up some data into a bots code which i find Difficult cauze i am no bot developer. Any help is much appriciated!

blissful sparrow
regal pulsar
# jovial pilot it still doesn't work
@commands.command()
@commands.has_permissions(manage_channels=True)
async def channel(ctx: commands.Context, channel: disnake.TextChannel):
    await ctx.channel.send(f"Deleting {channel}!")
    await channel.delete()
real cedar
#

uhh one sec

regal pulsar
#

forgot to await it

real cedar
#

https://github.com/Midorina/Shinobu

#

this is the bots code repository

#

with which i need help!

vagrant brook
real cedar
#

Extremely Sry For bothering Yall !

regal pulsar
#

np

regal pulsar
# vagrant brook <@674265869903200276>
@commands.command()
@commands.has_permissions(manage_channels=True)
async def channel(self, ctx: commands.Context, channel: disnake.TextChannel):
    await ctx.channel.send(f"Deleting {channel}!")
    await channel.delete()
jovial pilot
regal pulsar
#

this should work

#

if its not in a cog remove self

regal pulsar
vagrant brook
#

if its not in a cog then @commands.command() does nothing

regal pulsar
#

yes it does

lofty pecan
regal pulsar
#

you just have to add the command manually then

regal pulsar
#
@commands.command()
@commands.has_permissions(manage_channels=True)
async def channel(ctx: commands.Context, channel: disnake.TextChannel):
    await ctx.channel.send(f"Deleting {channel}!")
    await channel.delete()

bot.add_command(channel)
lofty pecan
regal pulsar
#

like so

blissful sparrow
real cedar
vagrant brook
#

ik but why even bother doing that

regal pulsar
#

just saying you can 🤷‍♂️

#

can someone help me with my problem :/

boreal ravine
#

i thought that was arl

regal pulsar
#
embed = disnake.Embed(
                            title="Welcome!",
                            description="""
Time To Begin Your Python Journey!
 How much experience do you have with python?       
""",
                            color=ORANGE,
                        )

                        select_level = Select(
                            placeholder="Choose your skill level",
                            options=[
                                SelectOption(label="No knowledge of python at all", value="noob", emoji="😶"),
                                SelectOption(label="Slight experience with python", value="beginner", emoji="😮"),
                                SelectOption(label="I know basic python", value="beginner", emoji="😎"),
                            ],
                        )

                        view_level = View()
                        view_level.add_item(select_level)
                        await ctx.channel.send(view=view_level, embed=embed)
#
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 169, in wrapped   
    ret = await coro(*args, **kwargs)
  File "c:\Users\\Desktop\Programming\PyScrap\cogs\core_cog.py", line 115, in start
    await ctx.channel.send(view=view_level, embed=embed)
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\abc.py", line 1504, in send
    data = await state.http.send_message(
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\http.py", line 420, in request
    raise HTTPException(response, data)
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.2: The specified option value is already used
regal pulsar
lofty pecan
#

I don't understand the indentation haha

boreal ravine
lofty pecan
#

discord go brr

regal pulsar
#

oh

#

🤦‍♂️

#

i forgot that i copy pasted the option

#

first time using select menus ;/

lofty pecan
#

a classic

jovial pilot
#

here it says channel is undefined

regal pulsar
#

are you using cogs

lofty pecan
blissful sparrow
#

can someone explain the sub command like wtf is that

regal pulsar
#

or not

boreal ravine
blissful sparrow
#

in / commands

jovial pilot
#

i'm not

regal pulsar
#

lol

#

then

#
@commands.command()
@commands.has_permissions(manage_channels=True)
async def channel(ctx: commands.Context, channel: discord.TextChannel):
    await ctx.channel.send(f"Deleting {channel}!")
    await channel.delete()

client.add_command(channel)
#

just paste this in

#

oh wait im using disnake one sec

lofty pecan
#

lmao

regal pulsar
#

there

lofty pecan
#

that's what I thought haha

regal pulsar
#

🤦‍♂️

blissful sparrow
#

can someone give me an example of how to implement prefixes and slash commands using this snippet

@commands.command(aliases=['beam'])
@commands.check_any(
        commands.is_owner(),
        commands.has_permissions(ban_members=True)
    )
    async def ban(self, ctx, member: discord.Member, *, reason=None):
        if reason==None:
            reason=" No reason provided"
        
        embed = discord.Embed(title='![Verify](https://cdn.discordapp.com/emojis/963038610175688734.webp?size=128 "Verify") Successfully Banned!', description=f'{member.name}#{member.discriminator} has been Banned. Reason: `{reason}`.', color=0xff0000)
        embed.set_thumbnail(url=member.avatar)
        embed.set_footer(text="Requested by: {}".format(ctx.author.display_name), icon_url=ctx.author.avatar)
        await ctx.send(embed=embed)
        await ctx.guild.ban(member)

        if member ==None:
            embed = discord.Embed(title='![Invalid](https://cdn.discordapp.com/emojis/963038609181659156.webp?size=128 "Invalid") Error banning member!', description='Please provide a valid @mention/ID!', color=0xff0000)
        embed.set_footer(text="Requested by: {}".format(ctx.author.display_name), icon_url=ctx.author.avatar)
        await ctx.reply(embed=embed)
lofty pecan
#

Hello hello, I have a small issue with a command to display the cooldown it might have, everytime, the bot sends the message several time (4 times in a row) and I have no idea why it does that, here is the problematic code:

@commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            retry = error.retry_after
            remaining_time = str(datetime.timedelta(seconds=int(retry)))
            embed = discord.Embed(title=":clock1: Slow Down!!", description=f'{ctx.author.mention}, you can use this command again in ' + str(remaining_time), color=0xE74C3C)
            await ctx.send(embed=embed)```
#

maybe it has to do with the fact that in my cog 4 commands uses a cooldown

blissful sparrow
#

is it possible to restrict certain drop downs to certain perms?

lofty pecan
#

but it doesn't make sense because another cog has 3 commands and has the same issue

lofty pecan
blissful sparrow
#

Lets say I have a help command that uses drop downs

#

For the admin commands I want the drop down to be restricted to admins only

lofty pecan
#

what is drop downs

blissful sparrow
slate swan
#

I'm currently using this for a random code generator:

.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for i in range(N))```
However, i get this error:
```TypeError: 'str' object cannot be interpreted as an integer```
I'm not sure how to fix it, have i got to replace `i`?
lofty pecan
#

what is i

#

and what is N

maiden fable
#

for some reason the function is being called 4 times

lofty pecan
#

ye

#

Idk why

maiden fable
#

can u show me the command due to which it is happening?

lofty pecan
#

all of them

#

they all have @commands.cooldown(rate=1, per=60, type=commands.BucketType.user)

maiden fable
#

Weirdddddd

lofty pecan
#

with a per depending on the command

maiden fable
#

Hm that shouldn't really be an issue

slate swan
lofty pecan
maiden fable
frozen patio
#
@bot.slash_command(title="Hello!", description="Hi!")
async def hello_cmd(inter: Interaction):
    await inter.send("Hello there!")
#

I think this is right

lofty pecan
#

events ?

frozen patio
#

I do not make slash much

lofty pecan
#

huh wait

maiden fable
#

Its not a command issue but one with the events prolly

fallow mauve
#

Ok so i wanna make a command that when used with a word or phrase after it will put the word or phrase into a json file, and then another that will remove a specific word or phrase from in the json file, can someone explain this to me?

lofty pecan
#

I have on_ready, on_guild_join and on_guild_remove

maiden fable
#

Only?

lofty pecan
#

ye

maiden fable
#

What the

#

Ha

surreal ruin
#

please tell me what i have to put in it i fork a code

maiden fable
#

He is on dpy

lofty pecan
#

mmh ?

maiden fable
lofty pecan
#

ha oke

frozen patio
#

Hmm, you need disnake or nextcord

surreal ruin
#

please some one tell me

frozen patio
#

d.py does not have slash

#

Yeah, or nextcord

#

Doesn't matter

maiden fable
lofty pecan
#

I just added the command to display the cooldown

maiden fable
#

Show

lofty pecan
#

so since I added it yes

rustic sky
#

hello there i just need to use data from a json file but python cant seem to access it though the file exists, any clue why?

lofty pecan
frozen patio
#

you have discord somewhere

#

you need to change it to disnake

maiden fable
rustic sky
lofty pecan
#

ho

lofty pecan
#
@commands.command()
    @commands.cooldown(rate=1, per=30, type=commands.BucketType.user)
    async def ocrandom(self, ctx):
        """ Gives the description of a random OC"""
        id = str(ctx.guild.id)
            
        file_name = random.choice(os.listdir(f'database\{id}'))
        Content = fetch(f'database\{id}\{file_name[:-5]}')

        user = await self.bot.fetch_user(int(file_name[:-5]))

        Key = random.choice(list(Content))    
        character = Content[Key]
        age = character['age']
        gender = character['gender']
        hex = character['hex']
        Url = character['picture']
        desc = character['description']
        universe = character['universe']

        embed = discord.Embed(title=Key, color=int(hex,0), description=desc)
        embed.set_thumbnail(url=Url)
        embed.add_field(name="Age", value=age)
        embed.add_field(name="Gender", value=gender)
        embed.add_field(name="Universe", value=universe)
        embed.add_field(name="Creator", value=user)
        await ctx.send(embed=embed)```
maiden fable
#

???

frozen patio
#

Can't just pass in user in the async def

#

Go to the dev portal and enable intents

#

Did you enable the application_commands scope when you invited the bot?

#

Show me your code

rustic sky
# maiden fable can u print `os.listdir()`

it prints out the directories above because im not working in the same directory but i've fixed this using this method and when i print it, it returns the correct directory of the file: half_path_name = python if os.path.exists(str(Path(__file__).parent.resolve()) + "/config.json"):

frozen patio
#

I think you need to do

from disnake.ext import commands

rustic sky
# maiden fable Ah cool

Here is the code that's sending me an error when i try to open using the "with open" methodpython print(str(Path(__file__).parent.resolve()) + "/config.json") if os.path.exists(str(Path(__file__).parent.resolve()) + "/config.json"): with open("./config.json") as file: config_data = json.load(file) else: config_template = {"discord_token": ""} with open(str(Path(__file__).parent.resolve()) + "/config.json", "w+") as file: json.dump(config_template, file)

frozen patio
slate swan
#

Which ide u use??

rustic sky
maiden fable
#

Ah that one

#

Thought there was a different error

frozen patio
#

Just move the 2 intent lines below the client = commands.Bot line

rustic sky
frozen patio
#

Code please?

slate swan
#

Go down

maiden fable
#

@rustic sky what is it printing?

slate swan
#

The intents

frozen patio
#

You need to add the intent lines, or remove intents=intents

#

No

slate swan
#

??

frozen patio
rustic sky
frozen patio
#

Like this

frozen patio
#

Do not worry about that

#

Colors do not matter

rustic sky
slate swan
#

It's replit

#

Or?..

frozen patio
#

No I use discord white cause ye keeps me awake

slate swan
#

Tf

frozen patio
#

But that is neither here or there

#

Yes

slate swan
#

..

frozen patio
#

is message_content an intent?

slate swan
#

Waaa

maiden fable
#

!d disnake.Intents.message_content

unkempt canyonBOT
maiden fable
#

(:

steady flume
#

how to fix that ? (V2)

winged bone
# frozen patio

why should he define his intents after the bot? This way he can't pass it to the bots constructor like disnake.Bot(intents=intents)

paper sluice
winged bone
#

that was already good, you still need to pass intents=intents to the Bot constructor

frozen patio
#

Oh yeah, you do need to add that 😐

blissful sparrow
rustic sky
#

@maiden fable thanks for your help man i finally found what caused the error

blissful sparrow
#

whys it saying this

#

its defined as a subclass

maiden fable
winged bone
#

disnake.Bot(..., intents=intents, ...)
One thing tho, you don´t even need message_content for slash commands

carmine pasture
#

How do you guys type code like that on discord

winged bone
#

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

blissful sparrow
carmine pasture
#

Alr

rustic sky
maiden fable
carmine pasture
frozen patio
#

then change bot to client

blissful sparrow
rustic sky
# maiden fable What caused the error tho

i copied the ./config.json statement from a video but it worked in the video because it was in the cwd (which is not my case) so i just used the same method to open the file as for the others and it managed to locate and it worked

#

pretty disappointing

winged bone
#

yeah you called it client by doing client = ...

frozen patio
#

👀

#

That is how I define slash commands

#

And it works

blissful sparrow
frozen patio
#

You need to import interaction

sharp snow
#

Hello, does anyone know how I can hide cogs from my bot's help page?

blissful sparrow
#

select not defined

#

even tho it is?

steady flume
winged bone
#

i think for disnake its disnake.ApplicationCommandInteraction

frozen patio
#

Oh yeah!

#

As you can see I do not use the library much xD

boreal ravine
#

@slate swan wanna hear a fact?

slate swan
blissful sparrow
slate swan
#

.

sick birch
sharp snow
#

Hmm, actually I was hoping for a solution that would work with the default help command, anyways, I guess it's time to switch over. Thanks.

blissful sparrow
#

its also very aesthetically pleasing

#

well to me anyways XD

lofty pecan
#

Hello hello, I have a small issue with a command to display the cooldown it might have, everytime, the bot sends the message several time (4 times in a row) and I have no idea why it does that, here is the problematic code:

@commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.CommandOnCooldown):
            retry = error.retry_after
            remaining_time = str(datetime.timedelta(seconds=int(retry)))
            embed = discord.Embed(title=":clock1: Slow Down!!", description=f'{ctx.author.mention}, you can use this command again in ' + str(remaining_time), color=0xE74C3C)
            await ctx.send(embed=embed)``` **Please could anyone help, I seriously don't understand what's happening** ![yahiaBOOHOO](https://cdn.discordapp.com/emojis/801197427629359114.webp?size=128 "yahiaBOOHOO")
boreal ravine
sick birch
boreal ravine
blissful sparrow
sharp snow
blissful sparrow
#

make classes within classes

lofty pecan
slate swan
#

Adding emoji to ur msg is more attractive

boreal ravine
lofty pecan
blissful sparrow
#

thats why shutdown command pog

lofty pecan
#

the other commands work just fine

sharp snow
blissful sparrow
boreal ravine
#

the class is inside a class so you have to use self to access it

sharp snow
blissful sparrow
#

ah I see, so why does it not work when I do it here:

@commands.command()
    async def help(ctx):
        await ctx.send("Help Menu!",view=self.SelectView())
lofty pecan
#

here is an example

boreal ravine
paper sluice
lofty pecan
#

no just one lol

lofty pecan
boreal ravine
#

inside

blissful sparrow
lofty pecan
blissful sparrow
#

of wait

#

i need to add self, ctx

boreal ravine
blissful sparrow
#

Thanks, lets see if it replies with something now

#

guess not

boreal ravine
blissful sparrow
#

I was thinking I should do that tbh

lofty pecan
boreal ravine
paper sluice
lofty pecan
#

truly odd

boreal ravine
lofty pecan
#

what is that

#

wait discord py

boreal ravine
boreal ravine
blissful sparrow
#

Yikes

boreal ravine
#

Defer it ig

blissful sparrow
#

?

#

oh wait ik what I did

#

nvm still failed

slate swan
lofty pecan
#

yes

#

indeed

lofty pecan
slate swan
#

lemme see if I can help

lofty pecan
#

🥺

slate swan
#

or simply reset your bot's token

lofty pecan
#

welp nope nothing

lofty pecan
#

it's weird that it does that only for this cogs listener and not the commands

umbral aspen
#

Am I able to host my bot with a domain that I own?

maiden fable
#

@lofty pecan did u post the code for the cooldown command (which caused the issue?)

lofty pecan
#

yes

maiden fable
#

Might have missed that

lofty pecan
#

that litteraly what I sent lol

maiden fable
#

Oh

#

Eh

#

Shouldn't really happen

lofty pecan
#

ye

slate swan
maiden fable
#

@lofty pecan can u try printing it?

#

Does it print 4 times?

#

It should print 4 times but eh

lofty pecan
#

lmao

lofty pecan
maiden fable
#

And how many times does it respond to a command?

#

Like when u invoke a command, how many times does it send the message

lofty pecan
#

4 times

maiden fable
#

Hm command response is only once

#

Meaning there is only one instance of bot running

lofty pecan
#

reseting the token did nothing

maiden fable
#

Eh, how big is the code?

#

The whole code

slate swan
#

yo can someone make me a code that when a user joins, it changes their username automatically -(pls send code in dms, i'll reward you)

lofty pecan
#

127 lines for that cog

maiden fable
#

Hm, is the code too big to share?

lofty pecan
#

I think so

#

the code works fine

#

only that cooldown part is buggy

maiden fable
#

Well rn I am just shooting arrows in the dark, cannot really do anything without seeing all the code

lofty pecan
#

lmao

slate swan
#

Lol

lofty pecan
#

I'm telling you, the code works fine, adding this command of cooldown to display how much time there is left is the problem

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

I didn't have that problem before

maiden fable
#
@bot.event
async def on_member_join(mem):
    await mem.edit(nick="Welcome bro")
cosmic agate
#

so i am trying to host my bot on railway and the logs are as follows:

maiden fable
slate swan
#

@maiden fabledms

lofty pecan
#

How do I do this?

cosmic agate
#
==========================
Using Buildpacks!
==========================
full: Pulling from paketobuildpacks/builder
Digest: sha256:bf3ca4acadd5449311e9d5cddda8a2e951f10198c180fc05004fd8c3d1c461f5
Status: Image is up to date for paketobuildpacks/builder:full
full-cnb: Pulling from paketobuildpacks/run
Digest: sha256:037e1acf18b5e2cb41cf8f9f9b6c8637b718f4a6ff823a22cde641a332d01505
Status: Image is up to date for paketobuildpacks/run:full-cnb
===> ANALYZING
Previous image with name "us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/05fb51cc-0cc0-4a6a-813e-5f648118482c/service/83f555fc-993a-4e81-b289-61fd7131198e:540b789e-ffea-4876-b1c4-2a5681e73330" not found
===> DETECTING
3 of 7 buildpacks participating
paketo-buildpacks/ca-certificates 3.2.0
paketo-buildpacks/cpython         0.9.3
paketo-buildpacks/python-start    0.9.0
===> RESTORING
===> BUILDING
Paketo CA Certificates Buildpack 3.2.0
https://github.com/paketo-buildpacks/ca-certificates
Launch Helper: Contributing to layer
Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
Paketo CPython Buildpack 0.9.3
Resolving CPython version
Candidate version sources (in priority order):
<unknown> -> ""
Selected CPython version (using <unknown>): 3.9.12
Executing build process
Installing CPython 3.9.12
Completed in 2.804s
Configuring environment
PYTHONPATH -> "/layers/paketo-buildpacks_cpython/cpython"
maiden fable
cosmic agate
#
Paketo Python Start Buildpack 0.9.0
Assigning launch process
web: python
===> EXPORTING
Adding layer 'paketo-buildpacks/ca-certificates:helper'
Adding layer 'paketo-buildpacks/cpython:cpython'
Adding layer 'launch.sbom'
Adding 1/1 app layer(s)
Adding layer 'launcher'
Adding layer 'config'
Adding layer 'process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'web'
Saving us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/05fb51cc-0cc0-4a6a-813e-5f648118482c/service/83f555fc-993a-4e81-b289-61fd7131198e:540b789e-ffea-4876-b1c4-2a5681e73330...
*** Images (8d7d3f983c5d):
us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/05fb51cc-0cc0-4a6a-813e-5f648118482c/service/83f555fc-993a-4e81-b289-61fd7131198e:540b789e-ffea-4876-b1c4-2a5681e73330
Successfully built image 'us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/05fb51cc-0cc0-4a6a-813e-5f648118482c/service/83f555fc-993a-4e81-b289-61fd7131198e:540b789e-ffea-4876-b1c4-2a5681e73330'
The push refers to repository [us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/05fb51cc-0cc0-4a6a-813e-5f648118482c/service/83f555fc-993a-4e81-b289-61fd7131198e]
Preparing  83d85471d9f8
Preparing  4bcf52917c7c
Preparing  195ce6778985
Preparing  71f46b69cb09
Preparing  c99d6be99282
Preparing  b4a080c9e328
Preparing  a53ff049d96e
Preparing  5a904fb774ec
Preparing  2b55f3c2f32a
Preparing  2f2856c4c220
Preparing  95c443da13bf
Waiting  b4a080c9e328
Waiting  5a904fb774ec
Waiting  a53ff049d96e
Waiting  2b55f3c2f32a
Waiting  2f2856c4c220
Waiting  95c443da13bf
Pushing [>                                                  ]  1.024kB/79.73kB 71f46b69cb09
Pushing [==================================================>]   85.5kB 71f46b69cb09
#
Layer already exists  c99d6be99282
Layer already exists  4bcf52917c7c
Layer already exists  83d85471d9f8
Layer already exists  195ce6778985
Layer already exists  b4a080c9e328
Layer already exists  a53ff049d96e
Layer already exists  2b55f3c2f32a
Layer already exists  5a904fb774ec
Layer already exists  2f2856c4c220
Layer already exists  95c443da13bf
Pushed  71f46b69cb09
540b789e-ffea-4876-b1c4-2a5681e73330: digest: sha256:4716f9b41812ba4baaa74d4206ef9b6da996baedf4710f2cd37f187371ae9a5d size: 2622
slate swan
#

why

cosmic agate
#

sad

lofty pecan
#

I need to open anaconda wait

slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

hi

cosmic agate
maiden fable
#

@slate swan help @slate swan add code to his bot hosted on replit

lofty pecan
#

version 1.7.3 @maiden fable

maiden fable
#

Because I am going to sleep

slate swan
#

jus an auto username when someone joins the server lol

slate swan
maiden fable
lofty pecan
#

yeah

maiden fable
#

@slate swan gonna help u @lofty pecan

#

prolly

slate swan
#

what

cosmic agate
slate swan
#

i have homework

maiden fable
cosmic agate
slate swan
lofty pecan
maiden fable
#

I am at my wits end for yr issue @lofty pecan, sorry

slate swan
#

lol

lofty pecan
#

ye it's oke

#

no worries you tried 💜

maiden fable
#

(:

lofty pecan
#

4 times

lofty pecan
#

exactly 4 times

slate swan
#

do you have many instances running of your bot?

lofty pecan
#

no

slate swan
#

damn

lofty pecan
#

one on my laptop

minor totem
lofty pecan
lofty pecan
maiden fable
lofty pecan
#

yeah

cosmic agate
minor totem
#

@lofty pecan do you have this cooldown code for multiple commands?

lofty pecan
#

yes

slate swan
#

its probably that

minor totem
#

Let me guess, 4 commands? 😅

lofty pecan
#

each cogs, I just thought maybe that would be the issue

slate swan
#

auto username?

maiden fable
#

Oh wait 😐

lofty pecan
#

one stuff like that in each cog

#

thats all

maiden fable
#

@lofty pecan how many commands have a cooldown?

lofty pecan
#

that's the thing

minor totem
slate swan
#

any command thats on cooldown will trigger the error handler

lofty pecan
#

so, 4 commands in this cogs, BUT in another cog only 3 have a cooldown and the cooldown error embed is triggered 4 times as well

slate swan
#

show ss

blissful sparrow
#

Ngl they should allow threads here

slate swan
#

they shouldnt

#

what are they even gonna be about? libs?

lofty pecan
#

4 have the cooldown thingy yahiaIQ

sick birch
maiden fable
#

@lofty pecan can u add the command name to the cooldown embed to see for which command its being called?

lofty pecan
#

ho yeah !

#

how?

minor totem
lofty pecan
maiden fable
#

ctx.command.name

maiden fable
slate swan
slate swan
#

how would the error get triggered 4 times?

lofty pecan
minor totem
# maiden fable Wym

There are 4 error handlers, one for each cog, yet they apply to the whole bot. What happens, is that they all get triggered because each error hanlder (as I said) applies globally

minor totem
maiden fable
#

Ah, so he has different eh's for each cog?

lofty pecan
#

one is enough for all the cogs ?

maiden fable
#

Who would have known 😔

slate swan
#

on_command_error is a global error handler for all commands

maiden fable
#

Yes @lofty pecan

lofty pecan
#

ho really ?!

minor totem
slate swan
#

all commands that are registered can trigger it.

lofty pecan
#

then !

slate swan
#

!d discord.discord.ext.commands.on_command_error

unkempt canyonBOT
#

discord.ext.commands.on_command_error(ctx, error)```
An error handler that is called when an error is raised inside a command either through user input error, check failure, or an error in your own code.

A default one is provided ([`Bot.on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.on_command_error "discord.ext.commands.Bot.on_command_error")).
lofty pecan
#

Mentlegen, your solution was a success

#

Thanks a lot, I hesitated at first to put it there but yeah that's actually what I should have done

regal pulsar
#

how do i add another argument to a callback func

lofty pecan
#

thanks a lot @minor totem !

regal pulsar
#
async def callback(interaction: disnake.Interaction, total):

        total += 1
        dict[select.values[0]] += 1

        dict_profile = dict[select.values[0]]

        embed = disnake.Embed(title=question, color=ORANGE)

        for ch in choices:
            embed.add_field(name=f"{ch}:    ", value=f"{(dict_profile * 100) // len(choices)}%", inline=False)

        await msg.edit(embed=embed)

    select.callback = callback
    view = View()
    view.add_item(select)
    msg = await ctx.channel.send(embed=embed, view=view)
slate swan
#

can it?

minor totem
regal pulsar
slate swan
#

just pass the argument to the View and then pass it to the menu

regal pulsar
#

looks like this

minor totem
regal pulsar
#

basically i need the total number of times options have been selected