blob: 09e2e4182b69f1e4e4861971f8c815c463538bdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# -*- coding: utf-8 -*-
from . import ModuleBase
import re, subprocess
class Module(ModuleBase):
def __init__(self, manager):
ModuleBase.__init__(self, manager)
self.fortune = manager.config['fortune']
def commands(self):
return [('!fortune', 'Zeigt ein zufälliges Fortune Cookie an')]
def groupchat(self, room, nick, text, handler):
if not re.match(r'!fortune(?:\W|\Z)', text):
return
handler.reply(subprocess.Popen(self.fortune, stdout=subprocess.PIPE).communicate()[0].strip())
|