Fix awaiting coroutine

This commit is contained in:
Gabriel Huber 2025-05-15 14:00:40 +02:00
parent 8c21710dd2
commit c7d6ef4414

View file

@ -4,6 +4,7 @@ import re
import urlpreview
import asyncio
import logging
import configparser
logging.basicConfig(level=logging.DEBUG)
url_regex = re.compile(r"https?://[^\s#]+")
@ -31,11 +32,11 @@ class PreviewBot(slixmpp.ClientXMPP):
async def on_message(self, msg):
if msg["type"] in ("chat", "normal") and msg["from"] != self.nick:
self.handle_msg(msg)
await self.handle_msg(msg)
async def on_muc_message(self, msg):
if msg["type"] == "groupchat" and msg["from"] != self.nick:
self.handle_msg(msg)
await self.handle_msg(msg)
async def handle_msg(self, msg):
url_matches = url_regex.findall(msg["body"])