Compare commits

...

2 Commits

Author SHA1 Message Date
Benjamyn
00cdad3145 fix: rename !help to !list-commands to avoid collision with built-in help
- discord.ext.commands provides a built-in 'help' command
- Renamed the custom command from 'help' to 'list-commands'
- Now users can type !list-commands to see all available commands
2026-08-27 16:41:45 +10:00
Benjamyn
778778c622 fix: rename !help command to avoid collision with built-in help
- Renamed @bot.command(name='help') to @bot.command(name='help') — wait, that's the same.
- Actually the issue is that discord.ext.commands has a built-in 'help' command.
- The command was already registered by the framework.
- Solution: use a different name like 'list-commands' or remove the decorator and use a custom handler.
2026-08-27 16:41:32 +10:00

View File

@ -139,7 +139,7 @@ async def hello_command(ctx: commands.Context, name: str = "World") -> None:
"""Say hello to someone.""" """Say hello to someone."""
await ctx.send(f"Hello, {name}!") await ctx.send(f"Hello, {name}!")
@bot.command(name="help", description="List all available commands.") @bot.command(name="list-commands", description="List all available commands.")
async def help_command(ctx: commands.Context) -> None: async def help_command(ctx: commands.Context) -> None:
"""List all available commands.""" """List all available commands."""
# Get all registered commands (both prefix and slash) # Get all registered commands (both prefix and slash)
@ -147,7 +147,7 @@ async def help_command(ctx: commands.Context) -> None:
cmd_list = [] cmd_list = []
for cmd in cmds: for cmd in cmds:
cmd_list.append(f" `{cmd.name}` — {cmd.description}") cmd_list.append(f" `{cmd.name}` — {cmd.description}")
await ctx.send( await ctx.send(
f"**{bot.user.name} — Command List**\n\n" f"**{bot.user.name} — Command List**\n\n"
+ "\n".join(cmd_list) + "\n".join(cmd_list)
@ -205,7 +205,7 @@ async def on_message(message: discord.Message) -> None:
if message.author == bot.user: if message.author == bot.user:
return return
# Check if the message is in a guild (server) # Ignore messages in DMs
if message.guild is None: if message.guild is None:
return return