test
This commit is contained in:
parent
295a05470e
commit
72fb598966
@ -110,56 +110,70 @@ class Commands():
|
||||
else:
|
||||
triggers = [trigger.args[1]]
|
||||
|
||||
first_trigger = triggers[0]
|
||||
first_full_trigger_str = triggers[0]
|
||||
del triggers[0]
|
||||
|
||||
if first_trigger.startswith(tuple(self.config.prefix_list)):
|
||||
if first_full_trigger_str.startswith(tuple(self.config.prefix_list)):
|
||||
first_trigger_type = "command"
|
||||
first_trigger_prefix = first_trigger[0]
|
||||
first_trigger = first_trigger[1:]
|
||||
elif first_trigger.startswith(self.bot.nick):
|
||||
first_trigger_prefix = first_full_trigger_str[0]
|
||||
first_trigger_noprefix = first_full_trigger_str[1:]
|
||||
first_trigger_command = first_trigger_noprefix.split(" ")[0]
|
||||
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:])
|
||||
elif first_full_trigger_str.startswith(self.bot.nick):
|
||||
first_trigger_type = "nickname_command"
|
||||
first_trigger_prefix = str(first_trigger.split(" ")[0])
|
||||
first_trigger = " ".join(first_trigger.split(" ")[1:])
|
||||
elif "intent" in trigger.tags:
|
||||
if trigger.tags["intent"] == "ACTION":
|
||||
first_trigger_prefix = str(first_full_trigger_str.split(" ")[0])
|
||||
first_trigger_noprefix = " ".join(first_full_trigger_str.split(" ")[1:])
|
||||
first_trigger_command = first_trigger_noprefix.split(" ")[0]
|
||||
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:])
|
||||
elif "intent" in trigger.tags and trigger.tags["intent"] == "ACTION":
|
||||
first_trigger_type = "action_command"
|
||||
first_trigger_prefix = "ACTION"
|
||||
first_trigger_noprefix = first_full_trigger_str
|
||||
first_trigger_command = first_trigger_noprefix.split(" ")[0]
|
||||
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:])
|
||||
else:
|
||||
first_trigger_type = "rule"
|
||||
first_trigger_prefix = None
|
||||
|
||||
first_command = first_trigger.split(" ")[0]
|
||||
first_str = " ".join(first_trigger.split(" ")[1:])
|
||||
first_trigger = first_full_trigger_str
|
||||
first_trigger_command = first_trigger_noprefix.split(" ")[0]
|
||||
first_trigger_str = " ".join(first_trigger_noprefix.split(" ")[1:])
|
||||
|
||||
commands.append({
|
||||
"trigger_type": first_trigger_type,
|
||||
"trigger_prefix": first_trigger_prefix,
|
||||
"trigger_str": first_str,
|
||||
"trigger_command": first_command,
|
||||
"trigger_str": first_trigger_str,
|
||||
"trigger_command": first_trigger_command,
|
||||
"trigger_hostmask": trigger.hostmask,
|
||||
"trigger_sender": trigger.sender
|
||||
})
|
||||
|
||||
for trigger_str in triggers:
|
||||
for full_trigger_str in triggers:
|
||||
|
||||
if trigger_str.startswith(tuple(self.config.prefix_list)):
|
||||
trigger_command = first_trigger.split(" ")[0]
|
||||
trigger_str = " ".join(first_trigger.split(" ")[1:])
|
||||
|
||||
if full_trigger_str.startswith(tuple(self.config.prefix_list)):
|
||||
trigger_type = "command"
|
||||
trigger_prefix = trigger_str[0]
|
||||
trigger_str = trigger_str[1:]
|
||||
trigger_command = trigger_str.split(" ")[0]
|
||||
elif trigger_str.startswith(self.bot.nick):
|
||||
trigger_prefix = full_trigger_str[0]
|
||||
trigger_noprefix = full_trigger_str[1:]
|
||||
trigger_command = trigger_noprefix.split(" ")[0]
|
||||
trigger_str = " ".join(trigger_noprefix.split(" ")[1:])
|
||||
elif full_trigger_str.startswith(self.bot.nick):
|
||||
trigger_type = "nickname_command"
|
||||
trigger_prefix = str(trigger_str.split(" ")[0])
|
||||
trigger_str = " ".join(trigger_str.split(" ")[1:])
|
||||
trigger_command = trigger_str.split(" ")[0]
|
||||
elif trigger_str.startswith(tuple(["ACTION", "/me"])):
|
||||
trigger_prefix = str(full_trigger_str.split(" ")[0])
|
||||
trigger_noprefix = " ".join(full_trigger_str.split(" ")[1:])
|
||||
trigger_command = trigger_noprefix.split(" ")[0]
|
||||
trigger_str = " ".join(trigger_noprefix.split(" ")[1:])
|
||||
elif full_trigger_str.startswith(tuple(["ACTION", "/me"])):
|
||||
trigger_type = "action_command"
|
||||
trigger_prefix = "ACTION"
|
||||
trigger_str = " ".join(trigger_str.split(" ")[1:])
|
||||
trigger_command = trigger_str.split(" ")[0]
|
||||
trigger_noprefix = full_trigger_str
|
||||
trigger_command = trigger_noprefix.split(" ")[0]
|
||||
trigger_str = " ".join(trigger_noprefix.split(" ")[1:])
|
||||
else:
|
||||
trigger_command = trigger_str.split(" ")[0]
|
||||
trigger_command = full_trigger_str.split(" ")[0]
|
||||
trigger_str = " ".join(full_trigger_str.split(" ")[1:])
|
||||
|
||||
command_types = ["command", "nickname_command", "action_command"]
|
||||
# Assume same command type until proven otherwise
|
||||
assumed_trigger_type = first_trigger_type
|
||||
|
||||
Loading…
Reference in New Issue
Block a user