#General Help

1 messages · Page 14 of 1

crimson coral
#

there's no one liner for that

sage birch
#

Do I use a counter or something in the check?

earnest rampart
#

my pycord isnt working

#

at all

#

i do import discord

#

and its jsut an error

#

ive reinstaslled etc

#

and nothing works

crimson coral
#

what error

earnest rampart
crimson coral
#

well

sudden path
#

That's where limit= goes

crimson coral
#

not quite, limit is the maximum amount

#

checks can force the actual purge to be lower than the limit you set

earnest rampart
crimson coral
sudden path
#

You're right

#

Misread the doc

earnest rampart
#

pip install py-cord

#

[y -3 -m pip install -U py-cord

crimson coral
#

you're probably mixing up python versions

#

what python version are you trying to run your bot on

slender lintel
#
async def info(ctx):
    embed=discord.embed(title="Bot Info", description="Hello! Here is some useful infomation about me.\n I run through slash commands and i am created by jack. here is my commands \n /ip - Sends our minecraft SMP IP \n  /ping - Stats of the bot \n /nick - Used to change someones nickname \n /say - Sends a message of your choice through the bot \n /bean - Fake bans someone \n /dm - dms anyone your chosen message through the bot", color=discord.Color.blue())``` Why am i getting 'Invaild interaction slash command' or something cant renember the full name of the error
earnest rampart
#

ive got 3.10 and 3.8 installed

crimson coral
#

what are you trying to run your bot on

earnest rampart
#

dont

#

know

slender lintel
#

guys how do i make inputs in slash cmds?

    @commands.slash_command(name="embed", description="Sends a nice looking customisable embed", guild_ids=[guild_id])

async def sendembed(self, ctx, title: discord.Option(discord.SlashCommandOptionType.string), content: discord.Option(discord.SlashCommandOptionType.string)):

just gives me an error

earnest rampart
#

how do i find that out @crimson coral

crimson coral
#

run this py import sys print(sys.version)

#

before anything else

earnest rampart
#

ok

slender lintel
earnest rampart
#

3.8

#

@crimson coral

crimson coral
sage birch
slender lintel
# slender lintel add the line ```py await ctx.respond(embed=embed) ``` You aren't doing anything ...

Sorry i have this forgot to copy and paste it heres the correct code

async def info(ctx):
    embed=discord.embed(title="Bot Info", description="Hello! Here is some useful infomation about me.\n I run through slash commands and i am created by jack. here is my commands \n /ip - Sends our minecraft SMP IP \n  /ping - Stats of the bot \n /nick - Used to change someones nickname \n /say - Sends a message of your choice through the bot \n /bean - Fake bans someone \n /dm - dms anyone your chosen message through the bot", color=discord.Color.blue())
    await  ctx.send(embed=embed)```
crimson coral
#

^

earnest rampart
#

thanks

crimson coral
#

all good

slender lintel
crimson coral
#

ctx.respond is required in slash command

slender lintel
#

I keep trying stuff like that then it dosent work but ill try again

slender lintel
crimson coral
#

don't use SlashCommandOptionType, just use str

slender lintel
#

ah

#

that too

#

didnt work

#

it just didnt show up

#

the slash cmd

sage birch
#

Can you send entire code?

slender lintel
#

me?

crimson coral
#

yeah we need some more context

slender lintel
#

kk lemme try what Arrakis just sent, if it don't work ill send

crimson coral
#

it's discord.Embed

#

(though do keep the ctx.respond)

slender lintel
#

thanks

#

okay, it seems like reloading a cog dosen't update slash cmds

#

yeah i did have respond at first, I changed to send to try fix it

slender lintel
sage birch
#

Cogs

deep grail
#

Is it possible to send a modal from a prefixed command without using an interaction from a view to send the modal?

crimson coral
slender lintel
deep grail
crimson coral
#

huh hold on

slender lintel
#

how do i make optional inputs?

#

slash cmd

crimson coral
#

required=False

#

if you're using discord.Option

slender lintel
#

ty\

crimson coral
deep grail
slender lintel
#

how do i make an input a user mention?

#

slash cmd

sage birch
crimson coral
sage birch
slender lintel
sage birch
#

Yes

crimson coral
#

it's generally done with a loop

deep grail
crimson coral
deep grail
#

Oh ok thanks for your help

crimson coral
#

all good

slender lintel
crimson coral
#

then for cog in cogs... and you know the rest

slender lintel
#

so, bot.load_extension('cogs.greetings', 'cogs.bans')

crimson coral
#

nono a for loop

slender lintel
#

Sorry, Can you repeat im confused

crimson coral
#
for cog in cogs:
   bot.load_extension(cog)```
sage birch
#
for filename in os.listdir('.'):
  if filename.endswith('.py'):
    bot.load_extension(F'Cog.{filename[:-3]}')
#

👀

crimson coral
#

or that i guess yeah

slender lintel
#

What way is better out the 2?

crimson coral
#

the latter works if you always want to load every cog in a folder

slender lintel
#

yeah

slender lintel
#

then it checks every folder with .py

#

and uses that

sage birch
#

No it checks current folder for all Python files

#

If you only want to load Cogs for certain files, then use Nelo's method

slender lintel
#

alr

slender lintel
# crimson coral ```py for cog in cogs: bot.load_extension(cog)```
from discord.ext import commands

class Greetings(commands.Cog): # create a class for our cog that inherits from commands.Cog
    # this class is used to create a cog, which is a module that can be added to the bot

    def __init__(self, bot): # this is a special method that is called when the cog is loaded
        self.bot = bot
``` Do i add this for each file at the top? (Obviously change greetings to the correct word)
#

oh mb

sage birch
#

You need

def setup(bot):
  bot.add_cog(ACog(bot))

at the bottom of each file with a Cog

slender lintel
sage birch
#

Where you replace ACog with the Cog name

crimson coral
#

? that's the right cog format

slender lintel
crimson coral
#

setting default automatically makes it optional

sage birch
#

Sorry I misread earlier

sage birch
#

In main.py you only need to load the cogs by using bot.load_extension(cog), for each file you will need

class ACog(commands.Cog):
  def __init(self, bot):
    self.bot = bot

  # Code here

def setup(bot):
  bot.add_cog(ACog(bot))
slender lintel
sage birch
#

Yes

slender lintel
#

thanks

#
---------------------
---------------------
Ignoring exception in on_connect
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.10/site-packages/discord/client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "/home/container/.local/lib/python3.10/site-packages/discord/bot.py", line 1042, in on_connect
    await self.sync_commands()
  File "/home/container/.local/lib/python3.10/site-packages/discord/bot.py", line 644, in sync_commands
    registered_guild_commands[guild_id] = await self.register_commands(
  File "/home/container/.local/lib/python3.10/site-packages/discord/bot.py", line 529, in register_commands
    registered = await register("bulk", data, _log=False)
  File "/home/container/.local/lib/python3.10/site-packages/discord/http.py", line 359, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 2: Application command names must be unique
Cog : Listeners.py Loaded
Cog : Server.py Loaded
Cog : Fun.py Loaded
Cog : Listeners.py Loaded
Cog : Admin.py Loaded
Cog : Info.py Loaded
---------------------
Connected to Discord!
---------------------

it dosen't tell which cog

#

or cmd

slender lintel
sage birch
#

def __init__

#

You're missing the space

slender lintel
#

Oops didnt mean to send twice

#

and yeah i noticed that so fixed it

sage birch
#

Indent for self.bot = bot

slender lintel
#

done

sage birch
#

Indent command code

#

So that it's in the class

#

Unindent setup(bot) so it's outside the class

slender lintel
#

Have i indented too far

sage birch
#

Yes command code should be in the class but not in init

slender lintel
#

lol i think ive confused myself

sudden path
#

He said not in the init

crimson coral
sage birch
#
class ACog(commands.Cog):
  def __init(self, bot):
    self.bot = bot

  @bot.slash_command(name="ping", description="Info about bot")
  async def ping(ctx):
    await ctx.send("The str here")

def setup(bot):
  bot.add_cog(ACog(bot))
crimson coral
#

just look through your list and see which of your cogs isn't there

slender lintel
sage birch
#

Hmm, I was wondering, is there any way to mention the Text in Voice channel? Or do I just meniton the Voice Channel?

slender lintel
sage birch
#

You didn't import Pycord stuff

slender lintel
sudden path
#

You don't use @bot.slash_command

#

You import slash command from discord.ext and use that

crimson gale
sage birch
#

from discord.commands import slash_command

slender lintel
#


class ACog(command.Cog):
  def __init(self, bot):
    self.bot = bot

  @command.slash_command(name="ping", description="Info about bot")
  async def ping(ctx):
    await ctx.send("The str here")

def setup(bot):
  bot.add_cog(ACog(bot))``` I have no errors anymore just wanna check this is right
#

Oh ill update to slash_command

#


class ACog(slash_command.Cog):
  def __init(self, bot):
    self.bot = bot

  @slash_command(name="ping", description="Info about bot")
  async def ping(ctx):
    await ctx.send("The str here")

def setup(bot):
  bot.add_cog(ACog(bot))```
crimson coral
#

it'd be the regular voice channel mention

sage birch
#
from discord.commands import slash_command
from discord.ext.commands import Cog

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

  @slash_command(name="Ping"):
    # code
#

Oh I see

#

Thanks

crimson coral
#

at least the library does support them

slender lintel
#

Why do i get bot is not defined, Should i add bot = Discord.bot or smth]

crimson gale
#

self.bot.latency

#

async def ping(self, ctx)

slender lintel
#

thanks!

crimson gale
#

also indentation

slender lintel
#

at await ctx?

crimson coral
# slender lintel any idea?

you should catch the exception and override the error logic when loading
e.g py try: self.load_extension(cog) print(f'loaded {extension}') except Exception as e: print(f'failed to load {extension}') traceback.print_exc() or something like that, you might have your own preferences for errors

slender lintel
#
  File "C:\Users\jackd\Documents\Felbcord Py\main.py", line 18, in <module>
    for cog in cogs:
TypeError: 'module' object is not iterable``` ```for cog in cogs:
   bot.load_extension(cog)```
#

ahh tysm

slender lintel
#

I have import cogs

#

at the top of my file

crimson coral
#

yeah but what did you define it as

slender lintel
#

near the top*

crimson coral
#

uhhh

slender lintel
#

is that wrong?

crimson coral
#

is cogs meant to be your folder

#

or a list of cogs you want to load

#

or what

slender lintel
crimson coral
#

so did you define this list

slender lintel
#

I dont think i did, no

crimson coral
#

ok lets go with the alternative method suggested earlier

crimson coral
#

yep, needs some changes though

#

since you're loading from another folder called cogs, we want os.listdir("cogs")

#

and in load_extension, you want cogs.{filename[:-3]}

slender lintel
crimson coral
#

yep

#

listdir commands, command.filename etc.

slender lintel
#

yeah

slender lintel
crimson coral
#

yeah you can ignore it

slender lintel
#

alright

slender lintel
crimson coral
#

all good

slender lintel
# crimson coral all good

Sorry to bother you again, I had 2 peices of the same code in the ping.py and in my main file from before i added all this, Then removed from my old file because when running /ping it ran the reply twice.. now it dosent show the slash command at all

#

@crimson coral

#

any1 else know?

slender lintel
#

how do i add options for a slash cmd?

#

Hey how can I check if the bot has the necessary rights to kick or ban a user?

slender lintel
crimson gale
#

takes a list of the matching type

#

max 25 elements

#

you can also provide a list of OptionChoice to allow code to have an internal value to refer to

deep grail
#

How do I run a function every time a command is run in a cog?

#

I remember that there is some method that you can have in a cog that will run before a command is run it that cog

slender lintel
deep grail
ancient gazelle
#

How do I get last n messages in a channel?

steep verge
steep verge
#

2nd one is what you’re looking for

#

async for message in channel.history()

steady lotus
#

is it possible to register the same command name for different guilds but the option choices are different

slow dome
mental rampart
#

How can you make a slash command cog

slender lintel
slow dome
slow dome
slow dome
#

make it a guild command by adding the guild_ids attribute

mental rampart
slender lintel
slender lintel
slow dome
#

guild_ids=[ids]

crimson gale
#

theyre ints too dont forget

slender lintel
# slow dome guild_ids=[ids]

bot = commands.Bot(command_prefix='!', intents=discord.Intents.all(), debug_guilds=[965533467557371944,933803468815204372,964126154774679582]) Ive got this in my main file, is this the same thing?

slow dome
#

yes, but sometimes, discord is weird

slender lintel
slow dome
#

no

slender lintel
#

Just remove the same code?

slow dome
#

yes

slender lintel
slow dome
#

what py-cord version

slender lintel
#

Is it not connecting the folder right or what?

async def ping(self, ctx):
    await ctx.send(f'My ping is ' + format(round(self.bot.latency, 1)))```
```for filename in os.listdir('commands'):
     if filename.endswith('.py'):
         bot.load_extension(F'commands.{filename[:-3]}')```
slender lintel
slow dome
slender lintel
slow dome
#

and from that, you get bot as a member object

slender lintel
slow dome
#

the bot's permissions

slender lintel
#

ok thanks

#

:(

crimson gale
glass nova
ancient gazelle
#

How can I get all the reactions from a message? And with list of members that reacted on it?

slender lintel
crimson gale
#

the exact same things as ClientUser but more

slender lintel
steady lotus
#
callback = discord.SlashCommand(
                func=self.custom_command_callback,
                name=name,
                callback=self.custom_command_callback,
            )```
#
async def custom_command_callback(self, ctx):
        print("test")
        await ctx.respond("test")```
#

discord.errors.ExtensionFailed: Extension 'modules.cogs.fun' raised an error: ClientException: Callback for one command is missing "context" parameter.

#

anyone know why its giving missing context error

crimson coral
slender lintel
crimson coral
#

where are you loading it

slender lintel
#

Just below my bot = commands.Bot(command_prefix=! ect

#

cant be bothered typing it all

crimson coral
#

did you invite the bot with applications.commands scope

slender lintel
slender lintel
#

All my other slash commands that are still in my main file work

#

@crimson coral ?

crimson coral
#

can you show the full cog file

slender lintel
slender lintel
# crimson coral can you show the full cog file
from discord.ext.commands import Cog

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

@slash_command(name="ping", description="Sends bot ping")
async def ping(self, ctx):
    await ctx.send(f'My ping is ' + format(round(self.bot.latency, 1)))
def setup(bot):
    bot.add_cog(ACog(bot))```
crimson coral
#

ah....

#

i think you're still misunderstanding

#

the command has to be inside the ACog class

#

with your current indentation, it's outside

#

it should be inline with def __init__

slender lintel
#

twice

#

@crimson coral ?

crimson coral
#

hmm

crimson coral
slender lintel
#

I keep forgetting that

crimson coral
#

do you have a second ping command somewhere?

slender lintel
#

I dont, I removed it from my main file

crimson coral
#

well try that change first

slender lintel
#

alr

slender lintel
crimson coral
slender lintel
#

yep

crimson coral
slender lintel
crimson coral
#

ah right, was just checking

slender lintel
#

alr

steady lotus
#

custom command per guild hmm

#

cause the command name will be stored in a db and loaded for that guild on bot load

deep grail
#

Is there any way to see who added my bot to their server?

slender lintel
crimson coral
#

hmm

crimson coral
deep grail
#

Ok thanks

crimson coral
slender lintel
crimson coral
#

sure

slender lintel
#

btw the bot.run is there i removed it for obvious reasons

crimson coral
steady lotus
#

no because the command name isnt hardcoded

crimson coral
#

hmm

steady lotus
#

the callback is however

crimson coral
#

i think you're better off forming it via application_command instead

steady lotus
#

i mean even if its just the command choices

#

that works

ancient gazelle
#

How can I get all the reactions from a message? And with list of members that reacted on it?

crimson coral
ancient gazelle
#

Here message is supposed to be an object of a message right?

crimson coral
slender lintel
burnt monolith
#

When I try to respond after a modal submission I always get: 404 Not Found: Unknown Interaction


class Submit_Answer(discord.ui.Modal):
    def __init__(self, bot, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self.bot = bot
        self.add_item(discord.ui.InputText(label="Your Answer"))
    

    async def callback(self, interaction:discord.Interaction):
        await interaction.response.defer()
        print("callback executed")

        embed = discord.Embed(title="Your Modal Results", color=discord.Color.random())
        embed.add_field(name="First Input", value=self.children[0].value, inline=False)
        await interaction.response.send_message(embeds=[embed])
crimson coral
#

yes hold on

slender lintel
steady lotus
#

I saw rapptz did this for prefix commands and it worked

#

Slash commands just wanna be different

crimson coral
#

well they kinda have to be apensive

#

it probably won't be too different, but just enough to be annoying lol

steady lotus
#

Inherit application command and add a custom implementation for invoke()?

crimson coral
#

my train of thought was to see what the @slash_command decorator does

    def application_command(self, **kwargs):
        """A shortcut decorator that invokes :func:`command` and adds it to
        the internal command list via :meth:`~.Bot.add_application_command`.

        .. versionadded:: 2.0

        Returns
        --------
        Callable[..., :class:`ApplicationCommand`]
            A decorator that converts the provided method into an :class:`.ApplicationCommand`, adds it to the bot,
            then returns it.
        """

        def decorator(func) -> ApplicationCommand:
            result = command(**kwargs)(func)
            self.add_application_command(result)
            return result

        return decorator```
#

it makes more sense in the file context

crimson coral
crimson coral
#

like maybe there's an instance of the bot running somewhere else that you forgot to turn off

slender lintel
#

hold up

slender lintel
#

sorry for wasting ur time, but thanks :D

crimson coral
#

all good

slender lintel
# crimson coral all good

also hopefully im not annoying u xd, I have a command so
/nick (member) (name) but how would i make it change it to a variable so it changes to 1 specfic name

crimson coral
#

well

#

this is your current code py @bot.slash_command(name = "nick", description = "Change nickname of a user") async def nick(ctx, member: discord.Member,*,name)

#

so you can just remove *,name and set it to whatever you want

#

in the member.edit

burnt monolith
crimson coral
#

hmmm odd

#

let's see

burnt monolith
#

If I leave the defer there, I get the error where the interaction.defer is

slender lintel
crimson coral
#

oh i see now lol

crimson coral
#

(it always required a title anyway, but it's now a kwarg instead of first argument)

slender lintel
burnt monolith
crimson coral
#

send_modal doesn't work on followup

#

it's only a part of response

slender lintel
# crimson coral yeah pretty much
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'commands.say' raised an error: ClientException: Cog named 'ACog' already loaded``` (when trying to add another command file/cog)
burnt monolith
crimson coral
#

are you not getting any errors..?

burnt monolith
#

well with the followup i did haha
I just tried some random things hoping it would work xD

#

with .response.modal I get the unknown interaction

crimson coral
#

can you show the full command code

#

oh right you made a post, we can continue there

clever lava
#

how to make name spaces in slash commands

#

for example

#

/help command1

crimson coral
#

only possible on message/user context commands

#

oh right

#

that's slash groups

clever lava
#

hmm

#

interessing

slender lintel
crimson coral
#

uhhhhhhhhh

slender lintel
slender lintel
#
from discord.ext.commands import Cog

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

    @slash_command(name="say", description="Repeats input")
    async def say(ctx, message):
     if ctx.author.guild_permissions.read_messages:
        await ctx.send(message)
def setup(bot):
    bot.add_cog(SayCog(bot))```
burnt monolith
steady lotus
#

but now im running into the command not being registered haHAA

crimson coral
#

hey at least you're getting close... haha....

crimson coral
slender lintel
slender lintel
steady lotus
crimson coral
#

eyy nice

steady lotus
#
    def __init__(self, bot: "DiscordBot"):
        self.bot = bot

    @commands.Cog.listener()
    async def on_ready(self):
        print(f"{__name__} loaded.")
        for name in ("one", "two", "three"):
            # discord.SlashCommand
            print(inspect.signature(self.custom_command_callback).parameters)
            callback = commands.slash_command(name=name)(self.custom_command_callback)
            callback.callback = self.custom_command_callback

            self.bot.add_application_command(callback)  # s
            # loop = asyncio.get_event_loop()
            await self.bot.register_commands([callback], force=True)

        print(self.bot.get_application_command("one"))

    async def custom_command_callback(self, ctx, *args, **kwargs):
        print("test")
        await ctx.respond("test")```
#

**kwargs is required for some reason

#

but other than that

#

it works

crimson coral
#

wait

#

...registering commands in on_ready isn't meant to work

steady lotus
crimson coral
#

...oh well if it aint broke

steady lotus
#

well it did

crimson coral
#

the wonders of discord

steady lotus
#

it didnt want to work in __init__

#

cause the bot user wasnt registered

#

it was raising attribute error

#

fixed kwargs being required

#

by just forcing options to be an empty list

#

now hopefully theres no pycord update that breaks this

crimson coral
#

laughs in potential command rewrites

steady lotus
#

fuck

#

i spent a long time on this

crimson coral
#

well we can worry about that if it actually happens

late fjord
#

Question, does role.edit() create a new role based on the old roles parameters and delete the old one therefore giving the new role a different id or just change the role keeping the same id?

sudden path
#

It edits a role

ancient gazelle
#

Question: Trying to create a ticketing system, i have a channel set as a template with all the roles issued. My plan is to clone it with a new name and add the user to its permissions. My only problem is idk how to add the user to its perms. Any help with that?

desert dagger
#

b!rtfm pyc create channel

steady lotus
#

for bridge commands, is it only possible to get prefix commands context only no matter what called the command

#

instead of slash or prefix

desert dagger
#

@ancient gazelle

#default_role basically refers to @everyone
# guild.me affects the person   aka you
perms= {
    guild.default_role: discord.PermissionOverwrite(read_messages=False),
    guild.me: discord.PermissionOverwrite(send_messages=True)
}

channel = await guild.create_text_channel(f'{ctx.author.name}', overwrites=perms)
ancient gazelle
#

I don't want the user to have perms of creating a channel.

ancient gazelle
#

Basically in the clone channel i want to add them as they can see it and send messages to it. Which they won't be able to in the clone channel.

desert dagger
#

workflow:

  • clone template channel
  • add them to cloned channel
  • delete clone channel at the end?
ancient gazelle
#

Yes.

desert dagger
#

why

#

that isnt a really effective way. what if someone deletes the clone channel?

#

plus cloned channels do nothing except copy permissions which u can get the bot to set

ancient gazelle
#

Okay so i am basically creating a private entry system for an audience that isn't really discord savvy.

#

I just want to welcome them in a private channel and have a few details pop in.

#

And if they need any help, the mods will see to it.

#

Makes sense? @desert dagger

desert dagger
#

so you want them to have a new channel with info and private contact with mod

#

Cloning channel isnt gonna be useful. cloned channels do not contain the content inside it

#

you can easily do this:

  • Slash command or button
  • creates a channel where only them and staff see
  • Embed messages are sent in channel
  • staff are opt pinged
  • close button system
ancient gazelle
#

Yes. Ik that i can send the messages anyway to the cloned ones.

ancient gazelle
#

Can you help me with this?

desert dagger
#

with what i said you can do or what ur doing?

ancient gazelle
#

If nothing else I just want a private channel that just says welcome to the server.

desert dagger
#

is english your first language?

#

b!rtfm clone

open bearBOT
# desert dagger b!rtfm clone

I couldn't find a documentation with the name clone! Maybe you used to command wrong? Correct Usage: <prefix>rtfm <docs> [<term>] (eg. b!rtfm py cool)
List of Documentations you can search:
python
pycord
discord.py
yarsaw
nextcord
disnake

desert dagger
#

b!rtfm pyc clone

ancient gazelle
#

Its fine.

#

Thanks for your help though.

clever lava
#

how do i make options for a slash command

#

like this

#

please help

stable torrent
#

you have choices param in discord.Option

stable torrent
# clever lava guys

check examples of creation slash commands in github repo, i think there was an thing with discord.Option

clever lava
#

hmm

#

ok

south ermine
#

jishaku==2.3.2 @sudden path

steady lotus
#

how do before invoke hooks work

ornate fog
steady lotus
#

so for example if i retrieve data from my database in the pre-hook, can i pass that data to the command callback

sudden path
ornate fog
#

you can assign the data to the context and read it from the command yes

steady lotus
#

icic

#

thank

near peak
#

trying to host and i keep getting this

#

same for vscode as well

slender lintel
near peak
#

i a;redy did

#

now i get this

slender lintel
near peak
#

no

#

how do install

slender lintel
#

?tag install

hearty rainBOT
#
  1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
    python -m pip uninstall discord.py discord -y

  2. Install py-cord
    python -m pip install py-cord

Installing other builds:
Note: You need to have git installed. Use !git to find out how to install git.

Updating the module to Alpha (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

Updating to release candidate:
pip install py-cord==2.0.0rc1

near peak
#

nope

#

wait

#

yup

#

its working

#

i did

#

pip install py-cord==2.0.0rc1

slender lintel
#

Oh ok

near peak
#

SUCCSES!!!

errant verge
#

if i have a command that needs the sender to have role 1 to use that gives button otions to approve or deny something , can i have it so only someone with role 2 can approve it?

#

like on button interaction if they have role

royal mantle
#

guys i'm using replit but everytime i have to uninstall discord.py

#

and reinstall pycord

slender lintel
#

Use vs code

royal mantle
slender lintel
royal mantle
#

okay

slender lintel
#

The docs tell you how

royal mantle
slender lintel
sage birch
#

Hi, is there any way to add the Server Booster role for Slash Commands?

#

I can't find it when I got to Server Settings > Integrations

errant verge
#

is it possible to use interaction.user to get their roles?

#

i.e. interaction.user.roles

sage birch
#

I guess so, but I only want to show the commands to Server Boosters

zealous brook
#

does anyone know the code for useravatar command?

#

because it doesn't work for me, i guess i dont know it lol

ancient gazelle
#

Anyone here knowing how to use discord SSO login in a website?

atomic thistle
#

Everytime when a reaction is removed and the bot gets the emoji that has been removed, emoji.animated is coming as False even if the emoji is animated. How do I fix this issue?

frigid lark
slender lintel
#

Mb

#

#983314627003809794 can someone help me there

acoustic rover
#

Hi, could somebody explain me what Role.is_bot_managed() checks and when it returns True?

sudden path
#

Whether the role is associated with a bot.

#

As in, the role that gets created when you add a bot.

acoustic rover
#

Ok, thank you.

potent tree
#

Is there a way to disable a select when timed out on View class? (Since timed out function don't get nothing)

slender lintel
#

how do I make selectable options for a slash cmd, instead of takin input

slender lintel
slender lintel
#

server: discord.Option(str, choices=["test", "test2"] )

#

would this work?

#

oh nvm

#

uhh

#

i don't get it, could you send me an example

rose acorn
#
server: discord.Option(str, choices=[OptionChoice(...), OptionChoice(...)] )
#

also new input_type layout:

#
str = server :disco......
#

and remove the str in parameter

potent tree
slender lintel
#

any idea?

#

removed str

rose acorn
#

u got too much bracketrs

slender lintel
#

still error

atomic thistle
#

I'm using the on_raw_reaction_remove event

slender lintel
#

is there a way to edit a ctx.respond msg?

rose acorn
slender lintel
#

that dosen't work.

rose acorn
#

why

#

what error

slender lintel
#
AttributeError: 'Interaction' object has no attribute 'edit'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.10/site-packages/discord/bot.py", line 993, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 357, in invoke
    await injected(ctx)
  File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 134, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Interaction' object has no attribute 'edit'
rose acorn
#

then

#

edit_original_message

#

does that?

slender lintel
#

ahh

#

does it work for ephemeral?

rose acorn
#

i think

#

test it

slender lintel
#

kk

slender lintel
rose acorn
#

potato.edit_ori...

#

wanna add so if u want more help

slender lintel
#

ah kk

#

await e.edit_original_message(content="test123eee", ephemeral=True)

#

FIXED IT

#

WORKS

#

daamn tysmm

craggy rapids
#

btw does await guild.system_channel.send(embed=embed) send embed to a system_channel?

slender lintel
#

if I have on_interaction in event, slash_commands don't work why

#

no error

delicate relic
#

commands.Greedy doesnt work with slash commands? HmmGe

slender lintel
#

it's just that if I have on_interaction in my code, slash_commands doesn't work

crimson coral
slender lintel
crimson coral
#

...it's still the same mistake

#

you keep getting the indent level wrong

slender lintel
#

bru

#

sorry

#

Indents r annoying

crimson coral
#

it's fine, just try to understand how the format works

slender lintel
#

yeah

delicate relic
#

Also, for slash commands isnt better to use ctx.respond?

slender lintel
#

yah

#

the command was made before i knew that lol

crimson coral
#

your command async def say is a class function just like def __init__, so it should be inline with it

delicate relic
#

And in cogs you need self also in the command function

crimson coral
#

yeah

slender lintel
#

What is the difference between ctx.send and ctx.respond, all i know is respond is better in slash commands

delicate relic
#

ctx.send still works, but you get a private msg, like if i rememebr correctly the interaction has failed something like that

crimson coral
#

respond is an interaction response and is required in slash commands

slender lintel
#

alright

crimson coral
#

send is just a general function to send a message to the channel

slender lintel
#

Btw, I fixed the ident but it shows although i get 'Application did not respond'

crimson coral
#

remember self as well

#

you should be seeing these errors in your console

slender lintel
slender lintel
delicate relic
#

use, ctx.respond()

crimson coral
#

^

#

and what's your code now

slender lintel
#
from discord.ext.commands import Cog

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

  @slash_command(name="say", description="Repeats input")
  async def say(self,ctx, message):
     if ctx.author.guild_permissions.read_messages:
        await ctx.respond(message)
def setup(bot):
    bot.add_cog(sayCog(bot))```
#

@crimson coral

#

Hello?

#

I think my args are wrong..

#

the message bit

slender lintel
#
from discord.ext.commands import Cog

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

  @slash_command(name="say", description="Repeats input")
  async def say(self, ctx, message):
     if ctx.author.guild_permissions.read_messages:
        await ctx.respond(message)
def setup(bot):
    bot.add_cog(sayCog(bot))``` Why isnt my bot responding?
frigid lark
#

do you have Intents?

#

and guild id?

earnest rampart
#

how do i make a custom status with guild_members

#

what is the function

#

to get the server members

slow dome
earnest rampart
pure lake
slow dome
#

command/control + f literally exists

#

and there's a search button

earnest rampart
#

ik

slender lintel
#

but this one

earnest rampart
#

idk how to get guild members

slow dome
#

bruh

slender lintel
#
from discord.commands import slash_command
from discord.ext.commands import Cog

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

  @slash_command(name = "ip", description = "Sends SMP IP")
  async def ip(ctx):
    embed=discord.Embed(title="SMP IP", description="The server ip is 51.222.130.213:25580 and the port is 25580", color=discord.Color.blue())
    embed.set_author(name="ignfoolish",url="(removed as inv link)",icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSe8Pq3771AeTs6c3kLBB589dmfERKVecUzPA&usqp=CAU")
    await ctx.send(embed=embed)
def setup(bot):
  bot.add_cog(IpCog(bot))``` It says no setup function??
slender lintel
#

u able to help me?

frigid lark
#

and (self, ctx)

slender lintel
#

bru forgot again

#

thanks

#

i am very forgetful

#

these commands are before i was told to have self and respond

slender lintel
slow dome
slender lintel
slender lintel
#

I cant figure it out

#

hm

spring wharf
#

Are buttons implemented yet?

slender lintel
#

?tag install

hearty rainBOT
#
  1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
    python -m pip uninstall discord.py discord -y

  2. Install py-cord
    python -m pip install py-cord

Installing other builds:
Note: You need to have git installed. Use !git to find out how to install git.

Updating the module to Alpha (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord

Updating to release candidate:
pip install py-cord==2.0.0rc1

spring wharf
#

cheers

slender lintel
#

install the release candidate

slender lintel
spring wharf
#

What do i put in requirements.txt just? pycord==2.0.0rc1

slender lintel
spring wharf
#

alright cheers could you link the docs for me please

#

just came from dpy to try pycord

slender lintel
#

No

#

uh

#
from discord.commands import slash_command
from discord.ext.commands import Cog

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


  @slash_command(name="bean", description="Fake bans someone")
  async def bean(ctx, member: discord.Member,*,reason):
    if  ctx.author.guild_permissions.administrator:
        await member.send('You have been banned from the felbcord! \n Join here )
        await member.send(reason)
        await member.ban()
        await member.unban()  
        await ctx.respond('I have fake banned them', ephemeral=True)

    def setup(bot):
        bot.add_cog(FakeBan(bot)) ``` this is my bean/fakeban command
#

it had a link in the msg so it deleted lol

#

well there is your problem lol

#

your setup function is inside your class

#

must be outside

#

bru

#

forgot to remove inv again 1 sec

#
from discord.commands import slash_command
from discord.ext.commands import Cog

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

  @slash_command(name = "ip", description = "Sends SMP IP")
  async def ip(self, ctx):
     embed=discord.Embed(title="SMP IP", description="The server ip is 51.222.130.213:25580 and the port is 25580", color=discord.Color.blue())
     embed.set_author(name="ignfoolish",url="",icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSe8Pq3771AeTs6c3kLBB589dmfERKVecUzPA&usqp=CAU")
     await ctx.respond(embed=embed)
        def setup(bot):
            bot.add_cog(IpCog(bot))``` is this right
#

no

#

outside of the class

#
import discord 
from discord.commands import slash_command
from discord.ext.commands import Cog

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

  @slash_command(name = "ip", description = "Sends SMP IP")
  async def ip(self, ctx):
     embed=discord.Embed(title="SMP IP", description="The server ip is 51.222.130.213:25580 and the port is 25580", color=discord.Color.blue())
     embed.set_author(name="ignfoolish",url="",icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSe8Pq3771AeTs6c3kLBB589dmfERKVecUzPA&usqp=CAU")
     await ctx.respond(embed=embed)
def setup(bot):
      bot.add_cog(IpCog(bot))```
#

and its the bean file you needd to modify

#

this file has nothing wrong

#

the reason why this command aint working is because you got an error when loading in your bean file

#

so this file was not loaded either

#

oh

#

oh i see it already

#

if i knew to look there i would have saw it straight away :/ sorry

slender lintel
slender lintel
slender lintel
#

Yes

#
     embed.set_author(name="ignfoolish",url="",icon_url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSe8Pq3771AeTs6c3kLBB589dmfERKVecUzPA&usqp=CAU")```

In here why do you have url=""?
#

I don't think the url should be blank

slender lintel
#

thats why it deleted before

#

ah

slender lintel
#

sometimes the first command doesnt respond

#

alr

#

I think i see my issue 1 sec

spring wharf
#

ERROR: Could not find a version that satisfies the requirement pycord==2.0.0rc1 (from versions: 0.0.1, 0.1.0, 0.1.1)
ERROR: No matching distribution found for pycord==2.0.0rc1

spring wharf
#

ah

#

ty

brave lagoon
#

is it possible for some server to require that the developer of the bot has 2 factor authentication enable ?

slender lintel
#

np

brave lagoon
# slow dome yes

oh and if it is not the case the bot jsut wont be able to join, or it will throw errors ?

slow dome
brave lagoon
#

I see thank you !

slender lintel
#

What should i do for bot.getchannel? if i indent it i just get errors

slender lintel
#

and you forgot self, ctx

#

also you need to do self.bot.get_channel(int(channel_id))

#

alright thanks

slender lintel
slender lintel
#

How would i do that? Is there docs to help on that part?

slender lintel
#

I believe in the pycord guide

#

it teaches this

#

let me find it

slender lintel
#
@client.command
async def reload(ctx, extension):
  bot.unload_extention(f"cogs.{extension}")
  bot.load_extension(f"cogs{extension}")```
#

thats a simple way of reloading cogs

#

alright (ive changed client to bot)

slender lintel
#

@slender lintel ?

slender lintel
#

🤦‍♂️ omg how forgetful am i

slender lintel
slender lintel
#

i think you ened to sync the commands

#

with bot.sync_commands

#

so add boy.sync where?

#

idk how to use those tho

#

i never really used a reload functionmyself

#

aalr

slow dome
#

it tends to... break

slender lintel
#

Oh okay

#

so restart when i update commands?

#

await ctx.respond(f'My ping is ' + format(round(self.bot.latency, 1)) \n f'I am in' + len(list(bot.servers))) I am getting the error bracket was not closed. but i cant see where?

steady lotus
#

await bot.process_commands() is it possible to only update register a command, so the other commands are registered, but i register a custom one for a certain server through this

slender lintel
#

Hey, how i can the content of message seen?
I have tried: await interaction.response.send_message(f"{interaction.message}") but not working.
by interaction.message.content come a error..

slow dome
slender lintel
steady lotus
#

?

#

you cant have a newline character not in a string

slow dome
#

why are you using format and f strings

#

pick one and stick with it

slender lintel
#

I still get ( was not closed

slow dome
#

smh

slender lintel
# slow dome await interaction.original_message()

Then come a error..

Ignoring exception in modal <extensions.Modal.Reports object at 0x0000020068654EE0>:
Traceback (most recent call last):
  File "C:\Users\zReaxrYT\PycharmProjects\Discord\venv\lib\site-packages\discord\ui\modal.py", line 217, in dispatch
    await value.callback(interaction)
  File "C:\Users\zReaxrYT\PycharmProjects\Discord\extensions\Modal.py", line 133, in callback
    message = await interaction.original_message()
  File "C:\Users\zReaxrYT\PycharmProjects\Discord\venv\lib\site-packages\discord\interactions.py", line 284, in original_message
    data = await adapter.get_original_interaction_response(
  File "C:\Users\zReaxrYT\PycharmProjects\Discord\venv\lib\site-packages\discord\webhook\async_.py", line 211, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
slow dome
slender lintel
#

Oh okay

#

sorry

slow dome
slender lintel
slow dome
#

So if you didn't respond with anything, it will not get an actual message

slender lintel
slow dome
#

learn python smh

slender lintel
#

bru

#

not helpful but sure

slow dome
slow dome
slender lintel
slender lintel
slender lintel
#

yes

slow dome
#

well, doesn't that context menu come with a message paramter

slender lintel
#

i have this but..

#

I have already made it so that the message comes but how should I connect it to the modal?

slow dome
#

how are you implemeting the modal

slender lintel
#

wait

#

Modal:

class Reports(discord.ui.Modal):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)

        self.add_item(discord.ui.InputText(label=f"📛› Report",
                                           placeholder="give a reason.", required=True,
                                           style=discord.InputTextStyle.long, min_length=8))


    async def callback(self, interaction: discord.Interaction):
        await interaction.response.send_message(self.children[0].value)

Context Menu:

    @message_command(name="Tests")
    async def tests(self, ctx, message: discord.Message):
        modal = Reports(title="Report")
        await ctx.send_modal(modal)
#

I mean how i can connect this?

slow dome
#

modal:

  class Reports(discord.ui.Modal):
    def __init__(self, message, *args, **kwargs) -> None:
        self.message = message
        super().__init__(*args, **kwargs)

context menu:

    @message_command(name="Tests")
    async def tests(self, ctx, message: discord.Message):
        modal = Reports(message=message,title="Report")
        await ctx.send_modal(modal)
#

and you should be able to access the modal with self.message

slender lintel
#

Ups.. Sry, yeah its working, thanks ❤️

slow dome
#

np

slender lintel
# slender lintel ok so you are in a class

Hey, @slash_command(name="ban", description="Bans a member") async def ban(self, ctx, member: discord.Member,*,reason): if ctx.author.guild_permissions.administrator: await member.ban() await member.send(reason) channel = bot.get_channel() await channel.send('hello') await ctx.respond('I have banned them') I have a similar issue here for bot.get_channel (trying to log a ban after banning someone)

#

bot is not defined

slender lintel
#

oh alr, so would i add self. every time i try do smth like this in a cog?

slender lintel
#

so yes

#

alr

slender lintel
slender lintel
slow dome
slender lintel
steady lotus
#

pls

#

read the docs

slender lintel
slender lintel
ornate fog
#

Saving asyncio.Locks in a weakref dict for every user? to free up space once it is out of use.
Good or bad could there be any caveats ?
Your thoughts ?

slender lintel
wintry python
#

Is there a way to have a script executed upon receiving a webhook push/post? Essentially trying to kick certain users in a role every 7 days. The webhook will send a message every 7 days and I want the bot to see that request and execute the script after

wintry python
#

Like ""

#

Don't really need the message, just need it to run every 7 days

slender lintel
#

Use a task loop

wintry python
#

Tyty

solar berry
#

does anyone know

vivid vector
#

Hey created a slash command and need to mention a server member but it doesnt let me mention a user: py @bot.slash_command() async def register(ctx, member: discord.Member = None): await ctx.respond("Registering {}".format(member.name))

#

I just don't get why its not working

wintry python
#

Anyone know what the max hours I can set for py @tasks.loop(hours = ?) is?

humble talon
wintry python
wintry python
humble talon
#

I'm sure you can set it to 7 days

wintry python
#

oh nice

#

tyty

humble talon
#

But at that point, you'll most likely want to check the datetime with a shorter loop

wintry python
#

true

humble talon
#

I don't think they're expected to live that long to be honest

#

So I'd recommend not doing that

wintry python
#

hmm, how else can I go about having it run every 7 days tho?

vivid vector
wintry python
humble talon
#

Yeah, that sounds more reasonable, maybe store the last time it run (easily in a small file), then check the time in an hourly function

slender lintel
#

Hm

slender lintel
#

so for example
@bot.slash_command(name='register', description='e')
async def register(ctx,member: discord.Member = None):
then ur bit

snow citrus
#

or just member.mention

languid hollow
#

I'm a bit confused on what does it mean when it says children on here, can someone please explain

#

also what variable example would you normally substitute in the param

errant verge
#

if i have a command that does a bunch of stuff with the inputted arguments, can i use them during button interaction?

#

i.e.```py
class View(discord.ui.View):
@discord.ui.button(label="Approve", style=discord.ButtonStyle.green)
async def button_callback(self, button, interaction):
guild = bot.get_guild(ID)
role = guild.get_member(interaction.user.id).get_role(ROLEID)
if role is None:
await interaction.response.send_message("No perms to interact")
else:
discordID = player.id
robloxuser = bloxlink(discordID)
embed = discord.Embed(title = f'{player.name}', description = f'<@{discordID}> : {robloxuser} added to {team}', color = discord.Color.blue())
sheets(robloxuser, team, tmz)
await interaction.response.edit_message(content = None, embed=embed , view=None)

#

and my command is /team player, team, tmz

slender lintel
#

ok for some reason, i literally can't make a slash command with any options

#

pretty much

#

im in a cog, and when i make it with 2 options, it errors that it cant take more than 3 args
when i make it with 1 option, the option doesnt even show

slender lintel
#
from discord.commands import (  # Importing the decorator that makes slash commands.
    slash_command,
    Option
)
from discord.ext import commands
import discord
from modules.handlers.EmbedHandler import genEmbed
from discord import option

class creategroup(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    
    @slash_command()
    async def creategroup(self, ctx, groupname: Option(str, "Group name e.g. Helper"), perms: Option(str, "Permissions", "Please put the permissions you would like, seperated by commas. Choices: kick,ban")):
        await ctx.respond(embed=genEmbed(title="Group Creation",description="Creating group... Please Wait..."))

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

when i make it with 1 option, the option doesnt show at all and it just sends the embed

#

when i make it with 2 Options, it errors

#

but when both args arent options it works

#

but still then the options arent passed through

#

one sec let me see how I made one

#

alright thanks

#
from discord.commands import (  # Importing the decorator that makes slash commands.
    slash_command,
    Option
)
from discord.ext import commands
import discord
from modules.handlers.EmbedHandler import genEmbed

class creategroup(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    
    @slash_command()
    async def creategroup(
          self, ctx, 
          groupname: Option(str, "Group name e.g. Helper"), 
          perms: Option(str, "Permissions", #"Please put the permissions you would like, seperated by commas. Choices: kick,ban"  I don't think you can have 2 descriptions in here)
    ):
        await ctx.respond(embed=genEmbed(title="Group Creation",description="Creating group... Please Wait..."))

def setup(bot):
    bot.add_cog(creategroup(bot))```
slender lintel
#

Permisions

#

is the description

#

wait

#

hm

#

hm wierd

#

i added those

#

and yet

#

it still doesnt show

#

wait no you are right

slender lintel
#

xD

#

confused

#

oh ok

#

but now my quesdtion is

#

when i try to run the command

#

theres no args

#

well there is definetly a name attribute

#

and description

#

so idk

#

hm

#

wierd

#

idk

#

i dont error anymore

#

but now

#

whats the / for hm

#

maybe add that

#

where

#

adding a / throws invalid syntax

#
from discord.commands import (  # Importing the decorator that makes slash commands.
    slash_command,
    Option
)
from discord.ext import commands
import discord
from modules.handlers.EmbedHandler import genEmbed

class creategroup(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    
    @slash_command()
    async def creategroup(
        self, ctx, 
        groupname: Option(str, "Group name e.g. Helper"), 
        perms: Option(str, "Permissions", /, "Please put the permissions you would like, seperated by commas. Choices: kick,ban")):
        await ctx.respond(
              embed=genEmbed(
                      title="Group Creation",
                      description="Creating group... Please Wait..."
               ))

def setup(bot):
    bot.add_cog(creategroup(bot))```
#

oh

#

ok

#

hmmm

#

@slender lintel do you want to try a different way in creating options?

#

its using decorators

#

whats what i was just doing there xD

#

o lol

#

sorry idk whats wrong with the code

#

looks fine to me

#

still doesnt add them

#

still doesnt add the args tf

#

wait maybe if i specify the guild id

slender lintel
#

it registers faster there

#

HM

#

ok

#

i got an error

#

now i added the guild id

#

discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed

#

uh where did dyou add dit

#

@slash_command(guild_ids=[982688378946486292])

#

uhh

#

so it doesnt work when i specify a guild id but it works when i dont tf

#

maybe try and reinstall pycord

#

ok

#

so

#

in dms

#

it has the args

#

nd now it has the args in my server

#

so i just had to spam restart the bot

#

oh so basically it just wasnt registered :P

#

still when i specify the guild id

#

i get a 405 method not allowed

#
Ignoring exception in on_connect
Traceback (most recent call last):
  File "C:\Users\Rio\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Rio\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1147, in on_connect  
    await self.sync_commands()
  File "C:\Users\Rio\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 770, in sync_commands
    await self._bot.http.bulk_upsert_command_permissions(self._bot.user.id, guild_id, guild_cmd_perms)
  File "C:\Users\Rio\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 359, in request     
    raise HTTPException(response, data)
discord.errors.HTTPException: 405 Method Not Allowed (error code: 0): 405: Method Not Allowed
languid hollow
#

Can you have multiple awaits to perform something, so like I wanted my button to get disabled and send a modal at the same time is that possible?

languid hollow
#

I can't seem to find it?

slender lintel
#

well its basically combining stuff

#

how are you doing it rn?

#

let me give an example ig

languid hollow
#

well I thought of doing it in an if statement but that didn't work since the one before already executed

slender lintel
#
@slash_command()
async def func_name(self, ctx):
    button = Button(label="oisuykhasja")
    view = View(button)
    
    async def callback(interaction):
        button.disabled=True
        #Create Modal Here
        #send modal same way as you send the button
    button.callback = callback
    await ctx.respond("randommessage here", view=view)```
#

@languid hollow

languid hollow
#

This is mine currently

slender lintel
languid hollow
#

I mean I want to disable the button upon callback and at the same time it sends the modal

slender lintel
languid hollow
#

I mean it works fine for me for some reason

slender lintel
#

so it disables but it jsut doesnt send the modal?

languid hollow
#

yes it disables & changes colour but when I want to send in the modal it gives the error

languid hollow
#
discord.errors.InteractionResponded: This interaction has already been responded to before
slender lintel
#

oh ye you cant respond twice.

#

you might have to use a follow up i think

languid hollow
#

so I'd replace the await with follow up?

slender lintel
#

one sec reading docs

languid hollow
#

followup works with webhook i believe

slender lintel
#

oh yes

#

ok yeah webhooks can send views

#

so ig thats your only way

languid hollow
languid hollow
#

and then the time_out function would kick it though Thanks for the help!

slender lintel
#

o ok

#

np

#

thats smart ig

warm jungle
#

is there any way to edit an interaction.response.edit_message

errant verge
#

if i have a button clicked, then a long function happen, i have to put interaction.response.defer() right?

sudden path
#

Yes

errant verge
#

i.e.

await interaction.response.defer()
# a bunch of stuff              
await interaction.response.edit_message(content = None, embed=embed , view=None)
earnest sail
#

how do I reply to the message without mentioning the user?

sudden path
#

mention_author=False

earnest sail
#

I see, thank you

surreal lagoon
#

So, some of the bots are not showing up properly because they're not cached on my PC

#

but when I tag them myself, they get cached and appear normally

#

Is there a way to like, force the bots to get cached on the user's end so that they appear normally?

surreal lagoon
#

yeah, it's the cache that doesn't get updated right?

#

but it gets updated when I tag them personally

#

why doesn't it get updated when the bot tags them?

errant verge
#

discord.errors.InteractionResponded: This interaction has already been responded to before
what does this error mean?

#

i'm referring to a button interaction