#discord-bots
1 messages · Page 416 of 1
hi
i have some custom emojis that looks small but are in max discord re s 128x128 ,can i make them bigger somehow in the embed?
In what part of the embed
description
You could use headers (#) to make them bigger, but that'd also affect the other text in that line
There's no other way really, not that I know of
Try "# {emoji}"
let me see
Yeah
cool worked ty
🙏🏻
Gotta love a good memory leak
I'm assuming it's a leak cuz I have no idea where allat would come from, was struggling to figure that out
Probably a module, I'll try to check deep
Memory profilers exist
I tried pympler
Guys, what is the proper / best way to get context from a discord interaction when Im using hybrid commands?
the main issue I am having is that I need to defer interactions, but it seems I cant defer interactions related to hybrid commands
await defer(*, ephemeral=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction based contexts.
This is typically used when the interaction is acknowledged and a secondary action will be done later...
one single lib ("rembg") that i only used a single function from - was 160 mb RAM 😭
because it's using an AI model
Yeah I knew that, but I wasn't thinking it'd just stay and bloat the memory like that
🤔 How do I get my bot to join a voice channel and start streaming?
Bots can only play audio, they can't stream video if that's what you mean
who need bot?
Me, that's why I make one
sry guys i little out of content but can anyone tell me how can i get the developer badge in discord
i already have a verified discord bot
Pretty sure you need to have a slash command that has been run at least once in the last 30 days
(Also that's the requirement for maintaining the badge - yes you can lose it otherwise)
oh so it will be automatically
Yes. When I got it, iirc, I eventually had a popup on the developer portal to claim it. Dunno if it changed since
okay thank you
is it possible to create a bot that notifies us when a new discord quest is available?
No, there's neither an event for that nor is the endpoint accessible for bots
so only option left possible is web scraping

Which would be against discord tos
also how can i add this?
Discord adds it automatically when your bot is verified, has enough usage, and you have global commands with no default permissions
That's an assumption at least (to be exact -> "enough usage" isn't defined)
what do you mean with default permissions
Everyone role can use it
default_member_permissions to be exact
I mean or try find public source where those people violate the ToS to get the data and public it
What's a good way of chunking many servers (including a bunch of large ones) without hitting the gateway rate limit
The library you're using should prevent you from hitting the limit
Hmm because someone I'm talking to gets these
It happens on startup
Also checked his code and no excessive/at all requests from gateway
So I assumed it's the chunking
yeah that's a warning, not an error
Well he's getting rate limited and that's not a good thing either way
Bot!?
I think you're misunderstand what "getting rate limited" means
This message specifically means the library is preventing you from exceeding the limit. It's letting you do things as fast as discord itself is saying you should. It's not a problem
Alright thanks
hi
assuming you are using discord.py
you can make multi line strings using triple quotes, eg.
msg = """
your multi-line string here
"""
no need for the msg +=
Can anyone help me create a bot on Discord?
Where are you stuck?
How do I get the inputted text of input_text in on_submit? 🤔
self.input_text.component, from there you should know what to do
you have to be a bit more specific. Do you not know how to create it from https://discord.com/developers/docs/intro. Do you not know what permissions to give it. Do you now know how to work the bot token. Do you not know how to programm it.
import requests
import customtkinter as ctk
def send_msg(username,content,discord_webhook,avatar_url,respond_label):
data={
"content":content,
"username":username,
"avatar_url":avatar_url
}
if not discord_webhook.strip(".") or not "discord" in discord_webhook:
respond_label.configure(text="No webhook provided",text_color="red")
return
try:
response=requests.post(discord_webhook,json=data)
if response.status_code==204:
respond_label.configure(text=f"Message sent succesfully, status:{response.status_code}",text_color="green")
else:
respond_label.configure(text=f"Failed to send message:{response.status_code}",text_color="orange")
except AttributeError:
pass
def create_gui():
root=ctk.CTk()
root.title("Webhook sender")
respond_label=ctk.CTkLabel(root,text="No message sent yet",font=("",20))
respond_label.grid(row=0,column=1,columnspan=2,pady=10)
ctk.CTkLabel(root,
text="Discord webhook:",
font=("",15)).grid(row=1,column=0,pady=15,padx=10)
ctk.CTkLabel(root,
text="Content:",
font=("",15)).grid(row=2,column=0,pady=15,padx=10)
ctk.CTkLabel(root,
text="Username",
font=("",15)).grid(row=3,column=0,pady=15,padx=10)
ctk.CTkLabel(root,
text="Avatar Url:",
font=("",15)).grid(row=4,column=0,pady=15,padx=10)
Discord_webhook=ctk.CTkTextbox(root,
width=120,height=90)
Discord_webhook.grid(row=1,column=1,pady=15,padx=10)
Content=ctk.CTkTextbox(root,
width=120,height=90)
Content.grid(row=2,column=1,pady=15,padx=10)
Username=ctk.CTkTextbox(root,
width=120,height=90)
Username.grid(row=3,column=1,pady=15,padx=10)
Avatar=ctk.CTkTextbox(root,
width=120,height=90)
Avatar.grid(row=4,column=1,pady=15,padx=10)
button=ctk.CTkButton(root,
text="Send",
width=200,
command=lambda:send_msg(Username.get("1.0","end-1c"),Content.get("1.0","end-1c"),Discord_webhook.get("1.0","end-1c"),Avatar.get("1.0","end-1c"),respond_label)
)
button.grid(row=5,column=1,pady=15,columnspan=4,padx=10)
root.mainloop()
create_gui()```
So not exactly a bot but its discord related, what could i add tho
or improve
(webhook sender btw)
You can use any of the popular libraries to simplify webhook usage dramatically
I just used requests cuz i found it the easiest to use
Have you tried using the webhook utilities in a discord library?
I don't think it's necessary for such project to install a large dependency
It is only a couple of lines to send a webhook, you dont need an entire library for it
I do recommend following formatting conventions tho
Such as snake_case for variables and a = 5 instead of a=5
And spaces after commas xD
Yea ik my code is hard to read 😭
It's not necessary but in the grand scheme of things, a few extra mb of dependencies doesnt matter compared to the code being more readable and extensible. Minimizing dependencies is not a very big priority especially for hobbyists
more readable
There are 17 line
There are literally no reason to download a whole library for it.
no
Use cv2's MediaGallery in a Container
how do people cluster their bots
gifs work i think
Yes images and gifs
"Literally no reason" is pretty disingenuous. Number of lines means absolutely nothing it's a completely useless metric.
The difference is between a bunch of custom written requests vs using a widely used standardized library. again "downloading a whole library" is a completely negligible cost.
Webhooks are entirely separate too from the main library too if we talking about discord.py & forks
I dont know how to code a discord bot, can someone help me?
do you know the basics of python?
Yes
take some time to read through this ig https://discordpy.readthedocs.io/en/stable/intro.html
Does it run 24/7?
Any errors you got?
No, it automaticaly disconnects , idk how to run it 24/7, idk anything about hosting servers
Or getting any domain
you need to have a way to keep the process running
That was very helpful ❤️
Gotta love mobile man 
Well it makes sense because there's a whole bunch of spaces to each side
I just have mine start with task scheduler but I almost never turn the pc off so its always active
this is an interesting question to which I had a decent guide saved somewhere
I'll try to find it
Agree
You ask for readability
That is clearly readable and your preference of more abstraction by downloading a very large library and then using only a very specific functionality discord.SyncWebhook is just unnecessary
The library is built to be able to do the task, but not specifically this task, and this just add even more complexity
Define "very large"
I never said it was necessary either but continue putting words in my mouth
17LoC compare to installing multiple extra dependency
Okay we both agree it's unnecessary. Just like making raw requests is unnecessary. So your point?
Why are dependencies inherently bad?
!
Just like making raw requests is unnecessary
??????
Depends on more things that clearly isn't needed
This is like saying:
I need to install numpy because I need to add 10 to each value in the array
You can do literally anything without dependencies
that's just a meaningless argument
The dependencies are useful when they meaningfully abstract away tedious or unnecessarily complicated code. Knowing the headers that discord expects and the json format they want you to send absolutely qualifies. I'm really confused why you think downloading a few mb of a library is like some herculean feat that needs to be avoided unless it's absolutely necessary
In this case, it doesn't meaningfully abstract away the tedious or unnecessary complicated code. You just move to knowing how to make a http request to knowing how a library works
This doesn't make it easier, it in fact makes it harder
This is similar to my argument, here
I need to install
numpybecause I need to add 10 to each value in the array
Yes, it abstracts away that you have to write a function map etc.
But clearly it is easier to just do it without numpy and having to research about it
You seem to just ignore the fact that you need to learn how the library works, every library you use is an extra part of code that you have to manage in some way
I'm not ignoring that. Using the webhook utilities from one of these libraries is a 10 minute exercise
It was just a suggestion and not an assertion that this this the only way to do it, you're reading way too much into this it's really not that deep
You would be unlikely to find anyone with sufficient skill and willing to dedicate a long time to teach you for free
The best way to do it is basically:
- Self learn it yourself, many people do it this way
- As some suggestions given by other user, such as cs50p which is free, the documentation of python is also free. There are other service doing similar thing that might require to pay, but is entirely optional and most people don't when taking this path
- Learn it at school
- Pay some tutor service outside of the server (note that asking to/for pay is not allowed in this server)
is there anybody here that hosts in discloud ?
Anything that markets itself as a "bot host" is a scam. "Bot hosts" don't exist
so should i look for VPS?
IMO yes, I would only recommend using reputable hosts that very clearly describe what they're selling you which is just a rented Linux box
ok, thx
Any free bot devs in here?
As in you want someone to spend their time to make something for you for free?
No
Hello guys,I want to code a Yu-Gi-Oh bot that can give the database of the card I name and rates of it's usage and what decks it's being used,idk where to start so can you help me how I can code something like this?
What have you tried and where are you stuck?
I tried to write a function for it but idk what function to write that uses the website database
Does the website have an API that you use
I assume that's what you're referring to with "database"
I think,I'm not so sure
"Website database" 
Do you have the URL for it
Yes
Mind showing me
Ofc
I mean if the question isn't specifically about discord bots, this isn't the right channel. If your road block is getting this data, it's not even a python problem
Anyway that website doesn't seem to have an API
Well I wanted to code discord bot for it so I don't have to keep changing tabs between discord and my web browser
So I can't use it as my website database?
"Website database" isn't a term
Only unofficial ones but I'd never recommend using unofficial APIs without carefully inspecting it
You'll need to first find a way to access the data you want in a digestible, reliable way. That may or may not exist
How can I do that?
By googling and asking people I guess
Oh, alright. I'll do that then
I was hoping to get the answer here but I guess maybe my request is out of reach
Is that even possible?
https://www.yugiohmeta.com/api/v1/cards?search={query}
Added some URL params in the image
Oh
Now I'd love to help with it, but that endpoint returns a number which I have no idea how to use
If they're not publishing an API, they probably don't want you using it
begone crypto bro
Do you defer responses if they might (very rare) take more than 3 seconds? Or is there a better way to handle this?
Depends on what's causing it to take that long
It feels like often there is no in-between, the thing you're doing is either instantaneous or will take too long. Is the reason it sometimes takes more than 3 seconds an edge case?
I almost always defer the response personally
I personally always defer API requests, DB requests and filesystem calls (if i had any)
I think the important thing with defer is to make sure to still respond with an error if something fails (when possible)
Line 113 is way after the API call
Traceback (most recent call last):
File "/cogs/riot_verification.py", line 113, in verify
await interaction.response.edit_message(view=self) # noqa
(otherwise it would go to the error handler)
Can you explain more? Do you have a separate timeout handler for the API call?
This is an external, not discord api? Then yeah defer, you have no guarantees on how long it'll take.
The rule of thumb I've heard that I agree with 99% of the time is that your interaction response should be your first await
agree
No timeout handler for either API or DB
and if this got longer than 3s when interaction response is the first await, then you got a bunch of thing to fix probably
I was thinking about that too (putting the interaction response first) but then, if it failed along the way it would give the wrong impression to the user
You could respond, then edit with an update status
I need to call the API first before responding
async asyncio.wait_for(aw, timeout)```
Wait for the *aw* [awaitable](https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables) to complete with a timeout.
If *aw* is a coroutine it is automatically scheduled as a Task.
*timeout* can either be `None` or a float or int number of seconds to wait for. If *timeout* is `None`, block until the future completes...
Is it a good practice to combine asyncio.wait_for + gather?
# Task 1
summoner_task = client.get_lol_summoner_v4_by_puuid(region=selected_region, puuid=fetched_puuid)
# Task 2
match_task = client.get_lol_match_v5_match_ids_by_puuid(
region=selected_region,
puuid=fetched_puuid
)
summoner, match_ids = await asyncio.wait_for(
asyncio.gather(summoner_task, match_task),
timeout=5
)
!d asyncio.gather
awaitable asyncio.gather(*aws, return_exceptions=False)```
Run [awaitable objects](https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables) in the *aws* sequence *concurrently*.
If any awaitable in *aws* is a coroutine, it is automatically scheduled as a Task.
If all awaitables are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in *aws*...
nvm
you'll want to try/except that since the timeout throws an exception, but yeah I think that should be fine?
or just
!d asyncio.wait
async asyncio.wait(aws, *, timeout=None, return_when=ALL_COMPLETED)```
Run [`Future`](https://docs.python.org/3/library/asyncio-future.html#asyncio.Future) and [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task) instances in the *aws* iterable concurrently and block until the condition specified by *return\_when*.
The *aws* iterable must not be empty.
Returns two sets of Tasks/Futures: `(done, pending)`...
All good thanks for the help anyway,I just wanted to know what's my starting point
So Ur saying they went full Nintendo on that?
It's not very rare
It's pretty much mandatory if you do an API call
For me at least
If I want to access the view's message (for example to edit it in on_timeout),
Do I just do something like:
msg = await interaction.original_response()
view = MyView(msg.id)```
Or is there a way that doesn't require doing that call?
does anyone know a site where i can host and code my bot for free?
can‘t pay for ghostbot
class MyView(ui.View):
def __init__(self):
super().__init__(timeout = None)
self.message: discord.Message | None = None
#your command or smth
view = MyView()
message = await interaccion.send_message(view=view)
view.message = message #assign the message here
i got another ygo website that has the same web database i need if it's helpful i can post it here to check for it's api
Perhaps contact the service owner to ask them if/how they'd like you to access their data?
I ended up using a task group with timeout
I doubt anyone would answer me but I'll try
Do I have to call view.stop() manually if I override the on_timeout?
Can look at the source real quick and see if the base on_timeout does anything
Nah just pass
Hmm but if just pass, then how is it supposed to call stop by default? Or maybe it doesn't do that at all?
Unless the stop is more internal
It is
The library removes the view from the store on timeout by default. Stop isn't required, that's just how you do it manually

My bot is down because I hit 100 servers and its not have the privileges for . Privileged Gateway Intents
I don’t know what to do with this form can anyone help me
Developer Portal -> Bot
Click the button
I believe the instructions there are clear enough

Unless this specifically is what you wanted help with ("form")
What do you mean down? You shouldn't be able to go past 100 unless you intentionally verified, that's the point where you'd lose intents
Or just disable the intents as you probably don't need them
I was wondering; can I access member.activities with just Presence intent but without Member intent?
Funny that I got just one command that needs presence intent, no idea if I'll get approved
Probably not if it's a built in feature
Well yeah it is, I'll either move that command to a tiny private bot or idk 😭
So I'm assuming the member won't be None if I have presence intent?
There are 3 and they're included in .all():
- message_content: gives access to
Message.content, .components, .attachments and .poll, required for prefix commands - presences: gives access to
Member.activities and .status - members: controls members cache and required for having/fetching a full list of a server's members
Slash commands don't require any intents really.
It's complicated
But it will probably will be None
I can not enable the because it says
This action cannot be performed because the application has reached its maximum number of servers.
Enable what
Hmm so what'd be a way to access their activities? Only using the presence update event?
You can't do what?
And his king it takes to verify me after the apply of the form
That and querying per user ids
I forgot that dpy drops the members sent for presences if the members intent isn't enabled, so you don't get them
https://discord.com/channels/336642139381301249/1401223828075581450
Yeah that bot won't get approved with such tiny usage of the intent
Perhaps I will not give up the game tracker bot so I can have that there xD
Fr?
Yeah, I already changed some things to use mentions, and woke up to seeing "unknown user"
Great work Discord

Apparently it was leaking information to places it shouldn't have
I don't really see how, to have a mention you must have that user's ID.
And if you have their ID, you can just fetch
No idea how mentions bring a big difference
You cant fetch a member you dont share a server with
You can literally do that and see the whole profile using the protocol link anyways
Generally?
Because you can't use the link with a user you have no mutual servers with (or not a friend with)
xD
Lala said that it was leaking role and permissions data too tho
For now Discord doesn't even detect my games
Registered Games section shows it but my profile doesn't
How fun
async def vote(self, interaction: Interaction) -> None:```
how to make a command that has no parent be synced to a certain guild again?
i only remember groups, i forgot how to do it just for a single cmd
i figured it out, mb
auto_react_users = {}
@client.commmand()
async def ar(ctx, user: discord.Member, emoji: str):
auto_react_users[user.id] = emoji
await ctx.send( f"Auto react with {emoji} enabled for {user.mention}.")
Anyone have the code for AR?
Does anyone know why my Auto react code isn’t working ?
auto_react_users = {}
@client.commmand()
async def ar(ctx, user: discord.Member, emoji: str):
auto_react_users[user.id] = emoji
await ctx.send( f"Auto react with {emoji} enabled for {user.mention}.")
I don’t see the error in the code thanks
its apart of myself bot code im trying to make a command for example
(prefix = ,)
(Ar = Autoreact)
,AR @user {emoji}
When command is active everytime @user messages it will auto react with {emoji}
Yeah so how do you do the last part
thats what im trying to find out my code is completely wrong
I cant remember anything of discord python AR is a real thing used in most self bots i just dont know the line for it
Ah so that's your question
So for that, you need to listen for all messages that your bot can see. You can do that using the on_message event, in that you get a discord.Message which has attributes like .author to get who sent the message and more.
What you need to do is check whether the author's ID (.author.id) is in your dict, and then use the .add_reaction("emoji here") method to add the emoji to that message.
Simple example of how to listen for the mentioned event:
@client.listen("on_message")
async def auto_react_handler(message: discord.Message):
print(f"{message.author} sent a message in {message.channel} with content: {message.content}")
Note that the event is called for all messages in all your servers, including from bots.
Now you try to implement the auto reaction.
self bots?
I've been in a server where there was a user auto reacting
I also saw a user with chatgpt integrated 💀
Every time you mentioned or replied to them or DMd them
Apart from that I know a single bot that uses a selfbot for one of its commands
As a matter of fact it has a selfbot user in this server, Idk who
does it necessarily have to be a "self bot"? couldnt it be a bot in the channel firing off for an oauth application executed on behalf of the user?
idr but I thought there was a permission for OAuth apps to send a message as the user
🥴
It uses the /profile endpoint - it shows user's bio, all badges, etc.
It shows where you were last seen (server and timestamp) - it shows even servers where it's not a member. So it must use a single or multiple selfbot users that are used for that.
Its privacy policy does say it tracks your activity by default and you can turn it off, but it's still very sketchy, and probably against Discord's ToS, wouldn't it be?
idk, it still sounds like the realm of possibility of being an OAuth app, like if it has the OAuth permission to read all messages for your account I feel like that is enough to track your last seen status
if the user sends messages in guilds that seem automated tho, thats very fishy
I've seen a user that that bot tracked but that user never installed the bot

But the profile part is most definitely a selfbot, I don't think Oauth2 has a scope for that
If a bot knows non mutual servers without an oauth grant, that's absolutely breaking at least one tos
The limit is 4k characters on the entire view
You can have 4k characters inside 1 text display or 2k in 2 text displays, etc
Alright thx
I thought it was 6k
Decided to use /applications/id/rpc for the description
the right side of Recent Games looks very empty but on mobile its good
Tested to confirm: In components: Components displayable text size exceeds maximum size of 4000
discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token
Is it trying to edit the message using something like edit_original_response? Is there no way to edit messages after more than 15 minutes?
(context: ui.View)
What is self.message?
Well the docs will tell you what it returns
Ok
I have a check on docs but only found on non-official docs stated that single container is 4k limit and total is 6k for a message 
Well I'm kinda lost then, maybe I'd have to use await interaction.original_response ? idk
And what does that return?
The original interaction response message.
And is your timeout more than 15 minutes?
yes
class discord.InteractionMessage```
Represents the original interaction response message.
This allows you to edit or delete the message associated with the interaction response. To retrieve this object see [`Interaction.original_response()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.Interaction.original_response).
This inherits from [`discord.Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message) with changes to [`edit()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.InteractionMessage.edit) and [`delete()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.InteractionMessage.delete) to work...
So this
If it's a ephemeral message (or if your bot don't have permission to read/write message in the channel normally to) there are no way 
Yea ik
But otherwise, you could try take the channel id and message id to fetch the message
You could try making a PartialMessage and editing it through that
Couldn't I just save the message's (edit_original_response) id and channel and edit it manually
Or this ye
Also save a call
No since it's only valid for 15mins
Interaction token is only valid for 15mins, so you cannot use that afterwards
However, if your bot have permission to, then you can just edit normally using bot power
i never said ill use it
id and channel id

Woah it's been a while, is discord.py back?
TypeError: expected PartialMessageable, TextChannel, StageChannel, VoiceChannel, DMChannel or Thread not <class 'discord.channel.GroupChannel'> aw man
Well fair enough since it's not messageable
Can a bot not edit messages in a group channel?
I'll either disable that command in group channels or I won't have (for now) logic for on_timeout that'll work in group channels
The bot cannot normally send message or view message in a group channel either
As said
The bot isn't physically invited into group chat
Send? It can
Sorry for ping
Wdym by normally
I might just add back the on_interaction that responds to expired components..
The only alternative for that specific command would be a dict that stores game sessions by message id or something
I really cant think of anything better lol
You can view and send message to the channel at any time, without requiring user to specifically interact with it

And in group channel, you cannot do that
Yep
Which therefore this method won't work and restrict so you must send the message within 15mins
Or just not update the message?
I really dislike the "This interaction failed", so no
It just tells you something wrong happened and as a user you don't know what happened
Huh? You don't need to edit a message to avoid failing an interaction
If this is for your timeout, you really should consider lowering it under 15 minutes
Hmm would it be right to lower a game's buttons to that
Not sure
Maybe I can lower it for group channels only, that could work
Also an alternative if possible: just make it don't timeout
If it must have a duration, only disable the component and tell the user when they interact it in group channel
Can't just make it not timeout:
If the bot restarts, and it occasionaly does, the buttons will stop working
DynamicItems?
I have the option of converting it to dynamicitem and using a game session dict but for now I dont want to do that
anyone know this issue?
yeah but its not even spitting out a error or anything
it usually says smth like
“running moderation bot”
It totally depends on what happens in your code in the global level
well i dont got a .env so wld that be why
Are we in a guessing game of what happened
We dont have access to the file content like you do
okay do u want the code
like im lwk lost
You need to provide the code or some context
if u wanna read through 745 lines igu hold on
Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
Your token and probably also the run stuff are indented inside the command
wdym
This won't ever run the bot:
@...
async def lol(...):
...
TOKEN = ..
...
You probably meant to do:
@...
async def lol(...):
...
...
TOKEN = ...
bot.run(TOKEN)
so replace mine with urs?
Just add this line in the end
That won't work...
Indent everything from the first # till the end back once
❌
TOKEN = ...
bot.run(TOKEN)
✅
TOKEN = ...
bot.run(TOKEN)
Man
Can't you just let them do it themselves..
And actually learn something from it

No they shouldn't copypaste anything
Mine is filled with placeholders on purpose
Ah yes now they're back with another error because you have them the full solution
i fixed the indent "accidental space" now this
Please make sure your bot.run is on global level !
Not inside an async function
It's that simple 
sooooo what i do
im ngl im so exhausted im barely awake
Select your bot.run and do shift + tab
@solid apex out of curiousity, do you know basic python?
xd
if you dont know basic python syntax etc, its not a great idea to instantly get into discord bots
When you run or import a file - everything on the global level (indented as back as it can be) is being run
But why would they learn python now when someone is spoonfeeding the exact code they need and they can come back here for more.. amazing isn't it
(Also for that reason using an if __name__ == "__main__" check is necessary sometimes)
fair enough
Updated link, it should work now @solid apex

Fml
I like how you want to help them, but just sending the code for them will make them less independent
oh i remember when i also used to beg for spoon feeding when learning lua 😭
Only one I ever did that with was chatgpt
Meh it's a 3 line of code
💀💀💀
Yeah "that's not serious right?"
Well if they don't know basic indention then 3 lines of code can definitely matter
But I'm not going to argue about this
3 lines of code that they dont understand
Hopefully they will learn from it
They won't
That's how it works
Hi guys I am new to python
So can u give me some introduction to it
*read
#python-discussion would be a better place for that
his tutorials are quick and easy
personally i learn more when watching, but its preferance
It's not preference. This has been studied and proven wrong
Only reason why one would respond to videos more is attention deficit issues
mhm
Ty I will watch some videos
Fr?
Yes, they have debunked the concept of "visual" learners or any other kind of learning type. The correct medium depends on the nature of the content, not the person receiving it. Ironically, veritasium has a very good video summarizing the studies
Any preference someone has for a medium regardless of the content stems almost exclusively from tiktok brainrot attention issues
Courses/tutorials, read docs, experiment, get some ideas from here/communities like this, AI/GPT and stack overflow
why have you sent it twice?
I wonder why the majority of in-school teaching is done in a modal that combines elements of live/video learning and self paced learning.
Because it works
Mixed media approaches tend to be the most effective, pivoting as the nature of the current material changes
As long as you are willing to learn, there is nothing that can stop you
@timber dragon Why are you giving me the skull emoji?
I don't agree with the AI part
AI is an utter dogshit learning resource
AI is the future
Okay, so is the sun exploding
It is as a learning resource. I've worked in applied AI in the industry
In its current state, generalized models are really only suitable for augmenting existing expertise
Obviously I never meant to rely solely on AI or google
It provides nothing that other methods would besides the potential for misdirection. If you need to fact check everything AI says, why are you bothering it in the first place
Simply because you ask, and you get direct answers
And if those answers are wrong? You're either checking everything or just hoping it's right
The whole point of learning is that you don't know the thing you're learning. That's why I said it was dogshit for learning specifically
That is why you use it as a tool, not a replacement for everything you do
Right but....if you're learning, how do you know how to use a tool
That's like giving a baby a knife, which is a tool but just because it could use it right doesnt mean it will
It's better to learn with a match than a bonfire
Or you could just use a resource that is vetted, peer reviewed, and accountable
I would say context dependent, if it's python (builtin+stdlib) then it probably is fine, but if it's stuff that is more specific, you probably should use the specific resources than AI
I tend to use AI from time to time when, for example, I need ideas on how to implement this and that, or features to consider making
But not for making the whole code for me
Which is what I did at the beginning and ended up with an unoptimized bot with confusing code

hello i whant to do an signal bot for trading but i am an noob at this, can i please get some help***
Where are you stuck, specifically?
we don’t help with signal bots here
In this channel or in this server?
I guess in the server
we don’t have a dedicated channel for signal bots so not this channel
i should have clarified, sorry
I'm French, can you help me remove the yellow highlights? Please tell me in PM.
Did you load venv and install discord.py in it?
I would imply it's used unless they say no
It's always better to use venvs
Have never said otherwise, it's besides his question anyway
im gnna guess, you either used ai or followed a tutorial, id say you should make sure to pip install discordpy
hey
was wondering if someone could help me integrate my website to a discord bot
e.g the website sends info to the bot so it can log it
So you want to log users signing up or something like that?
Wouldn't recommend doing that, at most logging amounts of people
yes
i prefer it on discord
yeah user passwords their usernames ect
Log users' passwords??
For what purpose
You only need to save such information safely in a database
only going to be me in that discord server
by me i mean a alt account
Still, never ever log a user's password in Discord..
Or anywhere that's unnecessary
If you're really willing that much (bruh) to see your users' passwords, this will still be a better option...
i would like to log it the thing is in the website i dont offer anything of monetary value
there is no reason for anyone to hack anyone
and no reason 4 anyone to breach it
Not going to help you with this, sorry
alr np
The flow you're describing is incredibly vague
Why not just use discord OAuth, which is the thing that built for this
Just a point on
You only need to save such information safely in a database
and
Still, never ever log a user's password in Discord..
Or anywhere that's unnecessary
Don't log passwords, don't store passwords, ever, with the one exception of if you're making a password manager. If a user gives you a password it shouldn't end up anywhere - logs or a database - until it's salted and hashed, there's no reason a plaintext password should be anywhere other than in-memory briefly while converting it to a secure format (i.e. an argon2 hash)
When I said database I never implied that it'd be just raw text
but yes you are right
really anything that purports to handle credentials in the context of a discord application is a massive, massive red flag. Either you lean on discord for users to authenticate, or if you're using other services there should be an oauth flow. You shouldn't be handling user credentials ever in this context
!pypi argon2-cffi
I think the passwords are not stored in plain rather hashed with an algo.
yes hash them through multiple types etc
I don't think chaining algorithms is a good idea
using 1 algorithm means if it got leaked or breached, you are cooked
If you really need use slow hashing algorithm
discord.py v2
from discord import Interaction
from discord.ext import commands
from discord.utils import maybe_coroutine
class BasicCog(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
async def interaction_check(self, interaction: Interaction):
check = await maybe_coroutine(super().interaction_check, interaction)
# custom code to check and return if False
return check
my type checker goes insane. What is the proper way to override interaction_check method?
issue is Return type mismatch: base method returns type "bool", override returns type "CoroutineType[Any, Any, bool]"
should i just remove async?
Does maybe_coroutine always returns bool?
Interaction_check returns a bool. The base interaction_check doesnt do anything so why would you call it?
maybe in case something overrides it, idk.
what would override it
me? like literally right now. i think i should ignore the error
You don't need to prepare for a hypothetical situation only you could bring about
Otherwise you're going to continually introduce unneeded spaghetti code
(Like calling a base method that doesnt do anything by design)
what is this point of this interaction check
you overrode the interaction check to return a static True, so you make sure you don’t override it…?
yo i have a question with discord.py i want to make my own discord bot, but how can i get the message that another message replied to?
like message.reply.content
how do i do it
Can you defer when using modals?
Depends on what you mean and which step
I want to defer and then send a modal with the same interaction
why do you want to defer sending a modal
Because I’m doing DB and API calls before sending it
what do you do in the api call that need to be processed every time someone interact
What does that matter?
you can send a head up message with a button to call a modal
But you can't defer + send modal
because i dont know what is the flow, the modal is depended on the api call result? is the result static? can all of them be simplified to select menu in a view you can send with defer?
Yes, it's not static
It just checks if the user already exists in the DB and sends the model
Why does that take more than 3 secs
It could
a sql would not take more than 3 seconds
It shouldn't and shouldn't that be checked before the command
There is a possibility for some API calls as well
Try it
Else that's ^ your only option
Or just always send the modal and do postprocessing on submit
I want the check when they click the button and before submitting it
I mean you can't wait more than 3 seconds between an interaction and sending a modal. We've given you the options
Either send the modal quickly and do whatever after, or gate the interaction that sends the modal in the first place
If you want to have an API call, then really just respond to the interaction (maybe a custom loading message) then check
There really is no benefit of using defer over normal interaction response (from what I know) - it's just about visuals
Nvm you meant before opening the modal - then just defer the command response and check, then have a button for the modal..

hi guys i uploaded a gif to my discord bot avatar and it only shows the first frame , its like image
Under which tab in the developer portal?
general information
That's only for images, use Bot tab for GIF
Either way, have one at the general information tab, but yeah it's going to be static
ok ty
Not sure if I want to use the presence intent in production
The bandwidth consumption is crazy apparently
Hmm, how crazy could it be
For 1 guy I know it got to 3TB a month just from a single large server
It's very unfortunate that there is no way to filter out the presence change events
and that is...
Probably meant the incoming events, those cannot be filtered
Yes
You can't set which events you receive, you will receive presence change for every member accessible
Well, for mine, my bot have about 400-500GiB bandwidth usage per month with a lot of server
Mainly from presence intent?
Because if it's a music bot then I assume its usage would be high anyway
Probably not just that, it also sends a bunch of API request

Well there's the underlying question of why you need to know what everyone's presence is
in nextcord i created a loop task but in it after a certain line the code just stops running like i did return
asyncio.create_task(coro()) ?
@tasks.loop(hours=24.0)
async def download_vids_clips():
clip_urls = []
for acc in clip_accs:
clip_urls += scrape_profile(acc)
clip_urls = filter_urls(clip_urls)
vid_urls = []
for acc in vid_accs:
vid_urls += scrape_profile(acc)
vid_urls = filter_urls(vid_urls)
download_clips(clip_urls)
add_urls_to_processedUrls(clip_urls)
download_metadata(vid_urls)
filter_metadata()
download_videos()
add_urls_to_processedUrls(vid_urls)
i start it with download_vids_clips.start()
Idk what @tasks.loop is, I'd just use asyncio.create_task 
But that doesn't really matter, probably code error
Do you have any logging or debugging to understand what's happening in here?
i added prints to the last few lines
Tasks.loop is just a thin wrapper over asyncio tasks
Probably hitting an uncaught error
Did you get any error
That won't necessarily recreate the same conditions
Does your code execute all the way until download_metadata?
You should verify that you have proper error logging, and barring that put a try except in here directly
Does download_metadata do API calls
why tho, since im not passing any args shouldnt it create the same conditions
uhhhh
It should if the code runs all the way til there
it does webscraping
bs4?
no
selenium?
no the download metadata runs
Yea I know it does
after that the problem is with the filter metadata
Try running download_metadata alone
the print after it also runs
Ah you said otherwise but ok
Does anything after filter_metadata run
nope
Can you send its code unless its something sensitive
The fact none of this is async is worrying
they should be?
im not very experienced in discord bot and async
And probably violating tos if you're using a scraper to download videos
Yeah I am worried the bot loop is blocked
But they said there's no error so Idk
so the problem is the funcs not being async?
Oh the sad reality
and in tasks if theres an error is it silent
If it is against tos, it's against the rules to help with here
So you should probably start with describing what you're doing
the thing you are helping with isnt the thing that breaks the tos
You might wanna use either official API or even an unofficial one so you'd be "legally safe"
But yea
im using a package
Explain how what were helping with isn't assisting you in violating tos
they label themselves as an unofficial api
https://business-api.tiktok.com/portal/docs in case you want to check it out (looks like straight buns)
TikTok API for Business is a series of interface services provided by TikTok for Business to developers. Through integrating and calling the TikTok API for Business interface, developers can leverage our interface to interact with TikTok Ads Manager, TikTok Accounts and TikTok Creator Marketplace functionalities.
no api for download
and they dont give any keys whatsoever
Well I cannot help further than this
i hate tiktok i wish the videos were on another platform :(
can you answer this
are errors in asyncio tasks silent
Shouldn't be
Maybe start by not making something that violates the terms of the service you're using
Not that I know
im not violating anything :(
Okay then what's the service you're downloading videos from?
That's not a service
oh
If tiktok is the service you're pulling videos from, you should read their terms of service
it skips it
Ngl this was a smart move now I don't have to create a separate client for each file
erm, akshually, its self.client: None | AsyncClient = None
I knew someone would say this
How to create a discord bot?
A hands-on guide to Discord.py
Thx
What do i need to do to get discort devoloper accses?
ty
is there a job board? im looking to hire someone to help build a discord bot
Does anyone know how to make these lines and buttons in the middle of the embed like Rythm or other bots?
components v2
what lib?
thx ❤️
@jaunty quail
I have good experience in development discord bot, so I can help you.
With or without ai
here is the prompt
open chatgpt login, then go to Code pilot 10x programmers
'Help me make a general full purpose bot for management and stuffs, code it on python and send it on one file simply.'
make your folder, name it whatever u want, make new text document, paste the python code, save as [Botname].py'
make sure u made ur developer portal first and get the bot_token, also remember to store ur token in .env
then learn there
@celest briar thank you
its ur choice, either to work for fun or work for real, use AI for fun, if you want to learn then go to learning sites about python and stuffs or even here at #1035199133436354600
I'm not sure how someone looking to learn would find blatant, unaccountable lying "fun"
It's not clear that you posted this as a joke. And if you did not post it as a joke... It is terrible advice.
okay bru @lavish pollen mb for that sh
you can learn here fr: https://realpython.com/how-to-make-a-discord-bot-python/
Unfortunately, that is also a really bad tutorial
The best thing to do is pick a library and follow their official docs, guide, and examples
Oof tutorial literally advocates breaking dev policy as one of its first use cases 😂
It's so outdated it does not have intents. Yet still shows up as a top result
seo moment
hi, i want to find the way some bots use the /commands as mentions , is it wasy to do and does it have spam limits or smthing?
There's a .mention on the AppCommand object, or you can just format it yourself
It's just </command:1234567> where that's the command's id
ty, one more question , how can i put the buttons inside the embed? not below it
like the image
new function?
for the traditional text based bot with slash commands too, do they still use on_message event in dpy? or commands.Bot
As of a couple months ago. It is a component, like buttons and selects.
does discord.py have support for it? i recall seeing a PR a while back but not sure where it's at now
Yeah it does now, was released a week or so ago
Anyone here experienced with Discord Bot dashboards? Like connecting a Discord Bot to a dashboard.
Like creating a web dashboard to configure the bots settings?
hello , i want to ask how can i use a modal components function with a dropdown menu? can i include a dropdown menu and a description in a modal components function?
something like this
You must put the select inside a label component
can u put 2 dropdown menus or just 1?
ok ty
components v2 doest support gifs inside?
u are right
does ui.LayoutView mean we can have multiple sections each with their own thumbnail
uh that does not mean anything really cuz you can't even use a thumbnail in ui.View
But yes, you can have mutliple sections with their own thumbnail
YO GUys
Suppose i have the code to a discord Bot
i user replit for now how do i make it alive 24/7 is there any free alternatives or like its pure pay
If you have a credit card google and oracle offers a very small cloud computing instance that would suit a private bot
ah
Aws also have a 12mo micro instance trial
Like i tried using uptime bot
that never worked 😔
pretty cool what u can do the bot can
- send a preview of anyone who pinged u
- send instant embeds
- create tickets on command
Running a fake web with the bot run under and keep the process online by pinging them is likely tos violation
Replit was actively blocking discord domain before
It costs money to run servers
Or you can self host (indirect costs though)
oracle free tier is the best; i've been running my bot shy of a year now with no issues
you don't technically need a credit card; you can use a debit card
alr
ty for ur help ❤️
hi guys . i am using top.gg for /vote . but now each user have to use the command again after the vote to claim the reward. is possible to make it automated? when user vote to instantly auto give him the reward?
Pretty sure they got webhook events for that ^
they do
Can anyone help idk how to fix this😭😭😭😭
pip isn't a program on your path
Try py -m pip in replace to pip
how to make hybrid command groups?
Take how you make a normal group, add hybrid_
?
Do you guys know any good ideas for my discord bot some ideas who challange me please reply or send me it to dm thank you!
a bot that generates ideas
Wait you low-key onto something
a bot that generates codes for practice
Discord bot that connects to any one public API. Like exchange rates or pokemon or dad jokes.
A discord bot that automatically deletes itself
Hello, because my creativity is very low I ask here if you guys have any ideas with which features I can build a discord bot cause I dont have any ideas. I have build a Website Scanning Bot
Build a bot that tells people what kind of bot to build
What is a website scanning bot
Sounds like another way to say scraping
Yeah
Wild
hello i used a ticket from a server , i typed my problem and the ticket started like this ,me with the "APP" next to me
how can i do it what is the function for it?
is it a webhook?
Yeah, it's a we hook with a custom pfp and name
InstructionsGroup has parent set to AIChatGroup.
I get the error:
CommandAlreadyRegistered: Command 'ai-chat' already registered.
What's the correct way to do this?
Okay I added add_command(InstructionsGroup() to AIChatGroup instead of using parent, removed the add_command of InstructionsGroup in the cog, and it works
You shouldn't ever need to manually add commands yourself
Just declaring the group in the cog is fine
Do you perhaps want a GroupCog
does anyone know how to get the bot to have an actual status like an user profile?
instead of activity
That is an activity. status is specifically online/offline/away etc
How do you do the code box looking thing
backticks
What is that
```
Could someone answer a question?
How do you load the Bot commands? For example, leave the emojis in a folder and load them.
What does a command have to do with emojis?
leave the emojis in a folder
🤔
How would i make a command that resets another commands cooldown for everyone, and an option to reset it for one person?
for example like reset the cooldown on this command:
@client.tree.command(description="test")
@app_commands.checks.cooldown(1, 300, key=lambda ctx: ctx.user.id)
async def test(ctx):
await ctx.response.send_message("Test", ephemeral=True)```
Ngl I just made my own cool down system cuz dpy's sucked
Lemme introduce you to dynamic cooldowns: https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.app_commands.checks.dynamic_cooldown
It's not resetting, but rather you can choose not to apply a cooldown if certain conditions are met
🤔
what sucks about it
unnecessarily complicated for dynamic cooldowns
this was how i made mine https://github.com/disutils/disckit/blob/main/src/disckit/utils/cooldown.py
and it's usage https://github.com/disutils/disckit-example-bot/blob/main/cogs/examples/cooldowns.py#L118
the decorator cooldown automatically handles the cooldown reply which you can configure, and if you need to handle dynamic cooldowns you can simply check if the user is under cooldown via CoolDown.check then add the cooldown on them (CoolDown.add) or reset it (CoolDown.reset)
there is some room for improvement but it's much simpler to use than dpy's version imo
It's not unnecessarily complicated just because your specific use case is simpler
A public library needs to cater to a wide range of use cases, not just yours
It's unfortunate that CooldownMapping is undocumented
But it's easy to make it do whatever you want like add a check etc
damn
:white_check_mark: Your 3.13 eval job has completed with return code 0.
001 | Theres a discord bot sec too
002 | Collio, Im a bot too
erm
Only if you are using interaction and not using the gateway
So I don't need to use interaction?
in discord portal
My bot in the server but it's offline
Your not required to use interactions, but it is the best way to get user input to your bot. I dont know what you mean by in the dev portal
So I have to use coding make it work for token than?
Yes, you need to have code and run it for your bot to work
Which requires a token to do most things
Ok I using python latest version
3.13
I wanna make a level bot
For test run
That way I don't have to use pay verison bots
Are you using a library?
How i use it?
I am asking if you are using one. The popular ones are py-cord, discord.py, disnake, nextcord, interactions.py, hata, and hikari. You can look at this website to choose one if you have not already: https://libs.advaith.io/#python
Compares Discord libraries and their support of new API features
let me check
Also how make my bot private by the way
in the dev portal
Your App -> Bot -> Public Bot -> Turn Off
Thanks I like keep my bot private not for public
brb for sec
Public Bot
Public bots can be added by anyone. When unchecked, only you can join this bot to servers.
this one?
If you dont want people other than you adding the bot to servers, yes
Thanks 🙂
Private application cannot have a default authorization link what this mean?
You cant have the "Invite App" button on your bots profile if it is private. In the dev portal go to Installation and set the "Install Link" to none.
thanks
it works yay
let me check my bot in my server if private
Yep it work
How make level coding?
write out the logic -> translate that into code
The core components you will need are
- Detect a user sending a message
- Add to the users XP
- Persistently store the users XP
- Do something when the user reaches an XP threshold (levels up)
How I find my guild id?
Do you have developer mode enabled?
yes
I should clarify, find your guild ID as a user or with code?
in my coding for guild id bot
I have to copy my bot id?
It depends on what you are currently doing. Where are you trying to get the guild ID? In a command callback? In an on_message event? Or somewhere else?
guildId: 'YOUR_GUILD_ID_HERE'
Oh, you can get it by right clicking on the guild profile picture and copying the ID at the bottom
can you show me don't show your id
You just have to right click on the server picture on the left side of your screen. Then click the "copy server ID" button
ooh my server discord
brb
Maybe this can help
why's there a library lol what
Anything that is commonly wanted needs a lib now 💀
Everything needs a lib
Nothing ever requires you to have a file named a specific thing
you can run a bot with steve.py
it say in my python i need bot.py
What is "it"?
probably the guy that makes the tutorial
It means your code is trying to find a file with that name
I guess? No idea what's in your code
Hey guys since ive got a load of tests coming up i thought a good way to consolidate both python and other subjects was to make a python bot which revolves around flashcards.
Do you guys think a csv text file, imported from anki, is the best way to import my notes
for example
with open flashcards.csv etc```
and then i can use async and @bot.command() to make commands for this bot
It depends on how big this file is and if you plan on having the bot itself modify it
hi, how can i find my /commands ids?
i want to use </NAME:COMMAND_ID>
fastest way is to just enter it into your chat bar, then right click the popup and copy id
Uhm guys do you know how to make discord online and offline fake members in python???
Automating user accounts is against discord TOS
Hello guys, I dont know if this question belongs here, but is there a way to find good and importantly free API´s cause I usually build discord bots with a API so that I learn how to get Infos from an API and how to put them in discord bots.
An API that does what...?
Like getting the weather of a location or infos about a pokemon
I mean. There are loads out there you're going to need to narrow down what you want to do
Isnt there like a website where its sorted in categorys cause I dont have any idea what I wanna do I just wanna test me throug.
If you don't know what you want to build, how is looking at a list of apis going to help anything. You should start with a problem that's worth solving, rather than picking a tool and inventing a problem to use it on
https://free-for.dev maybe this can help you
Thx
yo guys if anyone needed a midjourney api.. well, I've built one, then realized why not create midjourney from the ground up, it only took 3 months lol
How do you manage to one-up the capabilities of a GPU farm?
Unless you mean it's a local API
well I'm paying a provider, I don't have my own datacenter and such
mjapi does all the complex prompting and model selection based on what you ask it
add more gpu and comput loading cap
Best for latency for?
Discord
You just need to be close to one of their server
Which you would have no particular detail info
Also tbf it needs to go through Cloudflare I think?
So maybe close to one of Cloudflare data center
Are you actually in a case where the difference in latency matters?
You're sending messages on a chat service, not doing ultra low latency crypto trading
Just curious from a tech standpoint
In theory proximity to the data centers in ashburn but with any host that has a decent network connection the difference will be so small it's not worth any effort
What solsticeshard said, but in terms of from a technical interest standpoint I'll add that while Discord does use cloudflare as a proxy just being close to a CF point of presence isn't the key, it's being close to the GCP datacentre that the traffic eventually needs to go to that affects it most, cloudflare has POPs everywhere but as solstice rightly points out, Discord is hosted in us-east-4 which is in ashburn VA, where CF also has a POP, so being in a datacentre in ashburn means your traffic doesn't ever have to transit out of the town, let alone potentially across oceans
I am pretty sure discord is running distributively across the world no?
Nvm maybe only the voice is
Is it possible to create a video embed and send it via bot?
You can't put things into embeds besides text fields and values. But you can put files into a MediaGallery that goes into a container which looks like an embed
It's important to empathize like because they behave very differently
just realised that my roleall command is getting rate limited, is there a way to batch assign roles?
currently I'm just doing it individually
@moderation.command(name="roleall", description="give all members a role")
@app_commands.default_permissions(manage_roles=True)
async def _roleall(self, interaction: discord.Interaction, role: discord.Role) -> None:
await interaction.response.defer(thinking=True, ephemeral=True)
for member in interaction.guild.members:
await member.add_roles(role)
await interaction.followup.send(f"Gave {len(interaction.guild.members)} member(s) {role.mention}")
```(discord.py)
not really, d.py already handles the ratelimits for u
Just don't batch assign roles ig
Just add some delay
alr ty I assigned it to a task so the command doesnt time out and this is pretty much working
async def add_role(member):
await asyncio.sleep(2)
await member.add_roles(role)
await asyncio.gather(*[add_role(member) for member in guild.members])

You still want to make sure to respect all the rate limits
async def mass_give_roles(self, members: Sequence[discord.Member], role: discord.Role) -> str:
for member in members:
try:
await member.add_roles(role)
await asyncio.sleep(0.42) # this is probably good enough
except discord.Forbidden:
return f"Error: Missing permissions to update roles for {member.name}"
except discord.HTTPException as e:
return f"Error: Failed to update roles for {member.name}: {e}"
return f"Success! {role.mention} added to {len(members)} member(s)."
@moderation.command(name="roleall", description="give all members a role")
@app_commands.default_permissions(manage_roles=True)
async def _roleall(self, interaction: discord.Interaction, role: discord.Role) -> None:
await interaction.response.send_message("Assigning roles in the background...")
task = asyncio.create_task(self.mass_give_roles(interaction.guild.members, role))
result = await task
await interaction.channel.send(result + f"\n{interaction.user.mention}", silent=True)
``` I went with this

Pretty sure await task literally does the same thing as just awaiting the function
XD it works so it works
What's the point of a task if you're running it immediately
"It works" yes but it does nothing different
You may want to store a task per guild so that users can't spam it
its so the command doesnt expire on large servers
what
lots of members -> loop takes longwer

