From 356805abaf61e5a8579a9f64f9f0f30a244cb585 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 6 May 2022 09:43:51 -0400 Subject: [PATCH] test --- sopel_SpiceBot_Core_Prerun/__init__.py | 28 ++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sopel_SpiceBot_Core_Prerun/__init__.py b/sopel_SpiceBot_Core_Prerun/__init__.py index 5342522..d1fc8d3 100644 --- a/sopel_SpiceBot_Core_Prerun/__init__.py +++ b/sopel_SpiceBot_Core_Prerun/__init__.py @@ -49,12 +49,28 @@ def prerun(): # The command is not valid if comrun.is_catchall and not comrun.is_real_command: valid_command_results = sb.commands.search_similar_commands(comrun.command["trigger_command"]) - print(comrun.command_type) - if not len(valid_command_results): - comrun.osd("%s does not appear to be a valid command." % comrun.command["trigger_command"]) - else: - comrun.osd("%s does not appear to be a valid command. Possible Matches: %s" % (comrun.command["trigger_command"], valid_command_results)) - return + + # Don't be annoying when /me is conversation and not a command + if comrun.command_type == "action_command": + return + + # Handling for invalid nickname commands + if comrun.command_type == "nickname_command": + if not len(valid_command_results): + comrun.osd("I'm not sure what you are asking me to do! What do you mean by \"%s\" ?" % comrun.command["trigger_str"]) + else: + comrun.osd("%s does not appear to be a valid command. Possible Matches: %s" % (comrun.command["trigger_command"], valid_command_results)) + return + + # normal prefixed command handling + if comrun.command_type == "command": + + # warn that a command is not valid + if not len(valid_command_results): + comrun.osd("%s does not appear to be a valid command." % comrun.command["trigger_command"]) + else: + comrun.osd("%s does not appear to be a valid command. Possible Matches: %s" % (comrun.command["trigger_command"], valid_command_results)) + return # At this point, we update the re.match for trigger trigger = rebuild_trigger(comrun, function)