This commit is contained in:
commit
b881bfad96
3 changed files with 24 additions and 3 deletions
|
@ -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'],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
return process.wait() == 0
|
||||
|
||||
|
||||
class Plugin(BasePlugin):
|
||||
def init(self):
|
||||
if not is_figlet():
|
||||
self.api.information(
|
||||
'Couldn\'t find the figlet program. '
|
||||
'Please install it and reload the plugin.',
|
||||
'Error',
|
||||
)
|
||||
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(
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim:fenc=utf-8
|
||||
#
|
||||
# Copyright © 2018 Maxime “pep” Buquet <pep@bouah.net>
|
||||
# Copyright © 2018 Maxime “pep” Buquet
|
||||
# Copyright © 2019 Madhur Garg
|
||||
#
|
||||
# Distributed under terms of the zlib license. See the COPYING file.
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ try:
|
|||
from gi.repository import Rsvg
|
||||
import cairo
|
||||
HAS_RSVG = True
|
||||
except (ImportError, ValueError):
|
||||
except (ImportError, ValueError, AttributeError):
|
||||
HAS_RSVG = False
|
||||
|
||||
from poezio.windows.base_wins import Win
|
||||
|
|
Loading…
Reference in a new issue