From 86e0ab031d7a5a81da7287fddbc5fb3b8c5b6669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdulkadir=20Furkan=20=C5=9Eanl=C4=B1?= Date: Tue, 23 Jan 2024 18:15:41 +0100 Subject: [PATCH] Fix GIF upload. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Abdulkadir Furkan Şanlı --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 32f6489..1f0c54d 100755 --- a/main.py +++ b/main.py @@ -212,9 +212,7 @@ async def message_callback(client, room, event): content={"msgtype": "m.text", "body": intro_message}, ) with open("./parker.gif", "rb") as gif_file: - response = await client.upload( - gif_file.read(), content_type="image/gif" - ) + response = await client.upload(gif_file, content_type="image/gif") gif_uri = response.content_uri await client.room_send( room_id=room_id, @@ -227,7 +225,9 @@ async def message_callback(client, room, event): }, ) - if body == "!pow" and current_time - timestamp_sec < datetime.timedelta(seconds=30): + if body == "!pow" and current_time - timestamp_sec < datetime.timedelta( + seconds=30 + ): playlist_link = f"https://www.youtube.com/playlist?list={playlist_id}" reply_msg = f"{sender}, here's the playlist of the week: {playlist_link}" await client.room_send(