From 51a52e2b0e54031cce5876f54d1d48c268b5441c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Sep 2018 18:27:17 +0100 Subject: Switch to using @Utils.hook and docstrings for event hooks --- modules/ids.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/ids.py') diff --git a/modules/ids.py b/modules/ids.py index 17b20a6e..fb81f492 100644 --- a/modules/ids.py +++ b/modules/ids.py @@ -1,18 +1,20 @@ +from src import ModuleManager, Utils - -class Module(object): +class Module(ModuleManager.BaseModule): _name = "IDs" - def __init__(self, bot, events, exports): - events.on("received.command.myid").hook(self.my_id, - help="Show your user ID") - events.on("received.command.channelid").hook( - self.channel_id, channel_only=True, - help="Show the current channel's ID") + @Utils.hook("received.command.myid") def my_id(self, event): + """ + Show your user ID + """ event["stdout"].write("%s: %d" % (event["user"].nickname, event["user"].get_id())) + @Utils.hook("received.command.channelid", channel_only=True) def channel_id(self, event): + """ + Show the current channel's ID + """ event["stdout"].write("%s: %d" % (event["target"].name, event["target"].id)) -- cgit v1.3.1-10-gc9f91