#Basic Pycord Help (Quick Questions Only)
1 messages · Page 29 of 1
when i did that it was 'int' has no 'get_role'

you can still use the id if you want to by getting the guild first
so its should be the name?
if you using the command in the same guild
then it would be ctx.guild
hmmm but if not from the guild
I said object.
then get the guild first
Do you know how OOP works?
oh ok
ye
You don't
By "homeguild" I assume you want to get that guild no matter where the command is ran
So you'd fetch is with bot.get_guild(id)
try this
ah nvm i just forgot to something
this
i forgot to get all the members and define members
problem with this if the server has tons of members
how i can get this?
discord.Attachment
alr
Does having optional parameters for the function of a command group interfere with the subcommands?
one thing do i need the intents.members to be enabled
@bot.event
async def on_member_join(member):
channel = bot.get_channel(1025787487324483706)
background = Editor("welcome.jpg")
profile_image = await load_image_async(str(member.avater.url))
profile = Editor(profile_image).resize((150, 150)).circle_image()
poppins = Font.poppins(size=50,variant="bold")
poppins_smail = Font.poppins(size=20, variant="light")
background.paste(profile, (325, 90))
background.ellipse((325, 90), 150, 150, outline="gold", stroke_width=4)
background.text((400, 260), f"Welcome to {member.guild.name}", color="white", font=poppins, align="center")
background.text((400, 325), f"{member.name}#{member.discriminator}", color="white", font=poppins_smail, align="center")
file = File(fp=background.image_bytes, filename="welcome.jpg")
await channel.send(file=file)
nvm this fixed
on_application_command
https://docs.pycord.dev/en/master/api/events.html#discord.on_application_command
yeh i figure it out my code works when i used it in my test bot
but in the main bot its verified and it has no intents for members
so it cant check if they have the role
await bot.fetch_guild(id)
This already works in my dev bot with intents
but in my main bot it doesn't because i think to check if someone has specific roles you need intents
correct, you do.
now is there a way to check if someone has that role
without the intents
I don't think so.
Applying for the members intent is easy for, there are many use cases and discord will generally always grant it.
i once tried asked for message and got declined
members, not message content
i bet they will say something like this
I doubt it. Since members intent is often requested for general moderation.
hmmm ok ill try
What's the difference between Context and ApplicationContext
discord.Attachment
Context is for text-based commands while applicationcontext is for application commands (slash and context menus)
Thanks, so I need both if I want bridge commands. So I schould do both
There's BridgeContext for that
thank you.
Does that work if i want the same fields in Bridge commands, pure prefix commands and pure slash commands?
So I even need to subclass all three
You can just use bridge context and BridgeContext.is_app to achieve compatibility between slash and text.
So I only need to subclass the bridge context and I can use it in pure prefix commands, pure slash commands and bridge commands?
sure
That's good
I don't think you need to subclass at all, but ok
I would like to pass data from groups to commands.
And somebody told me that I would need to subclass thfe context for that
ah ok
im bumping my question and i dont asking it again and again
.tag cross posting
Please don’t cross post in multiple help channels
• This can result in a warn/mute
• Your message will get deleted
• Choose either your own help thread OR #998272089343668364
Choose either your own help thread OR #998272089343668364
Your question was already answered in your help thread Creve.
thats why i am pinging my thread and dont send the same question over here
There is no point in arguing. If you make a help thread AND post in here (even bumping your question) it can take away from other people wanting help since you’re using 2 ways to get help.


