cogwatch
cogwatch copied to clipboard
Reload slash command on cog reload for nextcord
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:
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