diff options
Diffstat (limited to 'plugins/marquee.py')
-rw-r--r-- | plugins/marquee.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/marquee.py b/plugins/marquee.py index bad06301..66ec8b70 100644 --- a/plugins/marquee.py +++ b/plugins/marquee.py @@ -34,6 +34,7 @@ Configuration """ +import asyncio from poezio.plugin import BasePlugin from poezio import tabs from poezio import xhtml @@ -41,7 +42,7 @@ from poezio.decorators import command_args_parser def move(text, step, spacing): - new_text = text + (" " * spacing) + new_text = text + ("\u00A0" * spacing) return new_text[-(step % len(new_text)):] + new_text[:-( step % len(new_text))] @@ -56,19 +57,21 @@ class Plugin(BasePlugin): } def init(self): - for tab_t in [tabs.MucTab, tabs.ConversationTab, tabs.PrivateTab]: + for tab_t in [tabs.MucTab, tabs.DynamicConversationTab, tabs.StaticConversationTab, tabs.PrivateTab]: self.add_tab_command( tab_t, 'marquee', self.command_marquee, 'Replicate the <marquee/> behavior in a message') @command_args_parser.raw - def command_marquee(self, args): + async def command_marquee(self, args): + if not args: + return None tab = self.api.current_tab() args = xhtml.clean_text(xhtml.convert_simple_to_full_colors(args)) - tab.command_say(args) + await tab.command_say(args) is_muctab = isinstance(tab, tabs.MucTab) msg_id = tab.last_sent_message["id"] - jid = tab.name + jid = tab.jid event = self.api.create_delayed_event( self.config.get("refresh"), self.delayed_event, jid, args, msg_id, @@ -85,6 +88,6 @@ class Plugin(BasePlugin): message.send() event = self.api.create_delayed_event( self.config.get("refresh"), self.delayed_event, jid, body, - message["id"], step + 1, duration + self.config.get("refresh"), + msg_id, step + 1, duration + self.config.get("refresh"), is_muctab) self.api.add_timed_event(event) |