#Basic Pycord Help (Quick Questions Only)

1 messages · Page 29 of 1

rapid geode
#

make it

#

role_id = 10333...

sleek haven
#

when i did that it was 'int' has no 'get_role'

rapid geode
#

then

#

get_role(1033...)

full basin
#

homeGuild is supposed to be a Discord.Guild object

#

Not an ID

rapid geode
#

🤦

#

yeh exactly

sleek haven
rapid geode
#

you can still use the id if you want to by getting the guild first

sleek haven
#

so its should be the name?

rapid geode
#

then it would be ctx.guild

sleek haven
#

hmmm but if not from the guild

full basin
rapid geode
#

then get the guild first

full basin
#

Do you know how OOP works?

sleek haven
#

oh ok

sleek haven
full basin
#

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)

rapid geode
#

try this

sleek haven
#

ah nvm i just forgot to something

#

i forgot to get all the members and define members

#

problem with this if the server has tons of members

cyan lark
#

how i can get this?

young bone
#

discord.Attachment

cyan lark
pseudo dawn
#

Does having optional parameters for the function of a command group interfere with the subcommands?

sleek haven
sage eagle
#

#1033383669177532477

#

pls help

cyan lark
#
@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

cyan quail
sleek haven
#

but in the main bot its verified and it has no intents for members

#

so it cant check if they have the role

silver moat
sleek haven
#

but in my main bot it doesn't because i think to check if someone has specific roles you need intents

silver moat
#

correct, you do.

sleek haven
silver moat
#

Applying for the members intent is easy for, there are many use cases and discord will generally always grant it.

sleek haven
#

i once tried asked for message and got declined

silver moat
sleek haven
silver moat
sleek haven
#

hmmm ok ill try

tender seal
#

what do I use

#

what class do I use

#

so the user can upload a file

pseudo dawn
#

What's the difference between Context and ApplicationContext

silver moat
silver moat
pseudo dawn
silver moat
tender seal
#

thank you.

pseudo dawn
tender seal
#

what do I do about this

#

Attachment.fp?

#

I mean

#

file.fp?

silver moat
silver moat
pseudo dawn
pseudo dawn
silver moat
#

I don't think you need to subclass at all, but ok

pseudo dawn
silver moat
#

ah ok

rare ice
#

@sage eagle Please don’t cross post

#

@fervent cradle Please don’t cross post

sage eagle
rare ice
winter condorBOT
rare ice
#

Choose either your own help thread OR #998272089343668364

#

Your question was already answered in your help thread Creve.

sage eagle
#

thats why i am pinging my thread and dont send the same question over here

rare ice
#

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.

sage eagle
rare ice
meager mica
#

i cant figure out how to make channel auto complete

#

i tried channel: discord.channel but it had error

young bone
meager mica
#

i did that first but

silver moat
#

type pip list in terminal and show output

proud pagoda
meager mica
#

ohhhhh

silver moat
#

if you want all channels (forums, voice, category, etc.), you can use discord.abc.GuildChannel

craggy crown
#

Can I do discord bots and learn python on mobile?

rare ice
#

Depends what hosting and IDE you use but yes.

#

.tag lp

winter condorBOT
#
rare ice
#

.tag guide

winter condorBOT
craggy crown
rare ice
#

Please don’t cross post

#

.tag cross posting

winter condorBOT
#

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

craggy crown
#

Whats cross posting

craggy crown
rare ice
#

Yes

craggy crown
rare ice
#

learn

craggy crown
#

Yeah, im learning the beginners link kinda confusing tho

meager mica
#

hey guys so is there a builtin mehod of checking if avatar changed

rare ice
fervent cradle
#

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)

meager mica
#

super().__init i think is way to go

fervent cradle
#

Oh subclassing it, I guess that'd work

#

Do you then just add it to the view with some add_item function?

meager mica
#

no i dont think so?

#

thats all the ui code i got

#

i just have callback code

fervent cradle
#

Do you not add this subclass to a view?

meager mica
#

it is a view

#

class Dropdown(discord.ui.Select):

fervent cradle
#

You can make a view out of an ui element?

#

interesting

meager mica
#

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)

fervent cradle
#

Not what I was saying but I figured it out

#

Thanks though 👍

full oxide
#

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?

fervent cradle
full oxide
meager mica
#

