2013-04-13 20:33:06 +00:00
|
|
|
"""
|
|
|
|
This plugin uses figlet to transform every message into a big ascii-art
|
|
|
|
message.
|
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
You only have to load the plugin (and have :file:`figlet` installed, of course).
|
|
|
|
::
|
|
|
|
|
|
|
|
/load figlet
|
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
|
|
|
Say something in a Chat tab.
|
|
|
|
|
|
|
|
.. note:: Can create fun things when used with :ref:`The rainbow plugin <rainbow-plugin>`.
|
|
|
|
|
|
|
|
"""
|
2011-11-06 22:46:35 +00:00
|
|
|
from plugin import BasePlugin
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
class Plugin(BasePlugin):
|
|
|
|
def init(self):
|
2013-03-08 21:53:35 +00:00
|
|
|
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)
|
2011-11-06 22:46:35 +00:00
|
|
|
|
2011-11-09 13:29:13 +00:00
|
|
|
def figletize(self, msg, tab):
|
2012-05-10 08:47:45 +00:00
|
|
|
process = subprocess.Popen(['figlet', '--', msg['body']], stdout=subprocess.PIPE)
|
2011-11-06 22:46:35 +00:00
|
|
|
result = process.communicate()[0].decode('utf-8')
|
|
|
|
msg['body'] = result
|