Added show function to topic module

This commit is contained in:
Matthias Schiffer 2010-05-06 22:10:50 +02:00
parent b5ade70817
commit 0904e7fec4

View file

@ -8,10 +8,14 @@ class Module(ModuleBase):
ModuleBase.__init__(self, manager) ModuleBase.__init__(self, manager)
def commands(self): def commands(self):
return [('!topic <Topic>', 'Fügt einen Text zum Thema des Chatraums hinzu')] return [('!topic [<Topic>]', 'Fügt einen Text zum Thema des Chatraums hinzu oder zeigt das aktuelle Topic an')]
def groupchat(self, room, nick, text, handler): def groupchat(self, room, nick, text, handler):
if not re.match(r'!topic(?:\W|\Z)', text):
return
if not re.match(r'!topic\W', text): if not re.match(r'!topic\W', text):
handler.reply(handler.get_topic())
return return
topic = re.sub(r'!topic\W+', '', text) topic = re.sub(r'!topic\W+', '', text)