25 lines
676 B
Python
25 lines
676 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from base import ModuleBase
|
|
import re
|
|
|
|
class Module(ModuleBase):
|
|
def __init__(self, manager):
|
|
ModuleBase.__init__(self, manager)
|
|
|
|
def commands(self):
|
|
return [('!topic <Topic>', 'Fügt einen Text zum Thema des Chatraums hinzu')]
|
|
|
|
def groupchat(self, room, nick, text, handler):
|
|
if not re.match(r'!topic\W', text):
|
|
return
|
|
|
|
topic = re.sub(r'!topic\W+', '', text)
|
|
if topic == '':
|
|
return
|
|
|
|
oldtopic = handler.get_topic()
|
|
if oldtopic != '' and oldtopic != None:
|
|
topic += ' | ' + oldtopic
|
|
|
|
handler.set_topic(topic)
|