cogwatch icon indicating copy to clipboard operation
cogwatch copied to clipboard

Reload slash command on cog reload for nextcord

Open JVemmer opened this issue 1 year ago • 1 comments

When cogs contains slash commands, they have to be re-sync'ed, as seen here: https://discord.com/channels/881118111967883295/1201648612745166880

Would be great if cogwatch could support this :heart:

JVemmer avatar Apr 04 '24 11:04 JVemmer

Current workaround is to use the following setup function for the cogs, but it does carry some serious risk.

async def setup(bot):
    bot.add_cog(MyCog(bot))
    await bot.sync_all_application_commands()

[...]This may call Discord many times depending on how different guilds you have local commands for, and how many commands Discord needs to be updated or added, which may cause your bot to be rate limited or even Cloudflare banned in VERY extreme cases.[...]

  • From documentation: https://docs.nextcord.dev/en/stable/api.html#nextcord.Client.sync_all_application_commands

JVemmer avatar Apr 12 '24 06:04 JVemmer