19 lines
744 B
Python
19 lines
744 B
Python
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, nick, text, handler):
|
|
if not re.match(r'!help(?:\W|\Z)', text):
|
|
return
|
|
|
|
commands = reduce(lambda l, mod: l + mod.commands(), self.manager.modules.itervalues(), [])
|
|
helpstring = reduce(lambda s, (c, h): s + c + ': ' + h + '\n', commands, '')
|
|
helptexts = '\n'.join(reduce(lambda l, mod: l + mod.helptexts(), self.manager.modules.itervalues(), []))
|
|
|
|
handler.reply(('Befehle:\n' + helpstring + '\n' + helptexts).strip())
|