DEV Community

Hazrat Ummar Shaikh
Hazrat Ummar Shaikh

Posted on

Discord help commands in discord.py

@commands.hybrid_command(name="help", description= "Get all the commands list")
    async def help(self, interaction: commands.Context):
        embed = discord.Embed(
            title= "Help",
            description= "List of commands all the commands",
            color= 0x00FFFF
        )

        for c in self.bot.cogs:
             cog = self.bot.get_cog(c)
             if any(cog.walk_commands()):
                 embed.add_field(name=cog.qualified_name, value= " , ".join(f"`{i.name}`" for i in cog.walk_commands()), inline= False)
        await interaction.send(embed=embed)
Enter fullscreen mode Exit fullscreen mode

Keep in Mind to disable the default Help command

if __name__ == "__main__":
    bot = Bot(command_prefix=".", intents=discord.Intents.all(), help_command = None)
    bot.run(token)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)