only once yes

full oxide
#

thx!

meager mica
fervent cradle
#

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

fervent cradle
#

I've made this work by editing the message, however if someone has a proper way to implement it that'd be neat 👍

loud holly
#

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

cyan quail
#

but you can also right click a command on the client to get its ID and use that

loud holly
cyan quail
#

master is just the latest stuff on github

loud holly
#

oh, so I presume it is stable in that sense?

cyan quail
#

it should be fine yeah

loud holly
#

how would I go about install the master?

cyan quail
#

let's see uhh

#

pip install -U git+https://github.com/Pycord-Development/pycord

loud holly
fervent cradle
#

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?

cyan quail
fervent cradle
#

Oh right, I'll just use this as a counter then, thanks!

fervent cradle
#

I may be stupid, but do modals really not support dropdowns?

cyan quail
fervent cradle
#

Oh that's great, modals with only textboxes seemed a bit pointless outside of opinion polls lol

cyan quail
#

a while ago you could add dropdowns to modals, but after some time discord said it was a bug and disabled it

fervent cradle
#

huh, weird

#

I hope discord adds more ui elements like date pickers or checkboxes and stuff to them

#

making them actually useful

cyan quail
#

date picker's coming to slash options at least

copper dew
meager mica
#

how do i get a guild from discord.User discord.Member has guild attr but not User for some reason

fervent cradle
#

a member is a user part of a server, a user is just a someone on discord

meager mica
#

is there a way i can get the guild id where a on_user_update event happned

#

im trying to make avatar log code

meager mica
#

and it doesnt log to on_member_update

fervent cradle
#

oh

#

I was gonna say to use this but

#

you can get a user from a member?

meager mica
#

😁

meager mica
fervent cradle
#

no

#

You can get a user from a member, not the other way around

#

Why not use that if you need a user?

meager mica
#

i have to use async def on_user_update

#

on_member update does not detect changes in avatar

fervent cradle
#

Oh alright

#

I suppose you could find the guilds you have in common with a user

meager mica
#

thenn loop ig

fervent cradle
#

And from those guilds get a member from the user id

meager mica
#

i think i can do that

#

that worked tysm

hollow brook
#

If you respond to an interaction with defer, you're supposed to be able to respond to it again, right?

simple canopy
#

Uh, seems about right

#

🤔

hollow brook
#

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?

simple canopy
#

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

bitter lance
#

do I have to use message id to edit embed?

simple canopy
#

No, if you have an message object

bitter lance
#

when I restart bot, I can use view (add_view), but I want edit specific embed

simple canopy
#

In this case you need an message id

bitter lance
#

ahh ok..

simple canopy
#

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

bitter lance
#

I think only one message that include embed and view in channel

simple canopy
#

You can just send new one every-time bot starts or fetch it by its id

#

Easiest way is to just fetch it

bitter lance
#

ok Thanks!

simple canopy
#

👍🏻

silver moat
#

Oof. Did you use a screenshot and filled out everything?

sleek haven
#

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

spark lantern
#

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

rigid sable
#

What is the default timeout for a button? How can I increase it?

spark lantern
spark lantern
#

no problemo

spark lantern
rigid sable
spark lantern
bitter lance
#

is there any way to make Embed class like class MyView(View):? or only function and return

storm hinge
#

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
tribal bough
storm hinge
#

do you mean convert a string to a string via str()?

tribal bough
#

nope

#

\👍

storm hinge
#

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?

tribal bough
# tribal bough \👍

use this type of emoji to get this type of emojies just simply add \ before the emoji example \:thumbsup: and copy that emoji

tribal bough
storm hinge
#

🤖 throws invalid emoji

tribal bough
bitter lance
#

try "⏯️" like this

