#Basic Pycord Help (Quick Questions Only)
1 messages · Page 44 of 1
import the cog
Yeah they don't show up as valid things to access though, I got around it by making a function that just returns it
bot.get_cog("Cog2").some_list
Remember that the bot creates an instance of the cog Classes, the class itself contains no information
That's what I needed thank you
np
I was trying to make static instances cause I couldn't figure it out
remember that if the cog is not loaded, bot.get_cog() returns None, and thus will error
please help me
I load them sequentially but I'll add a check
instead of await interaction.guild.....etc use await category.create_text_channel(name="aaa")
though
if your original code isn't working, it's likely the category var isn't getting filled at all
yea
it doesnt recognize it as a category
^^
that means you're not correctly retrieving the category
can you tell me how to do it
20 google searches i didnt find anything
"how to get a category by the id"
XD
guild.get_channel(categorychannelid)
I'm getting a no module found error, both cogs are loaded as separate extensions one after the other. The file names are the same as the class name but not capitalized, eg cog2.py cog named Cog2
I'm using the class name
the name should be the class name
Yeah just throwing modulenotfound
try to set your list copy in an on_ready listener
the module must not be loaded yet. This can happen if you try to load info in the init
or use await bot.wait_until_ready()
why are you using both interaction.guild and bot.get_guild?
ok, so you're not retrieving the guild correctly
is your bot in the guild you're trying to make a channel in?
yes
Why are you using get_guild at all when you have the guild in the interaction object?
thats a good question
why are you using both interaction.guild and bot.get_guild?
sure
if not, throw a print(category) in there to check what you're getting from that call
get_channel only works if the channel is cached
also remember you will need to respond to the interaction to get it to not error out
which it won't always be
@limber urchin @full widget thank you very much
do i just need to respond with a message to close the modal?
oh you dont even know my code, i opened a modal and the channel gets created when the modal submit button is pressed
ok
when i then respond with an ephemeral message, will the modal close?
the modal will close when you hit submit
but you need to respond with something to avoid "the application did not respond"
also as spaxter said, consider changing to category = interaction.guild.get_channel(....) or await interaction.guild.fetch_channel(....)
to avoid issues with caching
np gl
How would it be so that only numbers are allowed?
Yes
Only text input
Hopefully discord will add more eventually
Also more fields
and the Dropdown ^^
I need this. I have no idea why thay don't allow model chaining. If someone gets "trapped" they can hit cancel or the x and it would exit.
And more text for the Embed, the Modal can only use 1024 and not the 4k input
I'm sure they're holding back since modals are pretty new
yes 6 months
The last update I know that, It wasn´t working at the mobile version and sometimes crashing it
Is editing the guild specific integration permissions through a bot possible?
I have a couple commands that I want only a specific role to be able to use, and while setting a limit in the server integration settings is the cleanest way to do this, every time I restart the bot, these commands get reloaded which resets the server specific permissions
How do you send an ephemeral followup? I tried putting in the ephemeral argument in ctx.send_followup, and it doesn't work. What is the alternative?
ctx.respond with ephemeral=True
defer has to be ephemeral too
error
Ignoring exception in command ping:
Traceback (most recent call last):
File "C:\Users\Zalama\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "C:\Users\Zalama\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 980, in _invoke
await self.callback(ctx, **kwargs)
File "c:\Users\Zalama\OneDrive\Documents\GitHub\Grinder_Co\main.py", line 89, in ping
await msg.add_reaction("🏓")
code
@bot.bridge_command(description ="check bot's ping")
@commands.cooldown(3, 10, commands.BucketType.user)
async def ping(ctx):
embed = discord.Embed(title = "Pong! :grinning:", description =f"`Ping is : {round(bot.latency*1000)}ms`", colour= 0xFE6000)
msg=await ctx.respond(embed=embed)
await msg.add_reaction("🏓")
is there a way to use add_reaction for a bridge cmd as it work ok with prefix but slash gives error
Respond returns an Interaction if it is a Slash cmd
.rtfm discord.Interaction
discord.AutocompleteContext.interaction
discord.MemberCacheFlags.interaction
discord.InteractionType
discord.InteractionType.ping
discord.InteractionType.component
discord.InteractionType.auto_complete
discord.InteractionType.modal_submit
discord.InteractionResponseType
discord.InteractionResponseType.pong
discord.InteractionResponseType.channel_message
discord.InteractionResponseType.deferred_channel_message
discord.InteractionResponseType.deferred_message_update
discord.InteractionResponseType.message_update
discord.InteractionResponseType.auto_complete_result
discord.InteractionResponseType.modal
discord.InteractionResponded
discord.InteractionResponded.args
discord.InteractionResponded.with_traceback
discord.Message.interaction
discord.Interaction
Last one
so i need to put in try and except 
Get the original message and add reaction to that
No. Use isinstance
.rtfm bridgecontext.is_app
On the ctx
Oh this is better
error 404 
nvm found the right one
https://docs.pycord.dev/en/stable/ext/bridge/api.html#discord.ext.bridge.BridgeContext.is_app
i need help on editing an embed that my bot sends
What do you need help with
please describe the issue
basically i created an embed and the bot sends it, but i want the bot to edit the embed
i looked at this page that has the edit function but i don't realy understand how to use it :/
https://docs.pycord.dev/en/stable/ext/pages/index.html#discord.ext.pages.Paginator.edit
@bot.slash_command(name = "start", description = "Start a game of Mario")
async def hello(ctx):
asyncio.sleep(4)
mario = [":mario1:", ":mario2:"]
costume = 0
embed = discord.Embed(title = mario[costume])
await ctx.respond(embed=embed)
Well you arent using the paginator. Why look into docs of that
Where do you plan on editing the embed?
If you have the embed object, you can simply edit it as if it is a new embed
embed.description = smth
embed.title = smth
Like that
yes i am creating a new embed, but i don't know how to edit the original embed to the new one
oh that
.rtfm discord.Message.edit
oh thx i will try that
uhh i tried this
await discord.message.edit(embed=discord.embed(title="edited!"))
and it gave the error discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: module 'discord.message' has no attribute 'edit'
await discord.Message.edit()
isnt that what i already have
Capitalize Message
?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.
now i am getting this error
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: edit() missing 1 required positional argument: 'self'
Why discord
Use the message object
And read this
..so it would just be
await message.edit(embed=embed)```
right?
given that message is defined
so it would be like
msg = await ctx.respond(embed=discord.Embed(title="mario")
await msg.edit(embed=discord.Embed(title="luigi")```
that returns an interaction/message. you should handle it accordingly with is_app
how would i incorporate that?
thats used to see if something was sent by an application right
oh wait I mixed you up with another person
oh sorry lol
you can use ctx.interaction.original_response the receive the response message
Question, I recently started working on an older bot again, I switched the commands over to slash commands and am using pycord. The button I have is not providing an interaction object to work with. Before I switched to pycord it was giving me an interaction that I could for example access interaction.user
Now it is telling me "button doesnt have attribute user"
if this is not a quick question let me know ill make a post
switch the button and interaction parameter order
yes
blessed thank you, going forward does button or other components come first now?
yeah
What is the default timeout for buttons (PyCord) ? Couldn't find it in the Docs.
this didn't work because msg is an interaction. how would i edit the msg embed
how do i have dropdown menu that when a option is selected it gives you permission to view a specific channel but when unselected removes that permission?
.nohelp
Nobody helps you? See #help-rules #4, then you know why.
sorry. How do i give a user permissions to view a channel?
Yes but is this in a bridge cmd or a Slash cmd?
ty
interaction.edit_original_response
.rtfm interaction.edit_original_response
Use something like role reaction but with using drop-down menu 
I don't want there to be roles though
Then you have to update channel perms to give user access and remove access from that channel
How?
.rtfm set_permissions
yes you can, you have to keep the interaction object return on ephemeral creation
just made it work !
Uh
I forgot how to convert ['banana', 'apple'] to banana, apple in Python.
Anyone remember lol? Without using .replace
Learn Basic python...
I simply forgot..
#help-rules 2
I just forgot how to get a random sample of something without getting it as a list.
I'm using random.sample, but it returns a list. Is there a way to do random.choice in multiple sets without it returning to a list.
I'm dumb.
Got it.
Hello, I want to create a bot that fetches new posts from reddit. Can someone point me in the right direction as to how to go about it? I have used praw before
hello, I'm trying to get the privileged intent message_content to true, anyone can help me?
make sure your intents in the dev portal or on
they are. but I think I'm using the wrong handler or sth
Provide the code please.
ok, just a minute
import discord
bot = discord.Bot()
bot.intents.message_content = True
print("INTENTS:",bot.intents)
print("MESSAGE_CONTENT", bot.intents.message_content)
@bot.event
async def on_message(ctx: discord.Message):
if ctx.author == bot.user:
return
print(f'[{timestamp(ctx.created_at)}] {ctx.author}: {ctx.content}')
f = open("token", "r")
token = f.read()
bot.run(token)
the "print("MESSAGE_CONTENT", bot.intents.message_content)" line returns false somehow
bot = discord.Bot()
bot.intents.message_content = True
print("INTENTS:",bot.intents)
print("MESSAGE_CONTENT", bot.intents.message_content)
@bot.event
async def on_message(ctx: discord.Message):
if ctx.author == bot.user:
return
print(f'[{timestamp(ctx.created_at)}] {ctx.author}: {ctx.content}')
f = open("token", "r")
token = f.read()
bot.run(token)
the "print("MESSAGE_CONTENT", bot.intents.message_content)" ```
just so I can see it.
How are you getting the token?
.json?
ok
this
intents = discord.Intents.default()
intents.message_content = True
bot = discord.Bot(intents=discord.Intents.all())
@bot.event
async def on_message(ctx: discord.Message):
if ctx.author == bot.user:
return
print(f'[{timestamp(ctx.created_at)}] {ctx.author}: {ctx.content}')
f = open("token", "r")
token = f.read()
bot.run(token)```
there.
let's try!
IT WORKED! Thank you so much!!
didn't know I could pass the bot the intents as args
Perfect!
How do I get a discord.User object from a username? (name+discriminator)
code please
you can also pass intents=intents ig 
I did it that way bc it seems hes new
so I did it a way he can learn and see other ways.
Could someone help me get slash command options working? When I type the slash command in, no field for any options appears
class SelfRole(Cog):
@discord.slash_command(name="create", description="Create selfrole dropdown menu")
@discord.option("text", description="just some text", required=True)
async def create(self, ctx):
await ctx.respond(view=RoleSelector())```
I think you just need to add text after ctx in create()
That worked, thank you!
Yw
You can't. To get a discord.User object you need to fetch_user and it only takes an ID.
.rtfm get_member_named
Hi, Does Select Menus work only for one user?
No
you can make it on an ephemeral
oh, i couldn't figure out why my Select don't work, but i've just sending it with a paginator which works only with a author
Yeah, like i said, I've used praw before which is a reddit api wrapper for python. I am having trouble with integrating it with a discord bot. Like, where should the code that fetches new posts go? Should i create a new function for it and call it with async task, or use pycords task extension or some other way?
I think paginator has a way with which multiple people can use it. Asking in #1047189308131508306
There is asyncpraw too
Is it possible to have an eval command with discord.Bot?
I'm doing fetch_roles in a slash command to print all the roles in a server, and whenever I run it I get a 'command is outdated' error. It's been 20 minutes now, is that normal?
Code pls 🤔
@discord.slash_command(name="update", description="Update menu")
async def update(self, ctx, guild: discord.Guild):
await ctx.respond("`Updated menu`")
roles = await guild.fetch_roles()
print(roles)
hi, this is what i have so far : https://paste.pythondiscord.com/igopoveraq
the code works
but is this the right way to do it? thanks for your time
.rtfm Channel
#883236900171816970 please
sry
thanks i'll try that
.rtfm doesn’t work there I think
@proud mason sorry for bothering you again, is this alright? https://paste.pythondiscord.com/duzosafoxa
K
yeah it does work, i was just asking if im doing correctly corrctly as in professionally
thanks
Hey, how to set an image in a embed object, without assign it ? For example :
discord.Embed(
title=f"Test" ,
description=f"\u200b"
,color = 0xeb571c,fields=[
discord.EmbedField(name=f"test",value="Test")])```
discord.Embed.set_thumbnail() require a "self" parameter. But what is this self if i put it into the discord.Embed() object
Huh?
You don't call the method directly on the class, you need an instance of the Embed object to set the thumbnail
So i can't set a thumbnail without create an instance ?
What's stopping you from creating an instance??
it is more practical and visual, and allows me to arrange them neatly in precise lists
I mean you do you, but I think that would look really messy and definitely not a pythonic coding style
well i need to make much embed so it's pretty cool to make them like this instead of embed = ...
embed.add .....
embedlist.append(embed)
for example
Also, allow me to put it into a async function with parameters and is easy to use
that's how i code, ik there's others ways but this one pretty good for me
You can still do that with loops and functions
Either way, you should read the docs
It would take longer than defining each embed by hand as they will all be different
Already check it, as I say discord.Embed.set_thumbnail require self but there's no self into the discord.Embed()
I'm not talking about the set_thumbnail method
There are properties of the embed you can define in the constructor

