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

20 lines
627 B
Python
Raw Normal View History

from . import ModuleBase
2010-05-02 20:28:17 +02:00
import re
class Module(ModuleBase):
def __init__(self, manager):
ModuleBase.__init__(self, manager)
def commands(self):
return [('!help', 'Zeigt diese Hilfe an...')]
2010-05-02 23:40:21 +02:00
def groupchat(self, room, nick, text, handler):
if not re.match(r'!help(?:\W|\Z)', text):
2010-05-02 20:28:17 +02:00
return
commands = self.manager.commands()
2010-05-02 20:28:17 +02:00
helpstring = reduce(lambda s, (c, h): s + c + ': ' + h + '\n', commands, '')
helptexts = '\n'.join(self.manager.helptexts())
2010-05-02 20:28:17 +02:00
2010-05-02 23:40:21 +02:00
handler.reply(('Befehle:\n' + helpstring + '\n' + helptexts).strip())