diff options
author | David Lamparter <equinox@diac24.net> | 2015-01-09 06:05:24 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2015-01-09 06:05:24 +0100 |
commit | 7d4e80fa3114ed0cf9acc88fccf83b1bf4c8a8c3 (patch) | |
tree | ea229005cf54abfcc239758732f32cb3013cdd73 /bot_backend.py | |
parent | ee6814667340d18a129b9aea724e7844468800a4 (diff) | |
parent | 586d4521c2c1d1d62937ccf8dcf7df53024b1ec5 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'bot_backend.py')
-rw-r--r-- | bot_backend.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bot_backend.py b/bot_backend.py index b1ccb48..5c3812b 100644 --- a/bot_backend.py +++ b/bot_backend.py @@ -34,10 +34,18 @@ def tmp_set(url, value): def on_pubmsg(self, c, e): message = e.arguments[0] - light_command_prefix = '!light' - if message.startswith(light_command_prefix): - nick = e.source.nick - on_light_command(self, nick, message[len(light_command_prefix) + 1:]) + nick = e.source.nick + commands = { + '!light' : on_light_command, + } + + if message.startswith('!help'): + self.connection.privmsg(self.channel, "The following commands are currently known: %s" % ', '.join(sorted(commands.keys()))) + else: + for key in commands: + if message.startswith(key): + commands[key](self, nick, message[len(key) + 1:]) + break def on_light_command(self, nick, commandline): tokens = commandline.split(' ') |