test
This commit is contained in:
parent
6170d930fc
commit
c5e9d8f23c
@ -8,7 +8,7 @@ class ComRun():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def dispatch():
|
def dispatch_multi():
|
||||||
"""
|
"""
|
||||||
This splits the given command by `&&` and re-dispatches it internally to the bot.
|
This splits the given command by `&&` and re-dispatches it internally to the bot.
|
||||||
"""
|
"""
|
||||||
@ -16,7 +16,7 @@ def dispatch():
|
|||||||
def actual_decorator(function):
|
def actual_decorator(function):
|
||||||
|
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_dispatch(bot, trigger, *args, **kwargs):
|
def internal_dispatch_multi(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
bot.say("dispatch")
|
bot.say("dispatch")
|
||||||
|
|
||||||
@ -31,7 +31,30 @@ def dispatch():
|
|||||||
|
|
||||||
function(bot, trigger, *args, **kwargs)
|
function(bot, trigger, *args, **kwargs)
|
||||||
|
|
||||||
return internal_dispatch
|
return internal_dispatch_multi
|
||||||
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
|
def dispatch_pipes():
|
||||||
|
"""
|
||||||
|
This splits the given command by ` | ` and re-dispatches it internally to the bot.
|
||||||
|
This allows the output of a command to be sent
|
||||||
|
"""
|
||||||
|
|
||||||
|
def actual_decorator(function):
|
||||||
|
|
||||||
|
@functools.wraps(function)
|
||||||
|
def internal_dispatch_pipe(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
|
bot.say("dispatch")
|
||||||
|
|
||||||
|
# Get list of trigger command(s)
|
||||||
|
pipes = get_pipes(bot, trigger)
|
||||||
|
bot.say(str(pipes))
|
||||||
|
|
||||||
|
function(bot, trigger, *args, **kwargs)
|
||||||
|
|
||||||
|
return internal_dispatch_pipe
|
||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
@ -56,8 +79,9 @@ def prerun():
|
|||||||
|
|
||||||
def actual_decorator(function):
|
def actual_decorator(function):
|
||||||
|
|
||||||
@dispatch()
|
@dispatch_pipes()
|
||||||
@command_args()
|
@dispatch_multi()
|
||||||
|
# @command_args()
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
def internal_prerun(bot, trigger, *args, **kwargs):
|
def internal_prerun(bot, trigger, *args, **kwargs):
|
||||||
|
|
||||||
@ -72,6 +96,17 @@ def prerun():
|
|||||||
return actual_decorator
|
return actual_decorator
|
||||||
|
|
||||||
|
|
||||||
|
def get_pipes(bot, trigger):
|
||||||
|
|
||||||
|
# Get && split for multiple commands
|
||||||
|
if "|" in trigger.args[1]:
|
||||||
|
pipes = [x.strip() for x in trigger.args[1].split("|")]
|
||||||
|
else:
|
||||||
|
pipes = [trigger.args[1]]
|
||||||
|
|
||||||
|
return pipes
|
||||||
|
|
||||||
|
|
||||||
def get_commands(bot, trigger):
|
def get_commands(bot, trigger):
|
||||||
commands = []
|
commands = []
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user