Absolutely no way around it? I have 180 embeds to do 
Ho i have an idea
set_thumbnail on the discord.Embed directly
i'll try this
It's work !
Thanks for the help 
download vim
open terminal
open ur file in vim with vim {file}type the following command:
180aembed = discord.Embed(title="ok")
embed.set_thumbnail(text=123)
(press escape)
I need help connecting to a phpMyAdmin SQL database. Someone told me to use pymysql and then use connection = pymysql.connect(host="localhost", port=8889, user="root", passwd="root", database="SELECTION_DB")cursor = connection.cursor()
Would this work ?
it looks good to me
import pymysql
connection = pymysql.connect()
cursor = connection.cursor()
cursor.execute("INSERT blah b lah blah")
connection.commit()
cursor.close()
connection.close()
okay then so when I need to get the info i need IE: Steam ID from the database how would I do so?
using a select statement
SELECT steamID from table;
perfect
import pymysql
connection = pymysql.connect()
cursor = connection.cursor()
cursor.execute("SELECT streamID from tablename")
fetch = cursor.fetchall() # this will get all results from the query
fetchone = cursor.fetchone() # will get the first row
fetchmany = cursor.fetchmany(int) # this will get an amount of rows
cursor.close()
connection.close()
then for putting that into an embed
okay so how would i do all of this with aiomysql
^^
man i just need some basic connection and to get someones steam id when they make a ticket through my ticket bot
^^
so i would put my connection stuff that I sent before in the pymysql.connect() correct?
?
hold on
connection = pymysql.connect(host="localhost", port=8889, user="root", passwd="root", database="SELECTION_DB")
cursor = connection.cursor()
cursor.execute("SELECT streamID from tablename")
fetch = cursor.fetchall() # this will get all results from the query
fetchone = cursor.fetchone() # will get the first row
fetchmany = cursor.fetchmany(int) # this will get an amount of rows
cursor.close()
connection.close()```
like this.
if my bot sends a response to a slash command like
@bot.slash_command()
async def example(ctx):
await ctx.respond('text')
how can I get message_id of the message my bot has just sent?
.rtfm interaction.original_response
That thing
thanks a lot
is there a way to run my own clean up code when the bot is closing
Override the close method of your bot
Don't forget to call super().close() as well, otherwise your bot won't close properly
cursor.execute("SELECT * FROM `users` ORDER BY `users`.`steam_id` ASC") how would i get the persons steam id with the persons discord ID
what
How many rows do you want to get in return?
do you want one, or all, or in size
like an amount of rows that you want it to return
so you want them all
You can use a simple WHERE in your SQL statement
import pymysql
connection = pymysql.connect(host="localhost", port=8889, user="root", passwd="root", database="SELECTION_DB")
cursor = connection.cursor()
cursor.execute("QUERY HERE")
fetch = cursor.fetchall() # this will get all results from the query
cursor.close()
connection.close()
cursor = connection.cursor()
cursor.execute("SELECT * FROM `users` ORDER BY `users`.`steam_id` ASC")
fetch = cursor.fetchall() # this will get all results from the query
fetchone = cursor.fetchone() # will get the first row
fetchmany = cursor.fetchmany(int) # this will get an amount of rows
cursor.close()
connection.close()```
why do you have fetch, fetchone and fetchmany in the same code?
I wanted to show which one he can choose
but I see I made a mistake
connection = pymysql.connect(host="localhost", port=3306, user="opqfulkp", passwd="", database="users")
cursor = connection.cursor()
cursor.execute("SELECT * FROM `users` ORDER BY `users`.`steam_id` ASC")
fetch = cursor.fetchall() # this will get all results from the query -> will return an empty tuple if nothing is matching
cursor.close()
connection.close()
I guess spoonfeeding works too 🤷♂️
works too anyways
???
nevermind
If you're going to help in this channel, please actually help instead of just spoonfeeding people finished code
it's useless
okay what i needed was how do i get the steam id and put in an embed when a person opens a ticket
Just fetch the ID from your database and write it out in the embed
Slash
thanks you !
does pycord work in replit?
?tag replit
Read this to find out how you can install Pycord in Replit
Old instructions: https://web.archive.org/web/20211128084858/https://namantech.me/pycord/installation/#replit
New instructions: #998272089343668364 message
it says Replit: Package operation failed.
is member.history the same as channel.history except it gives only the member's results?
I get a error while overriding
And how are you defining help_command?
And did you read the error?
yes and I dont get it, it is working without subclassing the bot, why would it not work when I overwrite the close method
So what do you think this means?
yeah but never created a Help command using class
I just always use the decorator without problem
If you're creating your own help command why are you trying to set the help_command parameter?
I am not
You are
oh, it autocompleted, I though it was optional parameter
in python when you put = with value it is not a defautl parameters that you dont need to fill?
what?
I though help_command was a kargs with default value
it is, but why do you even have it there if you're not going to set a value?
yeah I agree, I just got confused. Thanks you for your help !
Don't use code you don't understand
yeah I thought I understood it, but did not. I tough if you don't put any value I it will put the default one like None
but thanks you !
Haven’t used discord.File objects in a while, I saw that the file object has an attribute fp which is a “*file-like object opened in binary mode *” (according to the docs). Is this what I use in open() to read it? My use case is a discord.File slash command option which is supposed to be a json file, and I want to get a dictionary from that json file.
.rtfm discord.File.fp
You can open a file in binary mode by adding 'b' to the mode parameter in the open function.
E.g
with open('myfile.txt', 'rb') as f:
...
Will read a files binary data
Ok, so will f be a json object?
It will not, it's going to be a BufferedReader. If you want it as a dict you just need to read it normally and turn it into json
import json
with open('myfile.txt', 'r') as f:
my_dict = json.loads(f)
or something.
I realize now you're asking how to turn a binary mode file into JSON, and not the other way around
Oh I see. So I have file as the discord.File object (test.json). I can’t seem to use it in open(). How would I ago about making that eligible to use in `open()? Says it only takes str, bytes or os.PathLike object. I assume I need to turn it into a bytes object.
You should be able to call read() on the file object to turn it to text, and then just use json.loads on that
👍
Is that for this? #998272089343668364 message
Using jsk and got this error
msg = await _channel.fetch_message(1054931375599399024)
f = msg.attachments[0]
t = await f.read()
import json
j = json.loads(t)
j
Error:
This is what t printed
I have a function with the decorator @commands.has_permissions(manage_messages=True). Whenever this function is called from a user who doesn't have the perms, it throws an error on stdout, but doesn't send a message to the user stating that they do not have perms. What is the correct way to handle this? I have tried using try and except, but since it's a decorator they do not run.
All about handling errors.
I am building a bot that handles hidden messages, and one thing is that I want these messages to persist through the bot going down and coming back up. I already have a python database set up for all of this, but the only issue is that the buttons dont trigger the interaction after restart.... any ideas?
A "python database"?
Oh yeah, you probably need to decode the string as well. Try adding .decode('ascii') or something
New code:
msg = await _channel.fetch_message(1054931375599399024)
f = msg.attachments[0]
t = (await f.read()).decode('ascii')
import json
j = json.loads(t)
j
Same error
Oh wait, is that a valid json file? Properties need to use ", but in your string it's '
Oh I see
is there any way to display the options in a dropdown menu as coloured text?
no
ok thanks
im kinda new to pycord i see in https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_options.py that instead of importing pycord, discord is imported. Why is that? + Can I do that?
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_options.py at master · Pycord-Development/pycord
as u can read Pycord is maintained fork of discord.py 
so after doing pip install py-cord i can do
import discord
from discord.ext import commands```
instead of
```py
import pycord
from pycord.ext import commands```
??
ye
k
it has never been import pycord, that's in v3.0 which isn't out yet
flexing 
like i said earlier I am kinda new and unfamiliar with Pycord
if you have worked with discord.py then its similar to that 🙂
How would I take a dictionary and turn it into a discord.File object that is a json file?
How make an slash cmd option a variable?
huh
how do you add a reaction to an interaction?
@bot.slash_command(name="character", description="Choose between Mario and Luigi")
async def character(ctx):
mario = ":mario:"
luigi = ":luigi:"
msg = await ctx.respond(
embed=discord.Embed(title=str(ctx.author).split("#")[0] + ", choose your character!", color=discord.Colour.yellow()))
for reaction in [mario, luigi]:
await msg.add_reaction(reaction)
add_reaction() won't work
Hey all, I am getting an error with my first slash command:
import discord
import os # default module
from dotenv import load_dotenv
load_dotenv() # load all the variables from the env file
bot = discord.Bot()
@bot.event
async def on_ready():
print(f"{bot.user} is ready and online!")
@bot.slash_command(name="test")
@discord.option("name", description="Enter your name")
@discord.option("gender", description="Choose your gender", choices=["Male", "Female", "Other"])
@discord.option(
"age",
description="Enter your age",
min_value=1,
max_value=99,
default=18,
# Passing the default value makes an argument optional.
# You also can create optional arguments using:
# age: Option(int, "Enter your age") = 18
)
async def hello(
ctx: discord.ApplicationContext,
name: str,
gender: str,
age: int,
):
await ctx.send(
"Hello World."
)
bot.run(os.getenv('TOKEN'))# run the bot with the token
Works fine, 0 errors however when I run the command in discord I get the following error:
The application did not respond
ctx.respond
Thanks, can I run a function such as random image selector in that or do I just send the result for example?
huh?
Sorry mate getting the same issue again this time with this:
import discord
import os # default module
from dotenv import load_dotenv
load_dotenv() # load all the variables from the env file
bot = discord.Bot()
def make_texture(name, collar, div):
return (f'{name} | {collar} | {div}')
@bot.event
async def on_ready():
print(f"{bot.user} is ready and online!")
@bot.slash_command(name="test")
@discord.option("name", description="Enter your name")
@discord.option("div", description="Choose your gender", choices=["Male", "Female", "Other"])
@discord.option(
"collar",
description="Enter your age",
min_value=1,
max_value=99,
default=18,
# Passing the default value makes an argument optional.
# You also can create optional arguments using:
# age: Option(int, "Enter your age") = 18
)
async def hello(
ctx: discord.ApplicationContext,
name: str,
collar: int,
div: str
):
await ctx.respond(
make_texture(name, collar, div)
)
bot.run(os.getenv('TOKEN'))# run the bot with the token
i recently installed pycord on server and i get spammed with this error every time emssage is ent but i only have slash commands
TypeError: Iterable command_prefix or list returned from get_prefix must contain only strings, not tuple
are you using commands.Bot or discord.Bot
yeah
if you arent using prefixed commands
How would I go about sending 3 images at once?
First, upload one image, then upload another, then another, and then send the message.
… ¯_(ツ)_/¯
allImages = []
with open(str(test) + "_shirt.png", 'rb') as f:
picture = discord.File(f)
allImages.append(picture)
with open(str(test) + "_black_vest.png", 'rb') as f:
picture = discord.File(f)
allImages.append(picture)
await ctx.send(
files=allImages
)
Well I created an array thinking that would work, how does one go about doing it?
files is supposed to be a list of discord.Files
a list
i am trying to have a command that changes a user's permission but its not working could somebody pls help me.
async def perms(ctx: discord.message):
await ctx.respond("perms changed?")
await message.channel.set_permissions('1054749066325655552', read_messages=True, send_messages=False)```
that id is a str, start with that
the guild id?
so like this?
message.channel.set_permissions(1054749066325655552, read_messages=True, send_messages=False)
im not on pc but that was something i saw immediately
actually the id needs to be a discord.Member
oh
do you have any python knowledge
a bit
just got on pc and my eyes hurt
@bot.slash_command(guild_ids=[guildID])
async def perms(ctx: discord.ApplicationContext, item: discord.Option(discord.abc.Mentionable)):
await ctx.respond("perms changed?")
await ctx.channel.set_permissions(item, read_messages=True, send_messages=False)
literally none
thx it works
?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.
Where are you getting role ID from to add 🤔
Where are you storing or getting the role ID from this cmd 😑
.nojson
JSON is a convenient and easy-to-read data storage protocol that's widely accepted by most programming languages. However, we caution against its use for storing and retrieving data in an asynchronous environment like a Discord bot. Don’t use json!
- It's a file-based data storage, which makes it vulnerable to race conditions
- You'll need to implement your own synchronization primitives to avoid corrupting data
- If you're not careful, you could accidentally wipe your entire JSON file.
Solution? Use a database. Recommended schema are SQLite, PostgreSQL, and MongoDB.
- Async libraries exist on pypi for each of these
sqlite --aiosqlite(or Danny's wrapper,?tag asqlite)
postgresql --asyncpg
mongodb --motor - Databases organize your data into tables, and are fast at inserting, retrieving, and removing records
- You can impose uniqueness constraints to ensure against duplication
- The Python libraries enforce synchronization for you
- The query language is intuitive, you can get running with simple queries in just a few hours!
Use motor wrapper
For mongodb
That's async
Also you haven't defined role in this command
.tag nojson
JSON is a convenient and easy-to-read data storage protocol that's widely accepted by most programming languages. However, we caution against its use for storing and retrieving data in an asynchronous environment like a Discord bot. Don’t use json!
- It's a file-based data storage, which makes it vulnerable to race conditions
- You'll need to implement your own synchronization primitives to avoid corrupting data
- If you're not careful, you could accidentally wipe your entire JSON file.
Solution? Use a database. Recommended schema are SQLite, PostgreSQL, and MongoDB.
- Async libraries exist on pypi for each of these
sqlite --aiosqlite(or Danny's wrapper,?tag asqlite)
postgresql --asyncpg
mongodb --motor - Databases organize your data into tables, and are fast at inserting, retrieving, and removing records
- You can impose uniqueness constraints to ensure against duplication
- The Python libraries enforce synchronization for you
- The query language is intuitive, you can get running with simple queries in just a few hours!
This will be out of scope for the other command
@discord.ui.button(style=discord.ButtonStyle.primary, emoji="🛒",row=0)
async def third_button_callback(selfBUTTON, button3, interaction):
await interaction.response.edit_message(view=selfBUTTON)
@discord.ui.button(style=discord.ButtonStyle.gray, emoji="◀️",row=1)
async def first_button_callback(selfBUTTON, button1, interaction):
await interaction.response.edit_message(view=selfBUTTON)
await selfBUTTON.crate_page(message=interactionMessageCrate,contents=contents,emote="◀️")
@discord.ui.button(style=discord.ButtonStyle.gray, emoji="▶️",row=1)
async def second_button_callback(selfBUTTON, button2, interaction):
await interaction.response.edit_message(view=selfBUTTON)
await selfBUTTON.crate_page(message=interactionMessageCrate,contents=contents,emote="▶️")
async def crate_page(self,message,contents,emote):
message = await message.original_response()
if emote == "▶️" and self.cur_page != self.pageTotal:
self.cur_page += 1
await message.edit(embed=contents[self.cur_page-1])
elif emote == "◀️" and self.cur_page > 1:
self.cur_page -= 1
await message.edit(embed=contents[self.cur_page-1])
elif emote in ["◀️","▶️"]:
if self.cur_page == self.pageTotal :
self.cur_page = 1
elif self.cur_page == 1:
self.cur_page = self.pageTotal
await message.edit(embed=contents[self.cur_page-1])```
Hello, i made a page button system, and i want that if i use ▶️ emote to change page for exemple, the 🛒 button get disabled. How to do this ?
you could use the paginator to make the stuff way easier x3
I heard about that but never take a look
It looks a bit complicated, I've been doing the pages like that for a year, I'll see if I can change later
Hey I'm hosting a bot through sparkhosting and my entire bot just went offline and has been for over 6 hours. Claiming I was exceeding the rate limits too often. My bot maybe sends 10 requests every 10 minutes. Is this because this host is sharing ips between instances?
Found how. Using selfBUTTON.children[0].disabled = True
It seems I should have thought a bit more before asking 
Tag not found.
what is that even?
How to remove category from slash command option? It shows up if i use discord.TextChannel
How would I take a dictionary and turn it into a discord.File object that is a json file?
I think you would need to encode the dict dump it into a BytesIO
Then load the Bytesio into discord.File and give it a filename that has a .json file extension
That's weird, it should not show up when using discord.TextChannel
.rtfm slashcommandoptiontype
discord.SlashCommandOptionType
discord.SlashCommandOptionType.sub_command
discord.SlashCommandOptionType.sub_command_group
discord.SlashCommandOptionType.string
discord.SlashCommandOptionType.integer
discord.SlashCommandOptionType.boolean
discord.SlashCommandOptionType.user
discord.SlashCommandOptionType.channel
discord.SlashCommandOptionType.role
discord.SlashCommandOptionType.mentionable
discord.SlashCommandOptionType.number
discord.SlashCommandOptionType.attachment
Hello, How to make a slash command in message like this
.slashcommandmention
</full name:ID>
@real frost
appreciate it
I'm new to slash commands; the code looks fine to me.
@bot.slash_command()
@option("url", description = "Enter the url for the text you want to be scraped.")
@option("summarize", description="Would you like the text summarized?", choices=["Yes", "No"])
async def scrape(
ctx,
url: str,
summarize: str
):```
Here is the error:
```async def scrape(ctx, url: str, summarize: str):
TypeError: ApplicationCommandMixin.slash_command() takes 1 positional argument but 2 were given```
I saw something similar to this in https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_options.py and I thought this code would work. Lmk if u know how to fix this.
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_options.py at master · Pycord-Development/pycord
wait... i think its working... wtf
Please explain your solutions instead of just spoonfeeding code
How to get a message by id?
I tried bot.get_message(id) but it returned None. The id matches with a message in a guild.
use fetch_message if get_message returns None, get_message only retrieves from the bots cache
fetch_messages makes an API call
Hey guys i have a problem when im try to make connect my discord code to the discord bot its showing me this
Read the error
i read but where i nedd to use intents
You need to define the intents kwarg where you initialize your bot
What do i call fetch_message on if I don't know what channel it is in?
you can get/fetch it from the guild
you can't encode a dict
AttributeError: 'dict' object has no attribute 'encode'
buffer = BytesIO(FORM.encode('utf-8'))
file = discord.File(buffer, filename=f"{FORM['name']}_export.json")
FORM is a dictionary
You can juse json.dumps to encode a dict
god im starting to hate dealing with discord.File
jesus i can't spell today
I think it’s more than just today
a bytes-like object is required, not 'str'
buffer = BytesIO(json.dumps(FORM))
file = discord.File(buffer, filename=f"{FORM['name']}_export.json")
don't even know if this is correct, i don't use the json module a lot :/
wha-
It seems like I can't ...AttributeError: 'Guild' object has no attribute 'fetch_message'
oops i’m misremembering.
i don’t think that’s a good sign on the day of finals 
Is there a reason you don't have access to the channel when fetching the message?
rip squid on finals
yeah still getting the same error
f* json
I was saving the message id to a file, but stupid me didn't realise i could save the channel id too :). Thanks for your help!
Is that being raised by bytesio or discord.File
Don't save dynamic data to files, use a database
Encode the json.dumps
Also you might need to initialise the Bytesio first and then use the write method on it
Ayye i found an example
It's easier to read in files while developing.
huh?
?tag nojson
Why not to use json files for data storage
JSON files are commonly used to store data that is read by a program, however, they are unsuitable for storing dynamic data due to a number of reasons.
It is recommended to use a DBMS (Database Management System) as they come with optimized technologies for storing and retrieving information.
Advantages of using a database:
- Database tables can be related, making it easy to separate your information into multiple tables and only fetch what you need
- Databases allow you to use a query/data processing language to make complex data operations easier with less code
- One misplaced character will corrupt an entire file. A database very rarely experiences corruptions due to their automatic handling of data integrity
- Transactions in SQL databases allow you to revert unwanted changes and prevent data corruption in the case of an error
- Databases have support for indexes, allowing retrieval of some data to be extremely fast
- It is very easy to update existing data in a database, as opposed to re-writing a file
- Databases are reliable
Popular database management systems:
- SQLite3 (File based, no need for a server setup, SQLite is the most used database engine in the world)
- MongoDB (Stores data in documents a similar manner to JSON format, easy for beginners)
- PostgreSQL (Very popular and robust SQL based database management system)
- MySQL (Another popular SQL based system, good start for learning SQL)
I mean you do you, but that sounds very inefficient
It probably is
Idk if this is a bug but:
print(a.id)```
gives the wrong id but
```a = ctx.send()
print(a.id)```
gives the right one
They are different things
Those are different methods and they return different things, not a bug
ctx.respond.send_message is the same as ctx.interaction.response.send_message which returns an Interaction
ctx.send is the same as ctx.channel.send which returns a message
.rtfm interaction.response.send_message
Target not found, try again and make sure to check your spelling.
.rtfm context.send
discord.ApplicationContext.send
discord.ApplicationContext.send_followup
discord.ApplicationContext.send_modal
discord.ApplicationContext.send_response
bridge.BridgeApplicationContext.send
bridge.BridgeApplicationContext.send_followup
bridge.BridgeApplicationContext.send_modal
bridge.BridgeApplicationContext.send_response
bridge.BridgeExtContext.send
bridge.BridgeExtContext.send_help
Context.send
Context.send_help
I feel stupid now
To get the message id from interaction, use interaction.original_response
.rtfm interaction.original_response
Thanks for all your help!
What the hell
First of all, just sending code without any explanation or question is completely useless.
Second, use codeblocks
Third, you have been told multiple times to learn Python before making a bot
No you have not
?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.")
???
What does that even mean?
Are you reading your own code?
You've clearly missed a closing parenthesis
Does anyone know why slash commands aren't showing in just one server? My bot is on many servers and slash commands are visible in all of these servers except for one server, any idea how to fix this? I invited the bot with applications.commands scope and waited over 1 hour.
You might not have perms to use Slash cmds of that bot
In that server
Or the server has 50 bots added
You have admin perms?
Yep.
Hmm that's weird
Hold on I think there are 50 bots.
Bots that don't have app cmds aren't really affected by this limit
Only 26 of them have app commands.
Kick bots until there are less than 50 bots, add your concerned bot and then add the rest of them again
I'll try that, thanks!
Np 👍👍
hey guys how can i use the api command to fast search something?
Fast search what
If you're going to spam commands do it in #app-commands
??
i cant use .rtfm in bot commands
Then use #883236900171816970
thanks
You're clogging up this channel for no reason
srry
what do you mean by "match the input"?
if you want a default value already in there you can use the value parameter
this then #998272089343668364 message ?ref
if you want a default value already in there you can use the value parameter
.rtfm discord.ui.InputText.value
.rtfm discord.ui.InputText.placeholder
something else to look for
If my bot is going to send something of 2000 characters what do I do?
embeds can have more characters
How much more?
Is there a way is can split my messages into groups of 2000 characters?
6k for the whole embed iirc
embed description is like 2048
write something that splits the message at certain points
im pretty damn confused
Error:
Traceback (most recent call last):
File "c:\Users\XXXXXX\Documents\XXXXXX\main.py", line 36, in <module>
async def keycheck(ctx, service):
TypeError: ApplicationCommandMixin.slash_command() takes 1 positional argument but 2 were given
Code:
@bot.slash_command
@option("service", str, description="2captcha OR capmonster")
async def keycheck(ctx, service):
# Some code ...
(please dont say its anything obvious id off myself 💀)
it's @bot.slash_command()
😭
that threw me off so hard
yeah
i forgot that
thanks 
asked chatgpt and it didnt help at all
ChatGPT is an unreliable source code because it is unfamiliar with Pycord. OpenAI is more familiarized with discord.py.
there is no listener
That's not a listener
Read this to find out how you can install Pycord in Replit
Old instructions: https://web.archive.org/web/20211128084858/https://namantech.me/pycord/installation/#replit
New instructions: #998272089343668364 message
do you know basic python?
Pong?
Do you know what premium_guild_subscription is?...
Target not found, try again and make sure to check your spelling.
.rtfm premium_guild_subscription
Read this to find out how you can install Pycord in Replit
Old instructions: https://web.archive.org/web/20211128084858/https://namantech.me/pycord/installation/#replit
New instructions: #998272089343668364 message
It's not a context attribute
You have conflicting libraries, uninstall everything that has to do with discord other than py-cord
?tag install
- Uninstall discord.py or any other forks of discord.py you might have with the namespace
discord.
python -m pip uninstall discord.py discord -y
2a. Install py-cord
python -m pip install py-cord
2b. Update py-cord
python pip install -U py-cord
Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.
Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
Then that's an issue with replit
Tag not found.
Did you mean...
noreplit
reinstall py-cord.
then restart IDE
uninstall, install
it basically is, but Bob, the owner, likes the partner badge better for color scheme I think.
[AFK] just a squid is AFK: No reason specified.
you are getting ratelimited
You're getting rate limited
Don’t use replit :/
I use a really cheap host, $1/month. There are other hosts like it too.
Very good uptime and performance
pterodactyl panels aren't great either.
Man got roasted by a squid
yes they are
The fastest ping I’ve seen for my bots was 5ms
when discord didn’t have bugs
Is there a way to have slash commands separated in different files?
If so, how would you do that?
The same way you do with any commands, cogs
What's a cog?
thx!
Do I have to use commands.bot or can I keep discord.bot?
You can use discord.Bot if you only want Slash cmds and not prefix cmds
You have to use discord.Cog instead of commands.Cog then
Rest of the stuff is almost the same
Ok tysm!
hey can i use ctx.defer() multiple times in one cmd or once its sufficient 
the latter
ok thanks 
I use ptero with 0 issues.
is there a way to able to type message with shift+Enter in a suggestion slash cmd 
No
Why NOT to use Repl.it as a hosting platform
You should not use Repl.it to host your bot.
It may be a nice option as its "free" but you should use something else considering the major flaws.
- The machines are super underpowered.
-
- This means your bot will lag a lot as it gets bigger.
- You'll need a web server alongside your bot to prevent it from being shut off.
-
- This isn't a trivial task, and eats more of the machines power.
- Repl.it uses an ephemeral file system.
-
- This means any file you saved via your bot will be overwritten when you next launch.
IMPORTANT
- They use a shared IP for everything running on the service.
This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.
Please avoid using repl.it to host your bot. It's not worth the trouble.
If you're looking for free options, consider using AWS/Google Cloud Platform/Azure/Railway and its respective free tiers or just pay for an actual VPS.
.rtfm modal
discord.ApplicationContext.send_modal
discord.InteractionType.modal_submit
discord.InteractionResponseType.modal
discord.InteractionResponse.send_modal
discord.ui.Modal
discord.ui.Modal.add_item
discord.ui.Modal.callback
discord.ui.Modal.children
discord.ui.Modal.custom_id
discord.ui.Modal.on_error
discord.ui.Modal.on_timeout
discord.ui.Modal.remove_item
discord.ui.Modal.stop
discord.ui.Modal.title
discord.ui.Modal.to_components
discord.ui.Modal.to_dict
discord.ui.Modal.wait
bridge.BridgeApplicationContext.send_modal
Hello! Is there any kind of tutorial about the discord.ui ? Docs don't give much info tho...
.rtfm button
discord.Activity.buttons
discord.ComponentType.button
discord.ButtonStyle
discord.ButtonStyle.primary
discord.ButtonStyle.secondary
discord.ButtonStyle.success
discord.ButtonStyle.danger
discord.ButtonStyle.link
discord.ButtonStyle.blurple
discord.ButtonStyle.grey
discord.ButtonStyle.gray
discord.ButtonStyle.green
discord.ButtonStyle.red
discord.ButtonStyle.url
discord.Button
discord.Button.custom_id
discord.Button.disabled
discord.Button.emoji
discord.Button.label
discord.Button.style
No clue what your Problem is tbh. #help-rules
Kinda the same like the normal commands but with interaction
the problem is with response.send_message
can u help me tho?
Sorry i dont understand. I dont see any interaction.response.send_message in your code.
Why is the name empty?
where
Of the fields?
You send the message before making the embed?
i put invis msg
Do you have any Error message?
no
In callback function or in actual cmd 😅
true?
.rtfm interaction
discord.InteractionResponded
discord.InteractionResponded.args
discord.InteractionResponded.with_traceback
discord.Message.interaction
discord.Interaction
discord.Interaction.app_permissions
discord.Interaction.application_id
discord.Interaction.channel
discord.Interaction.channel_id
discord.Interaction.client
discord.Interaction.custom_id
discord.Interaction.data
discord.Interaction.delete_original_message
discord.Interaction.delete_original_response
discord.Interaction.edit_original_message
discord.Interaction.edit_original_response
discord.Interaction.followup
discord.Interaction.guild
discord.Interaction.guild_id
discord.Interaction.guild_locale
Can be but as far as i know send_message does not have a embed1 keyword argument. Aswell as it actually should throw an error if it would have run up until this point.
I am not sure if your callback is actually connected with your button. I always make custom calsses, so i can not help you with that sorry.
Ok will try
ok thanks
embed=something and it cannot change
bro can u accepy my friend req
For what?
if i send my source code an u fix it im newin python
PLS?
?
#help-rules 3
Is it possible to use same modal in two different cmds sending output in 2 different channels ?
Noice 
?
You need to learn basic python. Your class does not have a init.
This is not to shame on you or anything but knowing Object Orientation is important for using pycord.
The answer would be you need to add func init to your Button class.
NICE I DIDNT UNDRESTAND ANYTHING
class MyButton(Button):
async def callback(self, interaction):
embed1=discord.Embed(title=f"Server Rules",description="ما قوانین سرور رو به دو زبان فارسی و انگلیسی نوشتیم با استفاده از دکمه های زیر یکی رو انتخاب کنید، و بخونید", color= 5793266)
embed1.add_field(name=f"ㅤ", value="ما قوانین سرور رو به دو زبان فارسی و انگلیسی نوشتیم با استفاده از دکمه های زیر یکی رو انتخاب کنید، و بخونید", inline=False)
embed1.set_image(url="https://media.discordapp.net/attachments/1052540239668846592/1053629574329671690/rules-concept-people-letters-icons-flat-vector-illustration-isolated-white-background-rules-concept-people-139612137.jpg?width=1260&height=546")
buttonfa = buttonfa(label="Persian", style=discord.ButtonStyle.green )
buttonus = buttonus(label="English", style=discord.ButtonStyle.blurple,)
view = View()
view.add_item(buttonfa)
view.add_item(buttonus)
await interaction.response.send_message(embed=embed1)
? CAN U MAKE THAT HERE PLSSSS??
?
I will not be able to explain Python to you.
class MyButton(Button):
def __init__(*args, **kwargs):
super().__init__(*args, **kwargs)
async def callback(self, interaction):
...
This would fix it I think. I did not test it so i am not sure. But i highly encourage you to learn Python.
Depends on how are you going to determine the channel
Hard-coded channel id, coming from a db, Slash cmd option, or what?
Hard-coded ig if i can able to get what cmd was used can put an if statement and send the output in that channel
i am trying to use it as suggestion cmd but i need two different cmd for two different role holder 

