Search code examples
pythondiscordnextcord

Create / Commands in Cogs with nextcord?


Im not sure if im doing this wrong or not but im having to wait quite a while for the command to show up

@slash_command(name="somename", description="somediscription", guild_ids=[id])
async def verify(self, interaction:Interaction):
pass

(this is my first stackoverflow post so im sorry if i dont do it entirely right)


Solution

  • Download the updated version of slash commands with these commands:
    pip uninstall nextcord
    pip install git+https://github.com/alentoghostflame/nextcord@slash_fixes

    Then add this code underneath bot.load_extension, wherever you load your cog:

    for guild_id in TESTING_GUILD_IDS:
        guild = bot.get_guild(guild_id)
        await guild.rollout_application_commands()
    

    where TESTING_GUILD_IDS is your list of guild ids.