Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Commit 921f840

Browse files
committed
ssvideo: add download progress
Signed-off-by: Alfiananda P.A <genengbendo12@gmail.com>
1 parent 46a7dd2 commit 921f840

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

userbot/modules/ssvideo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
# you may not use this file except in compliance with the License.
55
#
66

7+
import asyncio
78
import os
9+
import time
810

911
from telethon.tl.types import DocumentAttributeFilename
1012

1113
from userbot import CMD_HELP, bot
1214
from userbot.events import register
15+
from userbot.utils import progress
1316

1417

1518
@register(outgoing=True, pattern=r"^\.ssvideo(?: |$)(.*)")
@@ -39,10 +42,14 @@ async def ssvideo(event):
3942
in reply_message.media.document.attributes
4043
):
4144
return await event.edit("`Unsupported files..`")
45+
c_time = time.time()
4246
await event.edit("`Downloading media..`")
4347
ss = await bot.download_media(
4448
reply_message,
4549
"anu.mp4",
50+
progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
51+
progress(d, t, event, c_time, "[DOWNLOAD]")
52+
),
4653
)
4754
try:
4855
await event.edit("`Proccessing..`")

0 commit comments

Comments
 (0)