summaryrefslogtreecommitdiffstats
path: root/modules/ddate.py
blob: e687d7606f9812cd2c935a28e17e45162e8123b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from . 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, nick, text, handler):
        if not re.match(r'!ddate(?:\W|\Z)', text):
            return
        
        handler.reply(subprocess.Popen(['ddate'], stdout=subprocess.PIPE).communicate()[0].strip())