This commit is contained in:
deathbybandaid 2022-02-23 14:59:21 -05:00
parent c3d339dd4a
commit 2023e4e1bb
2 changed files with 20 additions and 0 deletions

View File

@ -104,7 +104,9 @@ class Commands():
return pretrigger return pretrigger
def get_command_from_trigger(self, trigger): def get_command_from_trigger(self, trigger):
commstring = trigger.args[1] commstring = trigger.args[1]
if commstring.startswith(tuple(self.config.prefix_list)): if commstring.startswith(tuple(self.config.prefix_list)):
command = commstring[1:].split(" ")[0] command = commstring[1:].split(" ")[0]
elif commstring.startswith(self.bot.nick): elif commstring.startswith(self.bot.nick):
@ -113,8 +115,23 @@ class Commands():
command = commstring.split(" ")[0] command = commstring.split(" ")[0]
else: else:
command = "" command = ""
return command return command
def is_real_command(self, trigger_dict):
if trigger_dict["trigger_type"] == "command":
commands_list = self.valid_sopel_commands
elif trigger_dict["trigger_type"] == "nickname_command":
commands_list = self.valid_sopel_nickname_commands
elif trigger_dict["trigger_type"] == "action_command":
commands_list = self.valid_sopel_action_commands
if trigger_dict["trigger_command"] in commands_list:
return True
else:
return False
def get_commands_split(self, trigger, splitkey): def get_commands_split(self, trigger, splitkey):
commands = [] commands = []

View File

@ -44,6 +44,9 @@ def prerun(rulematch=False):
sb.commands.dispatch(trigger_dict) sb.commands.dispatch(trigger_dict)
return return
if rulematch and sb.commands.is_real_command(commands[0]["trigger_command"]):
return
# This is where we rebuild trigger # This is where we rebuild trigger
# we validate a few things here # we validate a few things here
# trigger = clean_trigger(bot, trigger, commands[0]) # trigger = clean_trigger(bot, trigger, commands[0])