diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/stats.py | |
| parent | Also use docstrings to check if a command has help available, allow one-string (diff) | |
| signature | ||
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/stats.py')
| -rw-r--r-- | modules/stats.py | 12 |
1 files changed, 8 insertions, 4 deletions
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 |
