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/stats.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'modules/stats.py') diff --git a/modules/stats.py b/modules/stats.py index 867d7577..927eedad 100644 --- a/modules/stats.py +++ b/modules/stats.py @@ -4,17 +4,21 @@ from src import Utils class Module(object): def __init__(self, bot, events, exports): self.bot = bot - events.on("received.command.uptime").hook(self.uptime, - help="Show my uptime") - events.on("received.command.stats").hook(self.stats, - help="Show my network/channel/user stats") + @Utils.hook("received.command.uptime") def uptime(self, event): + """ + Show my uptime + """ seconds = int(time.time()-self.bot.start_time) event["stdout"].write("Uptime: %s" % Utils.to_pretty_time( seconds)) + @Utils.hook("received.command.stats") def stats(self, event): + """ + Show my network/channel/user stats + """ networks = len(self.bot.servers) channels = 0 users = 0 -- cgit v1.3.1-10-gc9f91