Oh yeah that's fine. You can do that. You would need to pass ctx.command to the modal init and assign it to an object variable
Then during callback check the command using if else and send accordingly
Don't forget you need to respond to the interaction too
You are at the wrong place my friend. This is a pycord server. This is where people build bots
I'll help you anyways. You can disable the Slash command from server settings
ctx.respond
application did not respond
yes i did
message.respond
message.respond
lol they not using ctx checked now 
xddddd
then also same bro
i know basics
the tab var takes more than 5 secs and app should respond in under 3 secs else discord shows no respond error
is your latency high?
hmmm i would just cry at this point
i am rn
please any pro guy help me 😦
Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
import discord
from discord.ext import commands,bridge
from datetime import datetime
class MyModal(discord.ui.Modal):
def __init__(self) -> None:
super().__init__(title="test")
self.add_item(discord.ui.InputText(label="Short Input", style=discord.InputTextStyle.short,required=True))
self.add_item(discord.ui.InputText(label="Longer Input",style=discord.InputTextStyle.long,required=True))
async def callback(self, interaction: discord.Interaction):
print(self.cmd)
uid= interaction.user.id
avatar=interaction.user.display_avatar
authorm=interaction.user.mention
authorn=interaction.user
tym =datetime.utcnow()
embed = discord.Embed(title = "Suggested By", description =f"{authorm} / {authorn}", colour= 0xFE6000, timestamp =tym)
embed.add_field(name =f"Title:\n{self.children[0].value}" , value = f"Suggestion:\n{self.children[1].value}", inline = False)
embed.set_footer(text=f"User-ID:{uid}")
embed.set_thumbnail(url = avatar)
await interaction.response.send_message(embeds=[embed])
class sugg(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bridge.bridge_command()
async def sug(self,ctx: discord.ApplicationContext):
await ctx.send_modal(MyModal())
@bridge.bridge_command()
async def gsug(self,ctx: discord.ApplicationContext):
await ctx.send_modal(MyModal())
def setup(bot):
bot.add_cog(sugg(bot))
where my brain.exe getting crashed 
it raises this error
Your command takes more than 3 seconds to respond. Defer at the 1st line of the callback and then followup
please see the above code i have attached
@proud mason
Well i GTG I'll help you in a bit
ye NP me need to coll my 🧠 too 
nooooo
Didnt your Question already get answerd? Use defer befor your api call then respond with followup.
Ok so how familiar are you with oop?
Basic 😅
Sry 😞
In the init of your modal, accept a channel id. Then assign it to self.channel_id
In the command, pass the channel id to the modal like this MyModal(channel_id=12345)
Change the id according to the command
Ok will try after sometime 👍
What error
ctx.respond
His ctx is message
Just a different var name
Oh in the error you mean
Why assign cursor again when you are getting it from async with
Remove the 2 lines where you reassign cursor
And pass that dict cursor thing to the async with cursor
Hmm show updated code
And explain what exactly is wrong
Any errors?
Hello all, for some reason my second slash commands arguments are not updating when I restart the bot (url being the one which isnt working), this is my py code:
@bot.slash_command(name="adduniform")
@discord.option("template", description="Enter the Template's Name")
@discord.option("url", description="Enter the imgur url for the template must be a .png")
@discord.option("div", description="Choose what division this is for",
choices=["LPT", "RPG", "FSG", "SYFRS", "YAS"])
@discord.option("type", description="Choose the type of clothing",
choices=["Shirt", "Vest", "Helmet", "Shoes"])
async def adduniform(
ctx: discord.ApplicationContext,
template: str,
div: str,
type: str,
url: str
):
#get_image(url)
await ctx.respond(str(div) + " - " + str(template) + " has been uploaded.")
Any help would be great
How can bot create a webhook?
.rtfm discord.Webhook
discord.Intents.webhooks
discord.AuditLogAction.webhook_create
discord.AuditLogAction.webhook_update
discord.AuditLogAction.webhook_delete
discord.WebhookType
discord.WebhookType.incoming
discord.WebhookType.channel_follower
discord.WebhookType.application
discord.Message.webhook_id
discord.Guild.webhooks
discord.InteractionMessage.webhook_id
discord.TextChannel.webhooks
discord.ForumChannel.webhooks
discord.VoiceChannel.webhooks
discord.Webhook
discord.Webhook.auth_token
discord.Webhook.avatar
discord.Webhook.channel
discord.Webhook.channel_id
discord.Webhook.created_at
Pycord offers support for creating, editing, and executing webhooks through the Webhook class. Attributes avatar, channel, channel_id, created_at, guild, guild_id, id, name, source_channel, source_...
Ye done some R&D now it's working like charm
thanks 👍🏼
But how to check for time out or if someone close the panel 🤔
.rtfm modal.timeout
Target not found, try again and make sure to check your spelling.
.rtfm modal
discord.ApplicationContext.send_modal
discord.InteractionType.modal_submit
discord.InteractionResponseType.modal
discord.InteractionResponse.send_modal
discord.ui.Modal
discord.ui.Modal.add_item
discord.ui.Modal.callback
discord.ui.Modal.children
discord.ui.Modal.custom_id
discord.ui.Modal.on_error
discord.ui.Modal.on_timeout
discord.ui.Modal.remove_item
discord.ui.Modal.stop
discord.ui.Modal.title
discord.ui.Modal.to_components
discord.ui.Modal.to_dict
discord.ui.Modal.wait
bridge.BridgeApplicationContext.send_modal
You can't check if someone closes the modal. But you can do smth on timeout
11th one
But if someone close the modal and do the cmd again it will work or through error 🤔
Ye saw that thanks 
K
Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
no sir that doesnt work
Show code
What is jj.order?
its from other file in same folder
it contacts api and returns the response
So you should defer before sending a request
i did
You did not
ok
ye sorry
And why the asyncio.sleep?
Use aiohttp
Also since you're not awaiting that API call, it's probably blocking and will stop your bot from executing anything until the request is done
thanks for help
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)
If you don't understand that error you probably don't know enough Python to be making a bot
wtw?
You need a minimum knowledge of Python before making a discord bot.
does on_voice_state_update trigger when a user is muted even when not in a voice channel?
Where is the embed documentation?
embed = discord.Embed()
embed.insert_field_at(1, "test", "Hello World", True)
This is not working
Any help/point in the right direction would be grand
.rtfm discord.Embed
discord.Embed
discord.Embed.Empty
discord.Embed.add_field
discord.Embed.append_field
discord.Embed.author
discord.Embed.clear_fields
discord.Embed.color
discord.Embed.colour
discord.Embed.copy
discord.Embed.description
discord.Embed.fields
discord.Embed.footer
discord.Embed.from_dict
discord.Embed.image
discord.Embed.insert_field_at
discord.Embed.provider
discord.Embed.remove_author
discord.Embed.remove_field
discord.Embed.remove_footer
discord.Embed.remove_image

