From 6174ca70d9bc36fde9d0a0c08ccb67e874a4711c Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 15 Feb 2022 22:43:10 +0100 Subject: internal: make command_say async --- plugins/amsg.py | 4 ++-- plugins/marquee.py | 3 ++- plugins/send_delayed.py | 3 ++- plugins/tell.py | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/amsg.py b/plugins/amsg.py index 4cd6c055..3b81085a 100644 --- a/plugins/amsg.py +++ b/plugins/amsg.py @@ -29,7 +29,7 @@ class Plugin(BasePlugin): short='Broadcast a message', help='Broadcast the message to all the joined rooms.') - def command_amsg(self, args): + async def command_amsg(self, args): for room in self.core.tabs: if isinstance(room, MucTab) and room.joined: - room.command_say(args) + await room.command_say(args) diff --git a/plugins/marquee.py b/plugins/marquee.py index 9319a7f6..2fea3ed6 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 @@ -65,7 +66,7 @@ class Plugin(BasePlugin): def command_marquee(self, args): tab = self.api.current_tab() args = xhtml.clean_text(xhtml.convert_simple_to_full_colors(args)) - tab.command_say(args) + asyncio.ensure_future(tab.command_say(args)) is_muctab = isinstance(tab, tabs.MucTab) msg_id = tab.last_sent_message["id"] jid = tab.jid diff --git a/plugins/send_delayed.py b/plugins/send_delayed.py index e8b00027..92ed97c1 100644 --- a/plugins/send_delayed.py +++ b/plugins/send_delayed.py @@ -18,6 +18,7 @@ This plugin adds a command to the chat tabs. """ +import asyncio from poezio.plugin import BasePlugin from poezio.core.structs import Completion from poezio.decorators import command_args_parser @@ -74,6 +75,6 @@ class Plugin(BasePlugin): tab = args[0] # anything could happen to the tab during the interval try: - tab.command_say(args[1]) + asyncio.ensure_future(tab.command_say(args[1])) except: pass diff --git a/plugins/tell.py b/plugins/tell.py index 614c1ef5..cd72a9e5 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -25,6 +25,7 @@ This plugin defines two new commands for chatroom tabs: List all queued messages for the current chatroom. """ +import asyncio from poezio.plugin import BasePlugin from poezio.core.structs import Completion from poezio.decorators import command_args_parser @@ -66,7 +67,7 @@ class Plugin(BasePlugin): if nick not in self.tabs[tab]: return for i in self.tabs[tab][nick]: - tab.command_say("%s: %s" % (nick, i)) + asyncio.ensure_future(tab.command_say("%s: %s" % (nick, i))) del self.tabs[tab][nick] @command_args_parser.ignored -- cgit v1.2.3