test
This commit is contained in:
parent
b76c84dffe
commit
39b4d83456
@ -20,24 +20,31 @@ class Commands():
|
|||||||
def sopel_action_commands(self):
|
def sopel_action_commands(self):
|
||||||
return self.bot.rules.get_all_action_commands()
|
return self.bot.rules.get_all_action_commands()
|
||||||
|
|
||||||
def dispatch_command(self, bot, trigger, message):
|
def dispatch(self, bot, trigger, trigger_dict):
|
||||||
|
if trigger_dict["trigger_type"] == "command":
|
||||||
|
return self.dispatch_command(bot, trigger, trigger_dict)
|
||||||
|
elif trigger_dict["trigger_type"] == "nickname_command":
|
||||||
|
return self.dispatch_nickname_command(bot, trigger, trigger_dict)
|
||||||
|
elif trigger_dict["trigger_type"] == "actioncommand":
|
||||||
|
return self.dispatch_action_command(bot, trigger, trigger_dict)
|
||||||
|
|
||||||
|
def dispatch_command(self, bot, trigger, trigger_dict):
|
||||||
pretrigger = PreTrigger(
|
pretrigger = PreTrigger(
|
||||||
bot.nick,
|
bot.nick,
|
||||||
":%s %s %s :%s" % (trigger.hostmask, "PRIVMSG", trigger.sender, message)
|
":%s %s %s :%s%s" % (trigger.hostmask, "PRIVMSG", trigger.sender, trigger_dict["trigger_prefix"], trigger_dict["trigger_str"])
|
||||||
)
|
)
|
||||||
bot.dispatch(pretrigger)
|
bot.dispatch(pretrigger)
|
||||||
|
|
||||||
def dispatch_action_command(self, bot, trigger, message):
|
def dispatch_nickname_command(self, bot, trigger, trigger_dict):
|
||||||
pretrigger = PreTrigger(
|
pretrigger = PreTrigger(
|
||||||
bot.nick,
|
bot.nick,
|
||||||
":%s %s %s : %s %s" % (trigger.hostmask, "PRIVMSG", trigger.sender, "ACTION", message)
|
":%s %s %s :%s %s" % (trigger.hostmask, "PRIVMSG", trigger.sender, trigger_dict["trigger_prefix"], trigger_dict["trigger_str"])
|
||||||
)
|
)
|
||||||
# TODO possible extra space in front of ACTION
|
|
||||||
bot.dispatch(pretrigger)
|
bot.dispatch(pretrigger)
|
||||||
|
|
||||||
def dispatch_nickname_command(self, bot, trigger, message):
|
def dispatch_action_command(self, bot, trigger, trigger_dict):
|
||||||
pretrigger = PreTrigger(
|
pretrigger = PreTrigger(
|
||||||
bot.nick,
|
bot.nick,
|
||||||
":%s %s %s :%s %s" % (trigger.hostmask, "PRIVMSG", trigger.sender, bot.nick, message)
|
":%s %s %s :%s %s" % (trigger.hostmask, "PRIVMSG", trigger.sender, "ACTION", trigger_dict["trigger_str"])
|
||||||
)
|
)
|
||||||
bot.dispatch(pretrigger)
|
bot.dispatch(pretrigger)
|
||||||
|
|||||||
@ -70,10 +70,12 @@ def prerun():
|
|||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
commands = get_commands(bot, trigger)
|
commands = get_commands(bot, trigger)
|
||||||
if len(commands) == 1:
|
|
||||||
|
|
||||||
stringtest = function(bot, trigger, *args, **kwargs)
|
function(bot, trigger, *args, **kwargs)
|
||||||
bot.say(stringtest)
|
|
||||||
|
for trigger_dict in commands[1:]:
|
||||||
|
|
||||||
|
sb.commands.dispatch(bot, trigger, trigger_dict)
|
||||||
|
|
||||||
return internal_prerun
|
return internal_prerun
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user