This commit is contained in:
deathbybandaid 2022-05-06 09:43:51 -04:00
parent a0740c9289
commit 356805abaf

View File

@ -49,12 +49,28 @@ def prerun():
# The command is not valid # The command is not valid
if comrun.is_catchall and not comrun.is_real_command: if comrun.is_catchall and not comrun.is_real_command:
valid_command_results = sb.commands.search_similar_commands(comrun.command["trigger_command"]) valid_command_results = sb.commands.search_similar_commands(comrun.command["trigger_command"])
print(comrun.command_type)
if not len(valid_command_results): # Don't be annoying when /me is conversation and not a command
comrun.osd("%s does not appear to be a valid command." % comrun.command["trigger_command"]) if comrun.command_type == "action_command":
else: return
comrun.osd("%s does not appear to be a valid command. Possible Matches: %s" % (comrun.command["trigger_command"], valid_command_results))
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 # At this point, we update the re.match for trigger
trigger = rebuild_trigger(comrun, function) trigger = rebuild_trigger(comrun, function)