From 323d31514f7e438df5883ad6cb9e17cce6a296b3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 2 May 2010 23:40:21 +0200 Subject: Added topic module --- modules/topic.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 modules/topic.py (limited to 'modules/topic.py') diff --git a/modules/topic.py b/modules/topic.py new file mode 100644 index 0000000..bc8c83e --- /dev/null +++ b/modules/topic.py @@ -0,0 +1,25 @@ +# -*- 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 ', '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) -- cgit v1.2.3