This commit is contained in:
deathbybandaid 2022-02-24 08:15:21 -05:00
parent 849814de86
commit 598a87e384

View File

@ -148,25 +148,25 @@ class Commands():
first_trigger_prefix = first_full_trigger_str[0] first_trigger_prefix = first_full_trigger_str[0]
first_trigger_noprefix = first_full_trigger_str[1:] first_trigger_noprefix = first_full_trigger_str[1:]
first_trigger_command = first_trigger_noprefix.split(" ")[0] first_trigger_command = first_trigger_noprefix.split(" ")[0]
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:]) first_trigger_str = " ".join([x.strip() for x in first_trigger_noprefix.split(" ")[1:]])
elif first_full_trigger_str.startswith(self.bot.nick): elif first_full_trigger_str.startswith(self.bot.nick):
first_trigger_type = "nickname_command" first_trigger_type = "nickname_command"
first_trigger_prefix = str(first_full_trigger_str.split(" ")[0]) first_trigger_prefix = str(first_full_trigger_str.split(" ")[0])
first_trigger_noprefix = " ".join(first_full_trigger_str.split(" ")[1:]) first_trigger_noprefix = " ".join(first_full_trigger_str.split(" ")[1:])
first_trigger_command = first_trigger_noprefix.split(" ")[0] first_trigger_command = first_trigger_noprefix.split(" ")[0]
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:]) first_trigger_str = " ".join([x.strip() for x in first_trigger_noprefix.split(" ")[1:]])
elif "intent" in trigger.tags and trigger.tags["intent"] == "ACTION": elif "intent" in trigger.tags and trigger.tags["intent"] == "ACTION":
first_trigger_type = "action_command" first_trigger_type = "action_command"
first_trigger_prefix = "ACTION" first_trigger_prefix = "ACTION"
first_trigger_noprefix = first_full_trigger_str first_trigger_noprefix = first_full_trigger_str
first_trigger_command = first_trigger_noprefix.split(" ")[0] first_trigger_command = first_trigger_noprefix.split(" ")[0]
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:]) first_trigger_str = " ".join([x.strip() for x in first_trigger_noprefix.split(" ")[1:]])
else: else:
first_trigger_type = "rule" first_trigger_type = "rule"
first_trigger_prefix = None first_trigger_prefix = None
first_trigger_noprefix = first_full_trigger_str first_trigger_noprefix = first_full_trigger_str
first_trigger_command = first_trigger_noprefix.split(" ")[0] first_trigger_command = first_trigger_noprefix.split(" ")[0]
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:]) first_trigger_str = " ".join([x.strip() for x in first_trigger_noprefix.split(" ")[1:]])
commands.append({ commands.append({
"trigger_type": first_trigger_type, "trigger_type": first_trigger_type,
@ -188,22 +188,22 @@ class Commands():
trigger_prefix = full_trigger_str[0] trigger_prefix = full_trigger_str[0]
trigger_noprefix = full_trigger_str[1:] trigger_noprefix = full_trigger_str[1:]
trigger_command = trigger_noprefix.split(" ")[0] trigger_command = trigger_noprefix.split(" ")[0]
trigger_str = " ".join(trigger_noprefix.split(" ")[1:]) trigger_str = " ".join([x.strip() for x in trigger_noprefix.split(" ")[1:]])
elif full_trigger_str.startswith(self.bot.nick): elif full_trigger_str.startswith(self.bot.nick):
trigger_type = "nickname_command" trigger_type = "nickname_command"
trigger_prefix = str(full_trigger_str.split(" ")[0]) trigger_prefix = str(full_trigger_str.split(" ")[0])
trigger_noprefix = " ".join(full_trigger_str.split(" ")[1:]) trigger_noprefix = " ".join(full_trigger_str.split(" ")[1:])
trigger_command = trigger_noprefix.split(" ")[0] trigger_command = trigger_noprefix.split(" ")[0]
trigger_str = " ".join(trigger_noprefix.split(" ")[1:]) trigger_str = " ".join([x.strip() for x in trigger_noprefix.split(" ")[1:]])
elif full_trigger_str.startswith(tuple(["ACTION", "/me"])): elif full_trigger_str.startswith(tuple(["ACTION", "/me"])):
trigger_type = "action_command" trigger_type = "action_command"
trigger_prefix = "ACTION" trigger_prefix = "ACTION"
trigger_noprefix = full_trigger_str trigger_noprefix = full_trigger_str
trigger_command = trigger_noprefix.split(" ")[0] trigger_command = trigger_noprefix.split(" ")[0]
trigger_str = " ".join(trigger_noprefix.split(" ")[1:]) trigger_str = " ".join([x.strip() for x in trigger_noprefix.split(" ")[1:]])
else: else:
trigger_command = full_trigger_str.split(" ")[0] trigger_command = full_trigger_str.split(" ")[0]
trigger_str = " ".join(full_trigger_str.split(" ")[1:]) trigger_str = " ".join([x.strip() for x in trigger_noprefix.split(" ")[1:]])
command_types = ["command", "nickname_command", "action_command"] command_types = ["command", "nickname_command", "action_command"]
# Assume same command type until proven otherwise # Assume same command type until proven otherwise