Use message.document.size instead of size_limit in case if the uploaded file is a bit smaller

master
blank X 1 year ago
parent b980e90068
commit 02ad4d6d6b
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
  1. 6
      autoytarchive/workers.py

@ -234,10 +234,10 @@ async def _upload_worker():
if is_big:
file.name = f'{base_filename}.part{str(files_sent).rjust(2, "0")}'
messages.append((await client.send_message(config['config']['storage_chat_id'], f'Uploading {file.name}...', parse_mode=None)).id)
await client.send_file(config['config']['storage_chat_id'], file, caption=file.name, parse_mode=None)
total_size -= size_limit
message = await client.send_file(config['config']['storage_chat_id'], file, caption=file.name, parse_mode=None)
total_size -= message.document.size
if total_size > 0:
size_sent += size_limit
size_sent += message.document.size
files_sent += 1
file = bopen(video_filename, size_limit, None)
if messages:

Loading…
Cancel
Save