SpiceBot/sopel_SpiceBot_Core_Prerun/pipe_split.py
deathbybandaid 5425fb5c4f test
2022-02-22 11:32:53 -05:00

29 lines
714 B
Python

import functools
from sopel_SpiceBot_Core_1 import sb
def pipe_split():
"""
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_pipe_split(bot, trigger, comrun, *args, **kwargs):
bot.say("pipe_split")
# Get list of trigger command(s)
pipes = sb.commands.get_commands_split(bot, trigger, "|")
bot.say(str(pipes))
function(bot, trigger, comrun, *args, **kwargs)
print(comrun.test)
return internal_pipe_split
return actual_decorator