Fix mixed leech after send media group

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-03-26 01:55:04 +02:00
parent 8387c145bd
commit 2d2d7c0a93

View File

@ -54,6 +54,7 @@ class TgUploader:
self._lprefix = ""
self._media_group = False
self._is_private = False
self._sent_msg = None
self._user_session = self._listener.userTransmission
async def _upload_progress(self, current, _):
@ -250,18 +251,6 @@ class TgUploader:
continue
try:
f_size = await aiopath.getsize(self._up_path)
if self._listener.mixedLeech:
self._user_session = f_size > 2097152000
if self._user_session:
self._sent_msg = await user.get_messages(
chat_id=self._sent_msg.chat.id,
message_ids=self._sent_msg.id,
)
else:
self._sent_msg = await self._listener.client.get_messages(
chat_id=self._sent_msg.chat.id,
message_ids=self._sent_msg.id,
)
self._total_files += 1
if f_size == 0:
LOGGER.error(
@ -282,6 +271,18 @@ class TgUploader:
for subkey, msgs in list(value.items()):
if len(msgs) > 1:
await self._send_media_group(subkey, key, msgs)
if self._listener.mixedLeech:
self._user_session = f_size > 2097152000
if self._user_session:
self._sent_msg = await user.get_messages(
chat_id=self._sent_msg.chat.id,
message_ids=self._sent_msg.id,
)
else:
self._sent_msg = await self._listener.client.get_messages(
chat_id=self._sent_msg.chat.id,
message_ids=self._sent_msg.id,
)
self._last_msg_in_group = False
self._last_uploaded = 0
await self._upload_file(cap_mono, file_, f_path)