hikari-py/hikari

Duplicate Slash Commands

Ethan-Ka opened this issue · 2 comments

Steps to reproduce

  1. Create a slash command
  2. Start and stop your bot a couple of times

Expected result

Commands should've been updated, like a regular bot

Actual result

Screenshot 2022-07-06 210040

yeah...

System info

hikari (2.0.0.dev108) [6dbab9a6]
located at C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\hikari
CPython 3.10.2 MSC v.1929 64 bit (AMD64)
Windows MSI 10 10.0.22000 AMD64 Intel64 Family 6 Model 165 Stepping 2, GenuineIntel

Further info

No response

Checklist

  • I have made sure to remove ANY sensitive information (bot token, passwords, credentials, personal details, etc.).
  • I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.

@DankBoi293 could you show code to reproduce?

First of all, thanks for the bug report, but this is not a bug with hikari, as we do not create/updated/delete commands for you. You seem to have both global and guild-specific slash commands, which is why they appear as duplicate.

That said, you can get rid of the ones you don't want with this script:

import asyncio
import hikari

rest = hikari.RESTApp()

TOKEN = 
GUILD_ID = hikari.UNDEFINED

async def main():
    async with rest.acquire(TOKEN, hikari.TokenType.BOT) as client:
        application = await client.fetch_application()

        await client.set_application_commands(application.id, (), guild=GUILD_ID)

asyncio.run(main())

You can set TOKEN to your bots token and leave GUILD_ID as it is to delete the global commands or set it to the ID of the specific guild to delete guild-specific commands.

Hope that helps!