#Basic Pycord Help
1 messages · Page 45 of 1
of course its working
rly?
yea
yea the creator came back and went on to create the most batshit insane implementation of application commands possible
thats why i wouldnt recommend it for modern bots either way
oh didn't know that nice
ye pycord is better
sorry for the stupid question again, but for things like my logger config should i also make a separete file and import it on each cog or how would you do it?
idk its confusing af to me
oh
You mean the logging module?
yeah
Wouldn't just placing it in the main file work for everything else?
im not sure... i will try
Creating application commands in discord.py is confusing to me
for some reason python imports confuse me
thats exactly the reason why i said this #1132206148309749830 message
dude made it way too complicated
ye true
slash command is not registering
do not use requests
bruh why
I was very surprised when I migrated to py-cord and how easy it was to create application commands lol
its not async, it blocks your entire bot
im using a good api that's return infos about movie
oh correct ye forget that there something called aiottp?
ctx.respond, not ctx.send_response
something like this?
ye ik
aiohttp
did you restart discord after restarting the bot
ye used it once
nope just the bot since when i need to restart discord?
also, you dont have to write the full name all the time
almost everything you need has shortcuts
e.g. discord.SlashCommandGroup or discord.Option
since discord sucks, so, ~2015
no its just caching so 
my vscode is giving me error
or not its working now
i think cuse the discord.py
was giving me the error
not pycord
discord.bot.Bot? Wtf
ye its the full name of the module
yea i already said its unnecessary
ik but discord.py was giving me the error i thought it was from py cord
anyways the slash command still not registering
are you loading the cog before on_ready now?
and remove the guild_ids thing if you want it available globally
dont even think that can work for subcommands
sure
working now
thanks again
the last time i used pycord was like from 3 years
read the guide & docs
no bc i have the logger object created on main
ye ur right but its working now
yea but it still blocks your bot
ah
do you know by any chance a good way to make a embed?
discord.Embed
no i meant a ui builder or smthg like that
to just preview the embed and the ill code it
just like a prototyppe
but yea they do exist
google it yourself
ah ye sure
https://message.style/app/editor seemed to be pretty good
im wacked rn whats going on
def string_check(message):
print(type(message.channel))
print(f"Is Another Author: {message.author.id != initiator}")
print(f"Is discord.DMChannel: {message.channel == discord.DMChannel}")
print(f"Is discord.channel.DMChannel: {message.channel == discord.channel.DMChannel}")
if message.author.id != initiator or message.channel != discord.DMChannel:
print("flagged")
return False
print("not flagged")
return len(message.content) > 0
console output:
<class 'discord.channel.DMChannel'>
Is Another Author: False
Is discord.DMChannel: False
Is discord.channel.DMChannel: False
flagged
better formatting
and not a screenshot
i've tried the same thing with is and is not
same results
thank you
any suggestions or info to put it on the embed?
yea that looks better imo
Now fix your emojis to be unicode and not discord style and you're set
also, Rating*
you're cooking with that embed
its a bot so you search about any movie/series send its give you this embed with all info
i've got this block of code and i'd like to get the values from a select back from the view, but it doesn't have the values attribute yet
events_view = Events()
await ctx.author.send(embed=embed, view=events_view)
view_finished = await events_view.wait()
if not view_finished:
event_select = events_view.get_item("yeag")
here's my callback
async def event_select_callback(self, select, interaction):
self.disable_all_items()
await interaction.response.edit_message(view=self)
print(select.values)
self.stop()
i just worked with view only once, and forget everything about it
do i gotta permanently attach those values to the select or smth?
Yes. You have to set them to some attribute
I am so confuse, Trying to debug why the guild.audit_logs is not working properly with the after param. (and do a PR to fix it)
As per discord doc If after is used, the list is reversed and appears in ascending order (older entries first)
But in my debugging, I have found that discord is returning the newest first ? Is discord doc wrong ?
are you on 2.5?
the lastest form master
yes I have seen the lastest PR
that change the audit logs
That is why I was testing again
if they are returning the newest first (contrary to the doc), that is why that iterator is failing
using an after value of 0 is ignored by discord
bruh whattt
is literally says in the doc to do that
hm let's see
actually
fairly sure our logic is broken for Object(0)
everything else works as expected
you are right, if I put after=Object(id=1), it is working as expected
that value should be -1 not 0
to work as expected
no, 0 is allowed
but our request ignores it
i.e. go to http.py -> get_audit_logs and change if after to if after is not None
If after is used, the list is reversed and appears in ascending order (older entries first) So if we want to continue the async iterator the after value need to be updated to the newest in the list (-1)
ooh I see
you're probably also right on the index
i'll pr with both adjustments
huh, it's already 0 on master
that is the problem
it should be -1
with 0, it does infinte loop
ah
hm, is your limit working as expected?
right, but can you test with limit anyway
this is why we need index -1 not 0
if I test with limit, it will not do batches, will stop after the limit I put
yeah, but i'm asking because my limit just isn't working lol
you are right, limit is broken to 😄
this needs a lot more thought huh
the audit_logs have been broken for a while
more than 1 year 😄
there have been a few PR to try to fix it, but still broken
I can try to fix it as well, but the index change and the accepting of 0 is a great start
i'll work on it some more
the raw request method is fine so it's just a matter off making sure the iterator works... all our other iterators are fine so this is rather odd
yeah, not sure why did one is like that. I have raise a few Issue on the GitHub mentioning the index need to change with the explication behind it. But could not find why the id=0 was not working 😄
so did not raise PR
can you tag me if you manage to fix it please ? Otherwise will look into it to
sure
thank you !
I tested a bit the Pr you put, it seems to have fix the issue. I can do more testing later, need to go sleep
wrote here because dont have write access in discussion 😄
which feature is this like search option in select menu
This is for channel_select
not for custom items?
You can still use that kind of thing but for 25 things only and u can’t type to find it
If that’s what you want
yeah i thought theres a search feature for custom items too
There is autocomplete but…
Discord could have done great things
we can't select more than 1 item in autocomplete
But sélect menu don’t create menu
mah
Traceback (most recent call last):
File "/opt/render/project/src/.venv/lib/python3.11/site-packages/discord/client.py", line 400, in _run_event
await coro(*args, **kwargs)
File "/opt/render/project/src/.venv/lib/python3.11/site-packages/discord/bot.py", line 1178, in on_connect
await self.sync_commands()
File "/opt/render/project/src/.venv/lib/python3.11/site-packages/discord/bot.py", line 754, in sync_commands
app_cmds = await self.register_commands(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/render/project/src/.venv/lib/python3.11/site-packages/discord/bot.py", line 531, in register_commands
prefetched_commands = await self._bot.http.get_guild_commands(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/render/project/src/.venv/lib/python3.11/site-packages/discord/http.py", line 367, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
whats this eror about
def subcommand(group: str):
def decorator(command: bridge.BridgeCommand):
multicog_metadata[str(command.slash_variant.id)] = group
multicog_metadata[str(command.ext_variant.)] = group
return command
return decorator
I need inside my cog to be able to get a command inside a dict, however if i use the name or ext_variant which is equal to the same in this case, it will get the wrong command. How can i get some get of id / unique thing for a command using the variant of a commands.command
ig ur bot does not have the necessary scope
got it thx
got it fixusing callback as an id
I believe it isn't possible, but asking to be sure. Is it possible to change the selected option in a dropdown after an interaction? Like "resetting" the component?
edit the message and replace the view by the same one
Yeah that's what I was about to do
i was doing like so in my memory
or remove view and add it again if that doesnt work
not the best but
How does BridgeCommand work with Options?
I have my code like this:
@bridge.bridge_command(
name="whois",
description="Gives you information about a user",
)
@bridge.guild_only()
async def _whois(
self,
ctx: bridge.BridgeContext,
member: Option(
discord.Member, "The user you want to know more about", required=False
) = None, # type: ignore
):
member = member or ctx.author
await ctx.respond(embed=self.whois(member))
Which works fine for Slashcommands and when I use the Text Command without Args/Options. But when I add an arg in the Textcommand then I get following error:
[2024-07-07 15:49:08] [ERROR ] cogs.ErrorHandler: Converting to "Option" failed for parameter "member".
Ignoring exception in on_command_error
Traceback (most recent call last):
File "/Users/dominik/Development/D-20/.venv/lib/python3.9/site-packages/discord/client.py", line 400, in _run_event
await coro(*args, **kwargs)
File "/Users/dominik/Development/D-20/cogs/ErrorHandler.py", line 39, in on_command_error
name=f"{error.original.__class__.__name__}",
AttributeError: 'BadArgument' object has no attribute 'original'
I see. Thank you
its possible to send mumlti embeds in one message?
My bot isnt receiving on_ban and on_invite_creation events even though i have all intends enabled
on_ban isn't a thing
and it's on_invite_create
Pycord is a modern, easy to use, feature-rich, and async ready API wrapper for Discord. Features: Modern Pythonic API using async/ await syntax, Sane rate limit handling that prevents 429s, Command...
and it's on_member_ban
show your code
btw, bot.load_extensions("cogs") loads everything
no, it should not be there
ah
also, your cogs won't load at all that way unless i'm wrong lol
because i dont think your code ever leaves bot.run
it loads
ah
also, why so complicated lol
its not like you ever import your main bot file, so thats just unecessary
wdym
do you even know why that if __name__ is there?
.rtfm on_member_ban
name is a good things to do
it's unnecessary
I will not debate about that
do you ever import your main bot file?
No.
Ergo: Unnecessary
lmao
Reload will be more appropriate in my case
Is there a way with discord.Forbidden to have more context on for ex. what permission the bot was lacking if it tried to do something in a server, etc...?
isn't it in the message?
Application Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
Don't think so
ah
well, typically, the action you're trying to do leaves only one possible permission
Yeah I get that, but what I mean is if i catch that in for ex. in on_application_command_error i wouldn't know that unless parsing the traceback which is not efficient at all and can be unreliable
Missing Permissions is usually role or channel permissions.
Yeah but again I don't know which permission
Ok by plaing a bit in the debugger I found a hacky way
yeah no noway I do that
It's because you get error.response
Presumably silly question(s):
most of my bot framework is from discord.py, so it has discord.intents and specific debug_guild target information. I've removed them as per the pycord "my first bot" tutorial, and it seems they're unneeded. So... I presume, pycord automatically sets the intents, and sets the target guild to be any server the bot is currently within, am i right with that presumption?
intents are a kwarg in your bot definition
and the guilds, yea, of course lol
do you have to manually set that in discord.py?
i had a debug_guilds value, i think
so that must've restricted which guilds were being targetted
yeah probably
yea, well, thats also possible with pycord, but the default is all guilds
fairs fair 🫡 was just curious when transitioning from the discord.py style to the pycord style :3
Guys, one question, can a user command also be a normal application command at the same time?
Or do I have to make a separate command?
class UsersCommands(commands.Cog):
def __init__(self, bot):
super().__init__()
self.bot = bot
@commands.user_command(name="Profile")
async def profile_user(self, ctx, user):
# ...
yes
ok, ty!
This is probably a very silly question, but do commands in slash command groups register as individual commands?
In relation to Discord's application command limit
no
Awesome, thank you!
how?
if they meant the new user apps, you can pass multiple contexts
judging from their code the mean context menu commands & slash commands
which i wouldnt know how that'd work without duplicating it
yeah that isn't a thing
How can I have members submit an image through a slash command and keep that image forever (besides downloading it)? The discord image URL eventually times out. Is there a way I can get a permanent link?
I mean, you'll have to download it lol
that's the only reliable way
one dumb hacky idea I just had is uploading it to Imgur and saving the reference in a db
do you need to use this image outside of discord?
No, but I need to send it as an embed more than only a few days later
It replies with an ephemeral reply, yeah. But it doesn't have to
What does it change ?
then yeah, you have to reupload it or save it
Ephemeral are not saved and not ephemeral are saved ?
ephemeral images are deleted quickly yes
i'd say, on submit just reupload the image to wherever the response is recieved
wait actually
Wdym
i.e., instead of sending attachment.url, convert it with await attachment.to_file() and send it in a new message
Wait I’m a little bit confused
then you can always use the discord link within discord
cant you have an image storage server with only the bot in it, upload it there for storage, and then later access it again
When you send a image to discord with an url send and get with message (discord message€
I save attachment.url in my data file, and then reference it later. You're saying I should send the image back to discord and save that link?
You can use the link and send it few days later ?
yes
Yes, but I don't want to unless I have to lol
if it's an ephemeral command, the image will be gone within the hour
If the link of the discord attachement has been deleted
It wasn't only an hour. It was a few days
Can be because of ur discord
That cached the image
cache is weird, but it's meant to delete as soon as the message is gone
Maybe other will not be able to see it
You have some free thing online
To upload image and get a permanent link
even if it's not an ephemeral command, if the message is deleted by anyone else then the attachment is gone. The safest way to retain it is for you to either save it or reupload it immediately to discord.
And how long does that last? Image links only last a few days anyway.
infinitely
within discord
the expiry does not apply to image urls if you send it in a message or embed
it's only to gate other websites from using it
attachment urls last 24h exactly though, just to bring that number up too
right, but for their purpose it's irrelevant
That doesn't make sense, because (unrelated to this) I sent an image, copied it's discord URL and linked to it in a message, and after a few days, the image was no longer accessible. Or is it different because it was opening in browser?
yes, opening it in your browser is different
Gotcha.
Do I need to send the image back, or if I reply with a public response, the URL will last forever too?
.
its not assured itll stay
you could respond with it publicly, but i'd personally just reupload it elsewhere to be safe (maybe log all command usages in a channel?)
(and reminder that you can put uploaded images inside rich embeds #app-commands message)
Yup, I actually helped fix a bug related to this and pagination haha
just double decorate it
shouldn’t matter
hey, am I somehow able to get on_error piped to a cog listener?
I don't want to overwrite the normal action (for now) but want to assign a listener
but according to the docs https://docs.pycord.dev/en/stable/api/events.html#discord.on_error it's not possible
This section outlines the different types of events listened by Client. There are 3 ways to register an event, the first way is through the use of Client.event(). The second way is through subclass...
and in my test it's also not working
oh, i was thinking about on_command_error
ohh, yeah that's easy with just @...listen but I want the "normal" error
then youll have to overwrite the event
and what do I have to put into bot.dispatch() ?
first would be smth like on_event_error
but how do I pass event, *args, **kwargs?
why do you need that top-level event though?
what do you mean with top-level event?
like why do you need on_error
what are you trying to do
I just want to log every error happening in the bot and be able to access it later using a command
but still have it raised in the console/log
@discord.slash_command(name='purge', description='Purge messages from a channel')
@commands_ext.guild_only()
@discord.default_permissions(manage_messages=True)
@commands_ext.has_permissions(manage_messages=True)
@commands_ext.bot_has_permissions(manage_messages=True)
@discord.option(name='amount', description='The number of messages to purge')
@discord.option(name='include_user', description='Include messages from this user')
@discord.option(name='exclude_user', description='Exclude messages from this user')
@is_blocked()
@analytics("purge")
async def purge_messages(self, ctx: discord.ApplicationContext, amount: int, include_user: discord.Member = None, exclude_user: discord.Member = None):
await ctx.defer()
if amount > int(get_key("Moderation_MaxPurge", "1000")):
await ctx.respond('The maximum amount of messages to purge is {amount}.'.format(amount), ephemeral=True)
return
messages = []
async for message in ctx.channel.history(limit=amount):
if include_user and message.author != include_user:
continue
if exclude_user and message.author == exclude_user:
continue
if (datetime.datetime.now(datetime.UTC) - message.created_at).total_seconds() >= 1209600:
continue
messages.append(message)
chunks = [messages[i:i+100] for i in range(0, len(messages), 100)]
for chunk in chunks:
await ctx.channel.delete_messages(chunk)
await ctx.respond('Successfully purged {messages} messages.'.format(messages=str(len(messages))), ephemeral=True)
This throws an error about an unknown message and deletes the deferred (bot thinking) message
well, exclude that message
log
yea, again, either dont defer (should still be within the time limit if you're lucky?) or make sure you dont delete the defer message itself
Fixed it by adding invisible=True, ephemeral=True into defer parameters
I want the purge method be able to delete beyond 100 messages which can't be in time limit when the user chooses to delete for example 500 msgs
oh yea, i missed that
you cant respond to non-ephemeral defers with an ephemeral response, or vice versa
what is get_key?
get_key gets an entry from configuration file, or adds it with the second parameter if it isn't there
that's just a check to prevent people from purging 100000 messages
discord.errors.ValidationError: Command names and options must be lowercase. Received "Katze" in locale de
Why doesn't py-cord just do a .lower()?
why don't you just make the string lowercase
It was an accident, anyway it seems to me that it would be simpler for the library to do a .lower() instead of throwing an error
The reasoning is that we dont want to do anything that the dev does not expect so we are telling the dev that something needs to be changed instead of doing it ourselfs. Also it prevents people from wondering why capitol letters are not working when in reality we are changing the input in the background.
Okay, that makes sense
Is it possible to use the selection of the first Option in a command to determine which Autocomplete is returned in the second Option of a command?
The beginning of the Command code, with where I want the autocomplete to trigger:
async def gift(
ctx,
what: Option(str, "...", choice=["Activate", "Learn"]),
which: Option(str,autocomplete=discord.utils.basic_autocomplete(giftlist_autocomplete)
)
# [slash command code goes here]```
The autocomplete code I'm wanting to fill out, but don't know if it's feasible:
```py
async def giftlist_autocomplete(ctx: discord.AutocompleteContext):
if ctx.??????? == "Activate":
# do X
elif ctx.??????? == "Learn":
# do Y```
is there something I can pass where I have `ctx.???????` ?
Command Permission Decorators: Commands: Shortcut Decorators: Objects: Attributes full_parent_name, qualified_id, qualified_name. Methods@ after_invoke,@ before_invoke,@ error, def get_cooldown_ret...
So would if ctx.options == "Activate" work in the above? I'm terrible at parsing APIs 😭 my brain just refuses to make the connection between the list of things and how to implement them.
no, it's a dict
Command Permission Decorators: Commands: Shortcut Decorators: Objects: Attributes full_parent_name, qualified_id, qualified_name. Methods@ after_invoke,@ before_invoke,@ error, def get_cooldown_ret...
if "Activate" in ctx.options.values(): ?
Thank you!
thank you!
you could also do if ctx.options["what"] == "Activate"
Is there something like on_interaction_error? for views
doesn't that also count as application command
I mean catching errors that are executed when clicking buttons
I am aware
and I'm saying that I think that'd also count as application command error
Ah, you're right, I thought it worked another way, thanks
I am trying to respond with an error message when an unexpected error is obtained when clicking any button. I am already using on_application_command_error, but when the error comes from a component it is not executed only if it comes from a command, I still do not understand how I can do it
Views have an on_error function that you can override
Yes, but I would have to write the piece of code that responds with an embed to the error in each of the views, I suppose that on_application_command_error avoids having to write error handling in each of the commands and having only one function, I wanted to know if that It is possible but with the views
the library doesn't have a general view error handler, no
You could create a master view subclass that all your views use
okay thanks
somebody can help me?
i am trying to delete channels that dont have categories but the code include categories
and when i am trying to check the channel type its doesnt saying true:
@subcommand("staff")
@commands.slash_command(name = "channel-delete", description = "Delete the currnt channel")
async def channel_delete(self, ctx):
guild = ctx.guild
channels = guild.channels
for channel in channels:
if channel.category is None:
print(channel.type)
if channel.type == "text":
print(channel, channel.type)
# try:
# await channel.delete()
# except Exception as e:
# print(channel, e)
elif channel.type == "category":
pass
output:
text
text
text
category
category
category
text
text
text
text
text
text
text
text
text
text
text
text
text
category
text
category
text
text
text
text
text
text
text
text
text
category
category
text
text
text
text
text
text
text
if isinstance(channel, discord.CategoryChannel)
ok thanks
Hello, I would like to replace the image from a post so that it does not add two images but somehow I can't get it to work because I get a file back and no path.
Code:
test = discord.File(file)
await interaction.edit(attachments=[test], view=view)```
Error
Traceback (most recent call last):
File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\discord\ui\view.py", line 426, in _scheduled_task
await item.callback(interaction)
File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2-PY\cogs\dev\images.py", line 417, in callback
test = discord.File(file, str)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\discord\file.py", line 99, in init
self.fp = open(fp, "rb")
^^^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not File
buffer = BytesIO(img.tobytes())
buffer.seek(0)
buffer = BytesIO(file.tobytes())
^^^^^^^^^^^^
AttributeError: 'File' object has no attribute 'tobytes'```
is the File in your error a discord.File? or is it from some other library
if it's discord.File, then pass file=file and attachments=[] instead
thx
so when using add_reaction, how do I use discord emojis (built-in) that don't have a unicode version
\🇸
Would there be a reason why when I disable the presence intent my bot throws an error even though I don’t use it
hm, weird
there is zero reason to disable it
and as you can see, it can cause issues
oh thanks
no that wasnt actually the fix, i was just trying out what backslashing the S emoji would do
(or maybe that works??)
because its not a normal s
wait i was thinking of another intent, my bad
can you show the error you get
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
well, dont pass it in the intents= kwarg
actually i think i know why
it does work though
fo my case
all discord emojis have a unicode version or are at least made up of unicode charecters
yeah
Just need to backslash and than copy/paste. 😉
Just a fyi you have to use copy message
im flabbergasted
for some reason highlight does not always work
kk
and than that will copy the backslash as well so you need to remove that after pasting
a unicode finder website just says "replacement character" for the escaped letter emojis tho
Because the letter emojis are a combination character and an actual letter.
ah
Did the Bridge Prefix for the Bot change in 2.5? I cant use the prefix anymore for my Bot, which worked in 2.4:
from discord.ext.bridge import Bot
bot = Bot(command_prefix=commands.when_mentioned_or("!"), intents=intents)
do you have the message content intent enabled on both the bot and the discord developer portal?
Oh i forgot about that. I removed that. My bad. Thank you
discord.Member.can_send() means whether I can send DMs or not?
No
Should I create a DM and use can_send() from it?
That tells you if you are allowed to send x content to a DM assuming you can send a message in the first place. It is used for checking if for example you have permissions to send an image.
You should try to send the message to the user and catch the exception to determine if you can send DMs or not
Are there no other ways?
No
Thank you
It had some breaking changes
Man I would just have uploaded the image to s3 or smth
Hi, I don't see anything about user apps in the documentation, it hasn't been updated yet?
documentation is updated
thats not how it works
ho
Do user apps need additional permissions or settings in the discord portal?
check default_command_integration_types in discord.Bot
you need to check the user install switch if you made the app longer ago i think
on new apps it seems pre-checked
ok, ty
all already existing commands will work in user app if enabled ?
You're supposed to structure your commands to support them
It doesn't magically make all your commands as user app commands too.
ok thanks
e.g. any commands that do stuff like create channels or roles won't work
The repo has examples.
this is a really unfortunate limitation tho
well, it will work if the bot is in the guild
yea
thats expected
but i really hoped it'd take on the user's permission in the guild to do such actions
that's more of an oauth thing
which i guess you could pull off but the lib isn't made for it
user apps would've been even more great if they added that
i had a huge amount of ideas
Is there a way to differentiate commands that originate from a user install vs guild install?
Like from ctx or smth?
i don't want to have to duplicate commands just to know 100% where a command came from, and i doubt that's the intention

wait no
that just tells me where a command was executed
but if a command is run on a server with a user-installed app, the context will still be guild
see Interaction.authorizing_integration_owners
it's not the most clear but ultimately it's implemented to discord's spec
bless you
that is one mouthful, if not two
so.. what happens if a user is installed on a guild and the user calling the command? will both be supplied?
docs aren't very clear on this https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object, i'd say just debug it yourself
probably
can someone give me a example code for the new polls feature?
It similar to an embed in how you make it. Just look over discord.Poll and than you can pass poll=my_poll into send/respond/etc
I used this in 2.5.0
SlashCommandGroup(name="example", description="example command", guild_only=True, xxx)
Now its changed to contexts (discord.InteractionContextType)
But in the Docs it says
The location where this command can be used. Cannot be set if this is a guild command.
Can someone give me a quick code example how to used it with 2.6.0 - or do I even have to set it?
you but i only get errors with is not defined
screenshot
yea i know xD
and.. what
copied out of the docs
@bot.slash_command(
contexts={discord.InteractionContextType.guild}
)
guild command refers to commands that are local to a specific guild
replace guild_only=True with contexts={discord.InterationContextType.guild}
yea, thats the problem
also.. does this actually work?
rlly
i dunno
but deleted that part
@discord.slash_command(name='poll')
async def poll(ctx, question: str, duration: int, *options: str):
if len(options) < 2:
await ctx.send("Je moet ten minste twee opties geven!")
return
if len(options) > 10:
await ctx.send("Je kunt maximaal tien opties geven!")
return
poll = discord.Poll(
question=question,
duration=duration,
allow_multiselect=False
)
for option in options[1:]:
poll.add_answer(text=option)
message = await ctx.send(embed=poll)
poll_message = await message.create_poll(poll)
await ctx.send(f"Poll gecreëerd: {poll_message.jump_url}")
class discord.Poll():```
what need to be in the class
i mean
...my guy
xD
poll = discord.Poll()
srry
you sohuld not need to do class poll anywhere
and you do not use ctx.send in slash commands
it depends on the context
usually you dont, and i know they wanna respond
Working, thanks a lot 
thank you too! :)
alr
@discord.slash_command(name='poll2', description='Poll Commando')
async def poll2(self, ctx, question):
poll = discord.Poll(
question=question,
duration=6,
allow_multiselect=False
)
poll.add_answer(text='hoi')
poll.add_answer(text='hai')
message = await ctx.send(embed=poll)
poll_message = await message.create_poll(poll)
await ctx.repsond(f"Poll gecreëerd: {poll_message.jump_url}")```
got this now
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.description: This field is required
get this error
and type respond correctly
poll_message = await message.create_poll(poll) also not sure what this does. But you dont need it
use @discord.option instead of the discord.Option typehint
in short, pylance sucks
why not attach the poll to the message?
honestly discord.Option typehint sucks
^^^^
oh yea in first place it was a embed with reaction emotes and in embeds the role ping doesn't work
yk
I have never had an issue with it
i'd like my typehints with my AquaticCreature objects thank you
can you tell me why it isnt working xD
pylance sucks, as i already said
Thats a warning not a error. The code will still run
and using the decorator is still recommended by me
usually, the thing after : is used as typehinting, however, we thought it was a good idea to put that as a way to get the Option passed there instead
oh you right
nahh Option >>> decorator
its objectively worse
i've been using it since 2.0 with literally 0 issues, while i've spent countless hours in this channel giving help to people using the decorator 
if it ain't broke don't fix it
Typehinting on top
yes
class FairnessView(discord.ui.View):
def __init__(self, custom_id, fairness_results):
self.custom_id = custom_id
self.fairness_results = fairness_results
super().__init__(timeout=None)
@discord.ui.button(label='Provably Fair', custom_id=self.custom_id, style=discord.ButtonStyle.grey, emoji='✔️')
async def button_callback(self, button, interaction: discord.Interaction):
await interaction.respond(fairness_results)
Inside of a command:
await msg.edit(embed=embed, view=FairnessView(random_id, fairness_results=result))
self.bot.add_view(FairnessView(random_id, result))```
why exactly does the view not get edited into the msg
What is msg?
msg = await ctx.respond(embed=e)
simply a msg i send and then edit later
use ctx.edit pls
Is the view outside of the command?
its inside of the command as a class
@commands.slash_command(name='coinflip')
async def hi(self, ctx: discord.ApplicationContext, bet: Option(str, "Enter your bet amount!"), side: Option(str, "Choose your side!", choices=['Heads', 'Tails'])):
class FairnessView(discord.ui.View):
def __init__(self, custom_id, fairness_results):
self.custom_id = custom_id
self.fairness_results = fairness_results
super().__init__(timeout=None)
@discord.ui.button(label='Provably Fair', custom_id=self.custom_id, style=discord.ButtonStyle.grey, emoji='✔️')
async def button_callback(self, button, interaction: discord.Interaction):
await interaction.respond(fairness_results)```
And the button is inside of the view class?
yep
oml
the callback is indented into the init
class FairnessView(discord.ui.View):
def __init__(self, custom_id, fairness_results):
super().__init__(timeout=None)
self.custom_id = custom_id
self.fairness_results = fairness_results
# Define and add the button in the init method
button = discord.ui.Button(
label='Provably Fair',
custom_id=self.custom_id,
style=discord.ButtonStyle.grey,
emoji='✔️'
)
button.callback = self.button_callback
self.add_item(button)
async def button_callback(self, interaction: discord.Interaction):
await interaction.response.send_message(str(self.fairness_results), ephemeral=True)
In my command (which is in a cog):
fairness_view = FairnessView(random_id, fairness_results=result)
await ctx.edit(embed=embed, view=fairness_view)
self.bot.add_view(fairness_view)```
The view is in-fact not persistent
hi, why can't i access message.content? I have the intent enabled in the developer portal?
Do I need to change it in code too? Atm, I'm using all intents
output ```
ChatGPT:
whytho | bnudyd:
purpurpetals:
ChatGPT:
ChatGPT:
ChatGPT:
Hi, why the default_command_entext and the other default one are not working? i can use the command in dms
def __init__(self):
intents = discord.Intents.all()
command_prefix = commands.when_mentioned_or("-")
default_command_contect={IntegrationType.guild_install}
default_command_integration_types={InteractionContextType.guild}
super().__init__(command_prefix=command_prefix, intents=intents, default_command_contect=default_command_contect, default_command_integration_types=default_command_integration_types)
```
you mixed them up
and you typed it wrong
you typed contect
and just switch around the {}, they're just in the wrong positions
default_command_context={InteractionContextType.guild}
default_command_integration_types={IntegrationType.guild_install}
should've been clear from the name
integration type goes into the integration type field, not command context
and im p sure guild_install is the default anyway
and.. i'm not sure if its smart making your bot subclass the exact same name as the default class, might cause issues
my app gets a permision error when i require move_members permission but works fine when i require administrator permission
im server owner so permissions shouldnt be a problem
any ideas why this happens?
dont use has_permissions for slash commands
use @discord.default_permissions
also, it's because you dont have that exact permission
you still need it even with admin, which is one of the reason has_permissions should be avoided
i do have the move_members permission tho..
using @discord.default_permissions works, thank you!
oh fu.... i use the worong word thxxx
I'm struggling with adding options to a Dropdown. I can write permanent ones in just fine, but in order to add_option() nothing seems to actually add itself to the list? Unfortunately the official example includes magical list population due to using roles.
I'm unlcear about where to position it (inside the class for the specific Dropdown? as a function inside that class? async? ) and what the exact code would read.
I've tried:
DropdownView.add_option(discord.SelectOption(label="RESULT"))
But it doesn't do anything. My Dropdown's Class is called DropdownView
Can we see some more code?
class DropdownView(discord.ui.View):
@discord.ui.string_select(
#select_type=discord.ComponentType.string_select,
placeholder="Select up to 3 dice...",
min_values=1,
max_values=3,
options=[discord.SelectOption(label=str(f"TEST")),discord.SelectOption(label=str(f"TEST2")),discord.SelectOption(label=str(f"TEST3"))]
)
async def die_lister(self, interaction: discord.Interaction):
# code that doesn't matter until I can add things to Options
DropdownView.add_option(discord.SelectOption(label="RESULT"))
async def dice_select_dropdown(
self, select: discord.ui.Select, interaction: discord.Interaction
) -> None:
pool=[]
rpool=[]
# more code that doesn't matter right now
view = discord.ui.View(timeout=None)
view.add_item(GoButton(rpool, pool))
response = (
f"**You selected the following dice**: "
+ f", ".join(die for die in select.values)
)
await interaction.response.send_message(response, view=view)```
I just don't know where to stick add_option() or what the preface should be.
At the select or where?
Current code: Rolls some dice from a /command and includes this dropdown at the end of the response.
Desired code: Include the die results as selectable to re-roll.
Challenge: How to add options to a dropdown list that aren't hard-coded (see: "TEST"s vs. "RESULT").
So.. yes, at the Select?
Subclass the select
first, the decorator function usage here is wrong - when using a @select decorator, the function args should be self, select, interaction. self, interaction is used when you DON'T use the decorator.
To follow from that, you can either:
- As mentioned above, subclass the select to fit to your needs (https://github.com/Pycord-Development/pycord/blob/master/examples/views/dropdown.py)
- Alternatively, there are methods when overriding the view's
__init__- you can either create the dropdown in there, or use the decorator without passingoptionsand then later assignoptionsinside the__init__
(the latter is somewhat more tedious)
I had missed that example in the list somehow, thank you!
le bump
how to listen for when someone replies to a message
to one of the bot's messages?
Guys, a question, I previously used the guild_only parameter so that the command group only works on servers but I get a message that this parameter is already obsolete. Is this the correct way to do it now?
ah, lol
ty
okay, thanks
maybe we should have a contexts decorator similar to has_permissions
That'd be cool
dont think that needs its own decorator tbfh
too little functionality for it to be one imo
and it really is just a direct property of the slash command, so having it there feels more natural
i mean
i jsut still wonder why its a set when most everything in the lib is a list
Fixed cog reloading and synchronising (2+ years old issue)
what's that issue?
same for guild_only, having something like @commands.contexts(guild_only=True) seems fairly in line with the library
was some duplicate name bug because the way we store commands is weird
you could unload but it fucked up with syncing
maybe
at least it wouldn't be as long as
discord.IntegrationContextType.guild etc
indeed, ultimately decorators are usually shortcuts
like how we have @default_permissions, you can actually set default_member_permissions in the command decorator instead because that's what it's called on the API
Has contexts= been implemented for SlashCommandGroup yet or not?
true
I was lazy this time...
InteractionType looks soo much like IntegrationType
good thing that it's InteractionContextType :)
No the other one
for integration_types
how would i get the possible args of a command to display them in the help menu?
embed = discord.Embed(
title=f"{cog_name} Commands",
description="\n".join(
f"`/{command.qualified_name} (args)` {command.description}"
for command in cog.walk_commands()
)
)
Command Permission Decorators: Commands: Shortcut Decorators: Objects: Attributes full_parent_name, qualified_id, qualified_name. Methods@ after_invoke,@ before_invoke,@ error, def get_cooldown_ret...
cog.walk_commands returns an ApplicationCommand not a SlashCommand
hm
check if it's an instance of SlashCommand first
do you guys know any complete currency symbol api? because when i search on google, the apis i found are either incomplete or even if they are compete they are pricy
wdym currency symbol API
an api that would give the symbol for the currency that was requested, for example $ for USD and etc
just make that yourself, it's not like there's thousands of currencies
just do like the 50 most common ones
if i had the time for it sure, but i'm mostly looking for an api
because someone has already done what i will be doing on the internet
I doubt it take you even an hour at most
using an API for such a simple thing is overkill imo
there's probably even just a list of all currency symbols you can download
i'm mostly want to use an api becasue i'm handling js code - i asked here because i thought some people might have that implemented in their own bot
I just made chatgpt generate a js dict of all currencies in like 10 seconds
i trust you can do the same
ok ty
Hi, you can use this json : https://gist.github.com/ksafranski/2973986
Hi,
I saw that Pycord now supports Premium Apps, but I don't see how to limit an order to a premium user?
On the documentation I only see servers boosters or nitro subscriber for premium or premium_subscribers
and there is no exemples on the github repo
I find this : https://docs.pycord.dev/en/stable/api/clients.html#discord.Bot.store_url for the store URL, but not how to limit a command for premium users only
Bots: Attributes activity, allowed_mentions, application_flags, application_id, auto_sync_commands, cached_messages, cogs, debug_guilds, default_command_contexts, default_command_integration_types,...
I have not used it before but I think this is what you need to do:
User.entitlements
Yes maybe, to find this ? https://discord.com/developers/docs/monetization/entitlements#entitlement-object
I see
thanks
here is a more detailed explanation. Note Client.entitlements is very similar to what I linked
#1260606876547289100 message
thanks
HI, I basically have a url that would usually open a website, but is there a way for it to redirect directly to open a mobile application on mobile, and then use the website only on desktop?
From Discord no, I don't think it's possible. But from your website you can detect the device with which the page is viewed and redirect to another link (for example the Google Play Store or the App Store).
you will have to use javascript tho
Okay mabye will have to try that
how would one go about handling the discord.ext.commands.errors.CommandNotFound exception and making the bot respond to the user informing them that the command is not valid?
Error handlers. on_command_error
@sage tendon
how to do that now ?🙂
interaction_metadata doesn't have any data 🙂💔
how close thread in forum?
Read the docs
Is there a way to display content in columns / tables?
Neither keyword appears in the pycord documentation so I'm hoping there's another workaround?
Column / tables as in?
antelopes: 5```
trying to make the numbers all line up.
You have to work with formatting yourself.
Forum posts are threads.
So put in my own whitespace or use a python module for table-generation?
Dang.. hopefully Discord adds tables someday.
Thanks!
Just note you will have to use codeblocks so that the charecters are all equal width

Thanks.
The sleekest solution I've found, for others looking to use columns and tables:
aDictionary = {'antelopes':1, 'bears':5, 'cats':12, 'dogs':4, 'elephants': 99999}
print(f"`{'Animal ':<10}` {'Quantity':>10}`")
for first,second in aDictionary.items():
print(f"`{first :<10}` {second:>10}`")```
replacing `print` with using the content however is needed.
results:
`Animal Quantity`
`antelopes 1`
`bears 5`
`cats 12`
`dogs 4`
`elephants 99999`
i havent read up but why not make an embed with 2 fields, one "Animal" and one "Quantity"
that way its lined up vertically and leftbound
My initial digging into fields didn't give me any sense that they'd be stacked horizontally.
adds spaces in an f-string up to that number of characters: <10 is left-aligned, >10 is right-aligned.
you can override this with inline=True though, but not entirely sure what that changes, i think a field that has that will be alone in a row
ohh, thats cool
Way sleeker than adding libraries and all their requisite funky syntax.
New question: how to fields?
I've got lots of embeds, in my efforts I kept get complaints about either not having a description= but then I'd add it and it would complain that fields shouldn't have a description=.
it's value=
and yea i think a description is mandatory for the embed itself
title isn't tho
Right, so I think I was sticking it in the wrong place... I deleted that code like two hours ago, let's see if I can throw something together...
oh yea i forgor i can show you, 1s
testfield = discord.EmbedField(name="Testfield", value="Testvalue")
discord.Embed(title=str(f"{Person}'s Skills"), description=SkillPage, fields=testfield)```
that ain't it 😦
`TypeError: 'EmbedField' object is not iterable`
my code isnt really flexible enough to show you properly lmfao but yea i meant kinda like this
embed.add_field()
way easier imo
but if you wanna use fields=, it has to be a list of embedfields
Could you show me your code block for that embed?
Thank you!!! 💞
Opposite:
inline = is it in the same line?
@sage tendon
hlw:)

@sage tendon
look at this
it's not working anymore
yea well 
good luck
message._interaction.data
is working btw
so there is no solution ?
man i dont even most remotely remember what the problem was
if it's private it usually means you should avoid it
okh wait , let me explain again
is there any way get the slash command name from message ?
/profile
message.interaction.data['name'] was working fine
but as there is InteractionMetadata 🙂
there is no data dict
message.interaction
yes but as interaction have data attribute , InteractionMetadata doesn't have any data attributes
i need to access the raw interaction data:)
yea no clue sorry
ok
fields don't stay inline on mobile
never have
was justs scrolling down to tell you this
problem is normal text might not stay in line either
table like formatting is a pain on discord
😭 k thanks for all the help, folks! I'll return with a solution if I find something.
oh.. right
I also had my share of issues with embeds on mobile
sorry
rip pycord 2.6 breaking change
what?
looks like its not some big issue
my terminale is full of error, i will check
what the difference between bot_dm and private message ?
is it for user app comalnd ?
DM with only the bot. Or a DM with another user/group DM
thanks
I have never looked into modals much but is it possible to have a message command pop up a modal, and once you submit that modal, the bot can ctx.respond in chat to the original interaction? or does that not work
Ignoring exception in modal <cogs.reports.ReportModal object at 0x00000267636EBDD0>:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\modal.py", line 341, in dispatch
await value.callback(interaction)
File "c:\Users\user\Documents\HOFFMAN\cogs\reports.py", line 93, in callback
print(channel.available_tags)
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1251.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f97a' in position 222: character maps to <undefined>```
why? How I can get tags from forum?
could you perhaps show the full callback where you print available_tags?
async def callback(self, interaction: discord.Interaction):
channel: discord.ForumChannel = await interaction.guild.fetch_channel(1260978288080195636)
with open(f"{FOLDER}/data/score.json", "r", encoding="utf-8") as file:
SCORE = load(file)
SCORE["reports"] += 1
with open(f"{FOLDER}/data/score.json", "w", encoding="utf-8") as file:
dump(SCORE, file)
description = ""
for i in self.children:
if i.label != "Ваш никнейм":
description += f"**{i.label}:** {'Неизвестно' if i.value == '' else i.value} \n"
embed = discord.Embed(
title=f"Репорт #{SCORE['reports']}",
description=f"**Отправитель:** {interaction.user.mention} \n **Никнейм отправителя:** {self.children[0].value if self.children[0].label == 'Ваш никнейм' else 'Неизвестно'} \n **Игровой сервер:** {interaction.guild.name} \n\n" + description,
colour=discord.Colour.red()
)
thread = await channel.create_thread(name=f"Репорт #{SCORE['reports']}", embed=embed, content=interaction.user.mention, view=ReportAdopt())
await thread.edit(pinned=True, applied_tags=channel.available_tags[1])
await interaction.response.send_message("Репорт создан", ephemeral=True)```
Ignoring exception in modal <cogs.reports.ReportModal object at 0x000001E9DA4F7710>:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\modal.py", line 341, in dispatch
await value.callback(interaction)
File "c:\Users\user\Documents\HOFFMAN\cogs\reports.py", line 93, in callback
await thread.edit(pinned=True, applied_tags=channel.available_tags[1])
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\threads.py", line 678, in edit
payload["applied_tags"] = [tag.id for tag in applied_tags]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'ForumTag' object is not iterable```
I'm trying to get a tag from the forum to attach it to the thread
applied_tags in edit should be a list
and i think you already fixed the previous error?
I was just checking to see what would return available_tags to me
This looks like you are not using utf-8 for your character encoding. It is trying to show the 🥺 emoji.
I found something on stackoverflow but im not sure if it will work for you.
You can try setting PYTHONIOENCODING=utf-8 in the enviroment varibles of python
well the code they posted already forced encoding to utf-8, no clue if they actually fixed it since they ran into a different error instead
What about this?
#1132206148309749830 message
it seems to me that these are library errors
the second error you posted is a library error but it is because you are passing the argument incorrectly.
I don't quite understand, it's supposed to return a sheet with tags.
channel.available_tags[1] you are getting a single tag and passing in a place that needs a list of tags
a, I understood
That error is from them trying to print though, not using the files.
I doubt it, I think it's more likely the traceback is reporting the wrong error line because they updated the file
Encoding would be completely unrelated to that print
How inconveniently it is done
You can just change the 1 to 1:2
?
For indexing
a, I need one tag
1 gets item at position 1, 1:2 gets the items from position 1 to 2 exclusive, thus you just get a list of 1 item
if I change to 1:2, I will use 2 tags at the same time
Nope, it'll be 1
My general point is that'll return a list for you already, not a single object (which fixes the issue)
is the error code 520 from cloudflare caused by too many requests to discord? Or is it a vps issue?
its a whole html
but the bot seems to be working fine?
Oh? I guess it's not as bad as I thought
Getting html in console generally isn't a great sign
it just stops that command
wow, its really work
I'm surprised, thank you.
Allgood
well it was in a traceback block that had to do with sending a DM to user or sending a message in a channel so not exactly
Try-except? Try without it
Oh it isn't consistent?
Hmm
You can probably ignore it, but it does sound like your vps has some weird inconsistency with discord
Allgood
how I can get thread from interaction? interaction.channel return forum channel
It's convenient
I found a slightly different way to get the thread
?
I meant why you only have interaction and not ctx
ctx.channel should return the thread
on_interaction event
ah
Is it right that Interaction not found can happen when you defer if your internet is slow cuz you are too slow to get it and send it back?
Becuase defer is a response
Yes. In most cases you should defer as the first line in your callback if you need to defer in the first place. If this is how you have it than it is just an internet speed issue
defer allows you to respond within 15 minutes
Yes thanks, was answering to someone elses question but wanted to be sure that internet was the issue before saying it 😆
which part of the code has fixed the unload ?
because i still got some issue reload the cog
2024-07-12 05:49:49 [WARNING] : Failed to load extension Slashs.Antiraid.antiroleupdate: Extension 'Slashs.Antiraid.antiroleupdate' raised an error: CommandRegistrationError: The command antiroleupdate is already an existing command or alias.
because i did overwrite
add_application_command, add_command, invoke, invoke_application_command
got also some issue about group not found
2024-07-12 06:00:18 [CRITICAL] : Failed to add slash command antimove: Group 'antiraid' not found
how to send photo? is the only way via embedding it into a text message?
tried to look for "photo" in the docs but no results somehow
file=
can you add more details
that's the kwarg you need to pass your image to in ctx.respond
literally new to discord bot development but ive been developing in python for quite some time
thanks ❤️
What is the difference between on_member_update and on_user_update
Called when a User updates their profile.
Called when a Member updates their profile.
user could be any user the bot has cached, member only guild members
Hmm, I don't fully understand, but I guess I will find out over time
But I have another question, are these attributes not available because of any intent?
The docs don't metion any needed intent
avatar_decoration, is_migrated and jump_url
why?
can you not access it?
what does it return?
I think it works, there are just no type hints
I mean is_migrated is just a bool for one
and the others are correctly typehinted in their return type last I checked
vscode is a bad IDE
Well, I don't think thats the problem here, since vs code works for the other attributes
Its probably because it's in user and not overwritten by member
which is sad that vscode can't even detect that
but not sure
yea, I checked, it is
but I don't even know where it gets avatar_decoration from, since it is not mentioned in discord.member.py
not sure if pycord remembered to implement that you can have an avatar decoration per server now
gotta ask a maintainer
then what would you suggest? It’s all I’ve used
pycharm
vscode sucks because it tries to work for every language, and thus sucks at all of them equally
pycharm is great for python.
How can he check if a user changed his profil if he doesn’t have any guild in common 🤔
It might has been removed in 2.6
For user installation !
no, it hasnt been
Well see
it's just because its inherited from discord.User
and apparently vscode is too stupid to recognise that
I got them in mine
Member uses a decorator to inherit attributes from User
(per-guild avatar decos are fairly recent and haven't been implemented)
ah yea i looked into this more, and i forgot that i tested this with ctx.author, which is a union of User and Member
if i explicitly typehint it as member it doesnt show either
mb
see apparently PyCharm is too stupid to recognise that 😆
Hey all - starting a new bot and i dont have any cogs yet... just have 1 simple slash command right now and its been showing in the server, but it doesnt seem to be updating as i make changes and add new arguments to it... is there some sort of refresh/register command im missing?
that was easy... thanks... i quess quitting out and opening again doesnt do it
it does, but ctrl+r is faster
unless you mean basically just minimizing discord to the taskbar
you can also just use the command once and itll update immediately, but if you have many required options, thats just slower most of the time
When using a slash command and providing a dropdown/list for an autocomplete, is it purely text you can display or do emoji's work? (providing you know the id etc.)
Hi! I want to know how User app works and how to do it
You have the example here, make sure tu upgrade pycord with pip install py-cord==2.6. If anything dosen't work, or you need questions, feel free to ask.
I selected this:
how to "invite" now
i found i think
Select "Discord provided link below", then add "bot" then select the permissions
so I have
with this for setup
I have a file named spamDetect,py in the cogs folder with a class named spamDetect and a function named detectSpam()
how
Is the spamDetect function an async function?
there it is "sDetect" not "spamDetect"
oh I tried renaming it to make sure I wasn't stupid lol, I changed it back since then (old log screenshot)
right
get_cog is not async
The none type error means that get_cog is returning none
ah
nope but I also have another identical thing that is working
if it is not async then you dont need await
what happens when you print bot.cogs
get this
Yeah but there's anther func after
then yeah remove await
also would probably be better to put a listener inside the cog instead
alright so yes it would turn out that I'm completely stupid
they're both async
I'm just blind
and got confused
thanks for the help lol
you can do unicode emojis, but not custom emojis
autocomplete will not render any formatting etc.
Thank you
How do i go about making some of these arguments optional and add descriptions to them?
@bot.slash_command(description="Run a backtest")
async def backtest(
ctx,
start_date: str,
end_date: str,
):
use the @discord.option decorator below the slash command decorator
found this but still looking for all the docs on Options
https://guide.pycord.dev/interactions/application-commands/slash-commands/#options--option-types
just use the decorator, its a million times better than the typehint and more flexible
and has the same args
how to i make it optional though?
required=False
Is there a way to keep data from the first execution of an autocomplete, so i don't have to execute a new api request each time the user write something ?
and what about for the default value.... default=?
yeah i couldnt find the page for the decorator
just this #1132206148309749830 message
discord.Option
as i said its the exact same args
its the same thing really, just written differently
ah missed that- found it now thanks
I mean i should cache it, but is there any pycord native way to do it
store it at a database?