Adding command descriptions to Discord.py bot help menu

I’m working on a Discord bot using discord.py and I need help with customizing the built-in help command. I want to add descriptions to my commands so when users type the help command, they can see what each command does.

I also want to organize commands into different categories like Entertainment or Utility in the help menu. I’m not sure how to set this up properly.

I have some experience with other programming languages but I’m new to Python. Here’s a snippet of my current bot code:

bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), 
description='Bot Commands', help_command=None)
bot.add_cog(Entertainment(bot))

file_path = 'blocklist.txt'
bl_file = open(file_path, 'r')

@bot.event
async def on_ready():
    print('Bot is online!')
    print(f'Logged in as {bot.user.name} (ID: {bot.user.id})')
    print(f'Connected to {len(bot.guilds)} servers')
    print(f'Discord.py version: {discord.__version__}')

@bot.command()
async def test(*args):
    await bot.say(":wave: Hello there!")

For example, if I want to add a description to my test command, where exactly should I put it and what’s the correct syntax?

I hit this same problem when I started with discord.py. You’re missing command descriptions because you disabled the help command with help_command=None. Add descriptions in the decorator:

@bot.command(description="Sends a greeting message")
async def test(ctx):
    await ctx.send(":wave: Hello there!")

Also switched bot.say to ctx.send since bot.say is deprecated. For categories, use Cogs properly - each cog becomes a category in the help menu. Just add docstrings to your cog classes and that becomes the category description.

Want to keep the default help? Remove help_command=None from your bot setup. The built-in help will grab your command descriptions and sort them by cog automatically. You can make a custom HelpCommand class if you need fancy formatting, but the default works fine for most stuff.

just noticed you’re using *args - that won’t work with discord.py commands. Change it to async def test(ctx): first, then add description="whatever you want" inside the @bot.command() decorator. that’s it, pretty simple once you get it.

You can add descriptions directly in the command decorator: @bot.command(description="Your description here"). However, there’s an issue with your code – you’re using *args as a parameter, which is incompatible with discord.py commands. Change it to async def test(ctx): and utilize ctx.send() instead of bot.say().

For categories, each Cog automatically appears as a category in the help menu. Include a docstring at the class level in your Entertainment cog; that will serve as the category description. If you want the default help command, simply remove help_command=None from your bot’s setup. The built-in help will show all command descriptions organized by cog. Additionally, you can use the brief parameter in the decorator for concise descriptions in the command list.