#Basic Pycord Help
1 messages · Page 77 of 1
then use typescript
also, view.get_item returns a discord.ui.Button, not a discord.Button
the whole point of python is huge flexibility and no need to type
it returns discord.ui.Item 💀
if you just type everything use java or ts
no
discord.ui.Button is a subclass of Item
discord.ui.Item
there is no such thing as discord.Item
this really is nitpicking now
in case
in wavelink i have a nicething that make me handle all of those music
what?
by using the on_track_start and on_track_stop or smth like that you could directly here edit the message each time
according to what you set
in case you're not already doing that
oh and luma, i'd recommend not using cast, but just do the typehint
FK I forgot about that, I have those in lavalink
ye he uses that for wavelink too 💀
although the code for it is just ```py
def cast(typ, val) -> typ:
return val
incredible
but in the background it does some shit that makes it consume more memory than neccessary
didnt even know that works, dont you need to use a typevar for that?
It's negligible though
so just do val: typ = sumth # type: ignore
How are you creating your button?
in case you mean in general, im using cast because of this
View class
# type: ignore when
and adding that on to the response
i dont really like to have a lot of type ignore
im fine with cast in those situation
Welcome to python buddy
but thanks for the advice
see luma genuinely
The only thing payload.player could possibly return is a wavelink.Player (or none but thats always the case)
why do you type it
whats the gain
you could also just have assert or if checks
With the discord.ui.button decorator?
yep
if they are typed as none it is because they can be at any point a None
Why are you defining player twice
for testing
cast is supposed to be used inline
it was to show me why he uses cast
luma just showed the warning the typehint way creates vs cast
The you might be able to do
view.button_callback.emoji = ...
Not sure if that is better for typing
sheep aint braining
the ultimate solution is to not type it BECAUSE THE RETURN VALUE IS TYPED ALREADY

Oh wait it does have its own type
even if not, not typing the var is the best solution to the self-made problem
because its not the only thing it can return ;)
says so in your IDE tho
maybe here, i took the habit to use cast since im usually using the guild.voiceclient
this is usually what im using:
player = cast(wavelink.Player, member.guild.voice_client)
yep
Yes
Depends what you want
But there is also an implementation made by dorûymk
Which is pretty easy, I did implement smth a bit more complex to suit my needs
But if you only need basic one, you should take a look at the repo pycord i18n
If I was looking at that python library, but it doesn't have implementation for subcommands
it should if you set the key name to the fully qualified name
e.g. "group subcommand" is a valid key
How do you use an emoji in slash option ?
@bot.slash_command()
async def emoji(ctx: discord.ApplicationContext, emoji: discord.PartialEmoji):
await ctx.respond(emoji.name)
gives
Traceback (most recent call last):
File "/home/paillat/Documents/pycord/pycord/discord/commands/options.py", line 255, in __init__
raise exc
File "/home/paillat/Documents/pycord/pycord/discord/commands/options.py", line 250, in __init__
self.input_type = SlashCommandOptionType.from_datatype(input_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/enums.py", line 804, in from_datatype
datatypes = [cls.from_datatype(op) for op in datatype]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/enums.py", line 804, in <listcomp>
datatypes = [cls.from_datatype(op) for op in datatype]
^^^^^^^^^^^^^^^^^^^^^
File "/home/paillat/Documents/pycord/pycord/discord/enums.py", line 862, in from_datatype
raise TypeError(
TypeError: Invalid class <class 'discord.emoji.GuildEmoji'> used as an input type for an Option
you cant
wait I cant read
Yeah
the dude that made the pr is wrong
yea
so didits the last comment that is useful
but you should be able to use discord.GuildEmoji
No
ts is all broken
@fresh sierra Your pr did not fiy that btw
discord.ext.commands.errors.EmojiNotFound: Emoji "😄" not found.
the point of my pr was not to fix the usage in slash command
but in discord.Option
i read the last comment
which is maybe my issue
Ok whatever
its because its should be with a custom emoji
not an unicode emoji
it's about something else
yeah but i think its intended
guildemoji should not include unicode emoji
i do have a custom converter for emoji, maybe someone could pr that to include partial emoji as a valid converter
doesnt work with ParialEmoji either
do you have code to reproduce the issue you fixed with the emoji pr thing
yeah ofc
this was the point of my pr
class DebugView(discord.ui.View):
def __init__(self, bot):
super().__init__(timeout=30)
self.bot: Lumabot = bot
button = discord.ui.Button(
emoji=str(discord.PartialEmoji.from_str(":person_medium_dark_skin
_tone_bald:")), style=discord.ButtonStyle.green
)
self.add_item(button)
await ctx.respond(view=DebugView(bot))
i dont think partial emoji is even a real converter is it ?
Uh ok so it has nothing to di with command ?!
nothing to do with slash commands
ok
by checking the code, the partal emoji only works for custom emoji
and not unicode
i might do a pr to handle all kind of custom emoji
we could add to this only a
if argument:
return discord.PartialEmoji(name=argument)
but it will not really check if its a real partial emoji
but at the same time i dont think partial never check for valid data
i didnt do a new pr, i just suggests that on my old pr
https://github.com/Pycord-Development/pycord/pull/2815
My idea would be to just add a strict = True to PartialEmoji.from_str and that's it
the thing is the from_str does not include the emoji by himself
so it would mean also add inside the partial emoji the real emoji (or its already the case, im not sure)
and so inside the converter just do a partialemoji = discord.PartialEmoji.from_str(argument) ?
how about PartialEmojiConverter
should work as long as it matches <(a?):(\w{1,32}):([0-9]{15,20})>$
EmojiConverter only works if the bot has the input emote cached
¿its possible to use selects in modals?
no
Soon™ maybe™
damn. another question, in the same view, can you show differents options in select2, depending what you choose in select1?
or when a view is rendered you cant change the options from a select?
you can edit select2 to reflect the changes
so its possible to change select2 options dinamically depending of what you choose in the first one right?
yes
okay good stuff, thank you so much! ✨
When the first select is submitted you can edit the second select values and then editing the message with the updated view
im trying to do that, but i not being able to have 2 selects in the same view, having them both in differents rows
why not?
i not sure, to be honest, i trying to just use the "choose a flavor" select twice in the same view, and no luck, actually, having them both, are making none of them appearing
okay, what gemini suggested worked, ussing self.add_item(self.first_select) and the same with the second one
i mean how else did you do it lol
in the example in the documents you dont need to do that with only one select i guess, only when you have multiples?
you shouldnt need to do that at all afaik
what you mean?
whats the best way to move a task that runs regularly into a thread (not a discord thread)?
do what you do in the task in an asyncio runner
i mean that you can just use the decorators
you just cant call the functions the same
would I be able to just have the tasks as normal and use the asyncio.to_thread?
that is what i tried, 2 with @discord.ui.select, one next to the other, but none of them have names, i guess adding a custom_id?
were the functions called the same
this is the example one, and just next to that one, i added the other
are the functions called the same
im sorry not being able to reply you with the info you need, but, there is no function here, not at least at my knowledge of pycord, i just added 2 selects with the decorator with that info inside in the same view. ¿i guess they are anonimous functions?
you put the select decorator ontop of a function
that function name needs to be unique.
so if you want to add 2 selects, you need 2 init functions with different names? and my bad, true, there was a function there. i kinda new to pycord yet and i dont undestand some stuff x3
no..
@discord.ui.select(...)
async def FUNCTIONNAME():
@discord.ui.select(...)
async def FUNCTIONNAME2():
the function names cannot be the same
to be honest, i never did that way 😬 . damn, i am really lost with this stuff. so, each of them would have they own select_callback. i guess?
i think i starting to getting it. okay, now it makes sense, sorry so much for bothering you...😅
please dont use AI, use the guide
Learn all about implementing Select Menus or Dropdowns in your Discord Bot with Pycord.
according to lala we can still dream...
advaith confirmed he'd be working on modals on his internship, give it a few months
that was smth different
is he not under NDA
"confirmed"
if saying "stay tuned" means confirmed yeah sire
i mean i don't think he has any other reason to say that on that particular discussion page lol
fair
but yeah i guess nothing "confirmed" until he actually starts on it
idk
He probably is
does pycord have a specific way to check a users presence? casue anytime i run an eval to pull it i get none even though intents is setup and on in the main file and dev portal
how are you checking it
im also pretty sure that users dont have presence and that only members have
I was using. The away fetch_user() function
im not sure user have presence
i'll check about it, but you should check for a member to see
Intents for presence is on for both the dev portal and in my bot.py it's marked as true
It returns offline for the things I tried to pull it for
as said before, i dont think users have a presence
you should check for member and not user
looking at the doc, it seems that its for member only
Oh so how would u check to see if they are online ?
That's all I'm trying to do lol
Ahh I remember reading that somewhere, would basically make your bot listen to the update event and apparently it's hard to catch
this is what you want, so you dont have to fetch userr each time
Thank u 🙏
is there a way to use put multiple commands of different cogs into one single SlashCommandGroup?
apparently this works https://github.com/Dorukyum/pycord-multicog but its very unclean and confusing so if anyone knows a better method lmk
nope, that's the best way I know too
can you do subcommands with it too?
becuae i just tried and it did not work i thought i may have mad some mistake
what exactly do you mean? like
/command subcommand
I use it to group commands like this and have each in it's own cog
mb i wanted to say subgroup not subcommand like this
/music queue add [params]
hmm, I haven't actually tried that yet but I have my commands organized in subordners like
/extensions/module_a
and in the /extensions folder I've got a file where I create the discord.SlashCommandGroup where you can create subgroups already so I guess it should work
(This layout is comfortable for me because I use the load_extensions functions for my bot with the recursive argument)
Yes, « group subgroups »
Instead of just « group »
hi. how can I edit a message by channel ID and message ID? just switched to pycord from discord.py and so far I did it like this:
channel = bot.get_channel(CHANNELID)
msg = await channel.fetch_message(MSGID)
await msg.edit(content=content)
that should work too ?
yea
mh. I'll check permissions then. the fetch_message being red underline in vscode confused me
show what it shows
no.. what vscode shows
yea either wrong IDs or permissions
or you don't have message intent but I think that'd look different
this is just vsc being dumb
oki, I'll double check the perms. just came to my mind once I posted my initial question
thank you, will let you know if it worked after lunch break
.tag get_x
Any function that starts with get_ in Py-cord is retrieving the related object from your bots cache. If the object is not in the bots cache the get_ method will return None. Because of this behavior you should check if the get_x method is None and if it is use the fetch_x method.
Why Is Using fetch_ Without Using get_ First Bad?
The fetch_ method makes a call to the discord API. This API call is unneeded if you already have the information. It will also make your command take longer because it will have to send and than wait for a response from the discord API. It will also contribute to the discord APIs global rate limit of 50 requests per second.
What Is Cache?
The cache is a temporary storage inside your bot. It holds many objects from members to messages. When you restart your bot the cache will be empty. When the cache is full it will delete older objects to make space for the new objects.
not the issue here but worth keeping in mind
I only saw get_channel so
Its because the channel you using fetch message form is a discord.abc.Guildchannel, this include some channel without the fetch message
And it also can be None
Si to resolve that you should make sure it’s not None / checking it’s a text channel for exemple
Hi, i will set a url but it dont work
Error:
In components.0.components.0.custom_id: A custom id and url cannot both be specified
In components.0.components.0.url: A custom id and url cannot both be specified```
code:
```py
# Create a View for the Payment Button and a cancel button
class PaymentView(discord.ui.View):
def __init__(self, payment_url):
super().__init__()
print(f"Payment URL: {payment_url}")
self.payment_button.url = payment_url
# URL Button for Payment
@discord.ui.button(label="Jetzt bezahlen", style=discord.ButtonStyle.link, emoji=":credit_card:")
async def payment_button(self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.send_message("Zahlung.", ephemeral=True)```
Ein Link Button hat kein Callback
Die haben auch kein Timeout
Sie können nur URL-Schaltflächen deaktivieren
mach sinn 😭
Ich hab das jetzt so geamcht, aber jetzt ist der abbrechen button links neben dem bezahlen button, abe rich will das erst der bezahlen button nund dann der abbrechen button kommt kannst du mir sagen wie ichd as amchen kanN`?
def __init__(self, payment_url):
super().__init__()
print(f"Payment URL: {payment_url}")
self.payment_button = discord.ui.Button(
label="Jetzt bezahlen",
style=discord.ButtonStyle.link,
url=payment_url
)
self.payment_button.url = payment_url
self.add_item(self.payment_button)
@discord.ui.button(label="Abbrechen", style=discord.ButtonStyle.red)
async def cancel_button(self, button: discord.ui.Button, interaction: discord.Interaction):
...```
Ich benutze für jeden Button eine eigene Klasse, du könntest das auch so testen, ob man so die Reinfolge ändern kann
ish libe dish
could also do something like self._children.insert(0, ...) but idk
Personally I like doing sellf.button = Button and self.button.callback = something
because I often have reactive stuff where state of other components changes depending on one
Pretty sure he is only on the internship for a maximum of 10 weeks. Due to his schools schedule.
Oop, ping :/
it’s UC Berkeley no?
https://guide.pycord.dev/extensions/commands/help-command
This page doesn't help me at all on how to safely disable the "help" command, it only tells me the wrong ways to do so. In addition, the UI examples aren't working either 
Can someone please tell me the correct way of disabling the built-in help command?
-# I've done way too much work for my dictionary stuff, and I really don't want to redo 300+ lines of code just because of this.
that's the wrong way to CREATE a help command
help_command=None will work
(the wording is pretty awkward regardless)
For the features and customizability that I want in a %help command, working with constrictions is very frustrating 
Plus I don't want cogs to be treated the same as categories, otherwise I would need to reorganize 1k+ lines of code.
This entire time, under the wrong way section, was the correct way, bruh. 
i mean, the entire section says it's talking about creating; this is correct
because when creating a custom help command you pass help_command=YourHelpCommandClass() instead of trying to set None
In myView have 2 selects added to the view with the self.add_item both of them with a few options, but i having the next error
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0.options: Must be between 1 and 25 in length.
In data.components.1.components.0.options: Must be between 1 and 25 in length.
what i am missing? 😅
no more than 25 options
the first select have 5, and the second have 1 (becuase the first one will add dinamically the rest)
you have more than 25 somewhere
there is any doc explaining how to do this with 2 selects with the self.add_item()? i feel i having some trouble with that, because it all worked with decorators, but i need to also modify dynamically the first one select (to add the default option to the selected one, so when i edit the message dont get deleted) also, not been able to trigger selects callbacks with the custom_id
nothing special about it
show your view code
why do you use both the decorator and the self.add_item variant
thatsn ot how that works lol
and how it works? https://guide.pycord.dev/es-ES/interactions/ui-components/dropdowns didnt help me how to do it correctly saving selects in variables
Learn all about implementing Select Menus or Dropdowns in your Discord Bot with Pycord.
so the decorator is not needed?
its one way to do it
what i said is if you use the decorator, the function name of the callback should be the select object so you can access it via that
but that would fix the options error?
what would
okay, makes sense, because the code thinks the decorators are the selects, and both of them are empty
if you dont wanna use the decorator you just need to remove it and set the select callback manually
how you set the callback manually?
could you share where i can find that? i really checked the select Menus, and i dont find anyway to do that without the decorators, the examples are only with the decorators, sorry for bothering you so much 😅
The library has helpers to help create component-based UIs. Shortcut decorators: Objects: Attributes children, disable_on_timeout, message, parent, timeout. Methods cls View.from_message, def add_i...
after reading it, i not really sure how to use it to be honest 😅 , self.category_select.callback(interaction)... what interaction should i pass it? self.my_method_name?
in select Menu callback examples have it to access to the selected item... i will remove it like i guess is not needed in this case 😅
how you access to the data then? with self.values[]?
i wish i could, but with the decorator you cant modify the options from a select dinamically? or its possible but i just dont know how?
You can
^
So it would be self.select_callback.options = [] in that case
Same for all the other attrs
yea
it works thanks you so much x3. and thanks to toothy too for being so patient with me 😅
same thing is true for commands btw
which is how you can dynamically create slash commands
i cant even imagine how it works, im kinda dizzy with all this, but im happy it works now xD, probably my code is quite a spaghetti but im okay with it
it's literally super easy lol
it's one or two extra lines
how do i put a button in an embed?
Components V2 are under development in pycord and aren't yet included in the official releases on PyPI or the master GitHub branch. However, you can access the features now by installing directly from the pull request #2707. To do this, use the following command: pip install git+https://github.com/Pycord-Development/pycord.git@refs/pull/2707/head Please be aware that this is a development version and may contain bugs, feel free to report them by adding a comment to the pull request.
ohh ok
hey, do I correctly use ctx.invoke() ?
Especially, how do I pass the command in? Do I just use the function name?
await ctx.invoke(command=self.warn, member=member, reason=reason)
This is how I currently use it (self.warn is the command function)
but it fails with this exception ApplicationContext.invoke() missing 1 required positional argument: 'command'
Dont do command=
You could also call the command await self.warn(ctx, member=..., ...)
alright, thank you!
Will calling it directly trigger error handling properly?
I don't know if it does currently, in the note is written
This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function. You must take care in passing the proper arguments when using this function.
nope
because you are just invoking a function and nothing else
if you use Client.invoke_application_command() however it should handle everything
hello! do i have to rewrite some codes to support the user install?
or it works for both user & guild ?
i think as long as you make it user installable every command should by default work everywhere
alr thanks i will try that!
If that does not work you can set the default installation contexts and contexts in the bot constructor
yea not working,
i will try this!
in every commands?
discord.Bot
discord.Bot.activity
discord.Bot.add_application_command
discord.Bot.add_check
discord.Bot.add_cog
discord.Bot.add_listener
discord.Bot.add_view
discord.Bot.after_invoke
discord.Bot.allowed_mentions
discord.Bot.application_command
discord.Bot.application_flags
discord.Bot.application_id
discord.Bot.application_info
discord.Bot.auto_sync_commands
discord.Bot.before_identify_hook
That would work but you can set the global default on the bot constructor
default_command_contexts
The default context types that the bot will use for commands. Defaults to a set containing InteractionContextType.guild, InteractionContextType.bot_dm, and InteractionContextType.private_channel.
New in version 2.6.
Type:
Collection[InteractionContextType]
default_command_integration_types
The default integration types that the bot will use for commands. Defaults to a set containing IntegrationType.guild_install.
New in version 2.6.
Type:
Collection[IntegrationType]]
forgot to ask, does it requires any intents?
wait nvm
its working now! thanks!

