Files
cproof-plugins/ascii.py
2016-02-28 23:28:12 +00:00

27 lines
811 B
Python

import prof
import subprocess
def _cmd_ascii(text):
proc = subprocess.Popen(['figlet', '--', text], stdout=subprocess.PIPE)
ascii_out = proc.communicate()[0].decode('utf-8')
recipient = prof.get_current_recipient()
room = prof.get_current_muc()
if recipient:
prof.send_line(u'\u000A' + ascii_out)
elif room:
prof.send_line(u'\u000A' + ascii_out)
elif prof.current_win_is_console():
prof.cons_show(u'\u000A' + ascii_out)
def prof_init(version, status):
synopsis = [ "/ascii <message>" ]
description = "ASCIIfy a message."
args = [
[ "<message>", "The message to be ASCIIfied" ]
]
examples = [
"/ascii \"Hello there\""
]
prof.register_command("/ascii", 1, 1, synopsis, description, args, examples, _cmd_ascii)