X-Git-Url: http://git.treefish.org/~alex/mtxbot.git/blobdiff_plain/68e819a04d93ac687e72ec02cc24f8b78bebb055..78728c1ec35a28086bf6939eb8afaaae897fa3e5:/src/presence.py diff --git a/src/presence.py b/src/presence.py index e239bdb..b3da858 100644 --- a/src/presence.py +++ b/src/presence.py @@ -1,5 +1,6 @@ import aiofiles import asyncio +import base64 import errno import logging import posix @@ -68,12 +69,18 @@ class Presence: if self._stop: break if self._joined_room_id != None: + try: + msgB64Bytes = line.rstrip("\n").encode("UTF-8") + msgBytes = base64.b64decode(msgB64Bytes) + except: + self._log(logging.WARNING, "Error decoding message") + continue await client.room_send( room_id=self._joined_room_id, message_type="m.room.message", content={ "msgtype": "m.text", - "body": line.rstrip("\n") + "body": msgBytes.decode("UTF-8") } ) else: