31 lines
832 B
Python
31 lines
832 B
Python
import functools
|
|
|
|
from sopel_SpiceBot_Core_1 import sb
|
|
|
|
|
|
def dispatch_multi():
|
|
"""
|
|
This splits the given command by `&&` and re-dispatches it internally to the bot.
|
|
"""
|
|
|
|
def actual_decorator(function):
|
|
|
|
@functools.wraps(function)
|
|
def internal_dispatch_multi(bot, trigger, comrun, *args, **kwargs):
|
|
|
|
bot.say("dispatch_multi")
|
|
|
|
# Get list of trigger command(s)
|
|
commands = sb.commands.get_commands_split(trigger, "&&")
|
|
|
|
# If more than 1 trigger command, dispatch
|
|
if len(commands) > 1:
|
|
for trigger_dict in commands:
|
|
sb.commands.dispatch(bot, trigger_dict)
|
|
return
|
|
|
|
function(bot, trigger, comrun, *args, **kwargs)
|
|
|
|
return internal_dispatch_multi
|
|
return actual_decorator
|