aboutsummaryrefslogtreecommitdiff
path: root/modules/stats.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-26 18:27:17 +0100
committerGravatar jesopo2018-09-26 18:27:17 +0100
commit51a52e2b0e54031cce5876f54d1d48c268b5441c (patch)
treea4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/stats.py
parentAlso 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.py12
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