From 0277a779c9dff841e04a08a5c39fe07faa92cfe8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 2 May 2010 20:28:17 +0200 Subject: Added modules --- modules/help.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 modules/help.py (limited to 'modules/help.py') diff --git a/modules/help.py b/modules/help.py new file mode 100644 index 0000000..d239f84 --- /dev/null +++ b/modules/help.py @@ -0,0 +1,18 @@ +from base import ModuleBase +import re + +class Module(ModuleBase): + def __init__(self, manager): + ModuleBase.__init__(self, manager) + + def commands(self): + return [('!help', 'Zeigt diese Hilfe an...')] + + def groupchat(self, room, message_from, message_body, reply): + if not re.match(r'!help(?:\W|\Z)', message_body): + return + + commands = reduce(lambda l, mod: l + mod.commands(), self.manager.modules, []) + helpstring = reduce(lambda s, (c, h): s + c + ': ' + h + '\n', commands, '') + + reply('Befehle:\n\n' + helpstring) -- cgit v1.2.3