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): # Get list of trigger command(s) commands = sb.commands.get_commands_split(trigger, "&&") comrun.trigger_dict = commands[0] del commands[0] function(bot, trigger, comrun, *args, **kwargs) if len(commands): for trigger_dict in commands: sb.commands.dispatch(trigger_dict) comrun.continuerun = False return internal_dispatch_multi return actual_decorator