.tag tias
Sorry for a ping, is there a good example on how it all comes together and used?
Whats confusing about it?..
Is it like this:
embed = discord.Embed(title="Test")
embed.field("Blah")
await ctx.respond(embed)
Sent my request
Came out like this
<discord.embeds.Embed object at 0x00000298562E80D0>
.rtfm Embed.field
Embed.field doesn't exist
You're looking for add_field method
And when responding, you need to provide the kwargs embed=embed
.rtfm ApplicationContext.respond
Ah awsome thanks mate, still quite new to this noticed I was missing something with ctx.respond(), thanks mate
i think it should be on_member_update event
how do i reset command cooldown
Is there something like if slash_command.user == 751563727161000017:?
hello guys I have a very basic question I believe : how can I respond to a message from a slash_command? I currently return an embed using ctx.send(embed=embed) and get the Application is not responding message because it is not seen as a response
you are looking for ctx.author.id
Change that to ctx.respond
That's all
Np 🙃
How are you implementing cooldown?
You have *users
It takes the second argument and the rest
Yes indeed
You'll never be able to get the reason
You'll need to take a str and parse the stuff yourself
Can I give a slash commands group default permissions with decorators like simple slash commands ?
Try it and see
Why not
Just asking chill
You can’t expect us to know what will and won’t work.
.tias
"Basic pycord help" thread when you ask for basic pycord help :
There's a difference between asking for basic help and just being too lazy to find out on your own
how do you mention a slash command like this?
</full name:ID>
.rtfm slashcommand.mention
does the command need to be global?
doesn't work for me (just displays the string "/command")
isinstance(channel, discord.Thread) id assume
Do you realize we don't know what your code does and you never stated what isn't working
We're not some type of "provide code, we fix it for you" AI
You've been told multiple times to ask your questions properly instead of just sending code and expecting someone to fix it for you. If you can't ask a proper question, no one is going to help you and you're just wasting time.
We already told him to learn the basic´s of Python...
takes 2 long
We've told him like 5 times, but it seemingly does nothing
read the error
idk how to add client intents
?tag intents
https://docs.pycord.dev/en/master/intents.html
https://discord.com/developers/docs/topics/gateway#gateway-intents
import discord
from discord.ext import commands
# Get specific intents for fine control
intents = discord.Intents()
intents.emojis = True
intents.guilds = True
intents.messages = True # Required for prefix commands!
...
# Get all non-priveliged intents; this excludes presences, members and message_content
intents = discord.Intents.default()
# Set priveliged intents: these must be enabled on dev portal
intents.members = True
intents.presences = True
intents.message_content = True # Required for prefix commands >= 2.0.0b5
# Get all intents; all intents must be enabled on dev portal.
intents = discord.Intents.all()
# Apply intents when creating your bot
bot = commands.bot(prefix="?", intents=intents)
In version 1.5 comes the introduction of Intents. This is a radical change in how bots are written. An intent basically allows a bot to subscribe to specific buckets of events. The events that corr...
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
can i just pay you to fix it
no
well you sent a thread that does not define how to add it in the code?
The irony
??
If you don't understand that, you're not ready for Discord bot development. Read rule 1 in #help-rules
hey @limber urchin can Helper mute people?
let’s find out 

