fix: strip only the first '!' character instead of all of them
- Changed from message.content[1:].lstrip('!') to message.content[1:]
- lstrip('!') removes ALL leading '!' characters, so '!ping' becomes 'ping' (correct)
but '!ping ' becomes ' ping' (with a leading space, breaking command parsing)
- Now only the first '!' is stripped, preserving spaces and subsequent characters
This commit is contained in:
parent
1c27ed17cf
commit
ba3fd2e8fa
8
main.py
8
main.py
@ -209,13 +209,11 @@ async def on_message(message: discord.Message) -> None:
|
|||||||
if message.guild is None:
|
if message.guild is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if the message is a command
|
# Check if the message starts with the command prefix (exactly one !)
|
||||||
if message.content.startswith("!."):
|
if message.content.startswith("!."):
|
||||||
# Strip the leading "!" and process
|
# Strip ONLY the first "!" character (not all of them)
|
||||||
content = message.content[1:]
|
content = message.content[1:]
|
||||||
# Remove the leading "!" again since we stripped one
|
# Now process the command
|
||||||
content = content.lstrip("!")
|
|
||||||
# FIX: Await process_commands to actually process the command
|
|
||||||
await bot.process_commands(message)
|
await bot.process_commands(message)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user