diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-05-02 21:51:15 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-05-02 21:51:15 +0200 |
commit | e732bdadf536221aa89bc98c61738dc5871f087c (patch) | |
tree | 8b7c589d1b545d08b95ec00002947e6f8b16b628 | |
parent | d537d4b69b4547814f2d01bc18ce2c472b978647 (diff) | |
download | curunir-e732bdadf536221aa89bc98c61738dc5871f087c.tar curunir-e732bdadf536221aa89bc98c61738dc5871f087c.zip |
Added ddate module
-rw-r--r-- | modules/ddate.py | 15 | ||||
-rw-r--r-- | modules/log.py | 1 |
2 files changed, 16 insertions, 0 deletions
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() |