So if you go to a mechanic that only speaks Japanese, you think it's weird that you are expected to know Japanese?
No one said you have to understand it fully, just the basics.
yea ill just pay a helper to rewrite it for me
Good luck 👋
Tryna milk the cow but doesn't have a cow
That shows you’re very lazy.

You won't find a helper here, you're free to look in other servers though
You’ll get no where in life if you’re like that.
I don't think so? Never tried
Tbh if someone payed me to fix code I’d say hell no learn the language.
learning python isnt a priority i need when i have the funds for someone to fix it
can you try it?
So then why are you here? Go to Fiverr or something
x3
What's the command? -mute?
"help & support"
Exactly, not "rent a developer"
not "developers for hire"
Yes. It's not "rent a helper"
LMAO

Lmao everyone thought the same
With that mindset. You’ll get no where in life. Paying someone to do something very simple shows your lazy and too pathetic to learn something.
-mute
Mute <User:Mention/ID> <Duration:Duration> <Reason:Text>
Mute <User:Mention/ID> <Reason:Text> <Duration:Duration>
Mute <User:Mention/ID> <Duration:Duration>
Mute <User:Mention/ID> <Reason:Text>
Mute <User:Mention/ID>
Invalid arguments provided: No matching combo found
-mute @limber urchin 5m test
Unable to run the command: Can't use moderation commands on users ranked the same or higher than you
Oh
Interesting
Try with me
-mute @full basin 10s testing
Unable to run the command: The Mute command requires the Kick Members permission in this channel or additional roles set up by admins, you don't have it. (if you do contact bot support)
I see
🔇 Muted dark#8901 for 1 minute
yes im "pathetic" for not learning a language that i will never have intent using !
-unmute @full basin
Unable to run the command: A reason has been set to be required for this command by the server admins, see help for more info.
xd
-unmute @full basin o
🔊 Unmuted dark#8901
If you don't want to learn Python, you're in the wrong place bud
ur clearly using it now...? * confusion *
You’re making a bot, sounds like an intent to learn it to me 
I'm amazed these kind of people exist
People on the internet never fail to surprise you


No tag

