plugins/figlet: error out when figlet doesn't exist

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <>
parent b7fc562c
......@@ -11,15 +11,35 @@ 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
from poezio.plugin import BasePlugin
def is_figlet() -> bool:
"""Ensure figlet exists"""
process = subprocess.Popen(
['which', 'figlet'],
return process.wait() == 0
class Plugin(BasePlugin):
def init(self):
if not is_figlet():
'Couldn\'t find the figlet program. '
'Please install it and reload the plugin.',
return None
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)
return None
def figletize(self, msg, tab):
process = subprocess.Popen(
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment