-
Notifications
You must be signed in to change notification settings - Fork 22
/
tiktok.py
36 lines (31 loc) · 1.23 KB
/
tiktok.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from pyrogram import Client, filters
from pyrogram.types import Message
from utils.misc import modules_help, prefix
from utils.scripts import interact_with, interact_with_to_delete, format_exc
@Client.on_message(filters.command("tt", prefix) & filters.me)
async def tiktok(client: Client, message: Message):
if len(message.command) > 1:
link = message.command[1]
elif message.reply_to_message:
link = message.reply_to_message.text
else:
await message.edit("<b>Link isn't provided</b>")
return
try:
await message.edit("<b>Downloading...</b>")
await client.unblock_user("@downloader_tiktok_bot")
msg = await interact_with(
await client.send_message("@downloader_tiktok_bot", link)
)
await client.send_video(
message.chat.id, msg.video.file_id, caption=f"<b>Link: {link}</b>"
)
except Exception as e:
await message.edit(format_exc(e))
else:
await message.delete()
await client.delete_messages("@downloader_tiktok_bot", interact_with_to_delete)
interact_with_to_delete.clear()
modules_help["tiktok"] = {
"tt [link|reply]*": "download video from tiktok",
}