From e732bdadf536221aa89bc98c61738dc5871f087c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 2 May 2010 21:51:15 +0200 Subject: Added ddate module --- modules/ddate.py | 15 +++++++++++++++ modules/log.py | 1 + 2 files changed, 16 insertions(+) create mode 100644 modules/ddate.py (limited to 'modules') diff --git a/modules/ddate.py b/modules/ddate.py new file mode 100644 index 0000000..eee8a29 --- /dev/null +++ b/modules/ddate.py @@ -0,0 +1,15 @@ +from base import ModuleBase +import re, subprocess + +class Module(ModuleBase): + def __init__(self, manager): + ModuleBase.__init__(self, manager) + + def commands(self): + return [('!ddate', 'Das heutige Datum im einzigen relevaten Kalender-System.')] + + def groupchat(self, room, message_from, message_body, reply): + if not re.match(r'!ddate(?:\W|\Z)', message_body): + return + + reply(subprocess.Popen(['ddate'], stdout=subprocess.PIPE).communicate()[0].strip()) diff --git a/modules/log.py b/modules/log.py index 3280d27..f97ad90 100644 --- a/modules/log.py +++ b/modules/log.py @@ -8,3 +8,4 @@ class Module(ModuleBase): def groupchat(self, room, message_from, message_body, reply): cursor = self.db.cursor() cursor.execute('INSERT INTO log (time, room, nick, text) VALUES (NOW(), %s, %s, %s)', (room, message_from, message_body)) + cursor.close() -- cgit v1.2.3