diff --git a/sopel_SpiceBotCore/SBCore/prerun.py b/sopel_SpiceBotCore/SBCore/prerun.py new file mode 100644 index 0000000..91c6542 --- /dev/null +++ b/sopel_SpiceBotCore/SBCore/prerun.py @@ -0,0 +1,14 @@ +import functools + + +def prerun(sb, t_command_type='module'): + + def actual_decorator(function): + + @functools.wraps(function) + def internal_prerun(bot, trigger, *args, **kwargs): + + bot.say(str(id(trigger))) + + return internal_prerun + return actual_decorator diff --git a/sopel_SpiceBotCore/__init__.py b/sopel_SpiceBotCore/__init__.py index 9e9ade3..f39fa52 100644 --- a/sopel_SpiceBotCore/__init__.py +++ b/sopel_SpiceBotCore/__init__.py @@ -10,6 +10,7 @@ import pathlib from sopel import plugin from .SBCore import SpiceBotCore_OBJ +from .SBCore.prerun import prerun SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) @@ -20,6 +21,7 @@ def setup(bot): sb.setup(bot) +@prerun(sb, 'nickname') @plugin.nickname_command('test') def sb_nickname_command(bot, trigger): bot.say("Testing the bot")