summaryrefslogtreecommitdiff
path: root/plugins/figlet.py
blob: ccff687a2f214a759e9895b208399ad6c3882390 (plain)
1
2
3
4
5
6
7
8
9
10
11
from plugin import BasePlugin
import subprocess

class Plugin(BasePlugin):
    def init(self):
        self.add_poezio_event_handler('muc_say', self.figletize)

    def figletize(self, msg):
        process = subprocess.Popen(['figlet', msg['body']], stdout=subprocess.PIPE)
        result = process.communicate()[0].decode('utf-8')
        msg['body'] = result