#Basic Pycord Help
1 messages · Page 59 of 1
Check that
i will take a look thanks
else i was thinking to make a decorator that will apply to all listener to catch every error, so i can get the discord Execption and do in consequence
brb stealing all of Dark's code
what do you need help sith ?
yea that is way too much shit
why?
just set the permissions as you create the channel
also stops the channel from showing for members for a fraction of a second every time you create one
also help with rate limit
how can i do this with the 2 perm tyopes
the docs tell you
overwrite
you need the bot scope
(sorry, double pic)
No, its just because there's a lot more stuff than just straight up bots you can make on discord
Yeah, i know, im just kidding
But this is new right? i made a bot a few weeks back and this wasn't an option i think
Whenever you add a new command or smt like that, you need to restart discord? or is there any other way to make it appear
it has always been like that
restarting, or ctrl+r
How can i forcefully set a cooldown for a guild (cooldowns using commands.cooldown) for a specific command?
using a dynamic cooldown already?
wdym
on the command i am using @commands.cooldown(1, 300, commands.BucketType.guild) but i want to be able to set the command's cooldown from another command overwriting it.
for a guild, without any interaction from that guild?
yes
thats a decorator tho, there isnt a function that would allow me to do what im wanting to do?
yea no, no idea if this is possible with the built in cooldown system
you can still use dynamic cooldown?
How can I fetch the Individual User Count? Sorry for HDR
Attributes approximate_guild_count, approximate_user_install_count, bot_public, bot_require_code_grant, cover_image, custom_install_url, description, guild, guild_id, icon, id, install_params, inte...
it's only on master right now
Thank you
Long ass attribute lmfao
it's what discord calls it
IIRC bot emojis are supported now. When using get_emoji(), are they given priority if there's a naming collision with a server?
get_emoji doesn't use names
Ah, you're right. I was thinking of a different method. Thanks
Small confusion regarding the documentation:
discord.Bot.emojis: "The emojis that the connected client has."
Is that the emojis uploaded to the application, or all emojis it can see on its servers?
Bots: Attributes activity, allowed_mentions, application_flags, application_id, auto_sync_commands, cached_messages, cogs, debug_guilds, default_command_contexts, default_command_integration_types,...
the library hasn't been updated for app emojis yet
you can see the relevant changes at https://github.com/Pycord-Development/pycord/pull/2501
Ah, thanks. I misread something late last night. So if I read this correctly, app emojis don’t need the use external emojis permission?
They don't
If I want to restrict a command to be only able to be used when someone has the Admin permissions, this should work right?
issue = SlashCommandGroup("issue", "desc", checks=[commands.guild_only().predicate])
default_permissions only works on the entire group
(pass default_member_permissions=discord.Permissions(...) inside the constructor)
If I don't have any interactions, nor am I listening to any events, is it safe to deploy a 2nd instance with the same token?
The bot will be controlled by a Flask API with the instances having different endpoints.
What do you want to do with the other one ? Depending you can either use .run or just login.
Also consider what dark said
Why does getting 50 messages worth of channel history take 8 seconds?
Is the discord API slow currently? it didnt take this long before
Okay.. it seems to only be like that on one server
Yea it seems to be happening in one server quite obviously, and not at all in another server
The chat histories aren't dissimilar, both a lot of text and some images
So i have no idea why its so slow?
v1 and v2 API, complete rewrite
Its only used to send / delete messages
Will be hosted in completely separate datacenters
i mean you can have one instance that ONLY handles incoming API requests, and the other instance that does all the actual bot stuff
should work
discord.ForumChannel
discord.ForumChannel.archived_threads
discord.ForumChannel.available_tags
discord.ForumChannel.category
discord.ForumChannel.category_id
discord.ForumChannel.changed_roles
discord.ForumChannel.clone
discord.ForumChannel.create_invite
discord.ForumChannel.create_thread
discord.ForumChannel.create_webhook
discord.ForumChannel.created_at
discord.ForumChannel.default_auto_archive_duration
discord.ForumChannel.default_reaction_emoji
discord.ForumChannel.default_sort_order
discord.ForumChannel.default_thread_slowmode_delay
@echo wraith Thanks
:)
Why fetch_channel doesn't show ForumChannel?
forumchannel is a GuildChannel
Alr thx
Why fetch guild returns no categories / channels?
Make sure the bot has permissions to view said channels
and you have proper intents
I have all intents and bot has admin perms
did you also select the bot scope when inviting the bot?
read the docs, fetch_guild doesn't include channels
(every time)
if you don't have channels cached, use guild.fetch_channels @deft bronze
better question (for me) would be why they dont have any of the guilds channels cached at all
ah
Idk i solved it using bot.guilds[0].categories
yes, that's your cache
yea thatll totally not break the instant your bot is in two guilds
if anything you should do bot.get_guild(id)
I wont have my bot in two guilds
Is for my personal sv
you think that now
I been thinking that for years
I know i should do it right
But thats how it ends
I did it just to work in my sv
Its filled with fetch channel, categories, etc
you should also avoid fetch whenever possible
Hey how to make the user command which you can use without a bot being in the server
As in what is it called?
Thank you!
within the on_timeout how can i send a message to the channel the interaction is in?
self.message.channel.send probably?
yeahh thank you
tho i dont see anything on the docs to get the client?
nvm i can have the guild
you dont need anything but what dark sent to send a message
i needed it for other things :p
Where can I subclass ApplicationContext where self.command is set ? Because self.command is not set in the __init__...
Yeah but I have no idea what sets ApplicationContext.command
I believe it is set by prepare
but I'm lost
Actually, no method of ApplicationContext is called after that ApplicationContext.command is set by ApplicationCommand.prepare, which kinda sucks because it means I need to somehow subclass ApplicationCommand and that's way harder
WAIT I KNOW
I cann override ApplicationContext.__setattr__ and do something there if it's setting command
it is
Yeah figured it, thx. In the end I went with that __setattr__ thing and it works great. But oh boi the code is hard to read...
a view
I am doing a check for permission before running come commands. This is the check:
def check_for_manage_role(self, ctx: ApplicationContext) -> bool:
my_bot: Member = ctx.guild.get_member(self.bot.user.id)
missing_permissions = []
if not my_bot.guild_permissions.manage_roles:
missing_permissions.append("manage_roles")
if not my_bot.guild_permissions.view_audit_log:
missing_permissions.append("view_audit_log")
if len(missing_permissions) > 0:
raise MissingPermissionsException(missing_permissions)
I never had a problem, but one user today complain that when running the command he is getting a error. When checking logs I see that ctx.guild is None. How can this happen ? I try to reproduce but cant get a ctx.guild that is None. Anybody got a clue ?
I am think of doing get_or_fetch guild with ctx.guild_id instead
This is in a slash command
in dms
also there's a builtin check bot_has_permissions for this, but it always returns True in guild so you'd need to make the command guild only https://docs.pycord.dev/en/stable/ext/commands/api.html#discord.ext.commands.bot_has_permissions
(which you should probably do anyway)
Oh did not know there was built in checks !
I can use bot_has_guild_permissions
yep quite a few on that page
But still does not explain why ctx.guild was null
did you set the command to guild only
How is that possible in a s’ash command running in a guild
No I did not
then they can use it in dms
but I am sure it was run on a guild, because I am loggin it
how many guilds is the bot in
On guild Rise of Kingdoms by user ruzxv (Ruz)
On command server_time_role with values [{'value': '1254719275084546091', 'type': 8, 'name': 'role'}, {'value': 30, 'type': 4, 'name': 'days'}, {'value': True, 'type': 5, 'name': 'apply_to_existing_member'}]
Error -> Application Command raised an exception: AttributeError: 'NoneType' object has no attribute 'guild_permissions'
Original -> File "/usr/local/lib/python3.11/site-packages/discord/commands/core.py", line 138, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/discord/commands/core.py", line 1486, in _invoke
await command.invoke(ctx)
File "/usr/local/lib/python3.11/site-packages/discord/commands/core.py", line 432, in invoke
await self.prepare(ctx)
File "/usr/local/lib/python3.11/site-packages/discord/commands/core.py", line 364, in prepare
await self.call_before_hooks(ctx)
File "/usr/local/lib/python3.11/site-packages/discord/commands/core.py", line 584, in call_before_hooks
await hook(ctx)
File "/usr/src/app/cogs/WriteCog.py", line 14, in cog_before_invoke
self.check_for_manage_role(ctx)
File "/usr/src/app/cogs/WriteCog.py", line 36, in check_for_manage_role
if not my_bot.guild_permissions.manage_roles:
if not my_bot.guild_permissions.manage_roles:
^^^^^^^^^^^^^^^^^^^^^^^^
NoneType: None
that's not the guild, that's your bot member
guild_permissions is a Member attribute
oh yeah right, sorry about that
did you set your bot to user install or is it just a regular one
regular bot
I guess somehow the bot is not cache in that guild
mmm odd but yeah
I can just do get_or_fetch member
but yes it is odd that not cache
never happenned because in more than a year 😄
it's not meant to be possible but eh the more you know
Thank you for your help !
allgood
Why is it that channel.send (sometimes) sends multiple messages when only being fired once? Is it just an API bug? It’s usually in button callbacks or timers for me
https://cdn.discordapp.com/attachments/1286740702809690113/1295893469474193499/IMG_7677.png?ex=67104e57&is=670efcd7&hm=b3997aacb1d605847344761897cbfac365fdbad353599db00a7c35b53ba65338&
its only doing channel.send once and i know for a fact
Isn't ctx.respond supposed to fill in the message attribute in View?
But that's probably because Discord didn't return the response/message before; it required an additional api request.
You can get the response from await ctx.interaction.original_response() and set it yourself for now.
Are you sure that the person is not clicking 2times really fast the button ?
When using bridge will commands still be in Yesbot.pending_application_commands ?
They aren’t
How would you "disable" slash / prefix commands from a bridge bot in a reasonable amount of lines ?
disable how?
Do you know if the Discord API is having issues right now? It seems like the slash commands aren't working as they should
Nvm found how to do it:
you want to disable all commands?
yes
i would've just done it in https://docs.pycord.dev/en/stable/ext/bridge/api.html#discord.discord.ext.bridge.on_bridge_command so you can also send a response back directly saying smth like "commands are disabled"
The reference manual that follows details the API of Pycord’s bridge command extension module. Bots: Bot: Methods def add_bridge_command,@ bridge_command,@ bridge_group. AutoShardedBot: Event Refer...
actually it's a listener so it wouldn't stop the execution if you return
hm..
Yeah no but it's not something I enable and disable sometimes, not gonna go into details but if I uses my bot base but dont want prefix commands but still want to use the commands that are already defined in the pre-made extensions I can do that
yea just posted lol
i made a bot_check to disable it depeding on the guild
Hi, is there any way to have 2 fields per line ? TIf I set inline=True for the third one it will be on the same line than the two previous ones, if I set inline=False it will put the fourth in a new line.
I tried to put an empty field between them but the last one is way too espaced
cant you do inline=False for the 3rd, and inline=True for the fourth field?
if not then i dont think you can
that's what I did here
yes I don't think either, just wanna make sure. Thanks for your reply
UPDATE : the empty field that I added was inline with the previous one, I put it on inline=False and now it works.
Wish it was easier to make blank lines. Didn't you have to do a special utf character instead of an actual blank string?
Of course it's all gonna look like trash on mobile, anyway 
blank string works for making empty fields, but apparently discord claimed it's a bug
otherwise i'd have liked to make name/value optional
(e.g, you can send a completely blank embed, and thus a message with zero content, using discord.Embed().add_field(name="", value=""))
Oh, weird. I could swear I had to do the UTF8 no-print character last time to get it to show. Appreciate the info.
that's the more "recommended" way because empty string is supposed to be patched, but it's worked fine for ages so might as well until they break it lol
How can i get the userID of people who reacted to a message?
Idk what to do with message.reaction bc i dont know how to get a user from there
nvm
to stop listening on a view so avoid the on_timeout event to be called i need to do #.stop()?
i just remove that view from the embed
so i dont think i really need to disable all items
hi is there an integrated thing to make a time input in a Modal dialogs ?
kk thanks for your response
You can get a small text box or a big text box. That's the extent of Modals.
I am trying to make member optional, however when I attempt to do so it doesn't support autofill like it does when I typehint it normally (member: discord.Member). Am I doing something dumb?
async def profile(self, ctx, member: Option(description="The member to display the profile of.", input_type=discord.Member, required=False, default=None))
Tried it both inline and with the decorator, same result
it might be because of the default, try to remove that
same result unfortunately
did you restart discord
yeah
can you try use the decorator method instead to make the option? it shouldn't change it but you are passing everything correctly
already tried that, didn't change anything
and it works if you remove the required=False but leave the rest?
still doesn't work for some reason
can you try just send the command with any input
if it somehow hasn't, it should update then
doing that just gives an error because it's trying to handle the random string I inputted as a discord.Member object
yea ok
try rename the command
worked for another person a few hours ago for some unknown reason
renamed, same result
can you try pass the input type positionally then
it somehow seems to just ignore that
that worked (not sure why but I'll take it)
thanks
np
I'm trying to use discord.ext.commands.Bot beucase I need my current bot to work only on the old prefix commands.
The issue I'm encountering is: it looks like all events related to commands are not being triggered. I tried using on_application_command_error, on_command_error and on_error and nothing is triggering when I use a command that does not exist. I just get an exception on stdout instead of it going through the code inside the event first.
Is there a fix?
Nevermind, on_command_error actually is the only one that works but I got confused because of mylogger.warn
anyways thanks.
on_error is for event, alors there is no need to return as a last line, to put messages and reactions = True for the intents
on_command_error = prefix
on_application_command_error = app commands
on_error = event
how should i do for the view of my paginator appear only if the number of pages is greater than 0 ?. Should i edit the send/edit function or another one ?
Can you rephrase your question? I am not sure what you’re asking.
For exemplenhere
Since there is only 1 page remove the view
(I will edit the class of the paginator for that h
Ah. I mean… couldn’t you just not send the Paginator in that case? You would know whether you have multiple pages or not
I also think there’s a kwarg for the view, you should be able to pass None nm that’s for custom view and it’s already default None (but you could make an empty view and pass it 🤷♂️)
Why not just subclass instead of editing? That way you can init an empty View if it’s passed len(pages) of 1
Yeah just check before
I was meaning subclass
But what part to edit in the subclass, the edit and sent it or innit for exemple
Okay I just noticed something odd and I'm not sure if it's a feature or not
When I reply to an interaction with an empty message, the API returns an error, logically
However, my error handler then catches that error, and upon trying to call ctx.respond to the ctx in question, it gives me an unknown interaction error
How does this happen? Does the "cant send empty message error" somehow consume and completely get rid of that interaction?
How long can a discord option input be
there is no limit
i tested it afterwards and the limit is the fact that discord freezes and starts eating hundreds of megabytes of RAM even on relatively small inputs
lol
How many slash command options ?
Let's hope it's more than 16
tf you need that many options for
a bad design decision
25 is right @echo wraith
Is there a more efficient way to add users to a thread, perhaps by role, than add_user? Unless I'm blind I'm not seeing anything in the documentation aside from that and when I tried it my bot's hitting ratelimits adding maybe ~10 people.
If not I could add a delay, but that would kind of suck if there's a better method
I remember that being a thing at one point, but I think they changed it. It's not mentioning the role in the thread via .mention (it does in a regular channel, tested it) and it's not adding my alt which has the role
allowed mentions
Also, there's two group of people that I need added, one that should be pinged and another that should have access but shouldn't be pinged, so I'd rather avoid using that method even if it does still work
hm
all ticket bots i know use pings, not sure if there's a way to avoid the seemingly strict limit
you can do silent pings
my bot's allowed mentions are on, it's only in threads that it doesn't actually ping the role members. Also I forgot to mention that this is a private thread, so sorry for accidentally leaving that out
That's probably why that doesn't work
weird since discord itself does convey that as "main" way
i just tried and it even works if you edit in the mention afterwards so it's not tied to ping itself
perhaps mentioning them individually works but not mentioning by role?
both worked when i just tested it
hmm that's odd
is your bot creating the thread?
hm but it does add the users if you use add_user?
it does, but I get angry messages in my console saying I'm being ratelimited
can you show that message
one sec
also doesnt every add_user cause a message about user x being added to the thread?
[2024-10-18 19:17:46,535] [WARNING - discord.http] We are being rate limited. Retrying in 3.89 seconds. Handled under the bucket "1296975537540960316:None:/channels/{channel_id}/thread-members/{user_id}"
yeah but I don't really care that much about it unless it's pinging them
no but it gets messy if you add more than like 2 people
true
but it really should work if you @ mention them in any way, its weird that it doesnt
and i dont see another way to do it
Just realized I'm dumb, I was testing it in a channel that the role doesn't have access to. It works now, thanks for your help lol
Is there a way for autocomplete options to have a name, value thing ?
Aren’t they? They should return list(OptionChoice). Or am I misunderstanding your question
correct
Yeah no wasn't sure if autocomplete could also return list(OptionChoice) or if it was only when choces were set directly
thats also the only way to do a "limited" role select
the value will be the actual role object, and the string shown to the user is just @Rolename
(if i highlight the rest it looks ugly)
is it possible to transver values from one class to another
As in?
in one class i have a command with input and i want the input in another class
then just use a setter for that attribute
?
otherclass.set_input(user_input)
and how do i use it
use what?
in your command, and exactly how i wrote it
just make a setter in the class you wanna give the input to, and then call that function on the class object
no idea how your structure is and what that class is but either you make a new class object just for that, then you could give the input to the constructor directly, or you already have an existing instance of that class, then it's a bit more complicated and i'd need to know how your program is structured and all
from the red to the red
ah
well just pass it to the view when you create it and then save it in an attribute, and then access it with self.attribute when you need it
?
im not so good at code
do you know how to use views?
kind of
and why are you subclassing object?
here as well
huh im just putting one class under another
yea so you're creating an instance of the view somewhere
just pass the user input as an extra argument to the constructor, and ofc change the constructor in the view class to take that argument and save it to a self. attribute
oh yea i see.. dont put multiple classes in one file if possible
it gets very messy
your cog doesnt even have a setup function from what i can see so it doesnt even work lol
?
yea but its not inside of your cog from what i can see here
well if it works i dont even wanna know how lol
but how
how what?
how do i pass the input to the constructor
... = Aufgabe_Button(your_input)
and then you just change the constructor in the view to actually take and save that argument
and where do i put it
put what
where do i put ... = aufgabe button
wherever you need to create the view
if you dont know how to use views, please check the guide
so here?
and how do i take and save the input?
in the constructor of the view
just add another argument after self and then save that with self.whatever = argumentname
i gotta go now tho, but i'm sure there's someone else who can help
And I recommend you look into basic OOP in python
and split your files so that you generally dont have more than one class per file especially not in a cog file
so like this?
yea
"discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction"
didnt work
I mean that error isn't about creating the channel or anything you just changed
that's just some response somewhere not working, and the error tells you where
i now put the class in another cog but a get another error, it says there is no module named aufgabe_button but that is my class that im importing
nothing works
Yeah I found it in the end, thx
just let your IDE import it, typing the name should be enough to make it pop up
got it
i accsidentaly had an older version running on a server
ok i got the button and the channel but when i try to place it in a category i get the error:
AttributeError: 'str' object has no attribute 'id'
are you passing the category name?
await interaction.guild.create_text_channel(self.aufgabe_grob, category="aufgaben")
thats not how it works
Models are classes that are received from Discord and are not meant to be created by the user of the library. Attributes key, url. Methods def is_animated, async read, def replace, async save, def ...
please check the docs
you need to pass either the actual channel object of the category, or discord.Object(id of the category) should work too
np
im trying for at least 2 hours
always have the docs open
(and use them lol)
also you might wanna run checks on the name the user passes for the channel, i think you'll just get an error if it's too long or uses forbidden characters
or depending on what you wanna do you could also have a channel named aufgaben, and the individual things the users create are threads
threads also have more lax naming restrictions and also capitalisation
ok
with paginator is possible to allow the user interact with the buttons only if they have x role?
You'd have to put the logic in the button callbacks. For permissioned stuff like that, it can often be more beneficial to just make it an ephemeral, so you can control who can even start the interaction.
well what i want to achieve is that everyone can click the button to get the pages but only if you have x role you can navigate
Your options are:
- Make the reply ephemeral
- Don't send the Paginator controls if a non-permissioned user presses whatever initiates the display
- Keep it as it is, but just return False (or optionally some feedback) in the Paginator callback buttons if a non-perm'd user interacts with it. (You'll have to create your own View for this)
Public interactions are public; it won't change output from one user to another.
Got it, i'll see if choose the second or third option
basically i defined slash command in cog like this async def cmd(self, ctx: discord.Interaction, img, link, dms):
what i get is discord.errors.ExtensionFailed: Extension 'commands.memes' raised an error: TypeError: Invalid class <class 'discord.interactions.Interaction'> used as an input type for an Option
ctx is not discord.Interaction
and show your code, the entire command with decorators
really?
it's discord.ApplicationContext
for slash commands, in pycord, yes
its fine now
ah that was the issue? lol
idk why im using interaction
i have no idea
probably discord.py code you copied from somewhere
or taking a view function or whatever
maybe because i moved from dpy
not the code, but i was rewriting smth
and never noticed, until cogs xd
tysm
How can I see the boost amount of a member?
at the server?
or everywhere?
you could check if this https://docs.pycord.dev/en/stable/api/models.html#discord.Guild.premium_subscribers returns duplicates if people boosted more than once but i dont think it does
Models are classes that are received from Discord and are not meant to be created by the user of the library. Attributes key, url. Methods def is_animated, async read, def replace, async save, def ...
server
Wouldn't that only give me those who boosted?
because what I want is the amount of boost that a person gave
i know, thats why i said what i said
check if it returns members who boosted twice, twice
if not then i dont think you can, as you cant in the normal UI either
nope It returned this:
[<Member id=814345765119590401 name='seba.nose' global_name='N' bot=False nick='N🍀(Future Assistant)' guild=<Guild id=1030567179726360657 name='ElServidorDelYonny [🎃]' shard_id =0 chunked=True member_count=2245>>, <Member id=1145046847317082192 name='ping1292z' global_name='PinG' bot=False nick='PinGas' guild=<Guild id=1030567179726360657 name='ElServidorDelYonny [🎃]' shard_id =0 chunked=True member_count=2245>>, <Member id=1161614399497310279 name='hijodedios_7' global_name='★' bot=False nick='Jasuas' guild=<Guild id=1030567179726360657 name='ElServidorDelYonny [🎃]' shard_id =0 chunked=True member_count=2245>>, <Member id=1281398673548251188 name='pepe_supremo123' global_name='Pepe the Magician' bot=False nick='Hearo remaster' guild=<Guild id=1030567179726360657 name='ElServidorDelYonny [ 🎃 ]' shard_id=0 chunked=True member_count=2245>>, <Member id=1017684724329746492 name='.itzjoel.' global_name='«†Joel♣»' bot=False nick='«†Joel♣»' guild=<Guild id=1030567179726360657 name='ElServidorDelYonny [🎃]' shard_id=0 chunked=True member_count=2245>>, <Member id=1029908521086627930 name='elyonnymasna' global_name='ElYonnyMasNa' bot=False nick=None guild=<Guild id=1030567179726360657 name='ElServidorDelYonny [🎃]' shard_id=0 chunked=True member_count=2245>>]
it does not return the number
wdym
yep
yea then i think you cant
hey there i have some code that should create a view depending on the options passed on the command although i have some problems making the view created from it remain persistent.
the current issue is that after restart, every view sends the pages of the default one instead of the one they should. how can i make them persistents while making them send the right pages?
@little cobalt
dont ping people for help please
It was someone who was asking me earlier.
.
i'm p sure that will require you to save and load it from a db
yeah def but how would i make this work? save custom ids or what i really dont know
message id | page that should currently be displayed
I want to write a ingame bot that invites users to a match, and it keeps track of the stats and such, but I want it to do it automatically based on the state of the queue that users can enter through the discord bot, anyone know any thing I can look into it to make it possible?
Why is it that this doesn't work:
debt = discord.SlashCommandGroup("debt", "Manage your debt")
@debt.command(name="add")
async def debt_add(ctx: ApplicationContext, ...)
but then i change
@group_name.command(name="add") => @bot.slash_command(name="add")
and it immediately works?
bc it's this
so it's bot.slash_group
after i have saved the message id and the pages connected to the embed how should i load them on start?
@bot.group()
async def debt():
pass
@debt.command(name="check")
async def debt_check(ctx: ApplicationContext):
i do this and then
TypeError: debt() got an unexpected keyword argument 'guild_ids'
this is the original message
@safe iris do you use cogs? if yes, the way you did it first is right
if I understand right you just load it on interaction to figure out which page to show
nope
hm, yea no clue how to do it without cogs
but paillat said slash_group and you did group
is this the part where i learn cogs
i did slash_group and it's the same .-.
you really should if you have more than like 3 commands
No
this
yeah but i dont understand why this doesn't work? also i went through history of this channel and saw another person who tried the same and didnt work
so just get the interaction message id and then get the associated slides right?
yes, that's how I'd do it
it is a decorator tho, say the docs
it's a decorator
AttributeError: 'function' object has no attribute 'command'
but I also don't know what it means with "initialises the given subclass of slashcommandgroup"
I'll be honest just do it with cogs, idk why slash groups are apparently so hard without cogs lol
it's quite funny because im copying the pycord guide and it still doesn't work..
that's prefix groups
mb
cogs speedrun any %
wha-
it's
debt = bot.create_group(...)
I think I know how the decorator version is supposed to work but it's kinda meh
ill try, this one seems promising according to ide
just put a line break lol
well, add a line break
and how
press enter?
and the thing with \n
I love how your code is just no typehints and nothing, it just instantly returns the inputs back to the user lol
?
that's for strings
also I have no idea how you're passing all that to ctx.respond
are you trying to concatenate it all into one big string?
and the python code for a new line
yes
and put newlines between them?
ah
yea use an f String thrn
?
currently you're passing everything as a seperate positional argument
which doesn't work
ok and how do i fix it
oh ok
you probably learnt it from python print function, but it mostly only applies to the built-in print
anyways- this works!
||why does the one in the guide not work 💀||
Can you send a link ?
guide is low-key outdated
Command groups are a way to create subcommands for your commands. For example, !afk set or `!afk
or well, not outdated but not well maintained IMO
so it can happen that some stuff doesn't work
well in this case i think it's more of the actual decorator not working, rather than the docs being inaccurate?
it didnt took the varibles
the decorator works, but according to the docs it's not supposed to work with a function
you didn't do the curly brackets like I showed
oh my bad
are you trying to build an embed btw?
no just a message
hm ok
also btw instead of the Option with just required=False you can also do footer=None
i have to make the footer required beacause right now it just sais "None"
in the input?
the first goes in the function header
?
what
ahhh alr 👍
well thank you so much and have a great rest of ur day 
np
{footer if footer else ''} that in the fstring
yea
worked, thx
i have arrived at this point, although the callback isnt being ran
https://mystb.in/6d521ec35c08527459
because you never set it lol
you just create a button and thats it
I'd recommend just using the decorator method to define buttons tho ngl
like here
from here
Learn all about implementing buttons in your Discord Bot using Pycord.
ty let me try
tbh im just having issues with using the decorator as i cant use the self variables how can i just set the callback with my current code?
i think button.callback = ..
yeah got it, button.callback = func
and the func should only take an interaction object
if message.content == "react me aaa":
await message.add_reaction(":white_check_mark:")
return
then
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
how am i doing this wrong 💀
await message.add_reaction("✅")
this works for some reason?
Because you cant add reactions with the shortform like that
last question, now i want that everyone can click the button to send the pages but i want to limit people without a role on the first page and people that have x role can use the buttons to navigate. how can i achieve that?
just build that into the button logic
how would i edit the logic of the default pages button? i need to create my own custom buttons right?
ah you're using the built in paginator as well?
yes
def create_paginator(self, slide_data):
"""Create and return a paginator for the slides."""
# Define buttons for pagination
buttons = [
PaginatorButton("prev", label="<", style=discord.ButtonStyle.green),
PaginatorButton("page_indicator", style=discord.ButtonStyle.gray, disabled=True),
PaginatorButton("next", label=">", style=discord.ButtonStyle.green),
]
# Create a list of pages from the YAML data
pages = self.create_pages(slide_data)
# Create and return the paginator
return Paginator(pages=pages, show_indicator=True, use_default_buttons=False, custom_buttons=buttons)
ah, then i have no idea, never worked with the paginator
Subclass the paginator
And you will be able to change the button
is there any example? im not really sure how to do it
You do the same thing that u do for the view
And then you edit the button part
(Look on GitHub how the thing is so you just have to change the button)
Should be really easy
uhm i'll try
ohh i got it
it was more easy than i thought
how do i defer a paginator?
interaction.response.defer()* mb
I'll pr something to add a shorthand for that as there is already one for interaction.respond
how can i check if the bot can use the custom emoji ?
because in some dropdown i got some error invalid emoji
Try except 
there is no way to know ?
i mean its a good way
i can still just replace my fonction by the creation of a dropdown and then see if its works or not
better would be to use app emoji
no permission needed for those, I've been told
Yeah but it’s not for myself and since it’s a public 2000 might be too less
gonna need more context here then
are you trying to use user supplied custom emojis?
let imagine a context of tickert, for the ticket the user can pass a emoji that will appear in a dropdown
Models are classes that are received from Discord and are not meant to be created by the user of the library. Attributes key, url. Methods def is_animated, async read, def replace, async save, def ...
if it has to be guild emojis, just do a permission check
I keep getting "interaction failed" and "discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction" at the defer() line in this callback. Only the first time I click.
Any idea why?
async def callback(interaction):
bi = int(interaction.custom_id)
if bi != 3:
await interaction.response.defer()
else:
modal = ManualModal(title="Enter Member Name", custom_id="ManualModal")
await interaction.response.send_modal(modal)
await modal.wait()
#do stuff
#do stuff
matches = ["Test1", "Test2", "Test3", "Manual"]
v = [discord.ui.View(timeout=None)]
b = []
for i, m in enumerate(matches):
b.append(discord.ui.Button(label=m, custom_id=str(i)))
b[i].callback = callback
v[0].add_item(b[i])
await msg.channel.send("Test", view=v[0], delete_after=900)```
I'm not defering the modal. Just a button click callback
ah
copy pasting is hard
Yeah my bad I'll fix it
oh yea ic i think
I only defer if it's not for the button to send the modal.
Basically I'm almost immediately defering but it's like the button times out and isn't defered.
are you sure you aren't somehow taking 3 seconds to reach the defer? like idk what the rest of your code looks like
Only the first time I click it though.
The callback I imagine is immediately called when the button is clicked. The call back only does this before the defer line:
async def callback(interaction):
bi = int(interaction.custom_id)
if bi != 3:
await interaction.response.defer()
I simplified the code in a text editor real quick to make it more readable. And that editor broke the indentation. It's fixed now. If only it was as simple as copy paste your code but it would take up the entire screen unfortunately and no one wants to read pointless code in between.
class AdvertisementButtons(discord.ui.View):
def __init__(self, bot):
self.bot = bot
super().__init__(timeout=None)
@discord.ui.button(label="Report", style=discord.ButtonStyle.red, custom_id="REPORTSERVERBUTTON")
async def report_server_button_callback(self, button, interaction):
await interaction.response.defer(ephemeral=True, invisible=False)
await interaction.followup.send("Coming soon.", ephemeral=True)
# Somewhere else
view = AdvertisementButtons(bot=self.bot)
view.children = [view.children[0], discord.ui.Button(label="Invite PartnerPal", style=discord.ButtonStyle.link, url="https://partnerpal.nziie.xyz/invite")]
This persistent view will occasionally have the Report button which is the original button in the view. I've tried different ways to get a link button in there with a persistent view but its definitely random of when the Report button actually shows up.
exact same function
I'm creating a basic ticket bot and everything seems to work, but after a while the main interaction with buttons just keeps failing? No error in terminal or anything, it's still running.
.tag persistant
Tag not found.
Did you mean...
persistant-view
persistent
.tag persistent
The Issue
When you send a message with a view, button for example
if your bot restarts, you will lose the ability to use this button.
How To Fix This
- Set your view timeout to
None
- By default, the view timeout value is set to 300 seconds
- Pass a
custom_idvalue to the view
- Custom ids must be unique
- Chose a custom id that has a meaning in relation to your view
- Add the view to the bot
- You can use the method
Bot.add_view(YourViewClass()) - Make sure to add the view when the bot begin ready
Thank you!!!
I have a channel with up to 100 messages (created automatically).
Each message has a button.
Clicking that button does something destructive.
So I'd like the user to confirm the action.
How would you approach that?
I've considered an ephemeral message with another button. But the message one will appear at the bottom of the channel. So if you click the button on a message higher up you'd have to scroll down first :/
I've also considered an empty modal, but those aren't possible it seems.
Any other ideas?
Why not use view.add_item()?
Adding an item has a few more things done internally
self.__weights.add_item(item)
item._view = self
self.children.append(item)
You could edit the message with new buttons but this might raise problems if they never select it, and the fact that it is not ephemeral may raise issues in your case. I think your model idea is great. You would just have to compromise and have one input text that you just ignore the contents of. You could but some placeholder text "You will be doing this destructive action. Are you sure you want to continue? If so press submit. If you want to cancel Press Cancel or The X"
Ah that's a nice idea!
I'll try that, thanks!
Hey, I don't know if I am going insane but do on_message (A) and on_message_edit (B) use different caches somehow?
When executing the same things,
for A, message.guild.get_member(user_id).display_name
for B, after.guild.get_member(user_id).display_name
A produces an error saying AttributeError: 'NoneType' object has no attribute 'display_name', whereas B is able to get that display name
do you have the full code for both functions (up until that point)
actually ima try just hardcoding the id first, because im not sure whether the user_id could be wrong or not
just make sure user_id is always an int
yeah i just realised
JUST now
😭
rip
which IDE
and remember python is all but typesafe, so IDEs sometimes can't detect that something is wrong
Badedpyright
😎
.add_item was doing the same thing
So the issue is that sometimes the Report button will not be included in the message?
Hello
How can I differenciate the Apps and Server webhooks ?
just check if the message has a webhook_id
mmmm i guess it's a bit more complex
i didnt even know there was a difference.. what is the difference?
like i've never seen the top one
And that is different from an announcement channel post/publish?
Message.webhook_idto see if it's a webhook (but this includes interactions)-
Message.author.discriminator == "0000"to ensure it's a webhook
Serverwebhooks will have amessage_referencethat has a differentguild_idto the current guild
so you need to combine all that
I thought the username would be the server name/channel and server pfp
oh
yea but it is ig? the channel is called #a ?
So the API allows you to just send a webhook as a server?
either that or there's another way of sending a "SERVER" message like that
all webhooks can break the username rules so it wouldn't matter unless you only want to guess from that pattern
apart from Message.publish, no
how can i transform an in put into an str object
If you set your option as a str, you will get a str
@discord.slash_command()
@discord.option(str, name="my_option", description="My option")
async def my_command(self, ctx, my_option: str)
...
if you put nothing it will also be by default str right
how to use the channel.can_send() ?
i dont understand what are the valid type
is there a way to get all categorys and display them as options to create a chat in
Look at the docs and try it out
nah nvm, the WebhookType is different, there is :
incoming (the one we creates ourself, with the copy URL button)
channel_follower (the ones from the announcements channels, managed by Discord)
application (created by the bots).
The all three have IDs, so I could not manage to base my code on it, so I choose the WebhookType of the method webhook.type
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'createchat' object has no attribute 'guild'
?
what do i have to do?
No..
what are you trying to do
you are just calling the create stage channel method on the categorychannel class itself, that makes no sense
you need an actual channel object of a category channel to use that method, or use the create_stage_channel method of ctx.guild and pass the category channel as discord.Object(categorychannelID)
you could also just let the user select one of the guild's category channels instead of passing it by name, that just asks for errors
i just wanna create a stage
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Guild.create_stage_channel() takes 2 positional arguments but 3 were given
why are you passing self?
oh honestly didnt realise that existed LOL, fairfair
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: Guild.create_stage_channel() takes 2 positional arguments but 3 were given
again, why are you passing self?
ah
you have to pass kwargs
yea, it doesnt take more than 1 positional argument
i.e. name=name and so on
ok works now
how would that work?
by using the option decorator to properly set up the option, and passing channel_types=[discord.CategoryChannel] in it
ok thx
https://guide.pycord.dev/interactions/application-commands/slash-commands#options--option-types
i recommend the decorator one over the typehint
Learn all about Slash Commands and how to implement them into your Discord Bot with Pycord!
bump
Well I dont understand what is the object that supposed to pass
Apprently not content or embed
Messages, embeds, files, emojis and stickers
I tried to put just Message as text but I got an error
Or a content basic one but same
I think message is just not passing anything
I tested with an embed and it worked too
Doesn't work if you pass a str
can_send is kinda weird
Yeah lolz
Idk if this is a discord bug or pycord, I didn't find much about it.
When you try to use this function message.channel.is_nsfw() but the channel there is a Thread... Shouldn't it act as the parent channel? So if the parent is NSFW, the thread is automatically NSFW
It's a User Install command btw
What I'm getting is that it always comes as false
Update: The behavior might only happen if your bot is not in the server you are using the command.
yea, user apps are extremely restricted
you cant access most of the guild related stuff
if you're checking for NSFW, you should mark the command itself as nsfw instead
https://discord.com/developers/docs/interactions/application-commands#agerestricted-commands
in pycord this is @is_nsfw(), or pass nsfw=True into your command decorator
I don't want to restrict the command. I want the command to have a nsfw behavior, only if the channel is NSFW
out of luck then 
Btw about this... I tried out a couple of things, its so annoying to reproduce, every time I try recording it works.
One thing I noticed is that it seems to happen more often in group chats, and when I haven't been in the chat for a while XD
I accept my defeat XD
I wonder if Discord doesn't provide the correct indicator if the channel is nsfw or not. Idk how pycord gets that value tho
its because its a user apps
user apps get absolutely nothing compared to a guild-installed bot
I bet
That should imo still be given to the apps
Ctrl click
yea, but discord chose not to
its dumb
Might be considered a bug
Imo
Is there a way to have a function get called for every application command, before the actual application command gets executed?
I tried listening to on_application_command, but it always gets executed after the actual command.
I want my bot to always defer on any slash command before executing the actual command handler.
on_application_command is trigger before the completion
I want my bot to always defer on any slash command before executing the actual command handler.
sooo i did that using a bot check
ye I tried this. Added the listener to my Events cog (which is also the very first one getting loaded), but the actual command code always gets executed before the event handler :/
because its a listener, so the command is not waiting for it to be done
yeah we can say that
but if you use a bot check, it will first do what there is inside ur check fonction before actually lunching the command
what's a bot check?
.rtfm bot check
discord.Bot.check
discord.Bot.check_once
discord.Bot.clear
discord.Bot.close
discord.Bot.cogs
discord.Bot.command
discord.Bot.commands
discord.Bot.connect
discord.Bot.create_dm
discord.Bot.create_group
discord.Bot.create_guild
discord.Bot.delete_invite
discord.Bot.dispatch
discord.Bot.emojis
discord.Bot.event
discord.Bot.extensions
discord.Bot.fetch_application
discord.Bot.fetch_channel
discord.Bot.fetch_guild
discord.Bot.fetch_guilds
oooh, thanks!
Sounds good.
Hmm. I'm getting
discord.errors.CheckFailure: The global check functions for command settings failed.
my code is:
@bot.check
async def always_defer(ctx: ApplicationContext):
await ctx.defer()
I guess it's because check is expecting a non-async function?
I just added defer to all my commands
guess I'll do that as well. Also tried making the check function sync and using asyncio to defer, but to no avail.
Einfach machen
what code are you running in the event?
Just await ctx.defer().
Genau
because they all request one or more external APIs, which don't always respond in time
I do it because of bad Internet
ah
I only do it for 2 commands, imo you should avoid it whenever possible
if your net is so bad you can't respond within 3 seconds I doubt it's usable at all
Well... another solution would be to subclass ApplicationCommand and implement my own @SlashCommandGroup.command() & @application_command() decorators ig?
Not sure if I'd wanna go that route tho
You could, but I genuinely think that's more effort than just to defer
absolutely overkill, yeah 😄
I might go that route, if I need more custom command behaviour than just that
what is your bot that you need APIs in every command tho
It's getting info from a game's API (Pixel Starships) to display on Discord.
Stuff like item info, player info, clan info etc.
ah nice
return true after
@bot.check
async def always_defer(ctx: ApplicationContext):
if not ctx.response.is_done():
await ctx.defer()
return True

This works really nice! My code:
class ConfirmationModal(ModalBase):
def __init__(
self,
action_name: str,
action_description: str,
callback: Callable[[Interaction], Coroutine[None, None, Any]],
*,
custom_id: Optional[str] = None,
timeout: Optional[float] = 15.0,
):
children = [InputText(label="Confirm action", placeholder=f"Submit this form to confirm {action_description}", required=False)]
super().__init__(*children, title=action_name, custom_id=custom_id, timeout=timeout)
self.callback_func = callback
async def callback(self, interaction: Interaction) -> None:
await interaction.response.defer()
// Have to defer() here or the callback would be executed, but the modal would error and not close. Alternatively send a confirmation message to the user. If the callback takes very long, still defer() before calling it.
await self.callback_func(interaction)
async def confirm_button_action(interaction: Interaction):
await interaction.response.send_modal(
ConfirmationModal("Action name", "doing this and that", button_action)
)
async def button_action(interaction: Interaction):
await service_layer.do_stuff()
Thanks again!
i may be stupid but doesn't your callback infinitely loop calling itself?
callback is also a parameter in init
dw ^^
i forgor that in python you'd need to use self.callback anyway
sometimes i hate this language a little
Aww man, I feel stupid now.
It works now. I even implemented it in a way that lets me specify the cogs whose commands should get auto-deferred. Don't need it for things like bot settings after all.
Thanks a lot.
I'm having a problem with autocomplete, my function that returns the list of options is working, I used print to debug, but for some reason it doesn't appear in the discord list if it doesn't follow the same order of letters as the words in the list, if the list has ['orange juice', 'apple juice'] and I write 'juice' in the parameter in discord, these two options don't appear even if the verification function returns this list.
Show the autocomplete
Heyy, can you send please the code you use for your command and the autocomplete ?
My guess is you are using basic autocomplete and your own function. You should only be using one
the "inner" function, IIRC, just returns a list of all options, and the basic autocomplete fuzzy matches it
smth like that
ill google it in a min
yep you use both
@bot.command(description = '/register _type: "Type name" item: "item name" obs: "..." (obs= observation)')
async def register(
ctx: discord.ApplicationContext,
_type: discord.Option(discord.SlashCommandOptionType.string, min_length = 1, max_length = 25,
autocomplete = discord.utils.basic_autocomplete(funcoes.get_types)), # type: ignore
item: discord.Option(discord.SlashCommandOptionType.string, min_length = 1, max_length = 25,
autocomplete = discord.utils.basic_autocomplete(funcoes.get_item_oftypes)), # type: ignore
obs: discord.Option(discord.SlashCommandOptionType.string, max_length = 30) = '' # type: ignore
):
if (_type not in await funcoes.get_types(ctx)) | (item not in await funcoes.get_item_oftypes(ctx, _type)):
await ctx.respond("Tipo de item ou item inválido.", ephemeral=True)
return
params = {
'guild_id': ctx.guild_id,
'user': ctx.author.id,
'type': _type.strip(),
'item': item.strip(),
'gameid': await funcoes.get_game_id(ctx),
'obs': obs.strip()
}
query = """
INSERT INTO panel (server_id, user_id, game_id, item_id, obs)
VALUES (:guild_id, :user, :gameid,(SELECT item_id FROM itens
WHERE type_id = (SELECT type_id
FROM types
WHERE type = :type
AND game_id = :gameid)
AND item_name = :item), :obs)"""
result = await funcoes.registrar(ctx, query, params)
if result:
await ctx.respond("item registrado com sucesso!", ephemeral=True)
else:
await ctx.respond("Isso já existe ou não está conforme!", ephemeral=True)

Not that fancy
any options that start with the value from the user, case-insensitive
async def get_item_oftypes(ctx: discord.AutocompleteContext, _type: str = None):
"""Autocomplete para listar itens."""
game_id = await get_game_id(ctx.interaction)
_type = (ctx.options.get('_type', False) if ctx.options else _type)
item = (ctx.options.get('item', False)) if ctx.options else None # Usa `ctx.value` para capturar o que está sendo digitado
params = {
'guild_id': ctx.interaction.guild_id,
'gameid': game_id,
'type': _type,
'item': f"%{item}%" if item else None
}
print(params)
async with aiosqlite.connect('src/data/_test/data.db') as db:
query = f"""
SELECT item_name FROM itens
WHERE (personalized_server = :guild_id OR personalized_server = 0)
{"AND item_name LIKE :item" if item else ''}
{"""AND type_id = (SELECT type_id
FROM types
WHERE game_id = :gameid
AND type = :type)""" if _type else ''}
ORDER BY item_name ASC
LIMIT 25
"""
print(query)
async with db.execute(query, params) as cursor:
data = await cursor.fetchall()
result = [row[0] for row in data]
print(result)
return result
command used in discord: /register _type: Equipament item: Laby (i dont send, just test autocomplete to wait a list do "laby" itens)
tag?
this
and also the code of the command where you use the autocomplete (at least the option you put autocomplete into)
but im p sure this is correct behavior
Instead of return result do
return [result for result in result if ctx.content.lower() in result]
can you do this again but add an a after the L? which options show up then
yea
basic autocomplete checks for startswith i think
yea, that's correct behavior then
then is a discord limit?
no
how i can pass this
basicautocomplete using startswith is criminal
you are using the function that does excatly that behavior
how i avoid it
if you want some other behavior, try what dark said, and just dont do the basic autocomplete part
just write your own autocomplete function

well they did, but they also pass it to basicautocomplete
inherit it?
Why does it even use startswith
i mean just skip it entirely
idk lol
yip
check is not only for command call?
that is the source code of the basic autocomplete
No, you just have to make a few switches. Currently you are retuning a list of all of the options to basic autocomplete. Instead you should make your autocomplete fucntion return the list of options that match your criteria, and not use basic_autocomplete
well, part of it
how i do this
i'd just glance through the example
Here's the slash autocomplete example.
it makes it pretty straightforward
the examples also use startswith lmfao
this ^, and get rid of basic autocomplete in your options, just pass your autocomplete function without the () directly
well more importantly it shows how to implement without basic
i'm confused, i dont need to pass a class to the autocomplete?
in typing
personally, use fuzzy search
you aren't passing a class there lol
what basic autocomplete does is to return a list of matching values
thats why it works like that
in the end if you write your own function it'll just be autocomplete = yourfunction
then, even if my options of "get_item_oftypes" return a list, if the start of the string not match the autocomplete ignore it?
no
YOU decide the list to return, so you handle all the filtering
basic_autocomplete just does it in a dumb way, thats why we're telling you to not use it
aaaaaaaaa, i change the basic_autocomplete for your check func then?

just make YOUR autocomplete function return the right values, and then do autocomplete = yourfunction
ALL values you return from that function will then show up in the UI
and if you do this, like dark said, it should match better
* You need to limit that to 25 results though, otherwise you will get an error
doesn't discord just cut the list short?
no you don’t
have a limit in the query
the first param of the function used receive a autocomplete context?
i have an autocomplete returning 1400 items it’s fine
its the only parameter an autocomplete function takes, and yes
yeah, i guess py-cord strips it for you
Also, I had no idea this worked choices = [1,2,3,4][:25] I thought that would give an index error. I feel like I have done that before and gotten an index error.
is it possible to catch event based (particularly on_message) from the cog errors, tried cog_command_error but it doesn't catch anything event related
that is the syntax for list slicing yes
not sure if you'd get an error, no idea
on_cog_error and the global on_error should handle that for you
(doesn't error)
you can also do ...[:-1]
I know about list slicing but I thought I would have to do
choices = [1,2,3,4]
choices = choices[:min(len(choices), 25)]
idk where I got that idea, but I have done that before
I remember being excited when I found out it works, too
me when you have to import arrays
or printing
Now that I looked for the definition of basic auto complete, I understand 
It’s not, but Python still has its warts. I really wish optional chaining were a thing (a?.b?.c)
felt
There was a proposal for it, but it never went anywhere
ctx.author?.id
but the ? looks kinda out of place, i find it meh
So this would return None instead of an attribute error? if author did not have a .id?
imagine
if ctx.author then ctx.author.id and if ctx.author.id then <idk>
wait..
hm no this is cursed enough
anything can be multiline if you try hard enough
@errant trout @sage tendon !!!!!
nice
btw you can get rid of that underscore of your first option if you want, you dont have to change the actual parameter name even
Parameters can have different labels than the var name?
yes
depends on if you use the decorator or the typehint tho
for the typehint you can pass name=, for the decorator you change the name to whatever you want and then link it to the parameter via parameter_name=
I did this to avoid conflict with the python type
yea but you can use what i said to still make it have the right name in the UI, I have the exact same problem for one of my commands
i configure the param with @option ?
hmmmmmm
whatever you already use
both ways work
Nice. I assume they can’t have spaces still
never tried, don't see why not
like that?
you are still using basic auto complete lol wut
and no, for the typehint method you pass name="type"
remove discord.utils.basic_autocomplete
also you don't need that whole slash command option type stuff
just passing str works too, or you can omit it altogether, it's str by default
but this param doesnt have some problems, is more the 'item', the type have less options
also idk what you're doing with that min and max length
but i can remove
it doesn't influence the amount of options shown, it influences how many characters the user can type
prevent trolls i think
a gigant name item

what
well the user doesnt need to "search" a type
but it's more because I didn't know I could implement my own autocomplete
but optional is after a required no?
I dont think this is what they mean.
yea I'm thinking that too lol
not really sure rn
well i can set default fot item None and all of param are optional, i check it in the function
in cases of pp using only item param directly
but I appreciate it, it saved me hours of headache ❤️
np, if you need help just ask again
Is there an official release cadence? (I really want app emojis, which I know are in master)
not that I know of
unofficially around christmas
Sadly they can't have spaces:
ERROR | COGS | Failed to load cog interface.cofd.basic: Extension 'interface.cofd.basic' raised an error: ValidationError: Command names and options must follow the regex \"^[-_\w\d\u0901-\u097D\u0E00-\u0E7F]{1,32}$\". For more information, see https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-naming. Received "amazing option"
How can I send a multiline ``` ``` block? Here's my var:
'`d` is amgiguous. Did you mean: ```Dexterity\nDrive```'
The embed, however, drops the Dexterity part:
(that typo is fixed on another branch, lol)
that should work as normal, are you sure the code is updated?
i doubt the library or discord would selectively ignore the Dexterity text
Yeah, it's odd. I'm on 2.6.1, and that's the value I pulled straight from the debugger. The method is simple:
(you can see my breakpoint there)
what happens if you print embed.description
(through whatever method, e.g. before sending it or also fetching the message and checking it after)
oh wait lol
you need a \n before dexterity
because it's reading the first line as a language code instead
Ah!
Good catch. I often do one-line code fences, but they're just one line. Thanks!
success!
nice
So, I have multiple subscription tiers in Patreon (since they aren't supported in Discord yet). I'm currently checking to see if a user has one by checking if they have a role in my bot's server. Is that the standard way of doing it?
Also, is there a way to mark an entire cog as only being available to guilds, not in DMs?
Don't think so
Hmm. Looks like I can set contexts for a SlashCommandGroup. If I understand correctly, I can use that to ensure the entire group can only run in a guild?
yes
yea, that's why its deprecated
patreon has always supported discord through their own bot system, or do you need something else
I mean that my Patreon supporters have a special role on my server that indicates they are paid supporters. My bot checks for this role to determine command eligibility. Is this the normal way of doing things?
(Yes, that role is managed by the Patreon bot)
you should just use the discord permission system if its slash commands
server settings > integrations > your bot > click any command and see
This is a bot on over 4k servers
so is it your bot?
Yes
so every guild can set patreo nroles
No, I have a "patreon" server. Supporters join that server and get the role, and they can use the premium commands wherever

