-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.py
51 lines (37 loc) · 1.13 KB
/
bot.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
app_url = os.environ.get("DOPRAX_APP_URL")
Bot = Client(
"vidstBot",
bot_token = os.environ["BOT_TOKEN"],
api_id = int(os.environ["API_ID"]),
api_hash = os.environ["API_HASH"]
)
START_TXT = """
Hi {}, I'm streaming link gen bot.
Send a YouTube video url or a direct download link of a video.
"""
START_BTN = InlineKeyboardMarkup(
[[
InlineKeyboardButton('Source Code', url='https://github.com/soebb'),
]]
)
@Bot.on_message(filters.command(["start"]))
async def start(bot, update):
text = START_TXT.format(update.from_user.mention)
reply_markup = START_BTN
await update.reply_text(
text=text,
disable_web_page_preview=True,
reply_markup=reply_markup
)
@Bot.on_message(filters.private & filters.text)
async def st(_, m):
vid_url = m.text
if vid_url[len(vid_url)-4:].startswith("."):
url = f"https://{app_url}/play?id=" + vid_url
else:
url = f"https://{app_url}/yt?id=" + vid_url
await m.reply(url)
Bot.run()