#Slash Commands with Cogs

1 messages · Page 1 of 1 (latest)

fringe horizon
#

I have a command called /reload that reloads a cog. In the cog, there are slash commands which have guild_ids set to it. The issue is when I want to change which guilds I want the slash command in, I have to restart the whole bot for the effects to come into change. If I just reload the cog or even unload and load the cog, that still doesn't reflect the changes.

Is there a way to fix this issue?

(I also have auto_sync set to True)

pure siren
#

What is your Version?

fringe horizon
pure siren
#

only 2.4.1 or with something else?

fringe horizon
chilly jackal
#

pycord lol

pure siren
pure siren
#

@fringe horizon ?

fringe horizon
pure siren
#

is anything working?

fringe horizon
fringe horizon
# pure siren is anything working?

If you’re talking about slash commands registering

They only register after restarting the bot, they don’t register when I reload the cog

pure siren
#

Do you sync the commands?

fringe horizon
pure siren
#

auto sync is at starting the bot

fringe horizon
#

I’ll do it tmrw when I’m on my computer

fringe horizon
# pure siren Do you sync the commands?
Ignoring exception in command dev cog reload:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "/Users/appletumu/Documents/GitHub/USMC-Bot/cogs/dev.py", line 251, in reload
    await code()
  File "/Users/appletumu/Documents/GitHub/USMC-Bot/cogs/dev.py", line 239, in code
    await self.bot.sync_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/bot.py", line 719, in sync_commands
    registered_commands = await self.register_commands(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/bot.py", line 599, in register_commands
    registered = await register("bulk", data, _log=False)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/http.py", line 371, 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

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 375, in invoke
    await injected(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 1312, in _invoke
    await command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 375, in invoke
    await injected(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 1312, in _invoke
    await command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 375, in invoke
    await injected(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/discord/commands/core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 2: Application command names must be unique
pure siren
#

can you try it with the new py-cord version?

fringe horizon
pure siren
#

#library-updates

fringe horizon
pure siren
#

did you uninstall py-cord?

fringe horizon
#

yes

#

oh wait

#

I have pycord 0.1.1

#

should I uninstall that?

pure siren
#

if you dont need it

#

that is not py-cord ;3

#

pycord is ffmped one

#

or something like that

#

idk

fringe horizon
#

wait nope

#

the error just came

#

it was delayed

pure siren
#

Its working for me but I still get the error

opaque panther
#

bongocat heyo, is this still active? @fringe horizon

zenith thunder
#

And found the correct way syncing the commands? I struggle with the same things

zenith thunder
pure siren
#

what is your py-cord version @zenith thunder

zenith thunder
pure siren
#

Im not sure if I should create a tag