This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
curunir/modules/help.py

19 lines
618 B
Python
Raw Normal View History

2010-05-02 20:28:17 +02:00
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
2010-05-02 21:18:09 +02:00
commands = reduce(lambda l, mod: l + mod.commands(), self.manager.modules.itervalues(), [])
2010-05-02 20:28:17 +02:00
helpstring = reduce(lambda s, (c, h): s + c + ': ' + h + '\n', commands, '')
reply('Befehle:\n\n' + helpstring)