#Basic Pycord Help
1 messages · Page 29 of 1
good luck updating your code every time your bot is added to a server ;)
for testing, yeah
lol yea. This bot will only ever be in one guild, but even so, I think i'll stop passing this in
yea, no point then
You can limit all of your bot's commands to one guild using the debug_guild_ids (i think) parameter in your bot definition
but thats not needed if its only ever in one server
i see, cool. I appreciate knowing nonetheless
debug_guilds
difference between what and what?
method and function
generally method is the term for a function that's part of a class, where function is a term for a function outside of a class, at the module level. Not sure if pycord docs are different here
hm, yea
and decorators are functions
inception functions
Yo, guys this might be a very stupid question, but how do I get a user from user id? I had this running for a while and everything worked previously:
print(bot.get_user(771786002153996309).name)
but it suddenly stopped.
And the bot is of course defined like this bot=discord.Bot()
at a command?
at a event?
yes at a command
no intents?
well I haven't specified anything regarding intents
I guess I should then
at least default, and depending on your use case, member intent as well
Yep that was the problem, thank you!
technically 5 but these profiles all have a shit ton of data, like 80k lines of json kinda data
unfortunately there is no way to just get the names of the profiles so i need parse thru the data and get the name of these profiles fast enough to where the discord api doesnt time out
ok, so you can make the user select their thing, then send the slash command
defer it and you parse the data and send it through a select menu
Is there any way give custom names to a bool? (ie /set_status bool:online/offline string:blaah int:123)
sorry if this sounds stupid, im new to it
use choices and make two choices
thanks
Is there anyway to move decorators of slash command into a discord.bot sub-class or some other better way to organize it?
i forgot about my nickname here lol
Does Py-Cord support userapps? i have enabled it for my bot but doesnt seem to work properly
how can I create a bot that if you send a video to the command "video_to_gif" this video will become a GIF
Use cogs
is bot.get_guild(guildid) and interaction.guild the same?
It both returns the guild, why should it not to be the same?
how can I add this: git+https://github.com/Pycord-Development/pycord (the development Version) to my requirements.txt
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - Pycord-Development/pycord
Can someone help?
add it exactly like you pasted it
well, nearly: git+https://github.com/Pycord-Development/pycord.git
just paste it or do I need to write py-cord=git+https://github.com/Pycord-Development/pycord.git ?
ok, thanks
Pls
is there a limit on how much auto complete choices you can have
awesome
How to get the name of application command from discord.Interaction? I've searched the documentation, but I can't find anything.
discord.Interaction isn't for slash commands
it's discord.ApplicationContext
and it's ctx.command
@balmy dome ^
Thanks for the reply.
Hi, i was told that I could omit the guild_ids param when decorating slash commands and it'll register with all guilds by default, but when I tried, the commands weren't registered. Am I missing something? My decorator looks like @bot.slash_command() where bot is initialized like so: bot = discord.Bot(intents=Intents.all())
i really would not recommend Intents.all()
oh really?
use default intents and add members / message content manually if you need it
all just makes your bot not work if you dont have all intents enabled on the developer page
i assume that isn't related to the guild_ids issue though
yesterday, you didnt have the intents enabled
so i suppose you changed both and now it doesnt wrok
did you restart your discord after restarting the bot
no, but i put the guild_ids param back and it registered the commands
show your code
i'm not really sure what else is relevant to share
well your bots code because something is apparently weird that your slash commands dont register lol
how do you know they aren't registering, tho
they dont show up in the menu that appears when typing the slash character. Then when i added the guild_ids param back and restarted the bot, the commands appeared in the menu lol
what if you keep your discord open and restart your bot without guild_ids passed?
Discord doesnt sync that often so the commands stay, and im curious if it works or if it shows an error
and again, try to avoid all intents unless you really need it / only enable those you need + default
what are the default? idk which ones i need. still a little confused by intents, so i figured it wasn't any harm in having all of them. And are you asking that I restart my bot after omitting the guild_ids param again and see if the commands still show up in the menu?
default is everything but members, message content and presences
they should not disappear unless you restart discord because of how shit discord's clientside command handling is
and yes
lets find out i guess
i removed it from one of the commands and it still shows up with the rest
not too surprising
it's a fair amount of code so I've tried to keep it to just some of it so it's not annoying to look through: https://paste.pythondiscord.com/PULQ
wtf is bot.start lol
bot.run is a little hand wavey, i needed bot.start in order to manually start it asyncronously so I could have that try/finally block, as i wanted to properly close the db connection upon halting the bot
correct, i provided 2 commands to see each. users in this case is what all the commands looked like at first
well the way you showed it, i dont see why it wouldnt work lol
like this should just, work
does it show up in settings > integrations
legit the only thing i could think of is the intents but that wouldnt make too much sense
but i did have someone have a similar issue before because they requested all intents but didnt have them enabled in the dev portal
huh, didn't know that was a thing. and yes it does
bot has been running since this latest test, and the command is still registered
intents don't matter for slash at all, they're unrelated
hm then it was just a weird niche case that time
i have a feeling though, that if i add a brand new command, it won't register
and what if you run it? or does it just not show when doing /
i've run the command too, it runs happily
i'm curious, if i add 2 new commands, one with guild_ids and one without, if one will register and the other won't
so
it works now?
they all register unless you actually get an error in your console
well idk, i feel like now that it's registered it's registered
lol
well if it works it works
and if it still shows up after restarting discord then it, well, works 100%
well not necessarily. If i continue omitting the param when i push this code to my bot in production which uses a completely different discord bot user, it has the potential to not register the commands
there is literally no reason for it not to work
your code is exactly how its supposed to be
and i mean just comment the command out, restart your bot and discord, then uncomment and restart both again
If it then shows up and works, then it works on your other bot too
ok lets try it
self.shard_status = {}
@commands.Cog.listener()
async def on_shard_connect(self, shard_id):
self.shard_status[shard_id] = "Connecting"
@commands.Cog.listener()
async def on_shard_ready(self, shard_id):
self.shard_status[shard_id] = "Online"
@commands.Cog.listener()
async def on_shard_disconnect(self, shard_id):
self.shard_status[shard_id] = "Offline"
@commands.Cog.listener()
async def on_shard_resumed(self, shard_id):
self.shard_status[shard_id] = "Online"```
Sometimes it doesnt trigger the events or they stay offline
But the shard is online
Can someone help
after commenting out the /users command entirely, it no longer appears in the menu of commands
...is there a problem with that?
well now i've uncommented it out, and the command is failing to register
restart your bot, wait until it actually started, then restart your discord
(it helps to override on_ready so you know when its actually ready, im not sure if it prints smth by default)
interesting, after restarting discord I do see the command again
yea, thats why i always say restart discord
it's just odd that i never had to restart discord when including the guild_ids param
you don't always have to, but command cache can be weird
because it never unregistered from that guild
99% = always, i never needed not to restart i think lol
i mean for me personally i don't need to restart for unsyncing and adding new commands
just kinda works
changing command options is the worst imo
NEVER updates
if you actually run it then it forces an update
oh really? i always just took the "outdated command try again" as a "welp off i go to restart"
that message means it's now updated yes
I was sending embed with an matplotlib image as set_image but the notification i get is of the image
can i somehow change it to embed notification?
I think it is not possible
idk
pretty sad 😦
yea discord just doesn't do that
well can some higher up here convey it to them as a suggestion? might already be conveyed idk
Send discord an email and ask for it
lol not sure they would take it up from a nobody
exactly
its really easy to do, but discord just doesnt
and i doubt they will anytime soon
(doesnt get them money)
whats this called/named when you check for channel permissions in code?
https://docs.pycord.dev/en/stable/api/data_classes.html#discord.Permissions.send_messages_in_threads
Some classes are just there to be data containers, this lists them. Unlike models you are allowed to create most of these yourself, even if they can also be used to hold attributes. Nearly all clas...
self.shard_status = {}
@commands.Cog.listener()
async def on_shard_connect(self, shard_id):
self.shard_status[shard_id] = "Connecting"
@commands.Cog.listener()
async def on_shard_ready(self, shard_id):
self.shard_status[shard_id] = "Online"
@commands.Cog.listener()
async def on_shard_disconnect(self, shard_id):
self.shard_status[shard_id] = "Offline"
@commands.Cog.listener()
async def on_shard_resumed(self, shard_id):
self.shard_status[shard_id] = "Online"```
Sometimes it doesnt trigger the events or they stay offline
But the shard is online
Can someone help pls?
is there any way to make slash commands visible to certain roles?
What affects the slash command float notation?
a user was saying only 0,03 (example) worked for them, with a comma
0.03 on the other hand didn't
When I tried it, it was exactly reversed. If i click the used slash command, it shows a plain 3 where i typed 0,03, and a 0.03 where i typed 0.03
Is this tied to the discord language, or what does that depend on?
probably client locale
sorry, i glanced through the code but i don't think there's anything strange on our side... perhaps add prints to see which ones fire and which ones don't?
how do i make command names have like a space, ive seen commands where its like /this that
Wdym
command groups
Here's the slash cog groups example.
thank you :D
add a print inside each event so you can directly see which ones are being triggered
I have the same event in main.py aand it works
...my point being that if you use the prints you can debug your issue
it's possible that there's some race condition or some other underlying issue, but i don't use shards to know what that could be
ok
Thank you. Mr. Tooth : D
for i in channels:
print(i)
await ctx.guild.get_channel(i).delete()```
is there any reason this might not work? the print statement throws out the channel_id but the channel never gets deleted and theres no errors
the channel isn't cached
but thatd be an error polly
check if the channel is !none first
or let them be printed
that should throw a NoneType error i had it happen before
itd say u cant use delete on NoneType
i know, thats why i said this
yep, imma print it out and also print the channels var and see what i get
yeah so the channels var does throw out a list as expected but the delete doesnt work for some reason still
print ctx.guild.get_channel
well shiet its apparently none
there you go
thats odd bc it really shouldnt be lemme send a snippet of code
channel = await ctx.guild.create_text_channel(f"${account-{acc_id}", category=discord.utils.get(ctx.guild.categories, id=1223137144286085250))
and then i slap the channel.id into a database
which is where i get the channels var from
if get is none, fetch it
and it prints out the id as it should but then its none
and make sure the id is right anyway
wdym by this
fetch_channel
.
await interaction.send_message(embeds=[embed])
how do I send this message to a specific channel
you get the channel and then use channel.send
interaction responses are only sent to where the interaction was invoked
I need to use interaction, without it the input text screen doesnt close
using the channel.send sends the message, but doesnt close the popup when i submit
"something went wrong"
send two responses
you should just respond ephemerally saying "done!"
"responses"
How would I find a user without "message"
class staffVerify(discord.ui.View):
@discord.ui.button(label="Approve", row=0, style=discord.ButtonStyle.green)
async def first_button_callback(self, button, interaction):
guild = message.guild
member = discord.utils.get(guild.members, name=username)
await member.add_roles("verified")
is it possible to pass an input from a slash command into a button when pressed?
yes
how would i go about doing that?
depends on how you use buttons
im kinda just following this https://guide.pycord.dev/interactions/ui-components/buttons
Learn all about implementing buttons in your Discord Bot using Pycord.
do you know how classes work?
kinda
thx
How can I assign multiple views to a message?
I believe you can't
what are you trying to do though?
What do you mean by that ?
Like multiple button ?
it all has to be one view I believe
Because you can still can everything in a class discord.ui.View
I have a problem. When I execute this command with limit is a negative number the code changes the json entry to the negative limit. How can I fix the problem:
async def settradinglimit(self, context, limit: Option(int, name="limit" ,description="Das neue Trading limit")):
if limit < 0: # and (len(await db.get_all_trading_players()) > limit):
await context.respond(embed=discord.Embed(
title='❌ Fehler bei änderung',
description='Das Trading Limit muss zwischen 1 und 50 liegen und es muss mehr Tradingspieler geben als den Limit',
color=discord.Color.red()
), ephemeral=True)
else:
with open('json/bot.json', 'r') as f:
data = json.load(f)
data['trading_limit'] = limit
with open("json/bot.json", 'w') as f:
json.dump(data, f)
await context.respond(embed=discord.Embed(
title='✅ Erfolgreich geändert',
description=f'Das Trading Limit wurde auf {limit} geändert',
color=discord.Color.green()
), ephemeral=True)
return, else it'll just run through
wait my phone is formatting it weird
well, does it go into the initial if clause? or the else?
Use prints
or just set min_value=0 in the option
thats the easiest way
example
that way users cannot physically enter <1 or >12 in my example
oh I remember, thanks
what am i missing here? sending an attachment still results in it still printing
do you have message content intents?
oh i forgot to include intents
thanks LOL
why client and not bot
if you only do events you dont need bot
I doubt they do
Yes
Make the view have multiple buttons
is there a method of connecting a bot to multiple voice channels at once?
no
sadge, but thx for the answer
not inside any one server at least
yeah, I assume a workaround would be to have multiple bots, but that's spammy ig
what would you need it for
I have this command here:
@slash_command(
name='sendleaguemsg',
description='Sende die Ligen Nachricht'
)
async def slm(self, ctx):
with open('json/bot.json', 'r') as f:
data = json.load(f)
await ctx.respond("Ligen Nachrichten wurden gesendet", ephemeral=True)
channel: discord.TextChannel = self.bot.get_channel(data["leagues_channel"])
with open('json/leagues.json', 'r') as f:
leagues = json.load(f)
for l in leagues:
index = next((i for i, c in enumerate(l) if c.isdigit()), None)
em = discord.Embed(title=f'{l[:-1]} {l[index:]}',
color=0x031C47)
em.set_image(url="url")
msg = await channel.send(embed=em)
leagues[l]["statsmsg"] = msg.id
with open('json/leagues.json', 'w') as f:
json.dump(leagues, f, indent=4)
this command should send 5 messages, because I have 5 leauges in the leagues.json the messages should be "leauges 1", "leauges 2", "leauges 3", "leauges 4" and "leauges 5". But the Bot sends "leauges 1", "leauges", "leauges", "leauges" and "leauges", "leauges 2", "leauges", "leauges", "leauges" and "leauges" and so on. Somethimes there is only one message containing only "leauges" sometimes more
I didn't change the code since a month, where the command worked fine, I just updated pycord (I use the development version)
the leauges.json looks like this:
{
"league1": {
"teamlimit": 20,
"teams": [],
"statsmsg":
},
"league2": {
"teamlimit": 20,
"teams": [],
"statsmsg":
},
"league3": {
"teamlimit": 20,
"teams": [],
"statsmsg":
},
"league4": {
"teamlimit": 10,
"teams": [],
"statsmsg":
},
"league5": {
"teamlimit": 10,
"teams": [],
"statsmsg":
}
}
i can't quite tell how that's happening, but why don't you send a single message with all 5 embeds?
how would this work?
instead of embed, use embeds which is a list
thanks, I will try this
(also that last open / write should be outside the loop)
still don't work
now the bots ends "leauge" some times then I can see 5 embeds with "leauges 1" to "leauges 5" but then these 5 embeds disappear and it looks the same like it was before
show your code
here
it sounds like network issues because there's no reason for your command output to duplicate
no, with the changes
@slash_command(
name='sendleaguemsg',
description='Sende die Ligen Nachricht'
)
async def slm(self, ctx):
with open('json/bot.json', 'r') as f:
data = json.load(f)
await ctx.respond("Ligen Nachrichten wurden gesendet", ephemeral=True)
channel: discord.TextChannel = self.bot.get_channel(data["leagues_channel"])
with open('json/leagues.json', 'r') as f:
leagues = json.load(f)
embeds = []
for l in leagues:
index = next((i for i, c in enumerate(l) if c.isdigit()), None)
em = discord.Embed(title=f'{l[:-1]} {l[index:]}',
color=0x031C47)
em.set_image(url="https://cdn.discordapp.com/attachments/1087719888677773382/1131242237771141270/formation.png")#
embeds.append(em)
msg = await channel.send(embeds=embeds)
leagues[l]["statsmsg"] = msg.id
with open('json/leagues.json', 'w') as f:
json.dump(leagues, f, indent=4)
from the Discord API or my PC? because I tried running it at 2 different PCs and also 2 other peoples at a totaly different location than me and the problems are there too. (We discorvered the problem this morning)
i really wouldnt use the dev version for a prod bot tho
use stable if you expect a stable experience
yeah I know, but we switched to the dev because we needed a paginator feature from Om that wasn't implemented yet in the stable version
try on stable, if it works, its a library issue
and wait with using that paginator feature until it's out on stable
does somebody know if this pr is in the stable version:
that PR was never merged
damn, but why?
read the comments, idk
this referenced it tho
oh like this is the same?
read the comments / initial PR text and find out
Say I want to use a standard emoji as Author for Embeds. That only uses a straight icon_url instead of an Emoji class. Is the best way just to grab it from the Twemoji repo or something?
yeah, grabbing from the twemoji repo would be the best. Do you need a link or something?
Thanks. I know the URL to the repo, was just validating the approach
@tasks.loop(seconds=5.0)
async def on_message(message):
channel = 134
await message.channel.send("heklo")
Is this possible
I heard that we can restrict emoji to some role, where can I find this in the doc ?
no
We can’t restrict can’t of emoji for certain role ?
It is documented
discord.Emoji i believe
but there is defo no way to do it in the UI
No idea if bots can use it
you can, it's documented, but clients can do some wonky stuff
Yep it’s in the edit my bad
Wdym by wonky stuff
also that was like a year ago, so maybe they fixed it?
its probably intended only for server subscription emojis
no, role restricted emojis have been documented since the endpoint was created
how can I add a message over the paginators embed?
is it possible to have a button on followup embed?
in the docs the @discord.ui.button method takes 3 parameters one of which is a slash command
so uhh this is confusing me https://guide.pycord.dev/interactions/ui-components/buttons#usage-syntax
Learn all about implementing buttons in your Discord Bot using Pycord.
attach the view to the embed lol
embed message*
yea, thats exactly how you do it
class ConfirmationView(View):
def __init__(self):
super().__init__()
@discord.ui.button(label="Confirm", style=discord.ButtonStyle.success)
async def confirm(self, button_interaction: discord.Interaction):
update_build(submission_id, update_values)
await button_interaction.response.edit_message(
embed=utils.info_embed('Success', 'record edited successfully'),
view=None
)
self.stop()
@discord.ui.button(label="Cancel", style=discord.ButtonStyle.danger)
async def cancel(self, button_interaction: discord.Interaction):
# Inform the user that the update was canceled
await button_interaction.response.edit_message(
embed=utils.info_embed('Cancelled', 'record edit cancelled'),
view=None
)
self.stop()
await followup.send(embed=preview_embed, view=ConfirmationView(), ephemeral=True)
you are missing an argument
so in confirm() and cancle() there should be a third argument
copy the docs
but what should i give it
the docs give it a slash command but the buttons appear on follow up
but i want it*
the docs give it a slash command but i want the buttons appear on follow up
i have no idea what makes you think that lol
just attach the view to the followup message
...send(content, embed=embed, view=ConfirmationView)
or whatever you want in there
did that but like there is a missing arg so the buttons are just failing
again, copy this
a button callback has 3 parameters
this really doesn't help but ok
what do you not understand then
you are just not giving the button callback function the right amount of parameters
it needs 3
self, button, interaction
for the object, the button that was pressed, and the actual button interaction
i don't understand what i should put in the third argument
copy the guide
it doesnt matter what you name it even
it just needs to exist
and i mean, you need it to do your button stuff
the second argument is just button, not the interaction like you have it in your code
I never really used it either
I think you understood how it works and you just omitted the second parameter
but you cant do that because its positional and not kwargs
when you are using a @button decorator in a View class, there are 3 arguments:
self, which is the view class.button, which is the button that was pressedinteraction, which is the recieved interaction
idk where you got slash command from, but that's what you work with
i already said that tho :3
good for you
this is a slash command if i have ever seen one
@bot.slash_command() # Create a slash command
async def button(ctx):
await ctx.respond("This is a button!", view=MyView()) # Send a message with our View class that contains the button
You explained it terribly
they are doing what i said
that is a slash command yes
attaching the view to the message
i literally said exactly what nelo said in very slightly different words, here #1132206148309749830 message
soo?? the button argument isn't assigned "the button that was pressed" it is assigned a slash command..
what do you even mean by the button that was pressed
no, it isnt
????
the button is part of a view
the view is sent with the message that is sent in response to the slash command
button is literally the button the user pressed, e.g. if you were to print button.label inside that callback you'd see the button text
idk how much more clearer that can be
im genuinely curious as to how you're seeing that as slash command data
nvm i don't even want to get it working at this point
(views can be sent in any context, in response to an event, by a prefix command, etc)
i mean we are trying our best to explain how it works lol
somehow i still don't understand what i should assign in the second argument
i can see that
i'm clearly dumb
the name doesn't matter in the end, it'll always be the arguments we listed
you can largely ignore the second element tho, its rarely used imo
but the order is important, the third argument, whatever you call it, is always the interaction
here is my bot's confirm view as an example
as you can see i never touch the second argument, because i dont care about the button data basically
so this?
yes
that won't work the embed that has the buttons will never get sent
?
you send it via a slash command or whatever should trigger that embed + buttons
you pass it via the view= parameter in a message send()
.
again, just attach the view to the followup message lol
add view=ConfirmationView() to the followup-sending
a
h
...what?
if i have it like this the follow up is never sent
man lmao im missing something here
well, you never clal that function
plus, followup is not defined anywhere or a parameter
where even is that function
can you tell me the order of operations for the user
like what they do & what happens
so they run a command named edit with record id and new values then initially the db is automatically updated but now i want to show them the new embed before updating the db
so now
-run command with new values
-confirm or cancel changes
-db updated
show your command code
that
is a shitton of options
wow
are you doubly sure you are using py-cord and not discord.py
i am almost certain you are using discord.py because most of that looks very much not like pycord to me
;3
yeah wrong server
now we know why it didnt make sense
there are a lot more than 2
it's a long story
also isnt dpy using tree commands instead of slash/app_command?
i'm invested
dpy syntax is so bad my goodness
tree is a structure but they're still referred to as slash/app, some other differences
am i reading the correct docs?
which docs?
https://pycord.dev/ are "ours"
i don't think i am then
eh long story short it used to be mainly dpy, after discord introduced slash commands the owner didn't like the direction and decided to halt development, tons of forks such as ours were created to continue it then some months later they came back to continue with the original
h
dpy's is https://discordpy.readthedocs.io/, and if you want support then go look up their discord server
Is it possible to start video stream?
i don't think so
bots cannot use video no
😥
uh it is not really my code tbh
i know, its chatgpt
no
yea i know dw, chatgpt would cry at that amount of coherent code
it is made by two people
but yea if you wanna try making a bot yourself, i highly suggest py-cord
its really straightforward imo
nah i'll pass c# my beloved
lala found a friend
i am going to suggest changing the current library to the current maintaner 🗿
how can I add a message over the paginators embed?
you mean like a normal text message sent into the same channel? or something else?
let me try to describe it better. I have a paginator with embeds as pages. but I want on top of the embed a text. Like in the same message, but a text above the page embed that stays there when I switch a page
when this is the current paginator message, I want a text above the embed where the red circle is
Okay, never tried something alike. next best thing i can think about would be a picture top right corner, that can be included in every page. doesn't sound like you were looking for such an option though.
or is it possible to add a embed and a "normal" text to a page?
yea solved it with this: pages.append(Page(content="Message I want over the embed", embeds=[embed]))
how can i get in which shard the instance is running ?
like a bot.shard_id
@tasks.loop(minutes=1)
async def role_level_loop(self):
await self.bot.wait_until_ready()
for guild in self.bot.guilds:
if guild.shard_id != self.bot.shard_id:
continue
does something like this will work (i dont find the documentation about that so
Hey I saw this post #1226541894113431663 and I was wondering, genuinely, how do you manage this?
I tried my best with autocomplete rn but it seems impossible to make a list of textchannels for the autocomplete (itll just show every channel regardless)
my test server doesnt have any announcement channels (cant make one just nvm it) so i tried instead by making it just show 1 particular channel
but since the option type in the slash command is textchannel, itll still show every textchannel there is
I tried faking a channel selection by just making it optionchoices, like this
but for some reason, that will end up in this error (the option has the type int)
i thought channel IDs were normal ass ints, so how does this happen? the channel id is 924757855624646667
is it just not possible to transfer entire channel IDs via autocomplete like that?
My guess would be that you're trying to fake it and Discord somehow detects it. Have you tried it with an actual channel object?
not possible
optionchoices can only be str, int, float
And if i make the type of the option textChannel, it just ignores the autocomplete
i can't do choices either because i can't access ctx
Then honestly, no idea, apologies.
np
i tried as float but then it ends up as 9.xxxxxxx
i could probably salvage that somehow, let me try that
but that seems incredibly janky
like i could just * 1000000 that
Could you not try it as float but then round it to ndigits=0 so there's no decimal?
oh wait, hm
its not a comma number its just the scientific notation
yea no if i do it as float is inaccurate when i convert it back to int
god this is awful lmao
Okay I made it work by using a string for the channel ID instead
discord doesn't accept large ints (which is why all snowflakes on the API are string, despite us using int)
yea i was very confused
so you can pass SOME channel IDs as ints because they're small enough
who tf made the API use int53? thats so random
isn't it just a js limitation
9007199254740991 is the MAX_SAFE_INTEGER
which converts to the start of 2015, before discord was even founded
How to feature certain slash commands on the bot's profile?
Like some other bots have a set of their commands on the bot profile and you can just click them too i think
?tag slashcommandmention
</full name:ID>
maybe this works
mhm
ah
How would I go about integrating official automod for my bot, like for it to show up on the automod section for server settings. Is it just using on_message and creating a list of banned words? or is it a different process
It is creating automod rules
.rtfm Guild.create_auto_moderation_rule
where is the documentation for that
Right above you.
its not on my screen can u send it again
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 ...
how can we convert the helpcommand of the prefix for the slash one ?
for i can filter the commands for each
discord.ext.bridge.Bot.walk_application_commands
discord.Bot.walk_application_commands
discord.ext.commands.AutoShardedBot.walk_application_commands
discord.AutoShardedBot.walk_application_commands
discord.ext.commands.Bot.walk_application_commands
discord.ext.bridge.AutoShardedBot.walk_application_commands
Bots: Attributes activity, allowed_mentions, application_flags, application_id, auto_sync_commands, cached_messages, cogs, debug_guilds, description, emojis, extensions, get_command, guilds, intent...
this used to look fine, did something change about how discord displays embeds or atleast code blocks within embeds?
different phone?
looks like the max width was changed by 3 characters or so
if it was using the entire width before
embeds on mobile are just pain
oh
its just how I screenshotted ig
idk what made me think that lol
but yea
let me fix that then
embeds are pain
But e.g. you can't use Multiline strings within your code that are indented. it'll be broken on mobile but look as intended on desktop, so you have to fully unindent any Multiline strings at least in embeds
they might've fixed that by now but it was definitely an issue before
bruh
why is it so slim on desktop, which traditionally has a lot more width than mobiles
idfk exactly my question
so there are no possibility to use the default one ?
because i need also to filter depending on what the user can do or not
and with the walk i cannot filter that
why wouldn't you be able to
# Create a markdown table of the pings
max_len_host = max(len(str(host)), 4) # 4 is the length of "Host"
max_len_latency = max(max(len(str(latency)) + 2 for latency in pings), 7) # 7 is the length of "Latency"
table = "| {0:<{1}} | {2:<{3}} |\n| {4} | {5} |\n".format(
"Host", max_len_host, "Latency", max_len_latency,
"-" * max_len_host, "-" * max_len_latency)
thats how I make my table ig
i tlak about this
self.help_command.filter_commands
ah
for it only show what the user can use
no f String?
also why do you call max(max()) once lmao
my man
i dont remember programming that
idk what I was on
I dont even know how the fk I managed to make that
you can simulate filter_commands by running cmd.can_run on all your commands
o thanks you !
a slightly simplified version of that func ```py
...
async def predicate(cmd):
try:
return await cmd.can_run(context)
except CommandError:
return False
ret = []
for cmd in commands:
valid = await predicate(cmd)
if valid:
ret.append(cmd)
return ret```you can see the full code [here](<https://github.com/Pycord-Development/pycord/blob/master/discord/ext/commands/help.py#L547>), just adapt it for your own purposes
but where does it ever receive a user argument to check the can run on
I'm missing something here
context
thanks you i will try
oh
but it never is passed that context
that snippet is inside filter_commands under the HelpCommand class, which has its own context
ah
is there an easy way to get number of command in /, so addition of command, sub command and sub sub commands ?
@fresh sierra | You said command a few times too many in that, not too sure what you mean....
You can access every command object using py for i in bot.commands and then using i as the command object.
Other than that, not too sure what you could be referring to...
i talk about slash command and not prefix, with prefix we can do len(self.bot.commands), and i wanna know if there are the same kind of thing with slash that also contain sub and sub sub
You want to access every slash command a bot has?
I would suggest using py for i in bot.commands: in addition to py if _isinstance(i, discord.SlashCommandGroup) to check if there could be subcommands, and just making a tree out of those.
bot.commands will be None
since its for prefix and not /
but i find an other way, i dont think there are an attribute for it so im just itinarating in all commands
You could always maniuplate bot.register_application_commands.
Use it in a loop and intercept it per-object (command) and logic the command object from there.
Hay, i was looking for a way to get a users server name. Before it used to be user.nick or something now i cant seem to find it.
i only find name, display_name and global_name. When i use the search i can only find a post to use the dev version which was for v2.5.0 (#1170056170975797379)
I am running 2.5.0 already but cant seem to find it tho.
So any way to get a users nickname on the server the slashcommand was used ?
ctx.author.name I think
There is a tag for name
.tags
- foo
- name-conventions
- sqli
- restart-cmd
- timestampgenerator
- xy
- local-file
- discord.app
- snowflake
- docs
- orjson
- get_x
- subcommands
- um-cmds
- bridge
- cmd-limits
- virtualembed
- specialchannelmentions
- cross-post
- username
- developermode
- asset
- message content
- tokens
- nohello
- examples
- 429
- mongodb
- objects
- woc
- official
- timer
- install github
- announcement-channel-options
- swasvid
- ephemeral
- rie
- invite regex
- nziie-examples
- gateway
- applicationcommands-registration-delay
- exception
- inline-fields
- update
- bitwise
- gather
- option
- solved
- get-help
- breaking-changes
.tag name
Tag not found.
.tag user_name
Tag not found.
Did you mean...
username
usernames
.tag username
If you have doubts or questions about the new username system, please read the following articles or contact discord:
Nope
@fresh sierra | Are you trying to reference the discord.*User snowflake?
.tag discord.User
Tag not found.
Did you mean...
discord.app
Tag not found.
this bot is dumb confirmed
I was trying to find a tag that explain each name
Not too sure what you mean by each name. Are you referring to user.name, user.display_name, etc?
.tag usernames
If you have doubts or questions about the new username system, please read the following articles or contact discord:
Before Pomelo- Versions 2.4.1 and before
member.name -> username
member.nick -> guild nick name
member.display_name -> member.nick OR member.name
After Pomelo- Versions py-cord-dev 2.5.0 and up
member.name -> username
member.global_name -> global display name (global nick name)
member.nick -> guild nick name
member.display_name -> member.nick OR member.global_name OR member.name
Exactly !
@daring perch
i just tried it and it works fine if i use the slashcommands ctx (e.g. ctx.author.nick) but when i fetch a user with user = await bot.fetch_user(ID) i cant use nick. Is the ctx.author different than user = await bot.fetch_user(ID) ?
Nick is the name in the guild so you will need member and not use
any way to get the member object from the user id ? Couldnt find a fetch_member function
guess i will use get_all_members when the bot starts and compare the ids to extract the member object
^
perfect. appreciate all your help peeps ❤️
does that also exist with get?
What's the ratelimit for channel renames?
2 updates per 10 minutes per channel
ic thx
hi
is there any poss way that i can make my dropdown menu's options
from a dict
with like a for function or smth
yes
select = discord.ui.Select(...)
for option in your_options:
select.add_option(label = option)
oh tyvm
wait but if i made dropdown menu with decorator then wha like this
@discord.ui.select(
placeholder = "Select a category!",
min_values = 1,
max_values = 1,
options = []
)
and how should i make a content menu without decorator
just call a function there that returns a list of select options
thanks
if you already have an array, just pass it in
list :>
list is technically wrong because it's static. :>
dont i have to do this
@discord.ui.select(
placeholder = "Select a category!",
min_values = 1,
max_values = 1,
options = [
discord.SelectOption(
label="...",
description="..."
),
]
)```
if it's not already an array of SelectOption objects, then probably have a function/method that returns it as that, then.
mm oki
Hey!
I have my function Exports._setup_all() which is async defined as ```py
class Exports:
config = Configuration()
flags = UserFlags()
@staticmethod
async def _setup_all():
await config.setup()
await flags.setup()
return 1
``` and I need to call this function in my main.py file.
I have imported Exports which works fine, but I need yet another async function to await Exports._setup_all().
How can I use this setup function without being caught in a whole loop of just making loads of async functions?
TIA!
have you looked into asyncio.run or asyncio.run_until_complete?
I have, but it didn't seem like it would work. Do you have any suggestions for how to use it?
Just ound what I was looking for on the docs, thanks!
class callCommands(commands.Cog):
def __init__(self, bot_: discord.Bot):
self.bot = bot_
analytics = SlashCommandGroup("postcall", "Publish Alpha Call Commands", guild_ids=adminServer)
@analytics.command()
async def nft(ctx: discord.ApplicationContext, reporter: Option(str, 'Reported by', autocomplete=getReporters)):
"Create and publish an alpha call."```
Gm! How can I lock this group command to a specific role so it's only visible to that the role holders
@discord.default_permissions(xx)
that locks it to a specific set of permissions
i think you can lock it to roles too but idk how to do that
probably smth like discord.has_role(), check the docs
usually roles arent used because bots are usually in more than 1 server
also, you forgot to pass self to the command, since its in a cog
also you might want the autocomplete to be choices
I couldn't find it earlier but I had asked this before, and apparently it's not possible?
I'll have to go the integrations route.
Thank you for the response!
good catch
using autocomplete since the fetched list is dynamic and keeps changing, choices saved the initial list and didn't update it with time
No, choices are fetched on execute of the command / typing it in chat
so if you put a function there that returns a list of optionchoices, it calls that every time someone types the command
Also has the important bonus of verifying the input to be one of the choices
Autocomplete doesn't do that
why do you have commands.Cog but discord.Bot?
do you use commands.Bot or discord.Bot?
my bot was bridge before so thats probably a remainder of that
any notable difference?
the distinction is more nuanced than that.
commands.Cog can include text-based commands, while discord.Cog can't.
my bot is slash only, so i guess i should change it to be discord.Cog?
yeah
any benefits or downsides from that
time to google what distinction and nuanced means
lol
rela
?
also, i have commands.cooldown, but there is no discord.cooldown, so, what do
same for buckets
Oh I guess i can also change commands.Cog.listener to discord.Cog.listener?
yeah
no, it's just the text-based commands themselves that is restricted
what
so commands.cooldown doesnt work for slash?
it works
you just can't just @commands.command() for discord.Cog
ah
how can I send multiple responses to one interraction?
An XY problem is when you're trying to ask about your attempted solution, rather than your actual problem.
You are trying to solve problem X, using solution Y. Instead of asking for help with X, you ask about Y. This only results in frustration as whoever is trying to help you needs to ask several questions before even beginning to help you with your actual issue, wasting both their own, and your time. Always include as much information as you can about your problem, including attempted solutions. If there are solutions you've ruled out, include them along with an explanation as to why you've ruled them out.
interaction.response.send, then interaction.followup.send, interaction.channel.send etc etc
you can also just respond twice and the library will handle it, but again, this
with interaction.respond not interaction.response
ctx.respond() works twice
thank you!
bruh
I'm not sure but it works aight
...? This is wrong
choices are bound to the command, they don't regenerate even if you make it a function until you re-sync
wut? srsly?
Yes
wtf
That's why autocomplete exists
my bad
Nah allgood
but autocmplet sucks
how many?
infinite i guess
at a time i mean
25 i think
discord will display 25 at max, but you can essentially return infinite
i dont understand something, can someone help me
In my before invoke, bot_.ping.embed.description print "test"
xp_ = YamlNamespace(lang_data.get("xp"))
#--------------------Info--------------------#
info_ = YamlNamespace(lang_data.get("info"))
#--------------------Bot--------------------#
bot_ = YamlNamespace(lang_data.get("bot"))
#--------------------Others--------------------#
error_ = YamlNamespace(lang_data.get("error"))
var_ = YamlNamespace(lang_data.get("var"))
print(bot_.ping.embed.description)
howver in my command : print("ping /", bot_.ping.embed.description) return
ping / `{bot_emoji}`┆**Ping** : `{bot_latency}` ms
`{db_emoji}`┆**Latence de la Base de Données** : `{db_latency}` ms`
why does even if it print the bot_.ping.embed.description as the one it should be, it still then print the wrong one ?
i hate when it does that
nice codeblock
maybe i need to reload the cog to get the update
.
like
there are ```py at the begining so
the ``` needs to be on a new line.
as done here
.
also the case
yea
its because of the _
just screenshot
xp_ = YamlNamespace(lang_data.get("xp"))
#--------------------Info--------------------#
info_ = YamlNamespace(lang_data.get("info"))
#--------------------Bot--------------------#
bot_ = YamlNamespace(lang_data.get("bot"))
#--------------------Others--------------------#
error_ = YamlNamespace(lang_data.get("error"))
var_ = YamlNamespace(lang_data.get("var"))
print(bot_.ping.embed.description)
howver in my command : print("ping /", bot_.ping.embed.description) return
ping / `{bot_emoji}`┆**Ping** : `{bot_latency}` ms
`{db_emoji}`┆**Latence de la Base de Données** : `{db_latency}` ms`
weird that it works hwen i do it
that's a cog, right?
how ??
the command isn't an attribute to bot, it exists separately
hovewer
you should use bot.get_application_command with your full command name, including groups
its a cog
and i used the bot.before_invoke
to get the translation working first
have you ever actually specified a ping variable, or is it just the command
the bot_.ping is a variable
no empty line
ok thanks
can you show exactly where it's defined
even without
you cant have text the line above it
class YamlNamespace:
def __init__(self, data):
for key, value in data.items():
if isinstance(value, dict):
setattr(self, key, YamlNamespace(value))
else:
setattr(self, key, value)
...you can, it's some other weird formatting issue
so basically it goes into my yaml
and then add value to each one
it work perfectly fine, im just a little bit surprise about why even after editing the bot it doesnt change, but i guess its because i didnt reload the data that im importing in the command
i will try
indeed, you need to refresh
but also, you can't update a command description without restarting
(you can do it internally, but it won't show on discord)
i think its more about the importlib.reload(data), the file where the variable are
i will try
so
i have some problem with the way im getting the translation
i need to do a function or it will reload everytime the thing is with the async function
so like that
async def translation(ctx: discord.ApplicationContext=None):
global xp_, info_, bot_, error_, var_
if not ctx:
lang_data = load_yaml('Resources/Languages/french.yaml')
elif ctx.guild.preferred_locale == "en":
lang_data = load_yaml('Resources/Languages/english.yaml')
elif ctx.guild.preferred_locale == "fr":
lang_data = load_yaml('Resources/Languages/english.yaml')
elif ctx.guild.preferred_locale == "custom":
lang_data = load_yaml('Resources/Languages/custom.yaml')
#--------------------XP--------------------#
xp_ = YamlNamespace(lang_data.get("xp"))
#--------------------Info--------------------#
info_ = YamlNamespace(lang_data.get("info"))
#--------------------Bot--------------------#
bot_ = YamlNamespace(lang_data.get("bot"))
#--------------------Others--------------------#
error_ = YamlNamespace(lang_data.get("error"))
var_ = YamlNamespace(lang_data.get("var"))
print(bot_.ping.embed.description)
asyncio.run(translation())
i will get this error RuntimeError: There is no current event loop in thread 'MainThread'.
but with a def function i will get the error before_invoke expect a corotine
does someone has an idea ?
can you show the full traceback
its because i used the asyc,io.run(translation before the bot even start
so it raise me an error at my bot = class telleming me tha
Why isn't autocomplete able to shortlist down to the relevant search item
ik but i still need to defined variable before
you have to do that yourself
you can override the on_connect event, just make sure to sync commands last. This is the default event ```py
async def on_connect(self):
if self.auto_sync_commands:
await self.sync_commands()
I know a bot programmed in Hikari, and it's able to shortlist the search
you can, but again you have to handle it yourself in your autocomplete function
if it's not narrowing you returned something wrong
not but like if i dont do it before, it will raise me unknow bot_
cos i will use it before its even initalised
why can't you do it after
i was trying that
if not locals().get('xp_'):
default_data = load_yaml('Resources/Languages/french.yaml')
if result == "fr":
lang_data = load_yaml('Resources/Languages/french.yaml')
elif result == "en":
lang_data = load_yaml('Resources/Languages/english.yaml')
if missing_keys(default_data, lang_data):
lang_data = load_yaml('Resources/Languages/french.yaml')
elif result == "custom":
lang_data = load_yaml('Resources/Languages/custom.yaml')
if missing_keys(default_data, lang_data):
lang_data = load_yaml('Resources/Languages/french.yaml')
# Initialize the YamlNamespace objects
xp_ = YamlNamespace(lang_data.get("xp"))
info_ = YamlNamespace(lang_data.get("info"))
bot_ = YamlNamespace(lang_data.get("bot"))
error_ = YamlNamespace(lang_data.get("error"))
var_ = YamlNamespace(lang_data.get("var"))
async def translation(ctx: discord.ApplicationContext=None):
global xp_, info_, bot_, error_, var_
if not ctx:
lang_data = load_yaml('Resources/Languages/french.yaml')
elif ctx.guild.preferred_locale == "en":
lang_data = load_yaml('Resources/Languages/english.yaml')
elif ctx.guild.preferred_locale == "fr":
lang_data = load_yaml('Resources/Languages/english.yaml')
elif ctx.guild.preferred_locale == "custom":
lang_data = load_yaml('Resources/Languages/custom.yaml')
# Update the YamlNamespace objects with the new lang_data
xp_ = YamlNamespace(lang_data.get("xp"))
info_ = YamlNamespace(lang_data.get("info"))
bot_ = YamlNamespace(lang_data.get("bot"))
error_ = YamlNamespace(lang_data.get("error"))
var_ = YamlNamespace(lang_data.get("var"))
print(bot_.ping.embed.description)
importlib.reload(data)
importlib.reload(data)
but that doesnt work
why
the on_connect event is where commands sync, so if you do it there then it should work fine.
the bot_.ping is still the value before the change
can you show your autocomplete function
class reporterCommands(commands.Cog):
async def getCollections(ctx: discord.AutocompleteContext):
"""Collections List"""
with open('collectionList.json', 'r') as File:
data = json.load(File)
return data.keys()
def __init__(self, bot_: discord.Bot):
self.bot = bot_
analytics = SlashCommandGroup("analytics", "Analytics Commands", guild_ids=adminServer)
@analytics.command()
async def reporter(self, ctx: discord.ApplicationContext, reporter: Option(str, "Reporter Name", autocomplete=getCollections)):
cogs should exist before connect though
its the case, but because i didnt defin the variable before the on_connect
right, your autocomplete returns the ENTIRE list; what you need to do is filter it by ctx.value, which is the text the user input
i think you need to consider the structure in more detail before doing this
the order specifically for this would be something like load cogs -> bot.run -> apply descriptions -> sync
i think what im doing is like really not optimal
probably
how can I do this please, example?
but i dont even know if what i want to do if possible
i mean... iterate through your list and check if in string
something like [x for x in data.keys() if ctx.value in x]
aight, ctx.value
autocompletecontext also has some other attributes that can be used creatively https://docs.pycord.dev/en/master/api/application_commands.html#discord.AutocompleteContext
@subcommand(f"{bot_.name}")
@commands.slash_command(name=bot_.ping.name, description=bot_.ping.description)
async def ping(self, ctx: discord.ApplicationContext):
print("ping /", bot_.ping.embed.description)
it is, you just need to restructure
do you think with a code like that, i can for each one it can go on a function to translate using the context and then work correctly ?
wait, is this for translation?
yeah kinda, i want to be abble to change the value of bot_.ping.name based in each user or guild
that's a built in discord feature using localizations
but through a function cos i need to be abble to change depending on a setting that they put in the database, they local user or guild
I suggested that already
oh
but yeah, what you're doing is not possible then
yes but apparntly i cannot use my database with that
you can't translate live
i think it is because of this
that does what i try to do
but just differently
yes, that uses discord's method which is interaction based
you cannot do it through DB
i18n submits all valid translations on sync, then uses the client language to translate
the bot does no extra processing
i could not just here
@classmethod
def get_text(cls, original: str, *format_args: object) -> str:
"""Translate a string based on the `translations` attribute of the I18n instance.
Returns the passed string if a translation for the current locale isn't found.
If `format_args` is given, the output string will be formatted using `text.format(*format_args)`.
"""
self = I18n.instance
text = (
translation
if (translations := self.translations.get(self.current_locale))
and (translation := translations.get(original))
else original
)
if format_args:
return text.format(*format_args)
return text
change to first checkx in my db the langague
and translate in purpose
get_text is for custom string translation in the callback
it does not do names and descriptions
for example if result is fr it does that etc
yep
Thank you, able to shortlist the search now! 🙃
allgood
so even here
def localize_commands(self) -> None:
"""Localize pending commands. This doesn't update commands on Discord
and should be ran prior to `bot.sync_commands`."""
for locale, localized in self.localizations.items():
for command_name, localizations in localized.items():
if command := utils.get(
self.bot._pending_application_commands, qualified_name=command_name
):
self._localize_command(
command,
locale,
localizations,
)
i will not be abble to do it add the database
what i was trying to do was just impossible i guess
pretty much yeah
discord tries to move certain features to be user-focused rather than dev-focused
just like permissions are set by server admins, localization is based on the user's app language
a lot of time lost but that okay snif
which you can access from interaction.locale
because for the moment i was doing it per bot
each bot can change the langage
but i was wanting to do it by guild
but not possible that sad
and i also think i cant combine both
you can still translate the output, but the names and descriptions are 100% user dependent
yes but name and description were also important but that okay
wait maybe i will do
i mean, why not just use discord's system?
because i want user to be abble to customizable there bot with a custom yaml
and the thing is there will be 3 things so
french
english
then it's out of your hands 
and custom
but so now since its not possible
i will maybe change
is that possible to combine both ?
no matter what, you cannot control name and description after the bot has started
yeah so not really
like i can but only with the localization
so its user based
and i cannot interact with that
when ur genious is limited by discord
that sad
i think i will do :
- localization for name and description
- custom text per guild for the other
Is there a way to force the bot to run it's help command if it's mentioned? I tried: py @bot.event async def on_message(message): if message.author == bot.user: return if message.content == bot.user.mention: await bot.process_applicaition_commands(_help())
where _help() is the definition of my bot's help command, but it wanted an interaction object instead?
The only usage I could find of bot.process_applicaition_commands was in on_interaction events to continue the processing of the interaction.
Thanks!
just call the function lol
Is it fr that simple?
try and see
Bruh I been overcomplicating all this if that actually works ;-;
i mean im tired but i dont see why not
It doesn't, raises: Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\there\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\client.py", line 400, in _run_event await coro(*args, **kwargs) File "C:\Users\there\OneDrive\Desktop\Projects\Bots\MSA Bot\main.py", line 59, in on_message await _help() ^^^^^^^ TypeError: ApplicationCommand.__call__() missing 1 required positional argument: 'ctx'
Also tried passing in discord.ApplicationContext to the function as both args and kwargs but still raised the same error :/
Yeah no shi, its 1am for u 😭
yea its probably in a cog so it wants self too
i think this is kind of a dumb idea after all
:> i am so helpful (sorry)
Is there a way to place the link in the word on the embeds title? like: Google
I tried it and it did not work as it should
url = …
lol
Is there a way to make a slashcommand group inside of another group?
wait
i think its subgroup
yeah
Here's the slash groups example.
there is no actually example about subgroups here but i will find out
processing an application command on a regular message probably won't work
why not offset the output to a separate function which is easier to call
Just a quick question, I just upgraded to py-cord 2.5 but now my bridge command are not working with prefix anyone know the fix ?
for eg this command
@bridge.bridge_command(name="order",description="Place your order")
@modules.checks.in_any_channel(channels = ["📩-order-here"])
@commands.cooldown(3, 15, commands.BucketType.user)
@option("item",description="name of item")
@option("amount",description="amount you wanna buy")
@option("priority",description="which priority you want your order to be",choices=["normal", "high"])
@option("info",description="Additional info / mention storage")
async def order(self, ctx, item, amount, priority, *, info = None):
how do i do cooldowns for prefix commands (or just something to stop users from spamming the command)
oop, im stupid
the answers literally right above
see #1132206148309749830 message
Thanks will try 👍🏼
you can get the context from a message
Is it possible to set the status to the phone icon?
I can set it to idle, do not disturb etc. with change_presence, but can I set it to the phone status?
Never seen it before, don't think so
But check the docs for the presence types
It's not in the docs, that's why I was asking. Thx.
yea, doesn't look like you can
Ive seen it done on bots, tho they were using d.js
What's the best practice when a Select has more than 25 options? Add another Select for the rest of the options?
forget that, the best should be NOT having more than 25 options
one day we'll get autocomplete in selects... maybe...
how can bot log boosting user
Are you asking how long a boost can be tracked by a bot?
nope
i want to make a thanking image for users who boost the guild
idk the event function name for this
You can use the on_boost and on_boost_expire events to track users who boost the guild. If you wish, you can store the timestamps of each event when they fire and use that to track the ammount of time the boost lasted.
No tag on_boost found.
yt-tutorials, youtube, xy, wavelink, virtualembed, usernames, usercmd, update, unofficialguide, um_cmds, tryitandsee, tokens, token, timer, tias, this, tcr, tca, tags, tagrules, swasvid, subcommands, sslfix, sqli, solved, snowflake, slashcommandmention, slashblog, rie, restartcmd, requests, replit-install, replit, removeall, pythonversion, pythonserver, python, practices, pp, pomelo, persistant_view, paste, partial_objects, oracle, option, oop, om, official, objects, notpycord, norepl, nojson, nohelp, nohello, no_status, name-conventions, mybot, msgcmd, mongodb, modal, missing_access, message-content, lp, logging, localfile, learnpython, json, intents, install_git, install, inline-fields, importerror, idw, ide, how2sql, helpgist, guide, git, gif_avatar, getalpha, get_x, get-help, gather, fork, forbidden, exception, examples, ex, ephemeral, eh, docs, discord.app, discord.Bot, deploy, commandnoshow, colors, codeexamples, codeblock, cmd-limits, closing, client, chatgpt, buttons2, buttonlimit, bridge, breaking-changes, botvar, bitwise, asset, applicationcommands-registration-delay, announcement_channel_options, aiohttp, activedevbadge, Woc, Timestamps, DMChannel, 429
^ available tags
look it up in the docs
?tag selfbot
No tag selfbot found.
LL
I didn't fount it in the docs
yea you're right, i can't find it here
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...
gottem
@glossy latch | Turns out that Pycord doesn't have an on_boost event. You can, however, use the on_message function in conjunction with discord.MessgeType.premium_guild_subscription to check to server boosts.
Documentation: https://docs.pycord.dev/en/stable/api/enums.html#discord.MessageType.premium_guild_subscription
The API provides some enumerations for certain types of strings to avoid the API from being stringly typed in case the strings change in the future. All enumerations are subclasses of an internal c...
Thx bro
The hell did you get this information from
That looks like chat gpt or something
It's from discord.py - I moved here from there not that long ago ;-;
these will be sent in https://docs.pycord.dev/en/stable/api/models.html#discord.Guild.system_channel btw
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 ...
Why even though I'm specifying a guild id on which command will work it still shows up everywhere
?tag codeblock
Please put your code in a code block:
```py
Here is your Code
```
That makes reading code in Discord a lot easier:
print("This is an example.")
literally does not matter here
welp
well no but people get into habits of attaching images with large chunks of code and it just gets annoying for everyone
again, a screenshot is just better here
with codeblocks, people tend to write their code by hand for short stuff, and then they write it differently than it actually is
screenshots > codeblocks for short snippets
yea i guess :p
you can add button
like 1 select
with 3 buttons, one left, one at the middle that tell you select menu/select menu total, one right
then the user can click on the right button and will edit the select menu to put the next one etc
doesnt exist in pycord
we went over that now
^ I also said that.
i know i was going to send u the good one
let me 5s
on_guild_update
then you check if the premium_subscription_count is different
and you have ur event
or do this
it doesnt work everytime that the things
yes, it does, at least for added boosts
so you can combine both
when you say at least it mean that it doesnt work everytime
like for unboost
thats exactly what i just said
without this there are like no way to know if someone remove only 1 boost
no you say yes it work everytime
Works 100% but only if the option to send messages on boost is enabled.
not if the server has that setting disabled
and no that not the case
true
also
i forgot you can even do that