summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2022-02-15 22:43:10 +0100
committerMaxime Buquet <pep@bouah.net>2022-03-23 15:38:00 +0100
commit6174ca70d9bc36fde9d0a0c08ccb67e874a4711c (patch)
tree45cd819c9599a75c9af2dd0739dd7d03b8ba2060 /plugins
parentd6de6dccfa4b832a84edd394bee4f92a00069277 (diff)
downloadpoezio-6174ca70d9bc36fde9d0a0c08ccb67e874a4711c.tar.gz
poezio-6174ca70d9bc36fde9d0a0c08ccb67e874a4711c.tar.bz2
poezio-6174ca70d9bc36fde9d0a0c08ccb67e874a4711c.tar.xz
poezio-6174ca70d9bc36fde9d0a0c08ccb67e874a4711c.zip
internal: make command_say async
Diffstat (limited to 'plugins')
-rw-r--r--plugins/amsg.py4
-rw-r--r--plugins/marquee.py3
-rw-r--r--plugins/send_delayed.py3
-rw-r--r--plugins/tell.py3
4 files changed, 8 insertions, 5 deletions
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