storm hinge
# tribal bough can you send error too?
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
tribal bough
#
{
  "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:"
  }
}```
storm hinge
#

custom ones work; default ones don't

storm hinge
bitter lance
#

not:.play_pause: just ⏯️. same?

storm hinge
#

am i suppoed to use \:robot:

tribal bough
storm hinge
silver moat
#

\🤖

storm hinge
#

it threw error too

tribal bough
silver moat
cyan lark
#

Hello i try to do auto select menu on ticket "bot.event" and this not working

#

i did try

tribal bough
#

i don't think select menu support 13 options

storm hinge
cyan lark
#

this working

silver moat
storm hinge
cyan lark
#

i just need need this bot send on category auto

tribal bough
silver moat
#

use whatever that gives

storm hinge
#

\🤖

#

okkkkay what

#

how does that work

cyan lark
tribal bough
obtuse juncoBOT
#

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.

cyan lark
#

HUHHHHHHHHH

#

no

#

bro what the can help

tribal bough
#

🤣 sometime people reactions are too funny here

cyan lark
#

fr...

tribal bough
#

another reason to love coding

cyan lark
#

@silver moatwhat the can help

#

....

tribal bough
silver moat
#

you are trying to use a class

cyan lark
silver moat
#

and its method

cyan lark
#

OHHH THIS WHY

#

let me fix this wait back

undone falcon
#

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 !

storm hinge
storm hinge
# tribal bough thats what we all are trying to make you understand
{
  "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
tribal bough
storm hinge
# tribal bough 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

tribal bough
#

this will work

storm hinge
# tribal bough 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
bitter lance
#

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.

cobalt tangle
cobalt tangle
rapid geode
#

in pycord its
await ctx.defer()

cobalt tangle
#

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)
fringe socket
#

Not necessarily

cobalt tangle
bitter lance
#

I use pycord

fringe socket
#

I believe both exist in pycord

rapid geode
cobalt tangle
fringe socket
#

^

cobalt tangle
bitter lance
#

yep thanks guys

cobalt tangle
cobalt tangle
rapid geode
#

my bad

fervent cradle
#

Is it possible to have multiple InputTexts in a modal on the same row?

#

I have gathered it's not

proud mason
lost lodge
#

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: ![bloob](https://cdn.discordapp.com/emojis/965278115570024518.webp?size=128 "bloob")

proud mason
cobalt tangle
proud mason
#

hmm

#

dk then

cobalt tangle
lost lodge
#

?

proud mason
#

and your bot cant use emojis of servers the bot is not in

lost lodge
#

but it isn't in the title

#

it's only with custom emojis

proud mason
# lost lodge

are you sure the emoji is from one of the servers the bot is in?

lost lodge
fervent cradle
#

Would it be possible to display some kind of loading bar instead of this?

fervent cradle
young bone
proud mason
fervent cradle
proud mason
#

maybe by editing the message with emojis. maybe an embed. your choice

#

dont do it as frequently

#

maybe once every second or slower

fervent cradle
#

I suppose I could use datetime for that

young bone
#

or do you use an image

fervent cradle
#

I was just wondering if there was a native solution lol

#

that's fair, I'll figure it out w edits thanks

proud mason
lost lodge
#

Do you guys know how to link a slash command in the bot description?

lost lodge
proud mason
#

I think you can use slash command mentions but im not sure if discord will allow

lost lodge
#

like that

proud mason
#

</name of cmd:cmd_id>

lost lodge
#

and how to get cmd_id?

proud mason
#

right click on the command description

lost lodge
#

ah

proud mason
#

name of the command should be exactly how it is

lost lodge
#

the name is the command? right

proud mason
#

yea

cyan lark
full basin
#

Create the embed inside the loop and append it to an external embeds list?

young bone
cyan lark
young bone
#

you have v and need V

#

you need discord.ui.View

cyan lark
#

oh sh

#

mb

cyan lark
#

if i try to do catrgory_id?

full basin
#

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

cobalt tangle
#

They can, i don't think u understand the logic here

#

We define commands in async def

fervent cradle
#

Are you sure you're talking about embed and not embed fields?

cobalt tangle
#

When two things are defined, for example,

f = 1
f = 2
print(f)
cobalt tangle
cobalt tangle
# cobalt tangle We define commands in `async def`

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

cobalt tangle
#

?

#

Lemme see the code

#

It's probably because the role isn't cached

full basin
#

Or you don't have intents

cobalt tangle
#

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

full basin
#

You need guilds intents.

grand shard
#

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

uncut skiff
#

Is it possible to run a bot on multiple machines so if one goes down the other still stays active? Redundancy basically

grand shard
#

?

rustic parcel
#

i cant install it somehow

cobalt tangle
#

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

grand shard
#

i just watched a youtube tutorial where the creator did this and it worked

cobalt tangle
#

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

grand shard
cobalt tangle
#

It's very good

cobalt tangle
grand shard
cobalt tangle
#
  1. Try resetting the token
  2. Try Enabling SERVER MEMBERS INTENT
grand shard
#

client.run(token) this?

cobalt tangle
#
intents = discord.Intents.default() 

client = commands.Bot(command_prefix="!", intents=intents)
cobalt tangle
#

And try

grand shard
#

it works tysm !

cobalt tangle
#

Np

#

It's because ur bot needed Intents to be defined and sent to the API I believe.@grand shard

grand shard
#

ok thx

lost lodge
#

Hey guys, how can i get the second newest message that was send?

silver moat
#

.docslink discord.TextChannel.history

lost lodge
uncut skiff
#

Oh true

#

I'll attempt that

lost lodge
#

ok

#

thanks

lost lodge
lost lodge
#

do i have to add a commands before it in a cog?

fervent cradle
silver moat
#

you also can make the command visible to everyone but only usable by you.

fervent cradle
sage eagle
#

squid could you help me in another thread?

silver moat
silver moat
lost lodge
silver moat
lost lodge
fervent cradle
cyan quail
#

You sure it ain't discord.default_permissions?

#

That's separate from commands.has_permissions

silver moat
#

oops, I'm stupid

lost lodge
#

now im confused

fervent cradle
cyan quail
#

discord.default_permissions sets discord sided permissions for new commands

#

commands.has_permissions is an internal check for any command

silver moat
#

I was assuming slash commands, but it seems like you are using text-based commands

lost lodge
cyan quail
#

Yeah that looks fine

lost lodge
#

good

cyan quail
#

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

lost lodge
dry echo
#

is it possible to create server events with pycord/api?

rare ice
rare ice
#

yes

#

Does anyone know how to use topggpy's webhook manager?

dry echo
silver moat
#

I find it easier

rare ice
silver moat
#

yeah

rare ice
#

where are the docs?

silver moat
#

it sends messages via a discord webhook

rare ice
#

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

silver moat
#

exactly, so you receive stuff in on_message

proud mason
#

good idea tbh

silver moat
#

make sure to have it mention your bot so you don’t need message content

proud mason
#

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

silver moat
#

is it just me that uses a private guild with 50 channels to communicate between bots

fervent cradle
#

do embed fields have inline default value set to true?

fervent cradle
#

uh ok thanks

stark crater
#

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?

full basin
#

Databases.

#

And your second question doesn't make sense.

stark crater
#

like

rugged lantern
#

yes we get it- but it is not specific at all and also read the rules

stark crater
full basin
#

No?

#

Just explain what you mean

rugged lantern
#

you update a database like you normally update one- that it's called by a command does not interfere with anything

stark crater
#

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?

rugged lantern
#

learn how to use a database and let your brain figure out the rest

#

sqlite is easiest

stark crater
#

Ok

#

Thank you

fervent cradle
#

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

rugged lantern
#

the same way u'd get the id of any other message

fervent cradle
#

i thought that would be a differnet id than the original message id

severe comet
#

Anyone have a good driver recommendation for MySQL?

fervent cradle
#

yep they are different

#

is this even possible ?

rugged lantern
#

tf u mean is this even possible

copper dew
#

for postgres, asyncpg

severe comet
copper dew
full basin
#

Read the docs.

fervent cradle
full basin
#

.docslink discord.Interaction

winter condorBOT
fervent cradle
full basin
#

You're literally looking for the message ID

fervent cradle
#

Yes

full basin
#

And I'm giving you an answer. Get down your sassy attitude.

fervent cradle
#

bro what?

full basin
#

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

fervent cradle
#

sorry if i came off sassy

#

you're right

#

sorry if i came off sassy my bad bro

full basin
#

Learn how to read and read the docs. Won't literally spit the answer for you when you have eyes.

fervent cradle
#

alright nvm fuck u

#

freako

rugged lantern
#

lil bro got issues

silver moat
#

Please keep general conversations to their respective channels

west pebble
#

is the commands cooldown on a per user usecase or is it a serverwide cooldown

silver moat
west pebble
west pebble
#

ooh cool

#

so if i set it to guild. it would be server wide cool

silver moat
#

yes

fervent cradle
#

i've been waiting for a bit now and this stays, did i do something wrong?

fervent cradle
#

but it works again

#

no idea what happened

#

🤷

young bone
#

lul

proud pagoda
#

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

cyan quail
#

Basically their way of preventing a desync when devs update commands

cobalt tangle
#

That's the issue

unborn veldt
#

How can i edit slash_command’s message?

#

Hey, anyone can help me?

copper dew
#

the interaction?

unborn veldt
#

like this

#

i want to edit this message

young bone
#

You mean you want to edit an embed?

unborn veldt
#

Can I do this?

young bone
#

Yes

unborn veldt
#

how?

#

OwO

unborn veldt
severe comet
#

Do buttons expire if I don't specify a timeout? Like will it last as long as the bot is online?

unborn veldt
#

i tried

#

about 3min

severe comet
#

Guess I have to do it the Persistent View way

pseudo dawn
#

Has somebody experienced problems when subclassing? I did encounter a strange error. I detailed the things in #1034020574420283404 .

cobalt tangle
#

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?

full basin
pseudo dawn
#

How many slash commands can you have?
Is there still a limit like in the past days?

pseudo dawn
young bone
tiny wagon
#

then 200 commands?

pseudo dawn
#

We'll see

tiny wagon
#

or net listed commands are 100 max

kindred sail
#

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

autumn goblet
#

Hello!
Can you please tell me how to get locale and guild_locale using interaction?

pearl sail
#

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

round rivet
#

on_message does the command handling

#

you can override the default event and move process_commands though

proud mason
kindred sail
#

yep

proud mason
#

iirc, they have the same limits

kindred sail
#

thats just global, you can have that per guild as well

proud mason
#

so 62.5k + 62.5k

#

so 125k cmds right

kindred sail
#

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

proud mason
light sky
#

if a member boosted a server twice does guild.premium_subscribers has them listed twice?

cyan quail
#

i don't think the api offers the amount of times someone's boosted

light sky
#

ok ty

verbal gulch
#

Hello. Why i get this error?

#

(i can also give the code, just ping me)

cyan quail
verbal gulch
cyan quail
#

bruh

#

upgrade to 2.2.2

verbal gulch
#

Ok

#

Thanks

fervent cradle
#

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
rugged lantern
#
names = ""

for row in tkm:
    names += f"<@{row.id} >> ({row.id}) \n"
await ctx.respond(names, ephemeral=True) 
#

directly equivalent to that

fervent cradle
rugged lantern
severe comet
fervent cradle
#

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

lost lodge
#

Guys, how can i link a channel in a embed, i rember somthing like this <channel_name:channel_id>

proud pagoda
proud pagoda
woeful spindle
vapid pumice
#

@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.

proud mason
#

what if i send multiple buttons with same custom id?

simple canopy
#

Is it possible to prevent console error message if global check for command fails?

#

💀

#

oh well i figured it out.

meager mica
#

hey so it said perms only work for top level commands

#

is there a workaround

#

becuz this bot might go above command limit

rugged lantern
#

read ffs

rugged lantern
#

great. that gives you something to work on for the next month or so

fervent cradle
#

Can I run slash command code and normal command (with prefix) code in same file using pycord?

#

any possibility?

silver moat
fervent cradle
copper dew
cobalt tangle
#

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?

young bone
cobalt tangle
#

Ty

fringe socket
#

Is there a way I can place my bot token in a separate file so that I can not have it visible constantly?

full basin
#

Because they use default avatars. Use display_avatar instead of avatar

full basin
#

Read the error

full basin
#

It was for another guy. Looks like he deleted the message.

naive steppe
#

i use a try except on pfp and banner when grabbing them

full basin
#

Oh you can, lol.Cool

fervent cradle
#

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)
rugged lantern
west pebble
fervent cradle
fervent cradle
west pebble
#

No. I was kidding. I was just guessing

rugged lantern
rugged lantern
fervent cradle
fervent cradle
fervent cradle
#

@rugged lantern is this the wey bot = commands.Bot(command_prefix='>',intents=discord.Intents.all())

#

sorry ping

fervent cradle
#

thanks

west pebble
#

Look at the command extension tab

fervent cradle
#

in visual studio code

young bone
#

Can you show the pip list?

fervent cradle
#

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

west pebble
#
from discord.ext import commands
fervent cradle
#

if this is fine

fervent cradle
#

thanks

fervent cradle
#

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)

rugged lantern
hybrid oasis
#

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!

fervent cradle
#

i am rely cant see it

silver moat
hybrid oasis
#

ooh perfect, i am also making a pokemon-ish game XD

hybrid oasis
#

my game is just one cog that interfaces with all the game functionality, looks like this poketwo is lots of cogs!

fervent cradle
#

ok

hybrid oasis
#

this is great thank you @silver moat ❤️

silver moat
fervent cradle
#

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()
silver moat
#

no

fervent cradle
silver moat
#

if you want to make your bot play stuff inside a voice channel iirc

fervent cradle
#

ok

copper dew
#

PyNaCl is used for voice support

fervent cradle
#

well this was unexpected

#

i cant search anything

#

why this sey this wrong

fervent cradle
fervent cradle
#

tested

#

its dosent work

#

discord is discord.ext

fervent cradle
fervent cradle
#

i use too new python 3.11

#

works fine on 3.11 for me i unno

#

ok

#

but alright cool

fervent cradle
fervent cradle
#

ok

#

thanks

copper dew
#

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

drowsy python
#

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

deep flax
#

i got some weird error message

#

can you guys help me to figure out what it is?

young bone
deep flax
fervent cradle
#

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

young bone
deep flax
#

i think that worked

#

tysm

loud holly
#

Docs down?

#

uhhh

#

loving the new style

alpine crag
#

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).

proud pagoda
#

That's a dpy thing, not a pycord thing

alpine crag
#

Alright, and the await should still work?

proud pagoda
#

Which await?

alpine crag
#

On line 15

#

Of the event_onready.py

rugged lantern
alpine crag
#

I have

#

But await is only allowed within async functions

rugged lantern
#

you're not supposed to await the add_cog

alpine crag
#

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

safe stirrup
#

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

rugged lantern
#

the same way you do it normally?

#

you need \n after yml

lost lodge
#

Hello, how can i create something like that?

winter condorBOT
verbal marten
#

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

meager mica
#

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

verbal marten
#

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'

verbal marten
#

It is probably your bot taking too long to respond, if you say it stops happening if you defer the response

meager mica
#

yes its just weird i never see it not respond

meager mica
#

are embed descriptions optinal or required i dont see the docs say anyhing about it

simple canopy
#

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.

meager mica
#

ohhhhh

#

thats really cool

fervent cradle
#

cant do anything on it

meager mica
#

does members have attribute date_joined or somthing i cant find any on docs or do i have to store it manually

naive steppe
#

Yes

#

Tho i believe its typed different

meager mica
#

oh i think i got

#

joined_at

naive steppe
#

Joined_at i think

meager mica
#

thanks

naive steppe
#

👍

rotund current
#

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?

rotund current
#

Really. Is there a place in the docs that I can find how to do it?

silver moat
#

.docslink discord.AutocompleteContext

errant craneBOT
#

Here's the slash autocomplete example.

silver moat
#

@rotund current

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

naive steppe
#

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

fallow hawk
#

how would i go about getting the value of something that looks like "{\"JoinInProgressData\":{\"request\":{\"target\":\"INVALID\",\"time\":0},\"responses\":[]}}" ?

simple canopy
#

you can use json.loads() to make it usable

safe stirrup
#

I'm boutta fight my server

fallow hawk
rare ice
safe stirrup
#

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

simple canopy
safe stirrup
#

Otherwise I can send it all

fallow hawk
#

i just realized i cant do anything since its a string lol

#

the whole thing

echo pond
#

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.

echo pond
#

^ figured out what the issue was (I was putting in a string instead of a int)

pseudo dawn
#

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...

cyan quail
verbal marten
#

Is there any way I can limit context menu commands to show in the menu in specific channels only?

pseudo dawn
young bone
pseudo dawn
full basin
verbal marten
full basin
#

Lmao. Sorry mich

#

You want to make your second response slower?

#

Your channel is None

tiny wagon
#

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?

fervent cradle
#

pls help

fervent cradle
#

and why my pip commanmd dosent work

buoyant pier
#
@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?

fervent cradle
#

.tag install

winter condorBOT
#

pip install py-cord

fervent cradle
#

there is all errors

still helm
#

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?

fervent cradle
#

can eny one help me check the frist message

proud mason
#

you are looking for that

#

do that

still helm
#

last line?

proud mason
#

wait no

#

thats some fucked up variable naming ngl

rare ice
# safe stirrup

You don’t even have Discord installed according to your DM

#

.tag install

winter condorBOT
#

pip install py-cord

proud mason
#

tbh

still helm
#

also last line?

proud mason
fervent cradle
wary rover
#

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

fervent cradle
safe stirrup
#

Oh oh

#

I see what you're saying

rare ice
#

Dude, you still need to install Pycord. How do you expect to use it if it’s not installed AYS_Hmm

#

.tag install

winter condorBOT
#

pip install py-cord

safe stirrup
#

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.

young bone
#

and how should we help you?

safe stirrup
#

Did you add checks to see where it's failing

rare ice
#

.tag idw

winter condorBOT
#

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.

rare ice
#

You need to respond to the interaction with a response

#

According to your code you aren’t

young bone
#

use try and except...

rare ice
#

They need to respond to the interaction

#

ctx.respond

#

i really hope you have read the docs before

rugged lantern
safe stirrup
#

There are docs?

#

Jk. :#

young bone
#

Can I use the persistent only with a View class?

full basin
#

That's the only thing you can persist isn't it

young bone
#

I was trying it with py button = ...

slender shuttle
#

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]

silver moat
#

if you mean ctx as in ApplicationContext, you can use ctx.interaction.locale

wary rover
#

I can't get the "Locale" variable from this event.

silver moat
#

you were not supposed to.

#

and the best is the guild's locale

wary rover
#

I think I'll give up if there's no way

silver moat
#

discord only gives the users' locale in an interaction. it is otherwise inaccessible

wary rover
#

Okay, thanks @silver moat 🙂

silver moat
#

you're welcome

hybrid oasis
#

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?

cyan quail
hybrid oasis
#

hmm i'm thinking at least 50, probably 100-150

cyan quail
#

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

hybrid oasis
#

so i'll probably just make a config file with the emoji separated by server, and refer to the emoji ID from there

cyan quail
#

it doesn't even need to be separated by server

#

but if you want to then go ahead

hybrid oasis
#

oh yeah, i want to categorize them like "fish," "items" etc

cyan quail
#

isee

hybrid oasis
#

so many servers to add 😦 should i just waste money boosting one XD

cyan quail
#

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

hybrid oasis
#

discord bill getting so big lol i think i will just make a boosted server

cyan quail
#

like py class Fish: bass = 1034827843441545306or something

#

fair enough

simple canopy
#

Well, bot can use any emojis from any server, so you can just create empty servers with emojis

rugged lantern
#

inb4 they change it so you need to have nitro to even use custom emojis for bots

somber remnant
#

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 :)

fervent cradle
#

Any help

woeful spindle
#

kinda off topic but does anyone know any packages which convert seconds into things like "1 minute" if my seconds = 60?

woeful spindle
# copper dew pytimeparse?

looked it up on pypi and it seems kinda confusing, I got recommended humanize and this seems to be working.. but thank you :)

safe stirrup
#

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.

simple canopy
#

should i somehow configure sentry to work better with async? PeepoThink
oh well, it seems to configure itself

safe stirrup
#

Oh.

safe stirrup
merry briar
#

How many add_files can be made in total?

safe stirrup
#

Frankly though, Async often confuses me, but I am easily confused.

cyan quail
merry briar
cyan quail
#

25

craggy nest
#

anyway to message the user that invited the bot on join?

silver moat
#

you can fetch the audit log for who invited your bot and message them

craggy nest
#

smart

silver moat
hushed ledge
#

One message removed from a suspended account.

#

One message removed from a suspended account.

silver moat
hushed ledge
silver moat
hushed ledge
#

One message removed from a suspended account.

silver moat
#

so you would have to fetch the invites and compare the invite changes

meager mica
#

it seems

#

1024102454943559700 is what it returns

#

1024102454943559730 is what it is when i click copy id

meager mica
fringe socket
#

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

young bone
#

I see you so many times in this channel

full basin
#

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

round rivet
#

dict has keys of target (user/role) and values of PermissionOverwrite

full basin
#

So basically I provide a user or role object

#

user = ctx.author
overwrites = {user: discord.PermissionsOverwrite(read_messages=False)"}```?