This commit is contained in:
deathbybandaid 2022-02-23 10:02:05 -05:00
parent 120372c8cf
commit e8fe785228

View File

@ -13,17 +13,33 @@ def rule_match():
returnfunc = True
# Applies to non-command rule matching
if comrun.rulematch:
first_full_trigger_str = trigger.args[1]
if comrun.trigger_dict["trigger_type"] == "command":
commands_list = sb.commands.valid_sopel_commands
first_trigger_noprefix = first_full_trigger_str[1:]
first_trigger_command = first_trigger_noprefix.split(" ")[0]
elif comrun.trigger_dict["trigger_type"] == "nickname_command":
commands_list = sb.commands.valid_sopel_nickname_commands
first_trigger_noprefix = " ".join(first_full_trigger_str.split(" ")[1:])
first_trigger_command = first_trigger_noprefix.split(" ")[0]
elif comrun.trigger_dict["trigger_type"] == "action_command":
commands_list = sb.commands.valid_sopel_action_commands
first_trigger_noprefix = first_full_trigger_str
first_trigger_command = first_trigger_noprefix.split(" ")[0]
# Ignore if the command was caught
# handle if the command was triggered with && or | too close to the command
if comrun.trigger_dict["trigger_command"] in commands_list:
returnfunc = False
if first_trigger_command != comrun.trigger_dict["trigger_command"]:
sb.commands.dispatch(comrun.trigger_dict)
else:
returnfunc = False
if returnfunc:
function(bot, trigger, comrun, *args, **kwargs)