summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/ddate.py15
-rw-r--r--modules/log.py1
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()