blob: 6e82381b18904b1e70db2663434eb8e9f14cf3ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
"""
This plugin uses figlet to transform every message into a big ascii-art
message.
Usage
-----
Say something in a Chat tab.
.. note:: Can create fun things when used with :ref:`The rainbow plugin <rainbow-plugin>`.
"""
from poezio.plugin import BasePlugin
import subprocess
class Plugin(BasePlugin):
def init(self):
self.api.add_event_handler('muc_say', self.figletize)
self.api.add_event_handler('conversation_say', self.figletize)
self.api.add_event_handler('private_say', self.figletize)
def figletize(self, msg, tab):
process = subprocess.Popen(['figlet', '--', msg['body']], stdout=subprocess.PIPE)
result = process.communicate()[0].decode('utf-8')
msg['body'] = result
|