test
This commit is contained in:
parent
ab17ba2c4e
commit
06955aac8f
@ -57,10 +57,15 @@ def prerun():
|
|||||||
# Run function
|
# Run function
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
|
|
||||||
# If not piping the replies into pipe, let's print to IRC now
|
# If not piping the replies into pipe, let'sprint to IRC now
|
||||||
if not comrun.is_pipe_command:
|
if not comrun.is_pipe_command:
|
||||||
for say_message in comrun._say:
|
for say_message in comrun._say:
|
||||||
bot.say(say_message)
|
bot.say(say_message)
|
||||||
|
# Pipe text back to bot for next piped command
|
||||||
|
else:
|
||||||
|
for say_message in comrun._say:
|
||||||
|
trigger_dict = rebuild_pipes(comrun.commands, say_message)
|
||||||
|
sb.commands.dispatch(trigger_dict)
|
||||||
|
|
||||||
return internal_prerun
|
return internal_prerun
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
@ -73,29 +78,45 @@ def rebuild_trigger(comrun, function):
|
|||||||
return trigger
|
return trigger
|
||||||
|
|
||||||
|
|
||||||
def rebuild_pipes(commands):
|
def rebuild_pipes(commands, trigger_str_add=None):
|
||||||
|
|
||||||
|
if not trigger_str_add:
|
||||||
repipe_trigger_dict = commands[0]
|
repipe_trigger_dict = commands[0]
|
||||||
|
else:
|
||||||
|
repipe_trigger_dict = ""
|
||||||
|
|
||||||
|
trigger_number = 1
|
||||||
for trigger_dict in commands[1:]:
|
for trigger_dict in commands[1:]:
|
||||||
|
|
||||||
|
if trigger_str_add and trigger_number == 1:
|
||||||
|
trigger_str = trigger_dict["trigger_str"] + " %s" % trigger_str_add
|
||||||
|
else:
|
||||||
|
trigger_str = trigger_dict["trigger_str"]
|
||||||
|
|
||||||
|
if trigger_str_add:
|
||||||
|
splitkey_str = ""
|
||||||
|
else:
|
||||||
|
splitkey_str = " %s " % sb.commands.pipe_split_key
|
||||||
|
|
||||||
if trigger_dict["trigger_type"] == "command":
|
if trigger_dict["trigger_type"] == "command":
|
||||||
repipe_trigger_dict["trigger_str"] += " %s %s%s %s" % (sb.commands.pipe_split_key,
|
repipe_trigger_dict["trigger_str"] += "%s%s%s %s" % (splitkey_str,
|
||||||
trigger_dict["trigger_prefix"],
|
trigger_dict["trigger_prefix"],
|
||||||
trigger_dict["trigger_command"],
|
trigger_dict["trigger_command"],
|
||||||
trigger_dict["trigger_str"])
|
trigger_str)
|
||||||
|
|
||||||
elif trigger_dict["trigger_type"] == "nickname_command":
|
elif trigger_dict["trigger_type"] == "nickname_command":
|
||||||
repipe_trigger_dict["trigger_str"] += " %s %s %s %s" % (sb.commands.pipe_split_key,
|
repipe_trigger_dict["trigger_str"] += "%s%s %s %s" % (splitkey_str,
|
||||||
trigger_dict["trigger_prefix"],
|
trigger_dict["trigger_prefix"],
|
||||||
trigger_dict["trigger_command"],
|
trigger_dict["trigger_command"],
|
||||||
trigger_dict["trigger_str"])
|
trigger_str)
|
||||||
|
|
||||||
elif trigger_dict["trigger_type"] == "action_command":
|
elif trigger_dict["trigger_type"] == "action_command":
|
||||||
repipe_trigger_dict["trigger_str"] += " %s %s %s %s" % (sb.commands.pipe_split_key,
|
repipe_trigger_dict["trigger_str"] += "%s%s %s %s" % (splitkey_str,
|
||||||
"/me",
|
"/me",
|
||||||
trigger_dict["trigger_command"],
|
trigger_dict["trigger_command"],
|
||||||
trigger_dict["trigger_str"])
|
trigger_str)
|
||||||
|
|
||||||
|
trigger_number += 1
|
||||||
|
|
||||||
return repipe_trigger_dict
|
return repipe_trigger_dict
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user