test
This commit is contained in:
parent
8da74ac9fe
commit
a2569cab86
@ -18,9 +18,9 @@ def prerun():
|
|||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_prerun(bot, trigger, comrun, *args, **kwargs):
|
def internal_prerun(bot, trigger, comrun, *args, **kwargs):
|
||||||
|
|
||||||
bot.say("prerun")
|
|
||||||
|
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
|
|
||||||
|
bot.say(comrun.say)
|
||||||
|
|
||||||
return internal_prerun
|
return internal_prerun
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|||||||
@ -9,8 +9,6 @@ def command_args():
|
|||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_command_args(bot, trigger, comrun, *args, **kwargs):
|
def internal_command_args(bot, trigger, comrun, *args, **kwargs):
|
||||||
|
|
||||||
bot.say("command_args")
|
|
||||||
|
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
|
|
||||||
return internal_command_args
|
return internal_command_args
|
||||||
|
|||||||
@ -14,7 +14,6 @@ def comrun_create():
|
|||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_comrun_create(bot, trigger, *args, **kwargs):
|
def internal_comrun_create(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
bot.say("comrun_create")
|
|
||||||
comrun = ComRun()
|
comrun = ComRun()
|
||||||
|
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
|
|||||||
@ -13,18 +13,16 @@ def dispatch_multi():
|
|||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_dispatch_multi(bot, trigger, comrun, *args, **kwargs):
|
def internal_dispatch_multi(bot, trigger, comrun, *args, **kwargs):
|
||||||
|
|
||||||
bot.say("dispatch_multi")
|
|
||||||
|
|
||||||
# Get list of trigger command(s)
|
# Get list of trigger command(s)
|
||||||
commands = sb.commands.get_commands_split(trigger, "&&")
|
commands = sb.commands.get_commands_split(trigger, "&&")
|
||||||
|
|
||||||
# If more than 1 trigger command, dispatch
|
if len(commands) == 1:
|
||||||
if len(commands) > 1:
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
|
comrun.trigger_dict = commands[0]
|
||||||
|
else:
|
||||||
for trigger_dict in commands:
|
for trigger_dict in commands:
|
||||||
sb.commands.dispatch(bot, trigger_dict)
|
sb.commands.dispatch(bot, trigger_dict)
|
||||||
return
|
return
|
||||||
|
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
|
||||||
|
|
||||||
return internal_dispatch_multi
|
return internal_dispatch_multi
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|||||||
@ -14,27 +14,21 @@ def pipe_split():
|
|||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_pipe_split(bot, trigger, comrun, *args, **kwargs):
|
def internal_pipe_split(bot, trigger, comrun, *args, **kwargs):
|
||||||
|
|
||||||
bot.say("pipe_split")
|
|
||||||
|
|
||||||
# Get list of trigger command(s)
|
# Get list of trigger command(s)
|
||||||
pipes = sb.commands.get_commands_split(trigger, "|")
|
pipes = sb.commands.get_commands_split(trigger, "|")
|
||||||
|
|
||||||
|
comrun.trigger_dict = pipes[0]
|
||||||
|
|
||||||
if len(pipes) == 1:
|
if len(pipes) == 1:
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
# for trigger_dict in commands:
|
|
||||||
# sb.commands.dispatch(bot, trigger, trigger_dict)
|
|
||||||
# return
|
|
||||||
|
|
||||||
# first_pipe = pipes[0]
|
|
||||||
del pipes[0]
|
del pipes[0]
|
||||||
|
|
||||||
function(bot, trigger, comrun, *args, **kwargs)
|
function(bot, trigger, comrun, *args, **kwargs)
|
||||||
|
|
||||||
repipe_trigger_dict = reassemble_pipes(pipes, comrun.say)
|
repipe_trigger_dict = reassemble_pipes(pipes, comrun.say)
|
||||||
sb.commands.dispatch(bot, repipe_trigger_dict)
|
sb.commands.dispatch(bot, repipe_trigger_dict)
|
||||||
|
return
|
||||||
bot.say(comrun.say)
|
|
||||||
|
|
||||||
return internal_pipe_split
|
return internal_pipe_split
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
@ -56,10 +50,10 @@ def reassemble_pipes(pipes, comrunsay):
|
|||||||
repipe_trigger_dict["trigger_str"] += " %s" % comrunsay
|
repipe_trigger_dict["trigger_str"] += " %s" % comrunsay
|
||||||
for trigger_dict in pipes:
|
for trigger_dict in pipes:
|
||||||
if trigger_dict["trigger_type"] == "command":
|
if trigger_dict["trigger_type"] == "command":
|
||||||
repipe_trigger_dict["trigger_str"] += " | %s%s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_str"])
|
repipe_trigger_dict["trigger_str"] += " | %s%s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_command"], trigger_dict["trigger_str"])
|
||||||
elif trigger_dict["trigger_type"] == "nickname_command":
|
elif trigger_dict["trigger_type"] == "nickname_command":
|
||||||
repipe_trigger_dict["trigger_str"] += " | %s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_str"])
|
repipe_trigger_dict["trigger_str"] += " | %s %s %s" % (trigger_dict["trigger_prefix"], trigger_dict["trigger_command"], trigger_dict["trigger_str"])
|
||||||
elif trigger_dict["trigger_type"] == "action_command":
|
elif trigger_dict["trigger_type"] == "action_command":
|
||||||
repipe_trigger_dict["trigger_str"] += " | %s %s" % ("/me", trigger_dict["trigger_str"])
|
repipe_trigger_dict["trigger_str"] += " | %s %s %s" % ("/me", trigger_dict["trigger_command"], trigger_dict["trigger_str"])
|
||||||
|
|
||||||
return repipe_trigger_dict
|
return repipe_trigger_dict
|
||||||
|
|||||||
@ -8,13 +8,13 @@ from sopel_SpiceBot_Core_Prerun import prerun
|
|||||||
@prerun()
|
@prerun()
|
||||||
@plugin.command('pipea')
|
@plugin.command('pipea')
|
||||||
def pipea(bot, trigger, comrun):
|
def pipea(bot, trigger, comrun):
|
||||||
comrun.say = "this is a test"
|
comrun.say = str(comrun.trigger_dict["trigger_str"])
|
||||||
|
|
||||||
|
|
||||||
@prerun()
|
@prerun()
|
||||||
@plugin.command('pipeb')
|
@plugin.command('pipeb')
|
||||||
def pipeb(bot, trigger, comrun):
|
def pipeb(bot, trigger, comrun):
|
||||||
comrun.say = str(trigger.args[1]).upper()
|
comrun.say = str(comrun.trigger_dict["trigger_str"]).upper()
|
||||||
|
|
||||||
|
|
||||||
@prerun()
|
@prerun()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user