- 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
- The on_message handler was calling process_commands() without await
- Without await, the coroutine returned immediately and the command never ran
- Now the command is properly processed and a response is sent
- 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
- 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.
- Added on_message event that strips leading '!' and passes to process_commands()
- Added !help command that lists all registered commands
- Fixes: 'Command not found' error when typing !help or any ! command
- Now supports both slash commands (/ping) and prefix commands (!ping)
- Added APP_DEBUG environment variable to enable debug mode
- Debug mode prints detailed logs to console and file (bot.log)
- Debug mode includes Discord library internals (discord, discord.ext.commands, etc.)
- File handler rotates at 10MB, keeping 5 backup files
- Console handler only active when DEBUG is enabled
- Default logging level is WARNING (non-debug) to reduce noise