diff options
Diffstat (limited to 'modules/tracking.py')
-rw-r--r-- | modules/tracking.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/tracking.py b/modules/tracking.py index 94b8d86..aa33980 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -54,6 +54,7 @@ class Module: def __init__(self, bot): self.setup_db() self.irc = bot + self.irc.register_keyword('!track', self) self.tracking = [] self.lc = LoopingCall(self.lc_callback) if bot: @@ -200,21 +201,18 @@ class Module: session.close() return msg - def __call__(self, nick, channel, msg): - if not msg.startswith('!track'): - return - + def keyword(self, nick, channel, kw, msg): args = msg.split() - if len(args) < 2: + if len(args) < 1: self.irc.msg(channel if not channel == self.irc.nickname else nick.split('!')[0], 'Usage: !track (start|stop|status TRACKINGNO)|list') return - mode = args[1] + mode = args[0] if mode.lower() in ('start', 'stop', 'status'): - if len(args) != 3 and mode.lower() != 'status': + if len(args) != 2 and mode.lower() != 'status': self.irc.msg(channel if not channel == self.irc.nickname else nick.split('!')[0], 'Usage: !track (start|stop|status TRACKINGNO)|list') return - code = args[2] if len(args) == 3 else '' + code = args[1] if len(args) == 2 else '' msg = None if mode.lower() == 'start': |