From b7027e53474c208d7b772794fd34b30092bc4df1 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 6 Nov 2011 23:46:35 +0100 Subject: [PATCH] Super-useful figlet plugin --- plugins/figlet.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/figlet.py diff --git a/plugins/figlet.py b/plugins/figlet.py new file mode 100644 index 00000000..ccff687a --- /dev/null +++ b/plugins/figlet.py @@ -0,0 +1,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