#Basic Pycord Help (Quick Questions Only)
1 messages · Page 18 of 1
how do i add tags to a forum chanel post created by a bot
tysm
how to get list of roles in one argument
i guess there is no way
someone pls help me
im trying to do the link button
and its not working
this is what i have
class MyView(discord.ui.View):
@discord.ui.button(label="go to support page", style=discord.ButtonStyle.url, emoji="😎")
async def button_callback(self, button, interaction):
await interaction.response.send_message("You clicked the button!")
@bot.slash_command()
async def button(ctx):
await ctx.respond("This is a button!", view=MyView())
and idk where i put the url in
You've got to manually add the link button using self.add_item(discord.ui.Button(label="...", url="...")) in the _init_ in the view
Also
?tag codeblock
Please put your code in a code block:
```py
Here is your Code
```
That makes reading code in Discord a lot easier:
print("This is an example.")
in the where
Add this to your view:
def __init__(self):
super().__init__()
self.add_item(discord.ui.Button(label="...", url="..."))
Add it as another method for the disord.ui.View
ok
i didnt understand what u where saying at first
Alright
i know now
👌
here bot will get that "hi"
<get this message
is there any way for the bot to access ur message
i mean replied message
gnoring exception in command owners guild_notify:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 127, in wrapped
ret = await coro(arg)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 904, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "/home/container/cogs/owners.py", line 112, in guild_notify
channel = await guild.fetch_channel(int(channel_id))
File "/home/container/.local/lib/python3.10/site-packages/discord/guild.py", line 2036, in fetch_channel
data = await self._state.http.get_channel(channel_id)
File "/home/container/.local/lib/python3.10/site-packages/discord/http.py", line 353, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
why am i getting 403 while tryna get a channel
guild = self.client.get_guild(int(guild))
channel = await guild.fetch_channel(int(channel))
no indents, worked before
idk
you literally don't have permissions
Is there any way to see who removed someones reaction
don't think so; you can see whose reaction was removed, but not the person that initiated it (in case a moderator etc. removed someone elses)
how do i add options to a select menu after it loads? when i make a Select object on __init__ it complains about the callback, and doing it in decorators doesnt work because the options are loaded from __init__ also
can you show what you've tried?
the follow_init used to just be in init
the data is passed through the bot object
oop forgot the callback
i'd done dyn_sel.callback = self.the_method
and it complained about the arguments
can you show the full error?
when i put select first it says ctx is missing, and when i put ctx first it says select is missing
callbacks don't take the select argument unless you used the decorator
what theme is that i like it
so how do i get the selected thing out? is that a property on ctx?
yeah
access self.children
is the order of that list always consistent?
from left to right
bro?
is that the order of decorators? nvm ill figure it out
oh the theme is one monokai python i think
ty
thanks nelo
if you haven’t fixed this yet you just need to call it with self (await self.toggle_drop(select, ctx))
did fix, thanks though
ah alr
@silver moat sorry i forgot to thank you
Thanks you very much for helping me 🙂
np
Is it a good practice to make the ticket buttons persistant view? the examples ^^
if it makes sense to you, then it's good
I see, it's just that I'm not sure if the persistant buttons will work for buttons that are disabled
since bc everytime after the update, through thorough testing, I somehow find bugs etc
and then depending on the severity, I have to patch it ASAP
you need guild members intent
#1016058923045888050 this bug is so annoying, it's been days and it still not patched
it's patched on master branch
I tried to install the last version of the master branch and it still not fixed
The command still don't have options
Hey, is there somehow an event where I can manage my data entries from my database for my giveaway command? I was thinking of the on_ready event, but that's only when the bot comes online
how do people enter the giveaway
with a button
so why don't you just save their entry when they click it
That is made however I must draw the yes somehow and I can not make two raffles....
?
so when i create the modal with the options so the time and the prize .. then have a asyncio with the time yk? and now when i start two giveaways then he draws only the last because of the asyncio. yk?
i'm not following
And that's why I ask if there is an event for it where I can manage it so my database
so the command brings up a modal for you to set the time and prize
Just use a task
Have it run every minute and process any giveaways that ended in the last minute
oh i see, deciding the winner
yeah that's the better option
it sounds like you're currently trying to sleep to the end of the giveaway?
yes but its not works because when i create two giveaways then is the one giveaway not working because asyncio is then for the two giveaway. can you follow or not? btw. i'm sorry for my english.
all good
Use a task
like jab said, you're better off using the tasks extension
a loop?
mhm
Okay
just have it loop every minute and check if the current time is past the giveaway's end time
In your giveaway table you store the winner and end time, and in the task you get all giveaways that ended in the past and have no winner, and then you pick the winner and update the table
Would this be a good place for help with webhooks? I currently need help with creating them in a channel when something specific is said and use it only if there's no existing webhook in said channel, otherwise it uses the existing webhook.
does anyone know how to make a subcommand within a subcommand
im trying to make a command like %cfg usr set <val>
it raises an error with my code
@bot.group()
async def cfg(ctx):
if ctx.invoked_subcommand is None:
await ctx.send("ERR: ctx.invoked_subcommand is None")
@bot.group()
@cfg.command()
async def usr(ctx, usr: discord.Member):
if ctx.invoked_subcommand is None:
ctx.send("ERR: ctx.invoked_subcommand is None")
@usr.command()
async def set(ctx, vlue):
embed = discord.Embed(title="Config ⚙", color=0xff0000)
embed.add_field(name=f"User Set", value=f"{usr} set to {vlue}", inline=False)
ctx.send(embed=embed)
also I believe it's role.members
It seems I won't be able to add it as persistent views bc of the params that it is being taken, from other classes etc
@lilac turret
urgent
actually wait stackoverflow solved
Still looking for help with this, would really appreciate it
when will this be supported in forum_channel.create_thread?
suggest it in #suggestions
okie
What is the other best way to only get text channel, since the Union needs 2 args
i tried discord.channel hoping a miracle would work since I got that option but npe
I only want to get TextChannel
nvm I can put in only discord.TextChannel, it didn't work previously now it somehow worked
overwrites = {
interaction.user: discord.PermissionOverwrite(send_messages = True),
'Members': discord.PermissionOverwrite(view_channel = False)
}
guild = interaction.guild
cat = discord.utils.get(guild.categories, name="TESTING")
ticketchannel = await guild.create_text_channel(name='channel-name', category=cat, topic="testing", overwrites=overwrites)
What do I add instead of 'Members' to call to a role?
I've tried some code using the TextChannel.webhooks and TextChannel.create_webhook, however I don't know how to get the webhooks from the list that TextChannel.webhooks generates, so it creates an error about the list not containing what I expected
Hi there, I recently migrated from discord.py too pycord, but when I did, I got an error saying that the discord.utils package didnt exist. I tried uninstalling and reinstalling several times but too no avail. Please let me know what could be causing the issue. Thanks.
pip list in terminal and send output, thanks
Ight give me a few minutes
Does anyone have mondodb integrated I could peek at?
mongodb ?
sorry for the ping it was an accident
so uninstall py-cord and reinstall it
alright tysm
Is it possible to check if a user voted for the bot in the last 12 hours?
Yes it is
how
Assuming the site has an API
Theres a library for topgg iirc
I only saw a event
hm I try ty
ty
Other question
How can I add an element to an Object?
pymongo and in general
Like this:
feedback: {
92919238298392: {
msg: "Good ig"
stars: "5"
}
92919238298392: {
msg: "not good lol"
stars: "1"
}
}
I'm still looking for help, I could send the code snippet if needed
Never mind I figured it out, thanks nonetheless!
Does anyone know how to make an argument have "Choices", for example the default /timeout command has the argument duration that shows a dropdown list of options to choose from. How can I have this dropdown as an argument? I cannot seem to find docs on it.
duration: Option(int, choices=[1,2,3])
async def toggle_url(ctx, setting: Option(bool, choices=[True, False])```
this is the context im trying to do it in, but im getting invalid syntax error, any thoughts?
whats the full traceback?
no error as i havent run it yet because i can already tell it wont work
you are missing an end parenthasee
and a colon..
and indenting
this is the best i can do when i see it
@DaveMod.command(description = "Toggles the UrlBlocker")
async def toggle_url(ctx, setting : Option(bool, choices = [True, False])):
await ctx.respond(setting)
i think i just need to sleep now. That fixed my issue ofc, thank you
anyone know why my on_ready event keeps getting called? it happens maybe once a day (i try to host my bot 24/7) and its rather frustrating as members intent is enabled and sometimes it just wont respond
this may explain why (taken from the docs):
This function is not guaranteed to be the first event called. Likewise, this function is not guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
alright
Any idea to get pylance to chill? ive checked the source, the types are all there and correct. I have no idea why this happens
if it's a bool there's no reason to use choices (also, I'm pretty sure you can't)
you're missing a closing parenthesis
i figured it out, thank you
Here's the persistent example.
Does anyone know how to set up persistent views without OOP?
Check out the guides
I believe its bot.add_view(persistent class)
In the on ready function I believe, just woke up so yeah
good luck
Use oop period
I tried to run my bot on Ubuntu VPS, but it gave me RuntimeError: PyNaCl library needed in order to use voice
So I checked the doc and it says I can install voice dependenses with this command: apt install libffi-dev libnacl-dev python3-dev
I ran it and installed it successfully, but I still get the same error.
What should I check?
did you install it with pip?
you mean the dependences?
how can I check if I have one?
It seems I have one installed
is lavalink light? i have a vm in azure with 1 core, 1 gb ram and 60 gb storage
in that i host my bot (running ubuntu 22.04)
If i am overriding the on_interaction() event, do I need to invoke the process_application_commands() coroutine as well? Because I have override it without invoking the coroutine, and all the commands work correctly.
well yeah, but if your commands are still working it sounds like you didn't actually override it
because that's the only place in the library where process_application_commands is used
https://github.com/Pycord-Development/pycord/blob/master/discord/bot.py#L1057-L1058
discord/bot.py lines 1057 to 1058
async def on_interaction(self, interaction):
await self.process_application_commands(interaction)```
I've done this:
@commands.Cog.listener()
async def on_interaction(self, interaction):
#Some code here
that's not overriding, that's an additional listener
so the original method still remains
oh, that makes sense. Then I don't really need to override it for anything
Then, how would I override it?
you'd override it in the main bot file with @bot.event if you didn't subclass
ok, thx
Hey, I am sending two help menu messages with the same view, after sending the second one if I press a button on the first message the corresponding callback of the second view object gets called, why doesn't the first view call its own callbacks and instead the callbacks of the second view? I am confused please help
because you're sending both with the same view...
make a new view if you want them to be different
but can't I create two intances of this view instead?
sure you can
why does it then always call the callbacks of the second instance even if I click on the buttons of the view which should be the first instance
yeah sorry I didn't speak clearly there, this is a slash command and if I execute it twice
What I would expect is, that the view of the first message would callback callbacks of its own instance, but I have noticed that it always calls the callbacks of the newest instance (in this case second message) and I don't fully understand why
why are you setting view.message?
you can just get the message in the callback from interaction.message
oh my bad
sadly that doesn't fix my issue tho
Please put your code in a code block:
```py
Here is your Code
```
That makes reading code in Discord a lot easier:
print("This is an example.")
sure
class help_view(View):
def __init__(self,ctx):
super().__init__(timeout=timeout)
self.context = ctx
self.page_counter = 0
# await interaction.response.send_message(view = self)
@discord.ui.select(placeholder="choose the page here or use the buttons below", min_values=1, max_values=1, options=options, custom_id="help_select")
async def help_select_callback(self, select, interaction):
value = select.values[0].split(":")
self.page_counter = int(value[0])-1
await self.maybe_disable(interaction)
await interaction.response.defer()
@discord.ui.button(emoji = "⏮️",disabled = True, custom_id="start_button")
async def start_button_callback(self, button, interaction):
self.page_counter = 0
await self.maybe_disable(interaction)
await interaction.response.defer()
@discord.ui.button(emoji = "◀️", disabled = True, custom_id="back")
async def back_button_callback(self, button, interaction):
self.page_counter -= 1
await self.maybe_disable(interaction)
await interaction.response.defer()
@discord.ui.button(label=f"1/{len(help_dictionary)}",disabled =True, custom_id="label")
async def label_button_callback(self, button, interaction):
pass
@discord.ui.button(emoji = "▶️", custom_id="next")
async def next_button_callback(self, button, interaction):
print(self.id)
self.page_counter += 1
await self.maybe_disable(interaction)
await interaction.response.defer()
@discord.ui.button(emoji="❌", custom_id="delete_help_button")
async def delete_help_callback(self, button, interaction):
if hasattr(interaction.message,"delete"):
await interaction.message.delete()
else:
await interaction.message.delete_original_message()
sorry for the messy code
and thank you for helping me
looks like your 2nd half got deleted
oh
why does it keep getting deleted?
ah theres a link in it
async def maybe_disable(self,interaction):
for child in self.children:
if child.custom_id == "label":
child.label = f"{self.page_counter+1}/{len(help_dictionary)}"
elif self.page_counter == 0:
if child.custom_id in ["back","start_button"]:
child.disabled = True
elif child.custom_id == "next":
child.disabled = False
elif 1 <= self.page_counter <= len(help_dictionary)-2:
child.disabled = False
elif self.page_counter == len(help_dictionary)-1:
if child.custom_id == "next":
child.disabled = True
elif child.custom_id in ["back","start_button"]:
child.disabled = False
await interaction.message.edit(embed = make_embed(list(help_dictionary.values())[self.page_counter]),view=self)
async def interaction_check(self,interaction):
if interaction.user != self.context.author:
await interaction.response.send_message(embed = make_embed(f"embed This is not your help menu\nUse `/help` to get your own. [Support Server]invite/wBGgE7drvt) 0"), ephemeral = True)
return False
return True
async def on_timeout(self):
for child in self.children:
child.disabled = True
try:
if hasattr(self.message,"edit"):
await self.message.edit(view=self)
elif hasattr(self.message,"edit_original_message"):
await self.message.edit_original_message(view=self)
except Exception:
pass
where were you using self.message before?
to delete the message with the X button but I changed it
do you have any idea what could cause the problem?
Hi, does someone know how to remove only the file from a message sent by a bot?
edit message with attachments=[]
In attachments.0: Attachment data not found
Hi, is there a way of restricting a slash command to a role or to exclude a role from it?
can you try interaction.edit_original_message instead
only from guild settings > integrations
Ignoring exception in view <piece_class timeout=None children=9> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='a7' emoji=None row=None>:
Traceback (most recent call last):
File "C:\Users\celia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 371, in _scheduled_task
await item.callback(interaction)
File "f:\bot_cafe\chess.py", line 228, in piece_callback
await interaction.edit_original_message(attachments=[])
File "C:\Users\celia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\interactions.py", line 375, in edit_original_message
data = await adapter.edit_original_interaction_response(
File "C:\Users\celia\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\webhook\async_.py", line 211, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
hm
I never use webhook on my code
async def piece_callback(self, interaction):
if interaction.custom_id == 'Back':
await interaction.message.edit(view=chess_class.type_piece(self.pieces,self.id))
else:
self.pieces[self.id][2] = interaction.custom_id
piece = self.get_piece(self.pieces[self.id][2],self.id)
size = (100,100)
case = Image.open("chess/case_poss.png")
case = case.resize(size, Image.ANTIALIAS)
background = Image.open("chess/echequier_base.png")
for y in range(8):
for x in range(8):
if piece.move_possible([y,x]):
print([x,y])
#On peut mettre la piece
background.paste(case,((x)*100,(y)*100), case)
background.save('chess/echequier_base.png',"PNG")
path = 'chess/echequier_base.png'
await interaction.edit_original_message(attachments=[])
await interaction.message.edit(file=discord.File(path))
well interactions are webhooks
oh you didn't respond
hold on lemme test something, im fairly sure you can do the bottom two lines in a single line
ok I found the problem, it works if I only edit the message once, like this:
await interaction.message.edit(attachments=[],file=discord.File(path))
exactly
yeah
well
also at the top there
thanks buddy for your help
you should be doing interaction.response.edit_message
unless you're already responding somewhere else in the callback
what will it change?
all interactions need to properly be responded to via interaction.response
just once
so your first message edit should be response.edit_message instead of message.edit
how to make a command that creates embed
what would be best option (i want it to be customizable
like any num of field

i mean let user create it
using a command
*slash command
That’s something you have to do. I have a system like that and I use buttons and modals so they can set the values themselves. It’s as a simple as having an embed and editing it depending on what modal they submit.
can i see it?
ok inviting ur bot
I-
someone over in #creations posted their embed maker function #creations message
i dont get it 😅
i dont need code, just need a good way to get input from user
hard for users
i like his method so going to use it
thanks vNziie--
Mhm
i assume u misunderstood and thought i am asking for code 😅, sorry i have problems in communication
im using my bot to manipulate files.
i want to make a select ui to select file and do some operations like delete or rename them... nelo already helped me to do that.
But i noticed something... if i do a class for this view in a separate file, the class is inicializated when the bot starts running, so i cant see the file change
@discord.ui.select(
placeholder = "Seleccionar presets",
min_values = 1,
options = os.listdir() # <----
)
im trying to give the list as a parameter, but i cant find a proper way to do it, since i cant use self.varname inside the decorator
Hi guys. How do I make a command that can only be performed by people with a certain role?
ctx.author.roles gives you the role list iirc
@commands.has_role(roleid)
discord.ext.commands.errors.MissingAnyRole: You are missing at least one of the required roles: '799691331735126087' or '979021006033272894'
Why?
well read the error, you need at least one of the required roles
make sure you're in one of those roles
what difference is there between discord.Bot and commands.Bot? Can I use both prefixed commands and slash commands with commands.Bot?
yep
Help, on my pc it works but on VPS it doesn't
File "/home/container/main.py", line 230, in <module>
@bot.slash_command(guild_ids=[settings["guildID"]], name="whitelist", description="Whitelist a person to use the bot.")
AttributeError: 'Bot' object has no attribute 'slash_command'```
i have this in main.py
from discord.ext.commands import Bot
bot = Bot(command_prefix='$', activity=activity, status=discord.Status.online, intents=discord.Intents.all())```
you're on an old version, upgrade to latest
how do i do that on vps? well not vps i only have hosting and panel
note your vps needs python 3.8 or newer, if it's on 3.7 or below then it won't be able to update to v2
Is it possible to make an embed look like the embed the automod uses
hello, is anyone good at oop?
maybe it has a package manager on the panel?
or a requirements.txt file
yep it installs packages from requirements.txt file
it has 3.9 python installed on it
why does ctx.author.avatar.url sometimes give AttributeError: 'NoneType' object has no attribute 'url'
surely everyone has a profile picture
how can i make a slash subcommand available to admins only, (disable them for others)
add py-cord==2.1.1 there
don't think so
nope, if you haven't set a profile picture it returns None
use display_avatar instead
though note that will also use guild-specific profile pictures instead of global
that didn't fix it :/
you can't set permissions for individual subcommands, it has to be for the entire group
well discord-sided anyway, you can always use internal @commands.checks decorators
can i set perms at subgroup level, i have made level 3 sub commands, like
/a b c
/a b d
don't think so no
if it doesn't appear separately in guild settings > integrations then it won't work because discord technically treats subcommands as options, only top level commands are truly considered commands
so it will raise appliication invoke error if check not satisfied?
i wonder they still work with app commands
yep
ah ok ty
they can't hide them from the ui, but they do still work
so is there like seperate error handler for only one command, like prefixed commands, @command_name.error
it should work the same with application commands yes
so um in check i should use ctx.guild.me or smth?
that would get the bot's member

what's your console saying when starting up
ok ty lemme try it out
like does it go through installing or
so what does it say for py-cord
requirement already satisfied
same error?
yes still the AttributeError
can you print(discord.__version__) somewhere in your bot file
bruh
that should still work...?
just checking, you haven't installed another discord library right
i guess not
Hey guys, How can i run a function from another file with only knowing relative path? (without hard coded import)
just like how py-cord adds cog classes
when importing, use a leading . to move up one folder
you can see this in quite a few places in the lib, e.g. https://github.com/Pycord-Development/pycord/blob/master/discord/ui/view.py#L53-L54
discord/ui/view.py lines 53 to 54
from ..components import _component_factory
from .item import Item, ItemCallbackType```
do you perhaps have multiple install locations for pip packages?
it looks like your bot is using another one that your console isn't using
I do have "additional python packages" in the panel settings but i don't use it
i will delete .local and .cache files and try again
i wouldn't recommend deleting ALL of that
if im not mistaken, .local is the folder it SHOULD be using
It'll just download the dependencies again
fair enough
okay uhhh that worked lol
@cyan quail thank you very much
my problem has been resolved
allgood
that is not what i want (also it is not related to discord too). i am making a project where i have something like this: src/extensions/<some name>/main.py. i want to loop every extension in extensions folder and run a function from main.py
so i cant import it hard coded
i need to use reflection tho but i never tried reflection in python.
then perhaps you want to use the os module to iterate through the folder?
yes
something like py for root, folders, files in os.walk("src/extensions")
may be worth reading through more of the os module https://docs.python.org/3/library/os.html#os.walk
but that for loop should work
after some search, i found what i wanted:
for folder in listdir("extensions"):
for file in list(filter(lambda f: f[-3:] == ".py", listdir("extensions/"+folder))):
print(f"extensions.{folder}.{file[:-3]}")
mainFile = importlib.__import__(f"extensions.{folder}.{file[:-3]}")
setup = getattr(getattr(getattr(mainFile, folder), file[:-3]), "loadApp")
setup()
nice
I'm trying to use replit to share code with another dev and I can't import pycord for some reason
is there a way to get the bot's avatar url with ctx?
ctx.me for the bot's member
got it thanks
how can i make a "hidden" slash command?
so the command interaction wont show for everyone
class MyHelp(commands.HelpCommand):
def get_command_signature(self, command): # to get the command (Ex. "-ban")
return '%s%s' % (self.clean_prefix, command.qualified_name)```
AttributeError: 'MyHelp' object has no attribute 'clean_prefix'
empherial=True as a kwarg in the send function.
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: send_message() got an unexpected keyword argument 'empherial
huh
You need to get your bot instance. Often called bot or client
I think I spelled it wrong
Try ephemeral
its a hard word to spell
Bot object has no attribute ‘clean_prefix’
Thought that was for something else this might be what you are looking for?
now I don't get errors but
I need a way of fetching the prefix in my subclassed help command
before self.clean_prefix used to work
solved
it is self.context.clean_prefix
also does anyone know if i can include attachments in command replies?
yes
Is it possible to make slash commands only visible to me? (owner of bot)
only possible via guild settings > integrations
so not possible?
not via the bot, no
It is, not with the bot
..
yeah, it is with oauth2
no one is authenticating their bot with oauth2
global and add checks
you can only do internal checks via the bot (see https://docs.pycord.dev/en/master/ext/commands/api.html#checks)
doesnt that look b a d ?
no
you can hide by specific permissions (e.g. administrator) but that's about it
it's actually better from a marketing perspective because it shows your users than premium features exist
though discord is adding built in support for bot subscriptions/premiums so maybe you'll see it in the future
ok
And how can I make it only visible to admin ?
@default_permissions or what was it?
ty
but note any other guild admins can override these
from guild settings
as per the docs
These permissions can be updated by server administrators per-guild. As such, these are only “defaults”, as the name suggests. If you want to make sure that a user always has the specified permissions regardless, you should use an internal check such as has_permissions().
ig i make them visible for everyone then..
so basically use default_permissions combined with the checks from ext.commands if you truly want to keep commands limited
assuming you imported (from discord.ext import commands), use @commands.is_owner()
works with slash commands too?
there are various other checks you can use at https://docs.pycord.dev/en/master/ext/commands/api.html#checks, and you can also make custom checks
yep, it won't hide them but it still works
alr
all check decorators from prefix commands also work with slash commands
ty
allgood
how do i use this discord.file thing
it sends an empty file :Cccc
uhh
you used it correctly
which means there's a problem with how you wrote the file above
ohhh
ok
i added printing number of bytes in that file
and it kinda works
but still, there are 0 bytes showing on discord
try seeking to 0 (rv.seek(0))
what are the other attributes for slash command interactions
When do you guys find it necessary to use max_concurrency?
it really depends, it's rather niche but it does have its use cases when you can find them
one place i use them is in step-by-step commands where the user may spend some time going through the command's instructions and you don't want them to start another instance of the command
yeah that makes sense
Does Discord do a form of ratelimiting on a user's end to prevent them from spamming commands? It kinda looks like it
yeah
cool, means that we don't need to do that on our end
in general the library also already handles all ratelimits it can
though you may find internal cooldowns are still worth implementing
One use case I can see is a command that involves creating/deleting webhooks
or a call to an external api
Maybe a dumb question but is there any way to force emojis as slash command arguments?
that's sort of what I guessed
I'll just try it out and see what happens 🙃
Is it possible to create threads on ephemeral messages?
I know there is a async def on_guild_join event. is there an event for when the bot leaves a server that gets triggered?
ah was looking at the wrong remove. Thanks!
o/
no
you could just create a thread without an existing message
Yeah. But the "X has created a thread" messahe pops up and its annoying
maybe delete it right after?
or make it a private thread, then unprivate it
ah, i guess you need lvl2 for private so that's not always viable
full traceback thanks
no it isn't
but basically
you're checking if a list is inside a string
which can't be done
shows your most used commands
how can i change the style of other buttons in a view from callback of one button
class HelpButtons(discord.ui.View):
def __init__(self):
super().__init__()
self.choice = "main"
@button(label="Raffles", style=ButtonStyle.blurple)
async def raffle_callback(self, buttons, interaction):
embed = Embed(title="embed 1", description="embed 1")
buttons.style = ButtonStyle.green
await interaction.response.edit_message(embed=embed, view=self)
@button(label="Auctions", style=ButtonStyle.blurple)
async def auctions_callback(self, buttons, interaction):
embed = Embed(title="embed 2", description="embed 2")
buttons.style = ButtonStyle.green
await interaction.response.edit_message(embed=embed, view=self)
@button(label="HP | IV Checker", style=ButtonStyle.blurple)
async def info_callback(self, buttons, interaction):
embed = Embed(title="embed 3", description="embed 3")
buttons.style = ButtonStyle.green
await interaction.response.edit_message(embed=embed, view=self)
when i press a button, the button changes to green, but other buttons should be changed back to blurple
How do I add slash command parameter description?
add a kwarg in decorator, description=""
It says "none type is not callable" now
Nvm
It's my issue
hey. How can I make my task execute every sunday?
After sending a File object, will there will a significant issue if I do not close it?
async def callback(interaction):
if options.values[0] == 'Admin':
l_button.disabled = False
r_button.disabled = False
admin_embed = discord.Embed(description='ADMIN Commands\n\n`/autorole`\n❯ **Description: **setup role to be given when a member joins the server\n\n`/counter`\n❯ **Description: **setup counter channel in the guild\n\n`/flagtranslation`\n❯ **Description: **configure flag translation in the server\n\n`/farewell`\n❯ **Description: **setup farewell message\n\n`/welcome`\n❯ **Description: **setup welcome message', color=discord.Color.blue())
admin_embed.set_thumbnail(url='https://icons.iconarchive.com/icons/dakirby309/simply-styled/256/Settings-icon.png')
async def l_callback(interaction):
await interaction.response.edit_message(content='oh my god', embed=None, view=None)
l_button.callback = l_callback
await interaction.response.edit_message(embed=admin_embed, view=view)
in l_callback instead of the message getting editted to something i want, the bot just posts a new message
i tried using interaction.edit_original_message but that doesnt work
@bridge.bridge_group(invoke_without_command=True). @bridge.map_to("help")
async def cc(self, ctx):
if ctx.invoked_subcommand is None:
em = await funcs.custom_embed("Custom Commands", "**Available Options**: `add`; `remove`; `list`")
await ctx.respond(embed=em)```
discord.errors.ExtensionFailed: Extension 'cogs.customcommands' raised an error: TypeError: BridgeSlashGroup.__init__() missing 1 required positional argument: 'callback'
^^
hey um i have an issue
where i try to make a new command
and it doesn't load
@commands.cooldown(1, 5, commands.BucketType.user)
@bot.command(name = "test", description="desc")
async def test(ctx: discord.ApplicationContext):
#stuff
Access other buttons with self.children
pls someone?
ok so loop through self.chilren which will return a Button object?
All of them?...
the single element from the list
yes i want to do for all of them
anyone ;___;
i think someone posted a possible solution right below
anybody?
specifically this command doesn't load? can you show the file
sure
its large
meh go for it
import discord, sqlite3, openai, urllib, ttictoc, termcolor, datetimeimport json, httpx
from unidecode import unidecode
from Scripts import Functionsfrom discord.ext
import commands
bot = commands.Bot(intents = discord.Intents.all())
@commands.cooldown(1, 5, commands.BucketType.user)
@bot.command(name = "test", description="Desc")
async def test(ctx: discord.ApplicationContext):
await ctx.guild.create_category(name = "Category")
@bot.event
async def on_ready():
print(f'Bot is Activated at Time {termcolor.colored(text = str(datetime.datetime.now()), attrs = ["bold"])} With The Time Of Execution Taking About {ttictoc.toc()}')
@bot.event
async def on_message(message: discord.Message):
# Stuff
bot.run(token)
do you have any other events?
i guess it might be taking time to sync...? what if you set guild_ids inside the command decorator
but il maybe need to configure it globally
yeah but just for testing
ok
you can remove guild_ids after, but it;ll still take time to sync
do you always use the @bot.command decorator
oh wait
lol
if it's commands.Bot, bot.command is a prefix command
you're looking for bot.slash_command
hmm okay let me check
there u go that solved the issue
i was copy pasting some old code
so that was the cause of it
Any fix?
You're indenting the function
How can I add per-user cooldowns to buttons? I am familiar with @commands.cooldown(1, 30, commands.BucketType.user) but this is for commands. Will I have to implement my own type of cooldown using a dictionary or so?
yep, button cooldowns aren't build in
Sure. Would love it if they were 😄 Not a priority I suppose
I’m a fan of aiocron https://github.com/gawel/aiocron.
Is this a setting I can tick in the developer portal?
Why pycord said in @bridge.bridge_command this to me?
Expected type '_SpecialForm', got 'str' instead
Just pass it into the _init_
So put bedingungen in between the parentheses when you create an instance of the view
Wdym
Send more code
Oh wait NVM where are you storing the database2 instance?
Where is bedingungen stored?
Well since you need to pass in bedingungen, add it as an attribute to the bot wherever you define it so you can access it anywhere
So smthn like this:
bedingungen = Someclass()
bot.smthn = bedingungen
du hast ein fehler
self.bot.add_view(gewinnspiel_buttons(self.bedingungen))
AttributeError: 'database2' object has no attribute 'bedingungen'
dein class hat kein self.bedingungen
No, do it wherever you define bedingungen
woher bekommst du die bedingungen
And then you can access it as a bot attribute anywhere
ich seh hier nix
i dont think thats the issue
.
Wait what
💀
dein database2 class hat kein bedingungen
geht es jzt?
ja
aber du musst die bedinungen haben
beim inizializieren von diesen class
schick mal den ganzen code
dm
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
gib code
gib den ganzen code
bruder ich bin zu busy fuer diesen kindergarten, gib code ich hilf und geh

bro mein bot ist ueber 20k also
egal ich geh
Wie unhöflich kann man sein
bro ich will helfen, ich hab in halber stunde deadline xd
Is it just me or is discord having some sort of issue?
Commands are not getting updated (I have guild_ids=)
One message removed from a suspended account.
can you show the pip list?
One message removed from a suspended account.
uninstall discord.ui
do you have discord or discord.py also installed?
One message removed from a suspended account.
One message removed from a suspended account.
async def callback(interaction):
if options.values[0] == 'Admin':
buttons = [PaginatorButton("prev", emoji="⬅️", style=discord.ButtonStyle.gray), PaginatorButton("next", label="➡️", style=discord.ButtonStyle.gray)]
paginator = Paginator(
pages = [Page(embeds=[discord.Embed(description='ADMIN Commands\n\n`/maxwarn`\n? **Description: **set max warnings configuration\n\n`/modlog`\n? **Description: **enable or disable moderation logs\n\n`/addrr`\n? **Description: **setup reaction role for the specified message\n\n`/removerr`\n? **Description: **remove configured reaction for the specified message', color=discord.Color.blue()), discord.Embed(description='ADMIN Commands\n\n`/autorole`\n? **Description: **setup role to be given when a member joins the server\n\n`/counter`\n? **Description: **setup counter channel in the guild\n\n`/flagtranslation`\n? **Description: **configure flag translation in the server\n\n`/farewell`\n? **Description: **setup farewell message\n\n`/welcome`\n? **Description: **setup welcome message', color=discord.Color.blue())])],
use_default_buttons=False,
show_indicator=False,
custom_buttons=buttons
)
await paginator.respond(ctx.interaction)
hey guys so i almost gifured out everything, but the problem is the paginator sends 2 whole embeds which i dont want, i want the messages to get editted
can someone tell me how i can do that?
this is a callback for a select menu btw
I guess it's await message.edit_message(...) though I might be wrong since idk how to use paginator, for me it's confusing
you made a single Page object with multiple embeds, not multiple Page objects with an embed each
also that page section is stupidly hard to read, i'd recommend defining the embeds somewhere else so you can actually comprehend the code...
oh ok, and how do i edit the original message rather than the paginator sending a new message?
what should i put for the message part?
does channel.edit(overwrites) rewrite all perms of this channel or only for the args i pass?
all

i want to edit the original message
then pass it in...?
but unable to do it
in the last part i am using pagination, and to edit i need to pass the message, which i have 0 idea on how to get the original message
interaction.original_message() just throws the error: unknown webhook
msg = ctx.message
await paginator.edit(message=msg)```is this not working?
yes
i tried with ctx.message too
are you getting an error or
so I'm not able to make this command only one server unless I pass the debug guilds in the bot variable, however I only want it to show in 1 server only, any suggestions on how to do this?
I want only this command in 1 server, and the rest of the commands globally
you don't need debug_guilds, you can set guild_ids for specific commands
I'll try once again
thank you! I put it as guild_id instead of guild_ids that's why it didn't work
can you define view above callback, then try view.message?
if that fails, try interaction.message
interaction.message did it, tysm
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
I'm confused on what this error is, I have bot and application.commands enabled
I searched online and it says ^^ but I'm not exactly sure what application.build means either
for a guild_id you specified, either:
- your bot either doesn't have the
applications.commandsscope - your bot isn't in the guild
Quick question guys, if I don't have talking perms in a channel or I'm muted, will I still be able to edit my message?
no
Alright, so the same carries over to bots right?
yes, i think
Ok, thanks for your help
My code to set the bot's status to streaming makes it say Playing
Hey hey... how could i make a monthly payment thing? I have 0 knowledge into this and honestly i don't even know what to start with
I want to know how to only let certain users in a list (their id's) use a command
can anyone help
@round rivet
#help-rules 6 please
async def get_position(ctx: discord.AutocompleteContext):
try:
guildProfile = guildCollection.find_one({"_id":ctx.guild.id})
return guildProfile["applicationPositions"]
except Exception as e:
print(e)
return ["Keep Typing"]
@bot.slash_command(description="Send your application profile to the server team. (Apply to the server)")
async def apply(ctx: discord.ApplicationContext, position: Option(str, description="/positions - to see all positions.", autocomplete=get_position)):
try:
await guildApply(ctx, position)
except Exception as e:
await ctx.respond(f"Error, the developer has been informed.", ephemeral=True)
await notusLog(ctx, "Automated Error/bug report.", e)
'AutocompleteContext' object has no attribute 'guild'
How can I fix this?
as the error says, you can't do ctx.guild because there's no guild attribute on AutocompleteContext. so you'll have to get the guild id some other way, I bet the docs show you how to do that
._.
Docs, show me how to do that
good
would be "interaction.guild.id" right?
?tag tias
does anyone know if it is possible for a slash command to have different names in different servers? Thanks in advance
no, you would have to have different slash commands
but you could have one common method that they all call
the only way to have different names is to use localization
the issue with the having multiple slash commands is that there is a limit of how many slash commands a bot can have right? What is localization?
it's localizing the command name/options into different languages
ah ok
thanks for the info
How would I use @is_owner() on a command within a cog? 🤔
like any other command
where do i import it from
ext.commands
tysm
if you've already imported commands, just do commands.is_owner
how do you type all that out so fast without autocomplete
idk
how i can send messages if a check fails? like @discord.ext.commands.cooldow or @commands.is_owner
on_command_error or on_application_command_error
arent those generic events?
yeah and you can filter them according to what errors they raise
All about handling errors.
Are there any good guides or information on clustering shards?
have you tried using autoshardedbot?
Doesn’t that just create shards? I thought it doesn’t have anything to do with clustering
Im taking a intro to programing class can anyone help me understand this lab its in python
not able to get the id of a slash sub command from code and mention it
a = self.bot.get_application_command("a b", type=discord.SlashCommandGroup)
What text editor are you using?
better use subclasses buttons
you can declare a variable to the Button object
button = discord.ui.Button()
button.callback= callback_function()
try this way @bright shard
good way to handle buttons
in view param just add ButtonClassYouMade()
lol
nice game
real ban button in sea of button: squid games 💀
not able to get the id of a slash sub command from code and mention it
a = self.bot.get_application_command("a b", type=discord.SlashCommandGroup)
hi
can someone explain me how to load a file with bot.load_extension if the file is on another folder?
We don't have any official resources, but ultimately clusters are just groups of shards py shards = 8 cluster_1 = AutoShardedBot(..., shard_count=shards, shard_ids=[0, 1, 2, 3]) cluster_2 = AutoShardedBot(..., shard_count=shards, shard_ids=[4, 5, 6, 7])
maybe having an official shard manager would be nice, but i don't think there are any plans for it at the moment
there's a bit more to clustering such as rules that apply on larger scales, but that's the jist of it
e.g. all clusters must have an equal amount of shards
it's the same syntax as python imports
e.g. if your bot's root folder contains a cogs folder, you'd load "cogs.filename"
Hmm alright thanks
Can we edit only one field of an embed?
? you can edit any fields
embed.fields is a list
I cant edit an embed?
why not
if you want to edit an embed from a message:
- get the message
- get
message.embeds[i]whereiis the index of the embed you're trying to edit - edit its attributes
- send a new message/edit the existing message with the new embed
ok thanks
I am getting ratelimited of discord several times a day
than change your api calls
Is it possible for specific slash commands to be in certain guilds and not others. e.g use debug_guilds but for specific commands, not all
could you elaborate?
#rules Do not crosspost.
The slash command decorator has the guild_ids= kwarg
Just what I need. Thanks
Trying to figure out how to keep state between a select view and a modal then to a database, what would be the best way to do that
after switching from Windows to Mac, i've been getting an error where, when i interact with a button, i get an error. I have no clue how to fix it..
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/bot.py", line 1058, in on_interaction
await self.process_application_commands(interaction)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/bot.py", line 722, in process_application_commands
) and isinstance(interaction.data, interactions.ComponentInteractionData):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/typing.py", line 2385, in __subclasscheck__
raise TypeError('TypedDict does not support instance and class checks')
TypeError: TypedDict does not support instance and class checks```
Hi, my on_message in my bot does absolutely nothing.
in fact, my bot literally doesnt launch
wait
nope, im just stupid
i havent made a bot in so long i forgot that you have to add the event decorator
reinstall, you managed to install a bugged build from master
how to handle errors in slash sub commands?
@settings_auctions.error
async def auction_settings_error(self, ctx, error):
print(error)
if isinstance(error, discord.CheckFailure):
await ctx.respond("> You are missing **Administrator** permissions.", ephemeral=True)
reinstall Python 3.10.6?
its not working
no reinstall pycord
not sure if custom error handlers are fully supported on subcommands yet
oh alright
hmm
should i do a try catch error, as a check is failing
in the standard command error handler, you could check ctx.command.name and redirect it to your custom one instead
@commands.has_guild_permissions(administrator=True)
@settings_auctions.command(description="configure auctions log channel")
typically the command decorator should always be first
but how will i handle the checkfailure 😅
wdym
how'd i do that again? uninstall it
pip uninstall
or you can just try to install it again
you don't handle checkfailure inside the command because the error raises before the callback is called
yeah
but since the custom error handler doesn't work, i recommended catching the command name/id/whatever in your global handler and then redirecting to your custom handler
like py if ctx.command.qualified_name == "settings auctioneer_role": await auction_settings_error(ctx, error)or however you need to call it
oh um
still got the same error
either i can check in the code block itself?
that works too
what the code snippet for it again 😓
for what
for checking within the code if user has admin
ig ctx.guild.me?
oh me is for the bot
hmm
it seems like if you do ctx.defer() without ephemeral=True then the response won't be ephemeral, even if you have ctx.respond(ephemeral=True) later on. is this true? is there a way to specify ephemerality only at the response stage?
anything else i can do?
the defer and response, both statements need to be ephemeral to work
hi friends -- is it possible to add a custom button to a paginator using the @discord.ui.button() decorator? (not a paginator button)
or maybe a different decorator i can't find?
my class if this helps (extends discord.ui.View)
the button decorator isn't adding the button and i think i missed something 😅
ahh i am silly, the decorator is inside the init oops
disregard me
quick question, I presume animated emojis can't be used in buttons?
i removed and my commands in cog dont work
last time this happened and like i added recursive it became okay now it shows error-
nvm it can use animated emojis, just something wrong with my code
how do i get interactions over http while still using pycord (or at least its models)
was thinking of using fastapi but my brain shattered for some reason
well you invite the bot with just applications.commands scope and not the bot scope
it'll work but you may well run into issues because the library wasn't built with http-only in mind
oh hmm
what am i going to specify as the interactions endpoint url tho
it is possible to use localization on choices inside an option ?
you don't have to specify one if you're already connected to the gateway
possible when using OptionChoice, set name_localizations
https://docs.pycord.dev/en/master/api.html#optionchoice
thx
i've been told to not set the bot status
when startup
How am I supposed to do it
I'm using on_ready
specify it inside the bot object itself (status=...)
it should be similar to how you use change_presence
await bot.change_presence(activity=discord.Activity(name="You | 👀", type=3))
This is what I was using
In the on ready
yeah you can pass the activity object right into activity when you call the bot
e.g. bot = discord.Bot(..., activity=discord.Activity(...))
allgood
Is it possible to add a description to autocomplete elements?
no, but if im not mistaken Autocomplete supports using OptionChoices so you can set the name visible to the user and value separately
does anyone know how to make an automod system? i cannot find anything anywhere for some reason
maybe my computer is tweaking idk
hello i need hellp
im getting this error
#Traceback (most recent call last): N File "/home/user 750844707755786252/main.py", line 2, in <module> ( from discord.commands import Option d File "/usr/local/lib/python3.10/site-packages/discord/commands/__init__.py", line 26, in <module> from .context import * c File "/usr/local/lib/python3.10/site-packages/discord/commands/context.py", line 69, in <module> 7 class ApplicationContext(discord.abc.Messageable): n File "/usr/local/lib/python3.10/site-packages/discord/commands/context.py", line 337, in ApplicationContext ? @discord.utils.copy_doc(Interaction.edit_original_message) |AttributeError: type object 'Interaction' has no attribute 'edit_original_message'. Did you mean: 'edit_original_response'?
how do i change this
What's your py-cord version
py-cord==2.1.1
it works on my laptop but not the hsting machine
i want to host it ,when requirments is then installed rom pip. i get this error from the host. but runs smooth on m computer
Show your requirements.txt
aiohttp==3.8.1
aiosignal==1.2.0
async-timeout==4.0.2
attrs==22.1.0
charset-normalizer==2.1.1
discord.py==2.0.1
frozenlist==1.3.1
idna==3.3
multidict==6.0.2
py-cord==2.1.1
yarl==1.8.1
you have discord.py
do i remove it?
i want to use pycord for specfic reasons
i just copied paste, from pip freeze nd added to requirments.txt
@full basin
without discord.py i cant do some stuff
pycord is a fork of discord.py; they are intended to be used independently, not together
ok now i uninstalled discord.py . but my code isnt working anymore
well yeah, they have some differences so regardless of which one you choose to stick with you're gonna have to make changes
also you'd need to reinstall py-cord
File "C:\Users\LG\dev\main.py", line 1, in <module>
from discord.ui import Button, View
ImportError: cannot import name 'Button' from 'discord.ui' (unknown location)
``` for example
again, reinstall py-cord
i want to stick with pycord
ok
how do i install pycord
via pip or github?
either works
though you could do github right now since i think we're about to release 2.1.2 or 2.1.3 something like that
which one has the edit_original_response instead of message
ok
dpy
ah so i was smashing things together
no wonder. but worked smoothly on my laptop, was when i hosted gave problem
pycord is soon going to have edit_original_response, but it will not remove edit_original_message
ok
this is the ling right? https://github.com/Pycord-Development/pycord
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - GitHub - Pycord-Development/pycord: Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API
mhm
alright ill pip install the exact link hopeully works
by that i mean the error
ok i installed it
i installed the latet
works perfectly on laptop
Thanks it worked
allgood
I'm beginning to like pycord
Why is my role check not working?
if role in ctx.author.roles():
TypeError: 'list' object is not callable
role is a role object btw
i set a button but when my user doesn't interact for some time. And hits the interact button it says interaction failed. Why's that?
Also why do people dislike pycord
Because interactions have a default timeout.
How do i change that?
timeout kwarg
Set it to None?
If you want it to never expire (unless you restart the bot), sure.
How can I check the time since a user created their account? I can't figure out how to format the time so it's the time since 'member.created_at'
Where is the kwargs
Init.
It returns a datetime.datetime object iirc
You can always checks the docs
Flip that around. if ctx.author.role in role since role is the list that you are searching for roles in
Wow sorry, had bad WiFi, that was a super slow response and also not the answer 👍
no lmfao... role is a role object not a list.. ctx.author.roles is a list though
I’m tired 😅
how do I make the checks for a group affect all children commands?
nvm I figured out I just can't use invoke_without_command
not able to get the id of a slash sub command from code and mention it
a = self.bot.get_application_command("a b", type=discord.SlashCommandGroup)
returns None
how to get application command id
Take a look one message above you
Ty
anyone have an idea how much messages channel.history(limit=limit) going to give me on 1 api request?
All?
no
fast question, im trying to make a create sticker command but its giving a error and idk what to do now, can someone help me?
Script:
@bot.slash_command(guild_ids=gguilds, nombre='sticker', description='crea un sticker con una imagen.')
async def stickerr(ctx, nombre:str, emoji:str, imagen: Option(discord.Attachment, required=True)):
await discord.Guild.create_sticker(name=nombre, emoji=emoji, description=ctx.author.name, file=imagen, self=ctx.message.guild)
await ctx.respond(f'Sticker {nombre}, creado con exito ✅')```
Error:
```py
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'guild'```
^^
Hello! Is it possible to make a global listener for Buttons being pressed?
My previous libraries allowed it but after migrating to Pycord I'm a bit lost.
What was your previous libraries?
"discord_slash", which has this:
@commands.Cog.listener()
async def on_component(
search for discord events in dev docs
there might be any event like" on_button_interaction or smth
then create a listener on its name
"discord.Guild.create_sticker" You need an actual Guild object.
on_interaction
Just check what the interaction is
Thank you both! I will try with that. 
I tried to create new roles but I can't. IDK how to say that but it won't work
At the beginning I had this code :
#players_in_game is a list of member (at least 2)
guild = bot.guilds[0]
roles = [await guild.create_role(name=f'LG - {user.name}') for user in players_in_game]
But it didn't work so I 'split' it and put some print to see were the problem is
guild = bot.guilds[0]
print(players_in_game)
print(guild.name)
roles = []
for user in players_in_game:
role = await guild.create_role(name='LG - ' + str({user.name}))
roles.append(role)
print(role)
print(roles)
So the prints work until the 'print(role)'. It just don't print anything and by the things that I can see on my discord server, like the roles or the channels not created, I can say that it seems like it doesn't do the stuff after it start 'create role'.
Can anyone tell me what is the problem ??
It works but I can't get "context" anywhere. Any ideas to get it?
I would prefer not to rewrite the whole function. 
still have this problem btw
how many players_in_game are there
we try with 1
2
2**
you might be getting ratelimited
even if we delete the role when we finish use them? we actually have 81 roles
but how many times has it actually created
lots
but everytime got deleted
deletion is irrelevant
we tried things and fight some bugs...
some threads from 2 years ago suggest that it's 1000 edits per 24 hours
not sure if that's changed
we've done sooo much less than this]
for today at least
do you not get anything in the console?
nope
and thats the problem
the bot stops working? or
no it just don't do the code
right before the for-loop, can you print(players_in_game)
like the bot is still up and can still be usedm but not for this
[<Member id=378661428061667329 name='Smiath' discriminator='1051' bot=False nick='「 🜲 ┆ SMIΛTH 」' g uild=<Guild id=923316085950918656 name='Café du coin ☕' shard_id=0 chunked=True member_count=50>>, <Member id=31073220
2570678272 name='VullWen' discriminator='0667' bot=False nick='Célian | VullWen' guild=<Guild id=923316085950918656 name='Café du coin ☕' shard_id=0 chunked=True member_count=50>>]
just us
just the two of us
and printing directly above/below create_role inside the loop?
it prints, but then when it start do to the create_role just once, it stop to do the rest of the code
and it only stop forn the create_role
and so the loop
what about py try: await guild.create_role(...) except Exception as e: print(e)
nothing on the concole
still absolutely nothing
that's... very odd
yeap
what about py try: role = await guild.create_role(...) except Exception as e: print(e) else: print(role) finally: print(...) # anything idk
if I add print(bot.is_ws_ratelimited()), console return False
role = **
still nothing
yeah i have no clue
i don't think create_role can just stop like that

