Skip to content

Commit

Permalink
update telegram_uploader.py
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Sep 17, 2024
1 parent 014b9a5 commit 1ba1441
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions bot/helper/mirror_leech_utils/telegram_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ async def _upload_document(self, cap_mono, thumb, is_video):
thumb = await create_thumbnail(self._up_path, None)
if self._listener.isCancelled:
return
self._sent_msg = await self._sent_msg.reply_document(
self._sent_msg = m = await self._sent_msg.reply_document(
document=self._up_path,
quote=True,
thumb=thumb,
Expand All @@ -400,7 +400,7 @@ async def _upload_document(self, cap_mono, thumb, is_video):
disable_notification=True,
progress=self._upload_progress,
)
await self._copy_message(cap_mono)
await self._copy_message(m, cap_mono)

async def _upload_video(self, cap_mono, thumb):
duration = (await get_media_info(self._up_path))[0]
Expand All @@ -409,7 +409,7 @@ async def _upload_video(self, cap_mono, thumb):
width, height = self._get_image_dimensions(thumb)
if self._listener.isCancelled:
return
self._sent_msg = await self._sent_msg.reply_video(
self._sent_msg = m = await self._sent_msg.reply_video(
video=self._up_path,
quote=True,
caption=cap_mono,
Expand All @@ -421,13 +421,13 @@ async def _upload_video(self, cap_mono, thumb):
disable_notification=True,
progress=self._upload_progress,
)
await self._copy_message(cap_mono)
await self._copy_message(m, cap_mono)

async def _upload_audio(self, cap_mono, thumb):
duration, artist, title = await get_media_info(self._up_path)
if self._listener.isCancelled:
return
self._sent_msg = await self._sent_msg.reply_audio(
self._sent_msg = m = await self._sent_msg.reply_audio(
audio=self._up_path,
quote=True,
caption=cap_mono,
Expand All @@ -438,33 +438,33 @@ async def _upload_audio(self, cap_mono, thumb):
disable_notification=True,
progress=self._upload_progress,
)
await self._copy_message(cap_mono)
await self._copy_message(m, cap_mono)

async def _upload_photo(self, cap_mono, thumb):
if self._listener.isCancelled:
return
self._sent_msg = await self._sent_msg.reply_photo(
self._sent_msg = m = await self._sent_msg.reply_photo(
photo=self._up_path,
quote=True,
caption=cap_mono,
disable_notification=True,
progress=self._upload_progress,
)
await self._copy_message(cap_mono)
await self._copy_message(m, cap_mono)

async def _copy_message(self, cap_mono):
async def _copy_message(self, m, cap_mono):
try:
await bot.copy_message(
self._user_id, self._sent_msg.chat.id, self._sent_msg.id, cap_mono
self._user_id, m.chat.id, m.id, cap_mono
)
except Exception as e:
LOGGER.error(e)
if self._user_dump:
try:
await bot.copy_message(
self._user_dump,
self._sent_msg.chat.id,
self._sent_msg.id,
m.chat.id,
m.id,
cap_mono,
)
except Exception as e:
Expand Down

0 comments on commit 1ba1441

Please sign in to comment.