From 70fa891ebc0bd27e4a1f24a5c7066df10cbac8fa Mon Sep 17 00:00:00 2001 From: L-ING Date: Fri, 29 Dec 2023 11:33:12 +0800 Subject: [PATCH] fix: None if file doesn't have name, use id + ext instead --- modules/handlers/transfer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/handlers/transfer.py b/modules/handlers/transfer.py index 762191e..363b25f 100644 --- a/modules/handlers/transfer.py +++ b/modules/handlers/transfer.py @@ -27,6 +27,8 @@ async def transfer_handler(event): try: if "document" in event.media.to_dict(): name = event.file.name + if not name: + name = "%d%s" % (event.media.document.id, event.file.ext) status_message = await Status_Message.create(event) callback = Callback(event, status_message) response_dict = await multi_parts_uploader(tg_client, message.media.document, name, progress_callback=callback) @@ -73,6 +75,8 @@ async def transfer_handler(event): try: if "document" in message.media.to_dict(): name = message.file.name + if not name: + name = "%d%s" % (message.media.document.id, message.file.ext) status_message = await Status_Message.create(event) callback = Callback(event, status_message) response_dict = await multi_parts_uploader(tg_client, message.media.document, name, progress_callback=callback)