i cant figure out how to make channel auto complete
i tried channel: discord.channel but it had error
discord.Channel
i did that first but
type pip list in terminal and show output
I believe you have to specify either a discord.TextChannel or discord.VoiceChannel
ohhhhh
if you want all channels (forums, voice, category, etc.), you can use discord.abc.GuildChannel
Can I do discord bots and learn python on mobile?
Official Beginner's Guide: https://wiki.python.org/moin/BeginnersGuide
Official Tutorial: https://docs.python.org/3/tutorial/
Shortcuts:
https://wiki.python.org/moin/BeginnersGuide/NonProgrammers
https://wiki.python.org/moin/BeginnersGuide/Programmers
Learn Python:
https://automatetheboringstuff.com/ (for complete beginners to programming)
https://learnxinyminutes.com/docs/python3/ (for people who know programming already)
https://docs.python.org/3/tutorial/ (official tutorial)
http://python.swaroopch.com/ (useful book)
http://www.codeabbey.com/ (exercises for beginners)
.tag guide
So its a yes? I can learn discord.py and python as well as do discord bots on mobile
Please don’t cross post in multiple help channels
• This can result in a warn/mute
• Your message will get deleted
• Choose either your own help thread OR #998272089343668364
Whats cross posting
I deleted
Now?
Yes
^
What do I do with that?
✨ learn ✨
Yeah, im learning the beginners link kinda confusing tho
hey guys so is there a builtin mehod of checking if avatar changed
in on_member_update check if before.avatar.url != after.avatar.url
i tried that
doesnt trigger so i print them and the string is the same
How would I use a class variable such as self.options as parameter for the options attribute of a Select UI element?
(I am dynamically generating options depending on passed parameters to generate a view, so I can't just hardcode it in)
my code is like py class Dropdown(discord.ui.Select): def __init__(self): options = [] for i in range(1, 17): options.append( discord.SelectOption(label=f"Team {i}", value=str(i), description=f"Your preferred team is {i}")) super().__init__( placeholder="Choose your preferred team", min_values=1, max_values=1, options=options, )
super().__init i think is way to go
Oh subclassing it, I guess that'd work
Do you then just add it to the view with some add_item function?
Do you not add this subclass to a view?
oh i see what ur saying i think
on a callback i do py view = discord.ui.View(Dropdown()) await interaction.response.edit_message(embed=embed, view=view)
Hello!
Does anyone know if the __init__ method of a cog is called every time a command is called or only when adding/registering the cog?
I haven't played around with Cogs at all but the init method of a class is only called when that class is first instanced
take a guess
I'd presume only once?
only once yes
thx!
some real good helping broski
How would you add/delete an item from a view that's already in use? add_item, clear_items and remove_item don't seem to do anything once the view is already initialized
(In this case, all three print statements are displayed, however, the button is not removed and the dropdown is not added)
I could get around this by editing the message and using a second view, however this feels like a trick whilst this seem to offer a proper solution
I've made this work by editing the message, however if someone has a proper way to implement it that'd be neat 👍
is there an efficient way to mention commands in a group instead of a subcommand
if it is
bot.get_application_command("group commandname")
this doesn't work and gives NoneType Error
the first one only works on master, the latter works assuming you know both group_name and command_name
but you can also right click a command on the client to get its ID and use that
master? is that the very unstable version?
master is just the latest stuff on github
oh, so I presume it is stable in that sense?
it should be fine yeah
how would I go about install the master?
thanks!
How would you get the index that a user clicked on in a Select view, if that view can contain the same string/SelectOptions multiple times?
in a Select Menu, all SelectOptions must have a unique value
Oh right, I'll just use this as a counter then, thanks!
I may be stupid, but do modals really not support dropdowns?
not at the moment no, but a staff member did say they would be next on the list
Oh that's great, modals with only textboxes seemed a bit pointless outside of opinion polls lol
a while ago you could add dropdowns to modals, but after some time discord said it was a bug and disabled it
huh, weird
I hope discord adds more ui elements like date pickers or checkboxes and stuff to them
making them actually useful
date picker's coming to slash options at least
the __init__ method is constructor for that class
how do i get a guild from discord.User discord.Member has guild attr but not User for some reason
A user is not a member, but a member is a user
a member is a user part of a server, a user is just a someone on discord
is there a way i can get the guild id where a on_user_update event happned
im trying to make avatar log code
no
and it doesnt log to on_member_update
😁
you mean member fro user?
no
You can get a user from a member, not the other way around
Why not use that if you need a user?
i have to use async def on_user_update
on_member update does not detect changes in avatar
thenn loop ig
And from those guilds get a member from the user id
If you respond to an interaction with defer, you're supposed to be able to respond to it again, right?
oh
it looks like i can't respond to a deferred interaction with a modal
Is there a way to get the function name of a command from the context object?
I’m not sure rn, but it seems like .respond() is sending sort of followup thing if defer was used
So send modal isn’t working because of that
Can’t really check since im not on pc
Defer is basically responding an interaction
do I have to use message id to edit embed?
No, if you have an message object
when I restart bot, I can use view (add_view), but I want edit specific embed
In this case you need an message id
ahh ok..
Or if it’s only message in channel, you can look up for it in channels history
But it’s kinda sketchy
I do not recommend smh
I think only one message that include embed and view in channel
You can just send new one every-time bot starts or fetch it by its id
Easiest way is to just fetch it
ok Thanks!
👍🏻
told yah
Oof. Did you use a screenshot and filled out everything?
ye
have to find a new way to check if someone is boosted in my main server
btw is the a event to check if someone is boosting your server and does it also need the intent
yo yo yo the resident dumbass is back, how do i add multiple buttons in a view if im subclassing it
@commands.Cog.listener()
async def on_ready(self):
self.bot.add_view(self.MyView())
class MyView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label="Appeal", custom_id="appeal-ticket", style=discord.ButtonStyle.primary)
async def button_callback(self, button, interaction):
await interaction.response.send_message("Appeal was pressed", ephemeral=True)
@discord.ui.button(label="Moderator Application", custom_id="mod-ticket", style=discord.ButtonStyle.primary)
async def button_callback(self, button, interaction):
await interaction.response.send_message("Mod was pressed", ephemeral=True)
@discord.ui.button(label="Report", custom_id="report-ticket", style=discord.ButtonStyle.primary)
async def button_callback(self, button, interaction):
await interaction.response.send_message("Report was pressed", ephemeral=True)
@discord.ui.button(label="Question", custom_id="question-ticket", style=discord.ButtonStyle.primary)
async def button_callback(self, button, interaction):
await interaction.response.send_message("Question was pressed", ephemeral=True)
@commands.command()
async def createticket(self, ctx):
embed = discord.Embed(title="Tickets", description="""Appeal - If you believe your punishment was wrong
\nModerator Application - Please make sure to read the requirements in #roles
\nReport - To report members
that break our rules
\nQuestion - To ask our staff team any questions you may have concerning the server
\nDonation - To donate to our server and future giveaways""")
await ctx.send(embed=embed, view=self.MyView())
only shows the Question button for some reason
What is the default timeout for a button? How can I increase it?
default timeout is 180 seconds iirc, if you want to increase it just add the timeout parameter to your view,
view = View(button, timeout = x number of seconds)
Thank you
no problemo
nvm figured it out, gotta have different call back names
Will it apply to all the buttons I put in the view?
i think it should
is there any way to make Embed class like class MyView(View):? or only function and return
why is invalid emoji being raised even when it's a default discord emoji?
yet using some custom emojis work?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.1.emoji.name: Invalid emoji
if you using default emojies i suggest you putting them in string
they are in string
do you mean convert a string to a string via str()?
well i have a json file
{
"General": {
"name": "General",
"description": "General commands.",
"emoji": ":tradecard_bain:"
},
"Moderation": {
"name": "Moderation",
"description": "Commands for moderation.",
"emoji": ":<carpenters_delight:1033585443603763270>"
},
"unknown": {
"name": "testing",
"description": "category for testing",
"emoji": ":klas_shovel:"
}
}
idk why the emojis are formatting themselves on discord wtf
oh
i put a wrong format for carpenters delight
but still, default emojis via windows + . still don't work?
use this type of emoji to get this type of emojies just simply add \ before the emoji example \:thumbsup: and copy that emoji
yup that works too
can you send error too?
try "⏯️" like this
line 195, in help
await ctx.reply(content=None, embed=discord.Embed(title="Help Page", description="Select a category to begin!", colour=discord.Colour.blurple()), view=view)
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.1.emoji.name: Invalid emoji
you are using default emojies right?
{
"General": {
"name": "General",
"description": "General commands.",
"emoji": ":tradecard_bain:"
},
"Moderation": {
"name": "Moderation",
"description": "Commands for moderation.",
"emoji": ":<carpenters_delight:1033585443603763270>:"
},
"unknown": {
"name": "testing",
"description": "category for testing",
"emoji": ":klas_shovel:"
}
}```
currently the ones in my json are custom ones
custom ones work; default ones don't
it is exactly what i'm doing it it throws error :(
not:.play_pause: just ⏯️. same?
if i use :robot: it throws error
am i suppoed to use \:robot:
no you are suppose to use "🤖"
I did!!!
\🤖
it threw error too
share your code pls
use this
Hello i try to do auto select menu on ticket "bot.event" and this not working
i did try
i don't think select menu support 13 options
I can’t see it
It supports 25
I did use the same as what you did and it still errors
i just need need this bot send on category auto
ohh in starting it as just 5 😅
use whatever that gives
this not work when i try to do "discord.get_catrgory(id)"
thats what we all are trying to make you understand
?tag oop
https://www.digitalocean.com/community/tutorials/understanding-class-and-instance-variables-in-python-3
https://docs.python.org/3/tutorial/classes.html
There's a difference between a class and an instance. Think of it like this:
- A class is like a blueprint, or a concept. It defines what something should have, but it's not the same as actually having it.
- An instance is the 'realized' version of the class, it contains everything that the class defines should be on it, but you can actually access and interact with these features.
Let's consider the Cat. We know a Cat has a name and an age, but Cat.age won't work, because Cat isn't an actual cat, it just represents the concept of a cat. It's like asking "What is the age of a cat?" - it doesn't make sense, because we need to have an actual cat.
mimi on the other hand is an instance of a Cat - it has everything a Cat should have. Maybe mimi was constructed, like mimi = Cat("Mimi", age=4), or maybe mimi was retrieved from somewhere else, like house.cats[0], but in any case, it has everything we need, and mimi.age will rightfully give us 4.
There are many situations in Object Oriented Programming where you will need an instance instead of a class to perform an operation properly (in fact, you almost always need an instance instead of a class), and these cases will usually be documented.
You should learn a good amount about Object Oriented Programming before working extensively with Pycord.
🤣 sometime people reactions are too funny here
fr...
another reason to love coding
can you please explain more?
you are trying to use a class
oh wait
and its method
I know that for a bot to delete a role of a member, you need to have the manage_role permission, dans the role to delete need to be lower in rank than the role of the bot. But is there any other constraint ? I sometime get Missing permission when deleting a role in my logs, and was just wondering if the server just did not give the manage_role permission or it could be something else. Thanks !
it still errors
{
"General": {
"name": "General",
"description": "General commands.",
"emoji": "\\:robot:"
},
"Moderation": {
"name": "Moderation",
"description": "Commands for moderation.",
"emoji": "\\:tools:"
},
"unknown": {
"name": "testing",
"description": "category for testing",
"emoji": "\\:hammer:"
}
}
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.0.emoji.name: Invalid emoji
In components.0.components.0.options.1.emoji.name: Invalid emoji
In components.0.components.0.options.2.emoji.name: Invalid emoji
Can you show your code
for page_name, lines in categorised.items():
# Per category
for __index, __line in enumerate(lines):
# Per page
cat_embed = discord.Embed(title=f"Help Page/{page_name}", description="\n\n".join(__line), colour=discord.Colour.blurple()).set_footer(text=f"Page {__index+1}/{len(lines)}")
try:
embeds[page_name].append(cat_embed)
except KeyError:
embeds[page_name] = [cat_embed]
with open("command_category_description_database.json") as file:
cat_info = json.load(file)
options.append(discord.SelectOption(label=page_name, description=cat_info[page_name]["description"], emoji=cat_info[page_name]["emoji"]))
select = Select(placeholder="Select a category...", options=options)
that's how the selectoptions are inserted
{
"General": {
"name": "General",
"description": "General commands.",
"emoji": "🤖"
},
"Moderation": {
"name": "Moderation",
"description": "Commands for moderation.",
"emoji": "🛠"
},
"unknown": {
"name": "testing",
"description": "category for testing",
"emoji": "🔨"
}
}```
this will work
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.0.options.0.emoji.name: Invalid emoji
In components.0.components.0.options.1.emoji.name: Invalid emoji
In components.0.components.0.options.2.emoji.name: Invalid emoji
can I use await interaction.response.defer() if I want to do nothing? or any other way?
I don't need to response after push button, and don't want interaction faild message.
itll just say its Thinking... forever if u defer
u could respond and immediately delete the msg
uh i think you are using discord.py
in pycord its
await ctx.defer()
My error check not working
elif isinstance(error, CheckFailure):
embed=discord.Embed(title="Error : Check Failure", description="You must fit the set checks! Common reason are below:")
embed.add_field(name="Economy", value=f"Make sure you are setup. Set yourself up by `/economy setup`")
await interaction.response.send_message(embed=embed)
Not necessarily
its interaction in buttons
I use pycord
I believe both exist in pycord
oh i thought he was using that in a command
he mentioned buttons
^
its raising the error instead of responding
yep thanks guys
raise CheckFailure(f"The check functions for the command {self.name} failed") discord.errors.CheckFailure: The check functions for the command beg failed
they do, interaction is used mostly in buttons, dropdowns and in on_application_command_error
my bad
Is it possible to have multiple InputTexts in a modal on the same row?
I have gathered it's not
is the error handler for application commands or normal commands?
Hey
Why the custom emoji doesn't show up in my embed
in the embed it looks: :bloob:
I got it from a message (reaction) and i've got that: 
slash cmds
are other errors getting handled properly?
yes
pls help
it doesnt work in the title
?
emojis cant be used in titles
and your bot cant use emojis of servers the bot is not in
ah in the embed title you mean?
but it isn't in the title
it's only with custom emojis
are you sure the emoji is from one of the servers the bot is in?
ah, no it wasn't, i have the emoji on multible servers, and guess wich emoji i've chosen
Would it be possible to display some kind of loading bar instead of this?
lol happens 😂
I can't find anything in the docs indicating it would be possible
you would have to do it yourself
not natively. you will have to implement on your own
With message edits I get ratelimited pretty quickly
maybe by editing the message with emojis. maybe an embed. your choice
dont do it as frequently
maybe once every second or slower
I suppose I could use datetime for that
or do you use an image
I was just wondering if there was a native solution lol
that's fair, I'll figure it out w edits thanks
asyncio.sleep will work
Do you guys know how to link a slash command in the bot description?
the about me?
yes
I think you can use slash command mentions but im not sure if discord will allow
like that
</name of cmd:cmd_id>
and how to get cmd_id?
right click on the command description
ah
name of the command should be exactly how it is
the name is the command? right
yea
?
Create the embed inside the loop and append it to an external embeds list?
View
what about this
and wait. this can to be work?
if i try to do catrgory_id?
What?
No? It doesn't?
That's not a list
list = []
for x in y:
embed = discord.Embed()
list.append(embed)```
This is basic python
They can, i don't think u understand the logic here
We define commands in async def
Are you sure you're talking about embed and not embed fields?
When two things are defined, for example,
f = 1
f = 2
print(f)
It prints 2 because the value of f is changed
Whenever we execute that cmd, the async def function is called and is run, so if a we define embed in it, it will change any other values named embed to this. And anyways, most values will be local only.
Hope you understood
Consider learning more python before approaching pycord
?
Lemme see the code
It's probably because the role isn't cached
Or you don't have intents
Yeah
Enable all the intents tbh
It'll be useful
R the intents approved
Get it
It is needed to see what's happening
Presence Intent - required for your bot to receive presence update events
It's the intent needed for logs
Logging features, it's simple
Well anyways gtg
You need guilds intents.
Hi, i just created my own thread but there was nobody who could help me. Because of this I ask here again.
So I was working on my Bot and shortly before I was finished an error appeared in the last row:
client = commands.Bot(intents=discord.Intents.all() , command_prefix= "!")
client.run(token, bot = True)
Error: TypeError: run() got an unexpected keyword argument 'bot'
Then I deleted the , bot = True but then there was an very long error which I made into the txt file but at the bottom of the error was RuntimeError: Event loop is closed
stay in one channel pls
Is it possible to run a bot on multiple machines so if one goes down the other still stays active? Redundancy basically
yeah but when i wait over 1 hour for a little error I can't fix why should I wait in my channel where nobody helps me
?
i cant install it somehow
Ik why
It happens to me too
And why did u include bot=True
Make sure u have good internet
Or ur host has a good one
i just watched a youtube tutorial where the creator did this and it worked
Just don't do it
That's prob for dpy or smth
I have never seen anyone do it
I'll send the common reasons of this
@grand shard send me ur bot.run line
ig it's good, isn't it?
It's very good
Block out the token
the client.run is the bot.run but I just named it the bot var to client
- Try resetting the token
- Try Enabling SERVER MEMBERS INTENT
Ok send me that line
client.run(token) this?
intents = discord.Intents.default()
client = commands.Bot(command_prefix="!", intents=intents)
Edit commands.Bot to this
And try
it works tysm !
Np
It's because ur bot needed Intents to be defined and sent to the API I believe.@grand shard
ok thx
Hey guys, how can i get the second newest message that was send?
.docslink discord.TextChannel.history
so i used that with limit but limit takes the second message from the top and not from the newest one's
oldest_first=False
squid, do you know how to make slash commands only visible for users with a permission
https://docs.pycord.dev/en/stable/api.html#discord.commands.default_permissions but guild admins can override these
ok, thanks, love you ❤️
do i have to add a commands before it in a cog?
Oh and is it possible to make commands only visible to a single user (the bot owner)?
nope, but you can limit it to just a guild
you also can make the command visible to everyone but only usable by you.
Yeah I figured as much, I just wondered if there was an alternative to that
squid could you help me in another thread?
What do you mean
ping me in that thread
in a cog i always add a commands. before everything but do i have to do that also with default_permission?
it should be discord.has_permissions
no, i use commands.bot
it should be discord.has_permissions
You sure it ain't discord.default_permissions?
That's separate from commands.has_permissions
oops, I'm stupid
now im confused
oh actually you're right lmao
.
discord.default_permissions sets discord sided permissions for new commands
commands.has_permissions is an internal check for any command
I was assuming slash commands, but it seems like you are using text-based commands
i do it now like that
Yeah that looks fine
good
just note that server admins can override the permissions, if you don't want that then you should also use commands.has_permissions in combination
that's good because i remember you and squid helped me by setting up commands.
ok
is it possible to create server events with pycord/api?
.docslink discord.ScheduledEvent.start
oh i searched for guild.create_event or something like that
I personally use https://webhook-topgg.com/ and make that webhook ping my bot and get votes from there
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
I find it easier
would I be able to have a function thats ran when it pings my bot?
yeah
where are the docs?
it sends messages via a discord webhook
no i mean like
im wanting it to be redirected to my bot so that I can add roles or something and send them a dm
topggpy hasn't been working for me
exactly, so you receive stuff in on_message
you can set this ^ to some private channel, and get your bot to read msgs from there. thus faking a direct webhook you can use
good idea tbh
make sure to have it mention your bot so you don’t need message content
i was wondering if you can somehow chain topgg webhooks (idk if im accurate with the terminology)
i wanna receive vote webhooks on a my private bot to do some X functionality and then send them to another public bot to do Y functionality
is it just me that uses a private guild with 50 channels to communicate between bots
do embed fields have inline default value set to true?
uh ok thanks
How do I keep information/variables separate for each user?
Like john has 3 dollars, and Emma has 5 dollars
And also, how can I make a command change the variable?
like
yes we get it- but it is not specific at all and also read the rules
Oh sorry, I need to make a thread then?
you update a database like you normally update one- that it's called by a command does not interfere with anything
like if I had a command call, "work" and I needed to add money to the person's balance, that would all be done in the command?
learn how to use a database and let your brain figure out the rest
sqlite is easiest
yo
does anyone know how to get the message id of a message when someone hits a button
like .. if someone hits a button it will print the message id that the button is attached to
i knoiw dumb question
the same way u'd get the id of any other message
just interaction.id ?
i thought that would be a differnet id than the original message id
Anyone have a good driver recommendation for MySQL?
tf u mean is this even possible
asyncmy
for postgres, asyncpg
tyty
np
interaction.id is the interaction ID (lmao) not the message ID.
Read the docs.
? fucks ur issue
.docslink discord.Interaction
i literally said right here i thought it would be different
You're literally looking for the message ID
Yes
And I'm giving you an answer. Get down your sassy attitude.
bro what?
No?
Are you even able to read
Read the docs and you'll cutely find out the interaction class has a message attribute which contains a message object
Learn how to read and read the docs. Won't literally spit the answer for you when you have eyes.
lil bro got issues
Please keep general conversations to their respective channels
is the commands cooldown on a per user usecase or is it a serverwide cooldown
It depends on your BucketType.
im not sure i understand what you mean by BucketType
yes
i've been waiting for a bit now and this stays, did i do something wrong?
Do you use ctx.send?
no, respond
but it works again
no idea what happened
🤷
lul
Tbh u could just have a webserver set up that recieves the request and then gives the reward to the user
If ur using flask then just add a task to a DB and then have a tasks.loop running in ur bot that will check the db for votes and give the use a reward or add roles or smthn
This just means your client had an outdated version of the command cached, so you have to wait for discord to sync the latest version to you
Basically their way of preventing a desync when devs update commands
ah okay
Sometimes, the cmd takes time to load into Discord. You probably started the bot and immediately tried that cmd. Give it like 30s to load.
That's the issue
the interaction?
You mean you want to edit an embed?
Yes
can teach me?
Do buttons expire if I don't specify a timeout? Like will it last as long as the bot is online?
button will timeout
i tried
about 3min
180 seconds = 3 minutes
Has somebody experienced problems when subclassing? I did encounter a strange error. I detailed the things in #1034020574420283404 .
Guys, if my bot sends a msg with a button with a timeout of 360s and I restart the bot at 120s, will the button still work? if no, how can I get it to work?
You don't need persistent views if you want the button work while the bot is online. Just specify timeout=None
How many slash commands can you have?
Is there still a limit like in the past days?
100 is max
That's good. I can't imagine having more that 100 base commands 😅
Im not even sure if you can have more with sub commands
if all 100 commands are grouped command, and 2 subcommand in each group
then 200 commands?
We'll see
or net listed commands are 100 max
you can have 100 global commands, and each command can have up to 25 sub-command groups. Each sub-command group can have up to 25 sub-commands.
100 x 25 x 25 = 62.5k
oh zamn
slash spammer bots 
Hello!
Can you please tell me how to get locale and guild_locale using interaction?
My on_message event handler interferes with my command event. Is there any way I can make the bot focus on the commands first before it checks the on_message thingy
on_message does the command handling
you can override the default event and move process_commands though
plus you can register additional commands as guild commands
yep
iirc, they have the same limits
thats just global, you can have that per guild as well
wellllll, if we wanted to get technical
if g is the number of guilds,
62500 + 62500g = total number of commands
cuz they don't have to be the same for every guild
oh true
but if you wanted more than 62.5k cmds on all servers then that would be the way
if a member boosted a server twice does guild.premium_subscribers has them listed twice?
nope
i don't think the api offers the amount of times someone's boosted
ok ty
what pycord version
2.0.0b1
my code
names = []
for row in tkm:
names.append(f'<@{row.id}> > ({row.id})')
await ctx.respond(names,ephemeral=True) ```
I need to send that message like carl bot how to send message like that anyone help me
use string instead
names = ""
for row in tkm:
names += f"<@{row.id} >> ({row.id}) \n"
await ctx.respond(names, ephemeral=True)
directly equivalent to that
not working and only showing first member
i don't have the rest of your code to know the correctly applicable translation
Yep, figured that out after a bit of experimentation. Thank you tho \o/
It means you've put an = instead of a : somewhere
lol
The variable opt is a type
If somewhere you've done something like opt = str instead of opt: str you'll get this error
lol
Guys, how can i link a channel in a embed, i rember somthing like this <channel_name:channel_id>
If you have the channel object you should just be able to use the mention attribute
and how?
How to get the channel object?
<#channel_ID> but like legend said if u have the channel object then use the mention attribute
@fast totem were you able to get your embed generator setup and functional?
I would love to get something like @abstract marlin's embed generator working, but I have NOOO clue where to start with something like that.
Thx
what if i send multiple buttons with same custom id?
Is it possible to prevent console error message if global check for command fails?
💀
oh well i figured it out.
hey so it said perms only work for top level commands
is there a workaround
becuz this bot might go above command limit
read ffs
great. that gives you something to work on for the next month or so
Can I run slash command code and normal command (with prefix) code in same file using pycord?
any possibility?
bridge command ?
Concept
thank u
np
Guys, if my bot sends a msg with a button with a timeout of 360s and I restart the bot at 120s, will the button still work? if no, how can I get it to work?
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/persistent.py at master · Pycord-Development/pycord
Ty
Is there a way I can place my bot token in a separate file so that I can not have it visible constantly?
Because they use default avatars. Use display_avatar instead of avatar
Read the error
It was for another guy. Looks like he deleted the message.
i use a try except on pfp and banner when grabbing them
You can get the banner?
Oh you can, lol.Cool
why this command is registered to / command
import discord
bot = discord.Bot(command_prefix='>',intents=discord.Intents.all())
@bot.command()
async def sano(ctx, sanominen):
await ctx.send(sanominen)
bot.run(my token)
because you're using discord.Bot
Because it appears to have Finnish variables l
what i then need to use to use perfix commands
is this the real reason
No. I was kidding. I was just guessing
obviously
use commands.Bot for prefixed
do you are form finland or do you just using google tranlater
thanks i test
Pls stay in one channel
sorry
@rugged lantern is this the wey bot = commands.Bot(command_prefix='>',intents=discord.Intents.all())
sorry ping
thanks
Look at the command extension tab
Can you show the pip list?
what is pip list its maybe this
Package Version
aiohttp 3.8.3
aiosignal 1.2.0
async-timeout 4.0.2
attrs 22.1.0
charset-normalizer 2.1.1
frozenlist 1.3.1
idna 3.4
multidict 6.0.2
pip 22.3
py-cord 2.2.2
PyDirectInput 1.0.4
python-dotenv 0.21.0
yarl 1.8.1
from discord.ext import commands
if i importted that import discord.ext
if this is fine
thats workked som how
thanks
why this dosent work
@bot.slash_command(guild_ids=[id], name = "ping",description = "pong")
async def ping(ctx):
ctx.respond("pong")
its is in / commands but no respond
if i not respond i am eattting (sory bad english)
you need to await ctx.respond
anyone have examples of large-ish pycord games on github? i am looking for inspiration for my game's architecture, it's getting pretty large!
oh i am sory
i am rely cant see it
pokétwo although it's not written in discord.py, but they should be similar enough. https://github.com/poketwo/poketwo
ooh perfect, i am also making a pokemon-ish game XD
https://github.com/jp00p/AGIMUS/tree/pokemodae/pocket_shimodae my game (part of a larger bot)
ok
sees prety cool
my game is just one cog that interfaces with all the game functionality, looks like this poketwo is lots of cogs!
ok
this is great thank you @silver moat ❤️
you're welcome
do we need to install pynacl for a tempchannel command which is like this:
@bot.event
async def on_voice_state_update(member, before, after):
if after.channel != None:
if after.channel.id == 700246237244555338:
for guild in bot.guilds:
maincategory = discord.utils.get(
guild.categories, id=700246237244555336)
channel2 = await guild.create_voice_channel(name=f'канал {member.display_name}', category=maincategory)
await channel2.set_permissions(member, connect=True, mute_members=True, manage_channels=True)
await member.move_to(channel2)
def check(x, y, z):
return len(channel2.members) == 0
await bot.wait_for('voice_state_update', check=check)
await channel2.delete()
no
then what is pynacl basically for
if you want to make your bot play stuff inside a voice channel iirc
ok
PyNaCl is used for voice support
remove import discord.ext
i etsted
tested
its dosent work
discord is discord.ext
What pip command did you use to install pycord?
i fuond the prodmel
i use too new python 3.11
works fine on 3.11 for me i unno
ok
but alright cool
just pip install discord
it should be pip install py-cord
ok
thanks
I'm not upgrading my bots to 3.11 just yet. Waiting for other libs to support 3.11 and gonna wait a couple of weeks for new releases to iron out bugs
hey, how do you get a message’s reply if it exists? goal is to make the bot react to the reply a message has
i see MessageReference but i’m not sure if its what i’d need
ive just tried to update it
i got some weird error message
can you guys help me to figure out what it is?
you need the git version
how do i install it?
how can i check if the author is in a tempchannel already if they try to override the tempchannel settings with a vc which is already a tempchannel
is it necessary i commit the channel id and all in db, coz i dont really want to do that
pip install -U git+https://github.com/Pycord-Development/pycord
Quick question: I just searched how to make a cog, but I get this error and I assume its from line 15 of event_onready.py. Does anyone know what I did wrong? If I remove the async and await, then it just says that the self.bot.name is not defined (because it doesnt wait for the bot to turn on).
The setup function is not async, so remove the async def and just make it def
That's a dpy thing, not a pycord thing
Alright, and the await should still work?
Which await?
remove the async
you're not supposed to await the add_cog
Ah, I see now, thanks, had an error in another part of the code that made me believe the bot wasn't properly loaded in, my bad
So I just came back to development after being away for quite some time, fired up my bot, fixed the version info...but my prefix commands are not being registered AT ALL. No error or debug, either.
Bot comes online just fine
not that
Staying on the topic of user commands, is there any way I can hide them completely based on the channel the user is clicked in? Or will I have to stick to using a check after its clicked
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction i keep getting this but i cant find anyhing thats not working on my bot defering it seems to not make error appear but the bot always works
it happens at completly random times
Does your bot reply with 'The application did not respond' before this error happens?
Most likely case is your bot is taking too long to respond (more than 3 seconds) so discord is timing out the interaction. If you defer, it gives you up to 3 minutes of 'thinking time'
i havnt seen any
It is probably your bot taking too long to respond, if you say it stops happening if you defer the response
yes its just weird i never see it not respond
are embed descriptions optinal or required i dont see the docs say anyhing about it
it's not required
nothing is required as long as there is at least one of those things present
aka, you can have only description, or only 1 field etc.
does members have attribute date_joined or somthing i cant find any on docs or do i have to store it manually
Joined_at i think
thanks
👍
I am assuming the answer is no, but is it possible to have a slash command's input fields change depending on the AutocompleteContext
For example, I use autocomplete functions to change what options are available in my slash commands depending on the user and other factors, but is it possible to use something like that to change what fields the slash command has or the field names or anything?
yes
Really. Is there a place in the docs that I can find how to do it?
.docslink discord.AutocompleteContext
Here's the slash autocomplete example.
@rotund current
I've used that example extensively. I guess what I am asking is if it is possible to present a slash command function in different scenarios
Yeah, i applied this using a json that contained different autocompletes depending on what each server added to the list
If someone dosnt already explain i can send my example when im home
how would i go about getting the value of something that looks like "{\"JoinInProgressData\":{\"request\":{\"target\":\"INVALID\",\"time\":0},\"responses\":[]}}" ?
yes
oh do the /'s not matter?
Run pip freeze and send me the output
There's a lot of output, but I assume this may be what you are looking for:
UNKNOWN @ git+https://github.com/Pycord-Development/pycord@f89453e92f00dd2bcf2a20aec705f88073d077e3
no, they are used so string doesn't break
Otherwise I can send it all
oh ok ty
i just realized i cant do anything since its a string lol
the whole thing
Thx
Hi I got a simple question (atleast I think there would be a simple answer)
I am trying to use guild.get_role(role_id) in a slashcommand and in a task loop but it return None every single time.
In my on_raw_reaction_add&on_raw_reaction_remove it works fine?
intents = discord.Intents.default()
intents.members = True
intents.guilds = True
client = commands.Bot(command_prefix='/', intents=intents)
I do got my intents setup (atleast I think correctly)
yes my bot has access to the role (is above all the roles), I can do guild.roles and it shows me the roles of the guild. Tried aswell to fetch the roles of the guild.
^ figured out what the issue was (I was putting in a string instead of a int)
Hi, could I hook into all commands to collect metrics?
I want to collect the total number of commands executed since the last start and don't want to duplicate the counter for every Command in every cog...
use the on_application_command event
Is there any way I can limit context menu commands to show in the menu in specific channels only?
And for prefix commands?
on_command
Thanks
Don't think so. You can do internal checks.
Dark why do you have to bring me such sad news
Lmao. Sorry mich
You want to make your second response slower?
Your channel is None
according to docs, Interaction.user returns a union of User and Member object
but when i use timeout_for method, it says: 'User' object has no attribute 'timeout_for'
how to fix this?
and why my pip commanmd dosent work
@bot.command()
async def ban(ctx, member : discord.Member, *, reason = None):
await member.ban(reason = reason)
error:
Command raised an exception: TypeError: '<=' not supported between instances of 'int' and 'NoneType'
does anyone know what the problem is?
.tag install
pip install py-cord
there is all errors
Hello there,
i have a download bot for tiktok bot the check does not work. you can enter everything
async def checkURL(self, ctx):
print("Check")
linkPrefixes = ['https://m.tiktok.com', 'https://vt.tiktok.com', 'https://tiktok.com',
'https://www.tiktok.com', 'https://vm.tiktok.com/']
for link in linkPrefixes:
if link in ctx:
print("True")
return True
return False
@bridge.bridge_command(description="Damit kannst du TikTok Videos runterladen")
async def tikload(self, ctx, link):
if link is not None:
if isinstance(ctx, commands.Context):
if self.checkURL(link):
whats my fault?
can eny one help me check the frist message
if link in ctx.message
you are looking for that
do that
last line?
pip install py-cord
you get errors when installing pycord?
yes and all errors is in first
Hello!
Do you know how to retrieve a user's "Locale"?
I have the one of a CTX but not the one of a member using the "on_member_join" event
froms message
This server is exclusively for running the bot off of - is this new? My previous versions have never needed Discord installed.
Oh oh
I see what you're saying
Dude, you still need to install Pycord. How do you expect to use it if it’s not installed 
.tag install
pip install py-cord
I ran the git command but never the py-cord
Which...is all I did in my dev environment too actually
un momento
Mmkay. That was it. But now I'm confused because that means py-cord was already installed in my dev environment...unless...
You know what, no. It works now, thanks. Not gonna argue with it.
and how should we help you?
Did you add checks to see where it's failing
.tag idw
Saying it doesn't work or asking what's wrong with this code? is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.
You need to respond to the interaction with a response
According to your code you aren’t
use try and except...
They need to respond to the interaction
Learn all about Slash Commands and how to implement them into your Discord Bot with Pycord!
ctx.respond
i really hope you have read the docs before
don't be rude; he's just asking us to do all the work for him
Can I use the persistent only with a View class?
That's the only thing you can persist isn't it
I was trying it with py button = ...
Help, please :c
Is this error due to the host?
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Temporary failure in name resolution]
yes
if you mean ctx as in ApplicationContext, you can use ctx.interaction.locale
@commands.Cog.listener()
async def on_member_join(self, member):
I can't get the "Locale" variable from this event.
I make a server for French and English
I think I'll give up if there's no way
discord only gives the users' locale in an interaction. it is otherwise inaccessible
you're welcome
looking for suggestions on managing custom emoji for a big ol game. does anyone have experience with this? should i just create a bunch of servers and keep references to their emoji in a config file somewhere?
how many custom emoji do you need? lol
hmm i'm thinking at least 50, probably 100-150
well the only thing you need is the ID
since you can do bot.get_emoji to use them
so your strategy will work pretty easily
so i'll probably just make a config file with the emoji separated by server, and refer to the emoji ID from there
oh yeah, i want to categorize them like "fish," "items" etc
isee
so many servers to add 😦 should i just waste money boosting one XD
well that's why i'm saying you shouldn't bother with splitting it by server, 150 custom emojis only requires 3
you could categorize it in the code, e.g. have classes for them
discord bill getting so big
i think i will just make a boosted server
Well, bot can use any emojis from any server, so you can just create empty servers with emojis
inb4 they change it so you need to have nitro to even use custom emojis for bots
Hello there is a way to make button wait to be pressed ? Cause i want to put them in a while, but it don't wait for the user response?
Please ping/respond to this message when u got an answer :)
Any help
kinda off topic but does anyone know any packages which convert seconds into things like "1 minute" if my seconds = 60?
pytimeparse?
looked it up on pypi and it seems kinda confusing, I got recommended humanize and this seems to be working.. but thank you :)
np
Is there a suggested way to add a cooldown to an on_message event that doesn't stop commands from being processed, or is that more or less not a thing?
More specifically, a cooldown for an if statement under an on_message event.
should i somehow configure sentry to work better with async? 
oh well, it seems to configure itself
Oh.
In my defense, I have nothing to back up the beginning of this statement.
How many add_files can be made in total?
Frankly though, Async often confuses me, but I am easily confused.
uhh can you elaborate? not sure what you mean by add_files
add_fields. sorry
25
anyway to message the user that invited the bot on join?
you can fetch the audit log for who invited your bot and message them
smart
One message removed from a suspended account.
One message removed from a suspended account.
you can use this external module created by one of the core devs of Pycord: https://github.com/Dorukyum/discord-helpers
A helper module for discord.py. Contribute to Dorukyum/discord-helpers development by creating an account on GitHub.
One message removed from a suspended account.
discord doesn't give that data
One message removed from a suspended account.
so you would have to fetch the invites and compare the invite changes
pycord returning wrong id for ctx.guild.id
it seems
1024102454943559700 is what it returns
1024102454943559730 is what it is when i click copy id
actually when i do member.guild.id it returns this one
Um... I need serious help
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Access is denied]
Oh wait I have an idea of what it could be
Yep
It was my firewall
Made a mistake in the settings
I see you so many times in this channel
So, working around forum posts. I can pass overwrites. But not quite sure how I exactly overwrite permissions for specific roles or members. Docs say it expects a dict with a target
dict has keys of target (user/role) and values of PermissionOverwrite



