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.
This commit is contained in:
parent
331e0e10a7
commit
778778c622
4
main.py
4
main.py
@ -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
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user