Fix awaiting coroutine
This commit is contained in:
parent
8c21710dd2
commit
c7d6ef4414
1 changed files with 3 additions and 2 deletions
|
@ -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"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue