diff options
| author | 2020-02-19 21:12:49 +0200 | |
|---|---|---|
| committer | 2020-02-19 21:12:49 +0200 | |
| commit | 1625c18265192e9560b443a574e564241b6f6883 (patch) | |
| tree | 36676c65f1e1b6de77944701e84b09aabc35a2e5 | |
| parent | Delete_after added for suggestion message (diff) | |
Suggest aliases when invoked instead of full command name
When found a similar command, the bot sent a suggestion about the full command name
This was fixed by saving the matching alias and sending it instead of sending the full command name
| -rw-r--r-- | bot/cogs/error_handler.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py index 1a1914b93..fb5f59ebc 100644 --- a/bot/cogs/error_handler.py +++ b/bot/cogs/error_handler.py @@ -105,12 +105,12 @@ class ErrorHandler(Cog): ] raw_commands = [c for data in raw_commands for c in data] similar_command_data = difflib.get_close_matches(command_name, raw_commands, 1) - log.debug(similar_command_data) - similar_command = self.bot.get_command(similar_command_data[0]) + similar_command_name = similar_command_data[0] + similar_command = self.bot.get_command(similar_command_name) if similar_command.can_run(ctx): misspelled_content = ctx.message.content await ctx.send( - f"Did you mean:\n**{misspelled_content.replace(command_name, similar_command.name)}**", + f"Did you mean:\n**{misspelled_content.replace(command_name, similar_command_name)}**", delete_after=7.0 ) |