Nope intents are (almost?) exclusively what discord sends you
all good! i thought it needed any intents. prob my research is mistaken
dont know if it's a bug, but the emoji stop working after the interaction message has been edited. such as paginator editing to the new embed
issues from group chat
and (emojis) it's working in any guilds
^ i mean the container, oop sorry
container
likely a discord issue, they have some strange logic when bots use custom emojis
Are those server emojis or app emojis?
server
Try with app emojis, you might have less issues
Are app emojis on master?
Yes: https://github.com/Pycord-Development/pycord/pull/2501
Although you dont need any code change to use them, only if you want the api functions like add/remove and list them
Is there a way to get the raw member payload without needing to do another api call
For example on on_member_update event
not currently no, you'd have to edit your lib files
could a on_raw_member_update be implemented ?
It wouldn't be very cool to do an api call there right
there's no point in raw_member_update
because any member update you'd get would be cached
dark has one ;), (except if its for the tag (which are currently not in the lib)
(the only point of raw events in the lib is circumventing cache)
probably in v3 we'll have _data as an attribute in all discord models or something
you could also propose it for v2 if you care enough but eh
i might do that around the 20 of july when im finally home
let me do my paillat rn
-reminder 15d #1132206148309749830 message
Set a reminder in 2 weeks and 1 day from now (<t:1752690359:f>)
View reminders with the reminders command
(i said 20 and i put 15...)
Remindme <Time:Duration> <Message:Text>
[-channel channel:Channel]
Invalid arguments provided: Not enough arguments passed
Hm
I guess forking the lib and editing it is the best way
Since it'd be for someone else
you could still pr that also ;)
if you add a attr _data that have the raw data it should not change
(we could have that for every obj maybe in v3)
I dont even know how the lib does the attributes shit either way
I have to look into the files
how do i install the dev version so i can use components v2?
Components V2 are under development in pycord and aren't yet included in the official releases on PyPI or the master GitHub branch. However, you can access the features now by installing directly from the pull request #2707. To do this, use the following command: pip install git+https://github.com/Pycord-Development/pycord.git@refs/pull/2707/head Please be aware that this is a development version and may contain bugs, feel free to report them by adding a comment to the pull request.
thank you bot
on_member_update still gets fired if the server tag changes?
or nour
it should
bug? or am i being silly
Might be on_user_update
But idk
ty
why is the accessory an iterable in the first place?
it's something internal, doesn't matter to the user
Perfect, that's what I came here for.
how should i do for the inline here:
i would like to have the default name and default user limit on the same row, but only those 2 and same for the channel and category
im not even sure this is possible tbh
this is the closest i have been but it looks awful with those big padding
you can reduce the padding with name="", value=""
empty fields is the only way to do 2 column inline consecutively
That’s how I did that
By using the \u200b
Ok phone the padding doesn’t appear
Im gonna try that then when coming back to gym
I thought it was the same
Isn't this the correct of using local files as image/thumbnail in embed?
.tag localfile
Tag not found.
Did you mean...
local-file
.tag local-file
f = discord.File("some_file_path", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)```
.tag local-file
f = discord.File("some_file_path", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)```
But it's not working somehow
what's ur error ?
might be ur client
you also forgot to add file=file
But it's in embed
look agin the tag
if I send as normal message using file=discord.File() it sends
yeah yuo do need
f = discord.File(f"media/{result}.gif", filename="image.png")
e = discord.Embed()
e.set_image(url="attachment://image.png")
await messagable.send(file=f, embed=e)
you client should cache it after os its ognna be faster
host your bot on a vps with proper uplink
silly question but can you make (discord) polls with py-cord or is this not even supported by the Discord API?
You can, but I think it is only on the master branch
https://docs.pycord.dev/en/master/api/data_classes.html#discord.Poll
.tag master
pip install -U git+https://github.com/Pycord-Development/pycord
-# Note: The Master Branch May Have The Newest Features But It May Also Have More Bugs
The docs for the master branch: https://docs.pycord.dev/en/master/
I'm looking at those docs but I can't seem to find where you actually send the poll? Is there an argument that accepts a poll in e.g. ctx.send, do you know?
ah I found it. Thanks and sorry for the hassle!
poll=... in all the contexts you can send a poll
tysm!
:P
if theres a better place to discuss this lmk
oh wait
this might be me being dumb
looks like you're trying to add something other than a TextDisplay to a Section?
error messages could be improved but yeah
calling it section is a lil misleading for newcomers
iirc discord said not to hardcode the types for now so 
hm true
yeah i was passing a discord.ui.Section into add_section, i didnt realise that was different
is it possible to use a persistent button with components v2? i subclassed the Button class, and i use it as the accessory in a section in a container in a view with no timeout, but it isn't persistent
Did you also add the view to the bot?
how can i get a before and after with the on_raw_thread_update event?
i just need to check whether any thread has been closed or reopened
but on_thread_update cant check if it's been reopened
Why cant on_thread_update work?
IE what are you seeing in the raw event that is not present in the normal event?
it doesn't detect when they're reopened because it says archived threads aren't in the cache
Ah, yeah ok.
and i check for something like before.archived == False and after.archived == True or vice versa to check whether they were closed or reopened
So the problem is you cant really get before in the raw events because discord does not send that data.
hmm
i do give closed threads a tag
so i might be able to check if it is opened and has that tag
ill try this
ty
Yeah that might be a good way to do it. Otherwise you might be able to just say that any thread that is not in the cache was archived but there may be some edge cases where that wont work. It might also show up in audit log (which also can be inconsistent)
cna nayone help me with my code
im making an ticket tool but wehn i press the panel button to make one the bot creates multple ticket and channles
.tag paste
.tag idw
Saying it doesn't work or asking what's wrong with this code is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.
me when I run my bot multiple times
Is there a tag for that ?
dont think so
if its a member, why is it typehint as User ?
probably if the user left
isnt it directly removed by discord ?
no idea
strictly speaking it should be Role | User | Member | Object because all are valid in overwrites_for
Object if you don't have the real object, User if for some reason you have User instead of Member
(effectively you could just reduce the typehint to Snowflake - the type used for any object that has an id)
so in fact it should always be also a member ?
except if its not cached or for weird reason ?
What about things that have snowflakes but cant have overwrites like a guild, I think this would make the typehint to general
it would but we already use Snowflake like that elsewhere in the library
if a function accepts Object for any reason, it can be typed as Snowflake
(i.e. it only relies on id and nothing else)
I am trying to migrate from dpy to pycord
cannot import name 'AppCommandOptionType'
.rtfm optiontype
discord.SlashCommandOptionType
discord.SlashCommandOptionType.sub_command
discord.SlashCommandOptionType.sub_command_group
discord.SlashCommandOptionType.string
discord.SlashCommandOptionType.integer
discord.SlashCommandOptionType.boolean
discord.SlashCommandOptionType.user
discord.SlashCommandOptionType.channel
discord.SlashCommandOptionType.role
discord.SlashCommandOptionType.mentionable
discord.SlashCommandOptionType.number
discord.SlashCommandOptionType.attachment
@fresh sierra How du save channel ids in JSONField?
I have this issue, see if I use supabase to manually set that channel_id field in json then the value gets rounded-off but when set using bot it sets correctly but shows wrong value. Ig js is the culprit here which is used by supabase.
So should I save them as Text?
@fresh sierra
i dont know supabase sorry
Talking about Tortoise ORM
but when i was using mysql only i was just using a text field with the list of int, and then for orm i just have a json fields list and i append the int inside
but when i used to only use the raw sql, i faced an issue with too big int, that were rounded into e^10, so i just convert then to int then str and then i used to added them inside my db
if you need to save json as string, use json.dumps when saving and json.loads when loading it back to python
(in case i meant save the int as str, but i was saving it alone and not inside a json)
Whenever I react to a message using a bot with add_reaction("❌"), the emoji appears invisible. The same thing happens with ✅. Is this a Discord bug?
await message.add_reaction("✅")
await message.add_reaction("❌")
Most likely, I don't think it could possibly be a py-cord bug
restart discord
and fixed automatically ?
Idk it comes an goes
if ive got a loop (ext.tasks.loop) in another file, which i import and start from my main file, does it need to be in a cog? if not, how can I reference the bot from that loop?
nvm
you shouldnt do that
why
there is no need to import a ready-defined task
just define it where its supposed to run
while it's not required, ideally you design your tasks to be inside a cog like the docs show https://docs.pycord.dev/en/stable/ext/tasks/index.html#recipes ```py
from discord.ext import tasks, commands
class MyCog(commands.Cog):
def init(self):
self.index = 0
self.printer.start()
def cog_unload(self):
self.printer.cancel()
@tasks.loop(seconds=5.0)
async def printer(self):
print(self.index)
self.index += 1
...```
however, it's not a requirement - you could import if you wanted py from discord.ext import tasks @tasks.loop(seconds=5.0) async def printer(): print(self.index) self.index += 1
from some_file import printer
... # Main bot code
printer.start()```
if you do the cog style and want to start it from a different file (like your main bot file), you should NOT import the cog; instead, use bot.get_cog(cog_class_name) and start it through that after the client is ready
so e.g. in your main bot file, you could have something like py @bot.event async def on_ready(): tasks = bot.get_cog("MyCog") tasks.printer.start()
is there any good way a ui component can access the view associated with it in a type safe manner? i keep having to put #type: ignore to shut mypy up but im sure there's a better way to do this. the underlying problem is that it recognizes self.view is a discord.ui.View but self.view is actually a class that inherits from discord.ui.View with extra properties
You can type Button
discord.ui.Button[MyViewSubclass]
Doing that you’ll type the view attr to MyViewSubclass | None
You’ll still need to do an assertion to check it is not None
oh shoot this works, thanks!
hi, the server members intent is kinda buggy recently for my bot, get guild returns none sometimes but works normally sometimes, get member too, sometimes it just returns none, and sometimes it works fine
Any get_ relies on cache
get_memeber returning None means the user isnt cached
nope but previously i use guild.chunk() in bot.check but i removed it and added the code into on_application_command after to decrease the command execution time
so am i supposed to chunk the user? with what method?
or guild.chunk() is enough?
the problem is that the command just doesn't load at all, and also not raising any errors
it just stucks at thinking
And doesnt chunking already happen by default
yeah
if you have member intents enabled and haven't manually disabled the member cache, you should never manually chunk
i disabled chunk guilds at startup
congrats, that's why your member cache isn't filled
so thats why i do guild.chunk
chunking blocks the websocket
but if i dont, it's going to take 10 years for the bot to get ready
I thought discord fixed that
how many guilds are you in
well kinda but regardless chunking is gonna take up a ton of websocket time
1.2k
then either you have to accept the long startup time or try build your commands without using member cache
also, the guild.chunk code has been there for over 2 years, and i havent tocuhed anything
so whats the issue here?
it started to happen recently
unless you updated im guessing discord changed something with chunking, but it's pretty standard for you to have long startup times with more members
the last time it took 10-20 minutes to chunk 400+ guilds
yea im not waiting 2 hours to chunk 1.2k guilds
you could probably just chunk in another thread
What features of yours require members to be cached?
wait, i think it's not the issue here
because the bot commands are not responding at all
from what i can tell they didn't actually go ahead with the change
it just stucks at thinking, the on_application_command is just an error happened alongside the main cause
does that still happen if you remove the chunk code
no idea, i never touched it
the bot stucks at thinking for some players, but not for the others
and it will be back to normal after a couple minutes 10-20 or an hour
ok, so try removing the chunk code
especially it's not working for new users
removing manual chunking and enabling chunk guilds at startup?
it sounds to me like chunking on command is the problem
if you haven't touched anything (neither have we), to our understanding chunking takes up most of your websocket traffic which ends up blocking other events
i changed it back to bot.check
doing it in a bot check would still do it in on every command though
so right now when i kick the bot and reinvite it, it stucks at thinking when i use a command
obviously i have a guild.chunked check
i mean yeah but that's not quite what my point is
you were saying that chunking at startup takes 2 hours; not chunking at startup means that 2 hours would still happen, just split across the runtime of your bot
yea
so if someone runs a command in a large guild and it needs to be chunked, it's still gonna block the entire bot for, idk, a few minutes
(or to be more accurate, floods websocket -> other events like command execution get delayed)
that's what I'm assuming you're dealing with, and the unfortunate part here is that using another thread wouldn't actually work because it's still coming down the same websocket
you could try switching to Sharding since you meet the minimum of 1k guilds, which should split your websocket connection, but not sure how effective it'll be
part of the reason why huge bots like dyno have insanely long downtimes for their maintenance is because across their thousands of shards they have millions of servers and hundreds of millions of members to cache - that's the largest bottleneck if you want to track them
how would i start
see https://docs.pycord.dev/en/stable/api/clients.html#discord.AutoShardedClient (or AutoShardedBot or ext.commands.AutoShardedBot
If you try and chunk the same guild twice it will not do anything on the second call iirc. I think a flag is set
what is the attribute to get a user's username (mine for example is nziie3) in the discord.User class? documentation was kinda vague on that part
.global_name?
nvm its just .name
It's global_name
.name is username which according to the docs isnt unique
Oh well
Its the other way around
Tf
.name has been and always will be their unique username
.global_name is their global display name
and the reason its like that is because changing .name would've been breaking
thanks for coming to my ted talk
w ted talk
is it possible to make 2 commands without getting the unique name error?
like these:
/report
/report directly
i want the second one to sue the slash command groups so it can be classified and has the space in between the words intead of a dash or an underscore
You can do this with slash command groups
Here's the slash cog groups example.
Its giving "Application command names must be unique."
show your code
No its not
No bypasses either? Thank you anyway at least i wont waste time tryna make it work now ❤️
wdym..?
idk why they said that but its absolutely possible
just follow the guide
you just need to call the other command smth too
like /report directly and report <idk>
No it's not
You can't have a command name be both a command and a subcommand parent
No it’s not
Saying it's not possible with an extra step
😂
Yes but i wanted one of the commands to be called /report with no additional text, if its mandatory to call it something else that just means its not possible
You could make directly be an option to the comment not that's less elegant unfortunately
I do something like
/Tag
/Tag-manage xyz
Would that work for you?
Actually I never tried but you could maybe do something to work around it with localisations
But I'm not saying it'd work
You could do that in prefix commands
You can do that with guild-specific commands. But you won't be syncing per each guild everytime, would you?
So you can have /report directly as a global command and /report as a guild command
Is directly the only subcommand?
If so just have "report" and "report-directly"
Hello ! How to see forward content message ?
message.content return an empty string (or None I don't remember)
.tag master
pip install -U git+https://github.com/Pycord-Development/pycord
-# Note: The Master Branch May Have The Newest Features But It May Also Have More Bugs
The docs for the master branch: https://docs.pycord.dev/en/master/
Remind me, cv2 has unlimited containers (things that can have an accent color) now? Or does that still have some sort of restriction
Oh. 40 - <#discord-api-updates message>
Wait, no. Top-level says unlimited. (But wouldn't that be 40? lol)
Yeah, dv8 confirmed it's really 40, in line with the per-message limit.
it's 40 across your entire message
previously, top level and container were 10 each
now those don't exist, you just have one constraint to consider
So accessories would reduce that number, then
Wait, what? Why 3?
the section itself counts, and sections must have both an accessory and at least 1 item
I thought the accessory was the item. woof.
So a section is different from a Container, right? Which one gets the accent colors?
We need a visual nomenclature guide.
container is with colours
a section should only be used if you want text with an accessory (thumbnail or button) to the right
So is that 4, then?
Container + Section + Accessory Definition + Button/Thumbnail?
4 yes, but button/thumbnail is the accessory
https://discord.builders/ is decent enough for testing a layout visually
Use new Discord components in messages for free and stylize your server however your want.
So what is "at least 1 item" - I thought that was the button/thumbnail and Accessory was just the container for them
no, Section must have 1-3 items - currently, it only supports TextDisplay
I see. I think
Container
\ Section
\ TextDisplay
\ Accessory
(Assuming accessory is a child of section, not textdisplay)
correct
guys my bot's music stutters when i add more music to the queue, idk if its anything to do with the processing power but the cpu usage isnt at 100% when that happens so i know the cpu can handle more than that, so maybe it's because the code was singlethreaded but idk how i can fix it, anyone have any ideas?
Which Music did you play?
Is that a youtube music bot?
Palying from YouTube is against ToS.
You won't receive help here.
its a personal bot thats used only by me, plus, i use adblock in youtube anyway
Using adblock has nothing to do with this. It is not allowed by discord's tos. And don't try, you won't get help about this here.
ok then, do you know any good alternatives that i can use that also have a wide range of songs?
I think Spotify has something for streaming music for personal use only but I'm not 100% sure, I don't use Spotify
Hm. Is there a way to have the 'author' stuff from Embeds (which had a nice image icon on the left) in cv2? Outside of galleries, all images seem to be pushed to the right
no
there's been concepts of alternatives but no guarantees (e.g. updating <@id> to support icon modes)
maybe <@!> will make a comeback
oh god
I was a big fan of %! and %#
This is from a time I never knew I think
Yeah I’m lost, as well
doesn't exist I believe
How hard is it to switch from disnake to pycord?
Are you using slash commands ?
yes
-# Please ping me when you reply to me. I use a translator and can't see all messages
Non slash stuff should be pretty easy because their base is the same. If your use slash is shouldn't be too hard but you'll have to play around. I think some implementations were copy pasted between the two but I'm not 100% certain
@torn light
ok
Can i make a slash command not show in DMs?
So I just made a simple autocomplete, but am getting the weirdest error that i don't understand.
Ignoring exception in on_application_command_auto_complete
RuntimeError: Task <Task pending name='pycord: on_application_command_auto_complete' coro=<Client._run_event() running at E:\VS Code\Omega\New\.venv\Lib\site-packages\discord\client.py:412> cb=[set.discard()]> got Future <Future pending> attached to a different loop
The whole autocomplete is just returning a list:
async def get_cogs(ctx: discord.AutocompleteContext):
return list(loaded_cogs)
Can i be pointed in the right direction to fixing it, please? I can provide the full traceback if needed, but it's not much...
Yes, set the contexts to not include DMs
https://docs.pycord.dev/en/stable/api/application_commands.html#discord.SlashCommand.contexts you can pass contexts=... into your command decorator
are you starting your bot is a "complex" way? Other then bot.run(...)? A full traceback might help
Kind of? I have a run file that uses a subprocess.run for the main.py which then has asyncio.create_task(bot.start()).
This was the traceback i got at first:
Ignoring exception in on_application_command_auto_complete
Traceback (most recent call last):
File "E:\VS Code\Omega\New\.venv\Lib\site-packages\discord\client.py", line 412, in _run_event
await coro(*args, **kwargs)
File "E:\VS Code\Omega\New\.venv\Lib\site-packages\discord\bot.py", line 883, in on_application_command_auto_complete
await self._bot.wait_for(
File "C:\Users\Kaspars\AppData\Local\Programs\Python\Python312\Lib\asyncio\tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
RuntimeError: Task <Task pending name='pycord: on_application_command_auto_complete' coro=<Client._run_event() running at E:\VS Code\Omega\New\.venv\Lib\site-packages\discord\client.py:412> cb=[set.discard()]> got Future <Future pending> attached to a different loop
now that i think about it i might not need the asyncio.create_task
If i had to guess that is par t of the problem, unfortunetly I do not understand asyncio enough to know how to fix it
Alright. Well i'll try to remove the asyncio part, i don't remember why i had put it in, in the first place
you might be able to fix it by passing the event loop into the bot constructor
Hehe not smart enough for that, will be finding ways around
Is there a way to get the content of a forwarded message? I keep getting blank messages in logs.
It is under Message.snapshots
But only on master branch
message.system_content is also a shorter way to get it (on master)
otherwise message.snapshots[0].message.content
Guys a quick question
I was wondering what is the best use case when you need to get the list of members of large servers (target 1000+ members)
I noticed that the Guild.fetch_members method does not have a chunk limit parameter, so does pycord care about the API rate limit? and how many members it fetches per request when the limit is set to None?
Guild.fetch_members is an iterator similar to TextChannel.history - it will fetch 1000 members by default, but setting limit=None will attempt to fetch all members. Ratelimits are handled by the library
per docs ```py
Usage ::
async for member in guild.fetch_members(limit=150):
print(member.name)
Flattening into a list ::
members = await guild.fetch_members(limit=150).flatten()
generally speaking, you probably don't want to overuse this with limit=None for large servers
but i guess that's up to you to decide
Thank you for the answer
Well idk is a one time thing an abuse? xD
I will use to get the members when the bot joines a server then it will never use it again
do you not have the members intent?
Yes i have them
did you disable member caching
Probably not
then you don't need to fetch
all members will be in guild.members when your bot joins the server
There is also Guild.chunk to get all members and cache them from the gateway
But do you really need them
You sure? i remember that it contains the members that are cached. I never truly understood when a member is removed from a cache actually
you don't need to chunk manually if you didn't disable cache
it caches all members when the bot joins the guild, but over i think 75k members there's some limitations
This bot will be used inside Rematch communities, and i want it to automatically link their rank and stats for the members of the server
Ofc there will be some commands to do so but since i want to focus on the tournament management i want this part to be like a secondary thing that u should not worry about for the most part
I will try then, thank you both
all good
if you want to do a basic test, make an on_guild_join listener and print guild.member_count and len(guild.members)
if the numbers are close enough, then it is caching members - they may not be exactly the same though
Yeah if a small part is missing i can run over on that actually
Can I set it globally so that nothing is available via DMs, without having to add it on each command (including prefix commands)
Yeah I think you can in the bot Constrictor
default_command_contexts
Rewrote my code that had a view with 3 buttons, now am getting an error that i don't think i've even seen in this channel:
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.1.sku_id: A sku_id is required
show your code
Which part? It is about 300 lines long...
the view
hit_button = Button(label="Hit!", style=ButtonStyle.primary)
stand_button = Button(label="Stand.", style=ButtonStyle.premium)
double_button = Button(label="Double Down!!!", style=ButtonStyle.danger)
view = View()
view.add_item(hit_button)
view.add_item(stand_button)
view.add_item(double_button)
and
hit_button.callback = hit_callback
stand_button.callback = stand_callback
double_button.callback = doubledown_callback
Seems the indentation messed up a bit when pasting, but it's indented as needed
well, if you have a premium button you need to pass the sku id of a premium product
ah, i thought it was a color xd
Will change and test.
Ok that worked, thanks a lot!
np
👋
I've got a bot that creates a message+view on command, and edits the message each time a button is clicked.
The message is correctly edited, but then it also says "This interaction failed" in red? Can anyone explain why please?
Code below:
class SociocracyBot(discord.Bot, abc.ABC):
def __init__(self, *args, **options):
super().__init__(*args, **options)
self.votes: Dict[uuid.UUID, discord.InteractionMessage] = {}
self.logger = get_logger()
async def consent_added(self, user, view_uuid: uuid.UUID):
message = self.votes[view_uuid]
await message.edit(content=message.content + f'\n* {user.mention}')
async def consent_withdrawn(self, user, view_uuid: uuid.UUID):
message = self.votes[view_uuid]
await message.edit(content=message.content.replace(f'\n* {user.mention}', ''))```
class ConsentView(discord.ui.View):
"""
A view which allows the user to consent or withdraw consent via buttons.
"""
def __init__(self, * args, ** kwargs):
super().__init__(* args, ** kwargs)
self.uuid = uuid.uuid4()
self.consents: dict[int, str] = {}
consent_button = discord.ui.Button(label='Consent', style=discord.ButtonStyle.green)
consent_button.callback = self.add_consent
self.add_item(consent_button)
withdraw_consent_button = discord.ui.Button(label='Withdraw Consent', style=discord.ButtonStyle.red)
withdraw_consent_button.callback = self.withdraw_consent
self.add_item(withdraw_consent_button)
async def add_consent(self, interaction: discord.Interaction):
if interaction.user.id in self.consents:
await interaction.response.send_message("You have already consented", ephemeral=True)
else:
self.consents[interaction.user.id] = interaction.user.mention
await sociocracy.consent_added(interaction.user, self.uuid)
async def withdraw_consent(self, interaction: discord.Interaction):
if interaction.user.id in self.consents:
await sociocracy.consent_withdrawn(interaction.user, self.uuid)
else:
await interaction.response.send_message("You have not consented so cannot withdraw", ephemeral=True)
@sociocracy.slash_command(name='ask_for_consent', description='Creates a view where you can ask for consent.')
@command_logging_decorator
@error_responder_decorator
async def ask_for_consent_command(
ctx: discord.ApplicationContext,
topic: discord.Option(str, description='What are we consenting to?', required=True),
):
view = ConsentView()
interaction = await ctx.respond(f'{ctx.user.mention} is looking for consent on:\n{topic}\n\n{underline("Consenting Users:")}\n\n', view=view)
message = await interaction.original_response()
sociocracy.votes[view.uuid] = message```
The button is clicked, does the "Processing" animation, edits the message, and continues said animation until it stops with the error message.
You aren't responding to the interaction
You can edit the message with the button using interaction.response.edit_message
I see, thanks!
Is there a way to get the current message content from the interaction?
interaction.response.content doesn't seem to exist.
why do you need that, you are building that yourself, you know what it is
It'd be handy to be able to just be able to pull it
i mean interaction.original_response() but you could just save it in a var
Mm, yeah, I probably will to avoid yet more async messing around. Cheers.
interaction.message is the message with the button
original_response is the response that you're supposed to send
interaction.message seems to be None for some reason
It's typed as Message | None but it can never be None for a component interaction
print(interaction.message.content)
AttributeError: 'NoneType' object has no attribute 'content'```
Oh you didn't say it was for a component
Yeah there is no message in a slash command since you're the one sending it after receiving the interaction
Hmm fair, thanks
Okay, going back to the start:
I send a message with a view.
view = ConsentView()
interaction = await ctx.respond(f'{ctx.user.mention} is looking for consent on:\n{topic}\n\n{underline("Consenting Users:")}\n\n', view=view)```
What is the best way to get a Message object from this that corresponds to the message created by `ctx.respond`?
Because interaction.message is None and interaction.original_response() gives me an InteractionResponse but I can't seem to get a Message from that.
(I tried ctx.send but that gives me 403 permission issues)
wait, why do you want that message
you are just there sending it, whats the point of regrabbing it
I want that message so I can edit it when someone clicks a button.
When someone clicks the green button, their name should be edited into the list.
When someone clicks the red button, their name should be removed from the list (if present).
Specifically, I want to store a reference to it for later use.
Why dont you store the relevant stuff in vars? The author, the topic and the users
I mean... I can, but I still need to fundamentally edit the message?
Then you just do
f"{self.author.mention} is looking for consent on: {self.topic}
Consenting users:
{"\n".join(self.users)}
What's self here, the View?
Yes
I didn't know views could contain text tbh - I didn't see anything on the docs about it.
Okay yes, but I don't know how I would add text that renders to it.
Because that seems like it'd require a lot of interacting with the Discord API itself.
(Like adding attributes is trivial, sure. But making Discord read them seems less so)
No?
Can you provide an example in that case?
Broad example cause im on mobile but sure
class MyView(discord.ui.View):
def __init__(self, author: discord.Member, topic: str, *args, **kwargs):
super().__init__(*args,**kwargs)
self.author = author
self.topic = topic
self.consents = []
async def your_some_callback(...):
add_consent(...) # this is your own function already defined
await interaction.response.edit_message(f"{self.author.mention} is looking for consent on: {self.topic}. Consenting users: {"\n".join(self.consents)}") # it is assumed self.consents is something iterable that will spit out mentions or the __str__ discord.Member is thats what youre storing (idk)
@undone shale
Oh right, adding them to the interaction - I thought you meant directly making the view render text like it renders buttons.
That's a good idea, thank you.
Working 🎉
Thank you 🙂
Hello, I'm a bit confused which slash_command decorator to use. I've got a simple bot that does not have prefix commands and I'm using cogs, I noticed theres discord.Cog as well as discord.ext.commands.Cog, but not sure which one would be best suited, as well as the tons of slash_command decorators. Can anyone guide me about the difference?
using v2.6.1 (latest)
commands.Cog
mostly the same for the slash commands, its just depends if you use discord.Bot, commands.Bot etc
I'm using discord.Bot
then @discord.command should be fine or @slashcommand etc etc
also I noticed in the guide it's commands.Cog but not @commands.slash_command instead @discord.slash_command
i think its just different decorators that work better with commands.Bot?
commands.slash_commands is if you use both commands and prefix commands, but i do thin they are interchangeable
let me take a look
yep but I'm not using prefix only application commands strictly
doesn't matter
yea i mean they all work but which one is the correct one
discord.slash_command is a shortcut of discord.command.slash_commands
yep I'm aware of that
if you want "correct", just use discord.slash_command
they're all shortcuts of each other
ah right thats what i was wondering then answers my question thanks
also what about discord.Cog is that different to commands.Cog
or again just a shortcut?
commands.Cog has some minor adjustments to work with prefix stuff
bit weird to have command.ext.slash_commands tho imo
ext doesn't have a slash decorator
i think that may be for commands.Bot idk if it works with discord.Bot but not sure
its the same, its just get imported into the file and exported that all
oh wait yes its commands.Bot.slash_command my bad you're right
alright well thanks
hi, why does discord.Color.embed_background() not work?
embed = discord.Embed(
title=f"Vysion Help",
description=f"Hi, for help with various commands, we recommend that you check out our **bot documentation** or join our Discord **support server**.\n\n- Just use the buttons below.",
color=discord.Color.embed_background()
)
embed.set_footer(text=footer_text, icon_url=avatar)
await ctx.respond(embed=embed, view=Buttons())
it's a legacy option, generally this isn't worth using because many themes exist
(even without nitro, users can still pick between 3 dark themes)
So you think it's because of the theme?
maybe? but i think it might not match any lol
because I think it doesn't work ...
this is the embed color in lightmode
on components V2 in the next release, Container by default doesn't show any bar so it's a better alternative
embed_background doesn't do anything special
it just sets the colour code to the same as the dark theme
to use another color you mean?
no like
yeah, but idk why it doesn't work for me here
because 1) you have a different dark theme and 2) the code is outdated
However, for some reason, it works for another user, as shown in the photos.
that's not Embed :)
yep
in cv2, Container is a new object that works similar to Embed. colour is optional in that
okay, lemme install the PR for test purpose
thank you
@fresh sierra curious, how does pycord do command translations and is there a guide
they dont really do it
there is just name_localization which you can pass as a dict but that's pretty much all
yeah, that's why i foun d that really interesting and i tried to get it
name_localizations={'en-GB': 'member', "fr": "membre"}
Loading a file for each command in each file sounds meh
wdym
im not sure to understand what link said there, can we talk about it or not ?
I assume you do with open("name", ...) as rp: json.load(rp) etc and then use the kwarg
I don't define them when creating the command
Ah you set the attrs
So basically what dpy and disnake do but then at library level
Idk I prefer having more control over my setup
Like for extensions
I just don't like the lib doing that for me
having a native thing could be nice too
meh
for people which dont really have time to do it by themselve
Dpy literally does what you do
you have a link ?
I cant find it in the docs
does it support chain like this ?
or it is a 1 depths localization so each string must be unique
i have to say that the local_str is a pretty good idea
I see
I don't think any lib has a builtin thing for content/embeds translations?
because you can get lost really fast between name, parameter name, name localization
ezcord does ;)
Damn
ezcord + my template
but i dont know if it would be a good idea to have that inside an internal lib
But dpy does have Interaction.translate
Basically calls your translator
that's already a nice feature
so you could use that to translate even in content / emebd ?
you also have a nice implementation of hybrid
but why does make also a HybridBot class to have access to listener, list of commands get_hybrid command etcs ?
If pycord ever gets something like this it should 100% be a separate package imo
Hybrid commands are basically prefix commands but with some handling for slash
Basically an implementation detail
i get that but not having any way to get that command seems strange
(even tho pycord dont have it too)
(but we cant even say pycord support bridge currently...)
[
c
for c in bot.commands
if isinstance(c, commands.HybridCommand)
]

Meh I think the way it should be is still having a bridge command create under the hood both the slash and prefix version
Bridge/hyprid/whatnot code should not implement anything slash related it should reuse the implementation
I don't see why we need to bloat the lib and potentially confused with HybridBot etc
English?
oops I wasn't looking at the keyboard
lol
as someone that only use hybrid command, having some common listener (even tho you can make that easily by urself is nice
I'm also tired i'm re-re-re-reading the cv2 pr rn
That's what dpy does yes
Poor you
At least yours is not that big of a change iirc
i didnt really get what's gonna happen for yours
Holy shit nvm 245 commits
yeah ws about to say
if i get it danny gonna make his own implementation ? even tho anonymous maked one ?
I mean that's average size of any v3 pr but yeah
Danny needs to try it like he's a beginner or something #1345167602304946206 message
No lol
But it'll probably have many requested changes from him
That's why you don't touch multiple things in one pr
Well, I’m not an expert on the design in views, and Danny does not trust 3rd party impls because it may be bad or not as optimized as he wants, so he needs to test how good the usage is as if he were a new user
How simple and that things

Ggwp nc fr
He does not trust us 
I understand why
Also, as I said I am not an expert on that complex things on Views, but I tried
Meh
Will see if Danny supersedes it with a commit or merges the pr
When we creating discord.py-but-worse-but-fast-released-features-because-we-do-poor-impls-but-we-fast-and-we-want-money-like-djs
Also one for pycord while we at it
One for all forks
or do a discord.py-plus-nextcord-plus-pycord
💀
is there any other lib that do use support hybrid command ?
pycord.js but it's py
to scam users
disnake steals impls from all possible forks
Oh bruh
Where did you mention me for a pr involving voice
On GitHub
Was it nextcord or disnake
they dont
nextcord dont support hybrid too
curretnly only dpy support it ig
Nextcord
does the hybrid command actually work ? supporting group, subgroup etc ?
yeah i did that too, but its not what currently in pycord
no i was like maybe its also a weird thing in dpy
on dpy the only change you do to support hybrids is change from commands.command to commands.hybrid_command
plus make sure you have valid unions and valid subgroups and etc etc

Pycord shouldn't have made it a separate extension lol
It makes sense for it to be separate
All messed up with separate options and decorators
Indeed
Meh
dont talk about option
im curretnly looking at it
either im stupid
either it does not make any sense

why do we skip attachment here ? ( only in bridge command ext context), while we dont do that for actual prefix command
async def transform(self, ctx: Context, param: inspect.Parameter) -> Any:
if param.annotation is Attachment:
# skip the parameter checks for bridge attachments
return await run_converters(ctx, AttachmentConverter, None, param)
else:
return await super().transform(ctx, param)
Lmao
That's because attachments need to get from the message
But it should always do that for prefix commands
yeah that's my thing
like what makes the prefix commands from a bridge different from the normal one for the converter
because there is also a Bridge converter mapping
its because Option is for slash command and so if we want to use it for both we need to also be able to support it by using the decorator
Bridge should just be separateeee
which show us a lack of support for other thing like choices, options name / descriptions etc
it will be, but this show mainly that ext commands lack some functionality that bridge ext supports and vice versa
that's why it is completly fucked up
bridge shouldnt be separated from ext tho
for me they should just be an addition of the ext.commands
