This commit is contained in:
levina 2021-10-27 15:53:08 +07:00 committed by GitHub
parent 3234384156
commit 8abd0736c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,10 @@ import asyncio
from pyrogram import Client from pyrogram import Client
from pyrogram import filters from pyrogram import filters
from driver.veez import call_py from driver.veez import call_py
from config import BOT_USERNAME
from pytgcalls import StreamType from pytgcalls import StreamType
from pyrogram.types import Message from pyrogram.types import Message
from driver.filters import command from driver.filters import command
from config import BOT_USERNAME, IMG_1, IMG_2
from youtubesearchpython import VideosSearch from youtubesearchpython import VideosSearch
from driver.queues import QUEUE, add_to_queue from driver.queues import QUEUE, add_to_queue
from pytgcalls.types.input_stream import AudioVideoPiped from pytgcalls.types.input_stream import AudioVideoPiped
@ -21,7 +21,7 @@ def ytsearch(query):
for r in search.result()["result"]: for r in search.result()["result"]:
ytid = r['id'] ytid = r['id']
if len(r['title']) > 34: if len(r['title']) > 34:
songname = r['title'][:35] + "..." songname = r['title'][:45] + "..."
else: else:
songname = r['title'] songname = r['title']
url = f"https://www.youtube.com/watch?v={ytid}" url = f"https://www.youtube.com/watch?v={ytid}"
@ -50,6 +50,20 @@ async def ytdl(link):
@Client.on_message(command(["vplay", f"vplay@{BOT_USERNAME}"]) & other_filters) @Client.on_message(command(["vplay", f"vplay@{BOT_USERNAME}"]) & other_filters)
async def vplay(client, m: Message): async def vplay(client, m: Message):
keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ",
url=f"https://t.me/{GROUP_SUPPORT}"),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ",
url=f"https://t.me/{UPDATES_CHANNEL}")
]
]
)
replied = m.reply_to_message replied = m.reply_to_message
chat_id = m.chat.id chat_id = m.chat.id
if replied: if replied:
@ -68,13 +82,18 @@ async def vplay(client, m: Message):
await loser.edit("» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**") await loser.edit("» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**")
if replied.video: if replied.video:
songname = replied.video.file_name[:35] + "..." songname = replied.video.file_name[:45] + "..."
elif replied.document: elif replied.document:
songname = replied.document.file_name[:35] + "..." songname = replied.document.file_name[:45] + "..."
if chat_id in QUEUE: if chat_id in QUEUE:
pos = add_to_queue(chat_id, songname, dl, link, "Video", Q) pos = add_to_queue(chat_id, songname, dl, link, "Video", Q)
await loser.edit(f"💡 **Track added to the queue**\n🔢 At position » `{pos}`") await loser.delete()
await m.reply_photo(
photo=f"{IMG_1}",
caption=f"💡 **Track added to queue**\n🔢 At position » `{pos}`",
reply_markup=keyboard,
)
else: else:
if Q==720: if Q==720:
amaze = HighQualityVideo() amaze = HighQualityVideo()
@ -92,7 +111,13 @@ async def vplay(client, m: Message):
stream_type=StreamType().pulse_stream, stream_type=StreamType().pulse_stream,
) )
add_to_queue(chat_id, songname, dl, link, "Video", Q) add_to_queue(chat_id, songname, dl, link, "Video", Q)
await loser.edit(f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({link})\n💬 **Chat:** `{chat_id}`", disable_web_page_preview=True) await loser.delete()
await m.reply_photo(
photo=f"{IMG_2}",
caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({link})\n💬 **Chat:** `{chat_id}`",
disable_web_page_preview=True,
reply_markup=keyboard,
)
else: else:
if len(m.command) < 2: if len(m.command) < 2:
await m.reply("» reply to an **audio file** or **give something to search.**") await m.reply("» reply to an **audio file** or **give something to search.**")
@ -113,7 +138,12 @@ async def vplay(client, m: Message):
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q) pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
await loser.edit(f"💡 **Track added to the queue**\n🔢 At position » `{pos}`") await loser.delete()
await m.reply_photo(
photo=f"{IMG_1}",
caption=f"💡 **Track added to queue**\n🔢 At position » `{pos}`",
reply_markup=keyboard,
)
else: else:
try: try:
await call_py.join_group_call( await call_py.join_group_call(
@ -126,7 +156,13 @@ async def vplay(client, m: Message):
stream_type=StreamType().pulse_stream, stream_type=StreamType().pulse_stream,
) )
add_to_queue(chat_id, songname, ytlink, url, "Video", Q) add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
await loser.edit(f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💬 **Chat:** `{chat_id}`", disable_web_page_preview=True) await loser.delete()
await m.reply_photo(
photo=f"{IMG_2}",
caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💬 **Chat:** `{chat_id}`",
disable_web_page_preview=True,
reply_markup=keyboard,
)
except Exception as ep: except Exception as ep:
await loser.edit(f"❌ issues: `{ep}`") await loser.edit(f"❌ issues: `{ep}`")
@ -150,7 +186,12 @@ async def vplay(client, m: Message):
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q) pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
await loser.edit(f"💡 **Track added to the queue**\n🔢 At position » `{pos}`") await loser.delete()
await m.reply_photo(
photo=f"{IMG_1}",
caption=f"💡 **Track added to queue**\n🔢 At position » `{pos}`",
reply_markup=keyboard,
)
else: else:
try: try:
await call_py.join_group_call( await call_py.join_group_call(
@ -163,13 +204,33 @@ async def vplay(client, m: Message):
stream_type=StreamType().pulse_stream, stream_type=StreamType().pulse_stream,
) )
add_to_queue(chat_id, songname, ytlink, url, "Video", Q) add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
await loser.edit(f"💡 **video streaming is started.**\n\n🏷 **Name:** [{songname}]({url})\n💬 **Chat:** `{chat_id}`", disable_web_page_preview=True) await loser.delete()
await m.reply_photo(
photo=f"{IMG_2}",
caption=f"💡 **video streaming is started.**\n\n🏷 **Name:** [{songname}]({url})\n💬 **Chat:** `{chat_id}`",
disable_web_page_preview=True,
reply_markup=keyboard,
)
except Exception as ep: except Exception as ep:
await loser.edit(f"❌ issues: `{ep}`") await loser.edit(f"❌ issues: `{ep}`")
@Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters) @Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters)
async def vstream(client, m: Message): async def vstream(client, m: Message):
keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="✨ ɢʀᴏᴜᴘ",
url=f"https://t.me/{GROUP_SUPPORT}"),
InlineKeyboardButton(
text="🌻 ᴄʜᴀɴɴᴇʟ",
url=f"https://t.me/{UPDATES_CHANNEL}")
]
]
)
chat_id = m.chat.id chat_id = m.chat.id
if len(m.command) < 2: if len(m.command) < 2:
await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") await m.reply("» give me a live-link/m3u8 url/youtube link to stream.")
@ -204,7 +265,12 @@ async def vstream(client, m: Message):
else: else:
if chat_id in QUEUE: if chat_id in QUEUE:
pos = add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q) pos = add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
await loser.edit(f"💡 **Track added to the queue**\n🔢 At position » `{pos}`") await loser.delete()
await m.reply_photo(
photo=f"{IMG_1}",
caption=f"💡 **Track added to queue**\n🔢 At position » `{pos}`",
reply_markup=keyboard,
)
else: else:
if Q==720: if Q==720:
amaze = HighQualityVideo() amaze = HighQualityVideo()
@ -223,6 +289,12 @@ async def vstream(client, m: Message):
stream_type=StreamType().pulse_stream, stream_type=StreamType().pulse_stream,
) )
add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q) add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
await loser.edit(f"💡 **[Live Stream]({link}) video started.**\n💬 Chat: `{chat_id}`", disable_web_page_preview=True) await loser.delete()
await m.reply_photo(
photo=f"{IMG_2}",
caption=f"💡 **[Live Stream]({link}) video started.**\n💬 Chat: `{chat_id}`",
disable_web_page_preview=True,
reply_markup=keyboard,
)
except Exception as ep: except Exception as ep:
await loser.edit(f"❌ issues: `{ep}`") await loser.edit(f"❌ issues: `{ep}`")