Added ddate module

This commit is contained in:
Matthias Schiffer 2010-05-02 21:51:15 +02:00
parent d537d4b69b
commit e732bdadf5
2 changed files with 16 additions and 0 deletions

15
modules/ddate.py Normal file
View file

@ -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())

View file

@ -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()