test
This commit is contained in:
parent
09ab9b0d88
commit
ad7c8ae2fa
14
sopel_SpiceBotCore/SBCore/prerun.py
Normal file
14
sopel_SpiceBotCore/SBCore/prerun.py
Normal file
@ -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
|
||||||
@ -10,6 +10,7 @@ import pathlib
|
|||||||
from sopel import plugin
|
from sopel import plugin
|
||||||
|
|
||||||
from .SBCore import SpiceBotCore_OBJ
|
from .SBCore import SpiceBotCore_OBJ
|
||||||
|
from .SBCore.prerun import prerun
|
||||||
|
|
||||||
SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
|
SCRIPT_DIR = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ def setup(bot):
|
|||||||
sb.setup(bot)
|
sb.setup(bot)
|
||||||
|
|
||||||
|
|
||||||
|
@prerun(sb, 'nickname')
|
||||||
@plugin.nickname_command('test')
|
@plugin.nickname_command('test')
|
||||||
def sb_nickname_command(bot, trigger):
|
def sb_nickname_command(bot, trigger):
|
||||||
bot.say("Testing the bot")
|
bot.say("Testing the bot")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user