commit
485c66999d
@ -5,4 +5,4 @@ COPY . /py
|
||||
WORKDIR /py
|
||||
RUN pip3 install -U pip
|
||||
RUN pip3 install -U -r requirements.txt
|
||||
CMD python3 -m program
|
||||
CMD ["python3", "main.py"]
|
||||
|
@ -22,6 +22,6 @@ SUDO_USERS = list(map(int, getenv("SUDO_USERS").split()))
|
||||
COMMAND_PREFIXES = list(getenv("COMMAND_PREFIXES", "/ ! .").split())
|
||||
ALIVE_IMG = getenv("ALIVE_IMG", "https://telegra.ph/file/c83b000f004f01897fe18.png")
|
||||
DURATION_LIMIT = int(getenv("DURATION_LIMIT", "60"))
|
||||
IMG_1 = getenv("IMG_1", "https://telegra.ph/file/92674c567ef7eb72521d2.png")
|
||||
IMG_2 = getenv("IMG_2", "https://telegra.ph/file/9aa0eb8e4703e6a1d94d7.png")
|
||||
IMG_3 = getenv("IMG_3", "https://telegra.ph/file/84568c753c738d7cfed46.png")
|
||||
IMG_1 = getenv("IMG_1", "https://telegra.ph/file/d6f92c979ad96b2031cba.png")
|
||||
IMG_2 = getenv("IMG_2", "https://telegra.ph/file/6213d2673486beca02967.png")
|
||||
IMG_3 = getenv("IMG_3", "https://telegra.ph/file/f02efde766160d3ff52d6.png")
|
||||
|
@ -1,5 +1,3 @@
|
||||
build:
|
||||
docker:
|
||||
worker: Dockerfile
|
||||
run:
|
||||
worker: python3 -m program
|
||||
|
18
main.py
Normal file
18
main.py
Normal file
@ -0,0 +1,18 @@
|
||||
import asyncio
|
||||
|
||||
from driver.veez import bot, call_py
|
||||
from pytgcalls import idle
|
||||
|
||||
|
||||
async def mulai_bot():
|
||||
print("[INFO]: STARTING BOT CLIENT")
|
||||
await bot.start()
|
||||
print("[INFO]: STARTING PYTGCALLS CLIENT")
|
||||
await call_py.start()
|
||||
await idle()
|
||||
print("[INFO]: STOPPING BOT")
|
||||
await bot.stop()
|
||||
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(mulai_bot())
|
@ -1,13 +0,0 @@
|
||||
import os
|
||||
from pyrogram import Client, idle
|
||||
from pytgcalls import PyTgCalls
|
||||
from pytgcalls import idle as engine
|
||||
from driver.veez import bot, call_py
|
||||
from program import __version__
|
||||
|
||||
bot.start()
|
||||
print(f"program v{__version__} started !")
|
||||
call_py.start()
|
||||
print("program client started !")
|
||||
engine()
|
||||
idle()
|
@ -1,12 +1,12 @@
|
||||
from cache.admins import admins
|
||||
from driver.filters import command, other_filters
|
||||
from pyrogram import Client, filters
|
||||
from driver.veez import call_py, bot
|
||||
from driver.queues import QUEUE, clear_queue
|
||||
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL
|
||||
from driver.decorators import authorized_users_only
|
||||
from driver.filters import command, other_filters
|
||||
from driver.queues import QUEUE, clear_queue
|
||||
from driver.utils import skip_current_song, skip_item
|
||||
from config import BOT_USERNAME, IMG_3, GROUP_SUPPORT, UPDATES_CHANNEL
|
||||
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from driver.veez import call_py
|
||||
from pyrogram import Client
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||
|
||||
|
||||
@Client.on_message(command(["reload", f"reload@{BOT_USERNAME}"]) & other_filters)
|
||||
@ -31,11 +31,11 @@ async def skip(client, m: Message):
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="✨ ɢʀᴏᴜᴘ",
|
||||
url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ",
|
||||
url=f"https://t.me/{UPDATES_CHANNEL}")
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
]
|
||||
]
|
||||
)
|
||||
@ -50,7 +50,7 @@ async def skip(client, m: Message):
|
||||
else:
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_3}",
|
||||
caption=f"⏭ **Skipped to the next track.**\n\n🏷 **Name:** [{op[0]}]({op[1]})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}",
|
||||
caption=f"⏭ **Skipped to the next track.**\n\n🏷 **Name:** [{op[0]}]({op[1]})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
else:
|
||||
@ -71,7 +71,10 @@ async def skip(client, m: Message):
|
||||
await m.reply(OP)
|
||||
|
||||
|
||||
@Client.on_message(command(["stop", f"stop@{BOT_USERNAME}", "end", f"end@{BOT_USERNAME}", "vstop"]) & other_filters)
|
||||
@Client.on_message(
|
||||
command(["stop", f"stop@{BOT_USERNAME}", "end", f"end@{BOT_USERNAME}", "vstop"])
|
||||
& other_filters
|
||||
)
|
||||
@authorized_users_only
|
||||
async def stop(client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
@ -86,29 +89,51 @@ async def stop(client, m: Message):
|
||||
await m.reply("❌ **nothing in streaming**")
|
||||
|
||||
|
||||
@Client.on_message(command(["pause", f"pause@{BOT_USERNAME}", "vpause"]) & other_filters)
|
||||
@Client.on_message(
|
||||
command(["pause", f"pause@{BOT_USERNAME}", "vpause"]) & other_filters
|
||||
)
|
||||
@authorized_users_only
|
||||
async def pause(client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
await call_py.pause_stream(chat_id)
|
||||
await m.reply("⏸ **Track paused.**\n\n• **To resume the stream, use the**\n» /resume command.")
|
||||
await m.reply(
|
||||
"⏸ **Track paused.**\n\n• **To resume the stream, use the**\n» /resume command."
|
||||
)
|
||||
except Exception as e:
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **nothing in streaming**")
|
||||
|
||||
|
||||
@Client.on_message(command(["resume", f"resume@{BOT_USERNAME}", "vresume"]) & other_filters)
|
||||
@Client.on_message(
|
||||
command(["resume", f"resume@{BOT_USERNAME}", "vresume"]) & other_filters
|
||||
)
|
||||
@authorized_users_only
|
||||
async def resume(client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
if chat_id in QUEUE:
|
||||
try:
|
||||
await call_py.resume_stream(chat_id)
|
||||
await m.reply("▶️ **Track resumed.**\n\n• **To pause the stream, use the**\n» /pause command.")
|
||||
await m.reply(
|
||||
"▶️ **Track resumed.**\n\n• **To pause the stream, use the**\n» /pause command."
|
||||
)
|
||||
except Exception as e:
|
||||
await m.reply(f"🚫 **error:**\n\n`{e}`")
|
||||
else:
|
||||
await m.reply("❌ **nothing in streaming**")
|
||||
|
||||
|
||||
@Client.on_message(
|
||||
command(["volume", f"volume@{BOT_USERNAME}", "vol"]) & other_filters
|
||||
)
|
||||
@authorized_users_only
|
||||
async def change_volume(client, m: Message):
|
||||
range = m.command[1]
|
||||
chat_id = m.chat.id
|
||||
try:
|
||||
await call_py.change_volume_call(chat_id, volume=int(range))
|
||||
await m.reply(f"✅ **volume set to** `{range}`%")
|
||||
except Exception as e:
|
||||
await m.reply(f"🚫 **error:**\n\n{e}")
|
||||
|
@ -20,7 +20,7 @@ async def cbstart(_, query: CallbackQuery):
|
||||
|
||||
💡 **Find out all the Bot's commands and how they work by clicking on the » 📚 Commands button!**
|
||||
|
||||
❔ **To know how to use this bot, please click on the » ❓ Basic Guide button!**""",
|
||||
🔖 **To know how to use this bot, please click on the » ❓ Basic Guide button!**""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
@ -58,11 +58,14 @@ async def cbguides(_, query: CallbackQuery):
|
||||
await query.edit_message_text(
|
||||
f"""❓ **Basic Guide for using this bot:**
|
||||
|
||||
1.) **first, add me to your group.**
|
||||
2.) **then promote me as admin and give all permissions except anonymous admin.**
|
||||
3.) **add @{ASSISTANT_NAME} to your group or type /userbotjoin to invite her.**
|
||||
4.) **turn on the video chat first before start to play video.**
|
||||
5.) **all the command list you can see on » 📚 Commands button, find it on start home, tap the » Go Back button below.**
|
||||
1.) **First, add me to your group.**
|
||||
2.) **Then, promote me as administrator and give all permissions except Anonymous Admin.**
|
||||
3.) **After promoting me, type /reload in group to refresh the admin data.**
|
||||
3.) **Add @{ASSISTANT_NAME} to your group or type /userbotjoin to invite her.**
|
||||
4.) **Turn on the video chat first before start to play video/music.**
|
||||
5.) **Sometimes, reloading the bot by using /reload command can help you to fix some problem.**
|
||||
|
||||
📌 **If the userbot not joined to video chat, make sure if the video chat already turned on, or type /userbotleave then type /userbotjoin again.**
|
||||
|
||||
💡 **If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}**
|
||||
|
||||
@ -74,34 +77,85 @@ async def cbguides(_, query: CallbackQuery):
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("cbcmds"))
|
||||
async def cbhelps(_, query: CallbackQuery):
|
||||
async def cbcmds(_, query: CallbackQuery):
|
||||
await query.edit_message_text(
|
||||
f"""📚 Here is the Commands list:
|
||||
f"""✨ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**
|
||||
|
||||
» /play - play music on voice chat
|
||||
» /stream - enter the radio link
|
||||
» /vplay - play video on video chat
|
||||
» /vstream - for m3u8/live link
|
||||
» **press the button below to read the explanation and see the list of available commands !**
|
||||
|
||||
⚡ __Powered by {BOT_NAME} A.I__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton("👷🏻 Admin Cmd", callback_data="cbadmin"),
|
||||
InlineKeyboardButton("🧙🏻 Sudo Cmd", callback_data="cbsudo"),
|
||||
],[
|
||||
InlineKeyboardButton("📚 Basic Cmd", callback_data="cbbasic")
|
||||
],[
|
||||
InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")
|
||||
],
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("cbbasic"))
|
||||
async def cbbasic(_, query: CallbackQuery):
|
||||
await query.edit_message_text(
|
||||
f"""🏮 here is the basic commands:
|
||||
|
||||
» /play (song name/link) - play music on video chat
|
||||
» /stream (query/link) - stream the yt live/radio/m3u8 live music
|
||||
» /vplay (video name/link) - play video on video chat
|
||||
» /vstream - play live video from yt live/m3u8
|
||||
» /playlist - show you the playlist
|
||||
» /video (query) - download video from youtube
|
||||
» /song (query) - download song from youtube
|
||||
» /lyric (query) - scrap the song lyric
|
||||
» /search (query) - search a youtube video link
|
||||
» /queue - show you the queue list (admin only)
|
||||
» /pause - pause the stream (admin only)
|
||||
» /resume - resume the stream (admin only)
|
||||
» /skip - switch to next stream (admin only)
|
||||
» /stop - stop the streaming (admin only)
|
||||
» /userbotjoin - invite the userbot to join chat (admin only)
|
||||
» /userbotleave - order userbot to leave from group (admin only)
|
||||
» /reload - update the admin list (admin only)
|
||||
» /rmw - clean raw files (sudo only)
|
||||
» /rmd - clean downloaded files (sudo only)
|
||||
» /leaveall - order userbot leave from all group (sudo only)
|
||||
|
||||
» /ping - show the bot ping status
|
||||
» /uptime - show the bot uptime status
|
||||
» /alive - show the bot alive info (in group)
|
||||
|
||||
⚡️ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@Client.on_callback_query(filters.regex("cbadmin"))
|
||||
async def cbadmin(_, query: CallbackQuery):
|
||||
await query.edit_message_text(
|
||||
f"""🏮 here is the admin commands:
|
||||
|
||||
» /pause - pause the stream
|
||||
» /resume - resume the stream
|
||||
» /skip - switch to next stream
|
||||
» /stop - stop the streaming
|
||||
» /reload - reload bot and refresh the admin data
|
||||
» /userbotjoin - invite the userbot to join group
|
||||
» /userbotleave - order userbot to leave from group
|
||||
|
||||
⚡️ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
|
||||
),
|
||||
)
|
||||
|
||||
@Client.on_callback_query(filters.regex("cbsudo"))
|
||||
async def cbsudo(_, query: CallbackQuery):
|
||||
await query.edit_message_text(
|
||||
f"""🏮 here is the sudo commands:
|
||||
|
||||
» /rmw - clean all raw files
|
||||
» /rmd - clean all downloaded files
|
||||
» /leaveall - order userbot to leave from all group
|
||||
|
||||
⚡ __Powered by {BOT_NAME} AI__""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")]]
|
||||
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
|
||||
),
|
||||
)
|
||||
|
||||
|
150
program/music.py
150
program/music.py
@ -2,29 +2,29 @@
|
||||
# Commit Start Date 20/10/2021
|
||||
# Finished On 28/10/2021
|
||||
|
||||
import os
|
||||
import re
|
||||
import asyncio
|
||||
from driver.veez import call_py
|
||||
from pytgcalls import StreamType
|
||||
import re
|
||||
|
||||
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL
|
||||
from driver.filters import command, other_filters
|
||||
from pyrogram import Client, filters
|
||||
from youtubesearchpython import VideosSearch
|
||||
from driver.queues import QUEUE, add_to_queue
|
||||
from driver.veez import call_py
|
||||
from pyrogram import Client
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||
from pytgcalls import StreamType
|
||||
from pytgcalls.types.input_stream import AudioPiped
|
||||
from config import BOT_USERNAME, IMG_1, IMG_2, GROUP_SUPPORT, UPDATES_CHANNEL
|
||||
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from youtubesearchpython import VideosSearch
|
||||
|
||||
|
||||
def ytsearch(query):
|
||||
try:
|
||||
search = VideosSearch(query, limit=1)
|
||||
for r in search.result()["result"]:
|
||||
ytid = r['id']
|
||||
if len(r['title']) > 34:
|
||||
songname = r['title'][:60] + "..."
|
||||
ytid = r["id"]
|
||||
if len(r["title"]) > 34:
|
||||
songname = r["title"][:60] + "..."
|
||||
else:
|
||||
songname = r['title']
|
||||
songname = r["title"]
|
||||
url = f"https://www.youtube.com/watch?v={ytid}"
|
||||
return [songname, url]
|
||||
except Exception as e:
|
||||
@ -34,33 +34,33 @@ def ytsearch(query):
|
||||
|
||||
async def ytdl(link):
|
||||
proc = await asyncio.create_subprocess_exec(
|
||||
'yt-dlp',
|
||||
'-g',
|
||||
'-f',
|
||||
'bestaudio',
|
||||
f'{link}',
|
||||
"yt-dlp",
|
||||
"-g",
|
||||
"-f",
|
||||
"bestaudio",
|
||||
f"{link}",
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await proc.communicate()
|
||||
if stdout:
|
||||
return 1, stdout.decode().split('\n')[0]
|
||||
return 1, stdout.decode().split("\n")[0]
|
||||
else:
|
||||
return 0, stderr.decode()
|
||||
|
||||
|
||||
@Client.on_message(command(["play", f"play@{BOT_USERNAME}"]) & other_filters)
|
||||
async def play(client, m: Message):
|
||||
async def play(_, m: Message):
|
||||
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="✨ ɢʀᴏᴜᴘ",
|
||||
url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ",
|
||||
url=f"https://t.me/{UPDATES_CHANNEL}")
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
]
|
||||
]
|
||||
)
|
||||
@ -96,6 +96,7 @@ async def play(client, m: Message):
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, songname, dl, link, "Audio", 0)
|
||||
await suhu.delete()
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_2}",
|
||||
caption=f"💡 **music streaming started.**\n\n🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}",
|
||||
@ -103,7 +104,56 @@ async def play(client, m: Message):
|
||||
)
|
||||
else:
|
||||
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.**"
|
||||
)
|
||||
else:
|
||||
suhu = await m.reply("🔎 **searching...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
search = ytsearch(query)
|
||||
if search == 0:
|
||||
await suhu.edit("❌ **no results found.**")
|
||||
else:
|
||||
songname = search[0]
|
||||
url = search[1]
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
pos = add_to_queue(
|
||||
chat_id, songname, ytlink, url, "Audio", 0
|
||||
)
|
||||
await suhu.delete()
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_1}",
|
||||
caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}\n🔢 **At position »** `{pos}`",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
await call_py.join_group_call(
|
||||
chat_id,
|
||||
AudioPiped(
|
||||
ytlink,
|
||||
),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
|
||||
await suhu.delete()
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_2}",
|
||||
caption=f"💡 **music streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
except Exception as ep:
|
||||
await m.reply_text(f"🚫 error: `{ep}`")
|
||||
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply(
|
||||
"» reply to an **audio file** or **give something to search.**"
|
||||
)
|
||||
else:
|
||||
suhu = await m.reply("🔎 **searching...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
@ -144,63 +194,21 @@ async def play(client, m: Message):
|
||||
except Exception as ep:
|
||||
await m.reply_text(f"🚫 error: `{ep}`")
|
||||
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply("» reply to an **audio file** or **give something to search.**")
|
||||
else:
|
||||
suhu = await m.reply("🔎 **searching...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
search = ytsearch(query)
|
||||
if search==0:
|
||||
await suhu.edit("❌ **no results found.**")
|
||||
else:
|
||||
songname = search[0]
|
||||
url = search[1]
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez==0:
|
||||
await suhu.edit(f"❌ youtube-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
pos = add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
|
||||
await suhu.delete()
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_1}",
|
||||
caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}\n🔢 **At position »** `{pos}`",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
await call_py.join_group_call(
|
||||
chat_id,
|
||||
AudioPiped(
|
||||
ytlink,
|
||||
),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
|
||||
await suhu.delete()
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_2}",
|
||||
caption=f"💡 **music streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
except Exception as ep:
|
||||
await m.reply_text(f"🚫 error: `{ep}`")
|
||||
|
||||
# stream is used for live streaming only
|
||||
|
||||
@Client.on_message(command(["stream", f"stream@{BOT_USERNAME}"]) & other_filters)
|
||||
async def stream(client, m: Message):
|
||||
async def stream(_, m: Message):
|
||||
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="✨ ɢʀᴏᴜᴘ",
|
||||
url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ",
|
||||
url=f"https://t.me/{UPDATES_CHANNEL}")
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
]
|
||||
]
|
||||
)
|
||||
|
@ -12,7 +12,6 @@ from config import (
|
||||
UPDATES_CHANNEL,
|
||||
)
|
||||
from program import __version__
|
||||
from driver.decorators import sudo_users_only
|
||||
from driver.filters import command, other_filters
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram import __version__ as pyrover
|
||||
@ -58,7 +57,7 @@ async def start_(client: Client, message: Message):
|
||||
|
||||
💡 **Find out all the Bot's commands and how they work by clicking on the » 📚 Commands button!**
|
||||
|
||||
❔ **To know how to use this bot, please click on the » ❓ Basic Guide button!**
|
||||
🔖 **To know how to use this bot, please click on the » ❓ Basic Guide button!**
|
||||
""",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
@ -71,7 +70,7 @@ async def start_(client: Client, message: Message):
|
||||
[InlineKeyboardButton("❓ Basic Guide", callback_data="cbhowtouse")],
|
||||
[
|
||||
InlineKeyboardButton("📚 Commands", callback_data="cbcmds"),
|
||||
InlineKeyboardButton("💝 Donate", url=f"https://t.me/{OWNER_NAME}"),
|
||||
InlineKeyboardButton("❤️ Donate", url=f"https://t.me/{OWNER_NAME}"),
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
@ -129,7 +128,6 @@ async def ping_pong(client: Client, message: Message):
|
||||
|
||||
|
||||
@Client.on_message(command(["uptime", f"uptime@{BOT_USERNAME}"]) & ~filters.edited)
|
||||
@sudo_users_only
|
||||
async def get_uptime(client: Client, message: Message):
|
||||
current_time = datetime.utcnow()
|
||||
uptime_sec = (current_time - START_TIME).total_seconds()
|
||||
|
104
program/video.py
104
program/video.py
@ -2,31 +2,35 @@
|
||||
# Commit Start Date 20/10/2021
|
||||
# Finished On 28/10/2021
|
||||
|
||||
import os
|
||||
import re
|
||||
import asyncio
|
||||
from driver.veez import call_py
|
||||
from pytgcalls import StreamType
|
||||
from pyrogram import Client, filters
|
||||
import re
|
||||
|
||||
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL
|
||||
from driver.filters import command, other_filters
|
||||
from youtubesearchpython import VideosSearch
|
||||
from driver.queues import QUEUE, add_to_queue
|
||||
from driver.veez import call_py
|
||||
from pyrogram import Client
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||
from pytgcalls import StreamType
|
||||
from pytgcalls.types.input_stream import AudioVideoPiped
|
||||
from config import BOT_USERNAME, IMG_1, IMG_2, GROUP_SUPPORT, UPDATES_CHANNEL
|
||||
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from pytgcalls.types.input_stream.quality import HighQualityAudio, MediumQualityAudio
|
||||
from pytgcalls.types.input_stream.quality import HighQualityVideo, MediumQualityVideo, LowQualityVideo
|
||||
from pytgcalls.types.input_stream.quality import (
|
||||
HighQualityAudio,
|
||||
HighQualityVideo,
|
||||
LowQualityVideo,
|
||||
MediumQualityVideo,
|
||||
)
|
||||
from youtubesearchpython import VideosSearch
|
||||
|
||||
|
||||
def ytsearch(query):
|
||||
try:
|
||||
search = VideosSearch(query, limit=1)
|
||||
for r in search.result()["result"]:
|
||||
ytid = r['id']
|
||||
if len(r['title']) > 34:
|
||||
songname = r['title'][:60] + "..."
|
||||
ytid = r["id"]
|
||||
if len(r["title"]) > 34:
|
||||
songname = r["title"][:60] + "..."
|
||||
else:
|
||||
songname = r['title']
|
||||
songname = r["title"]
|
||||
url = f"https://www.youtube.com/watch?v={ytid}"
|
||||
return [songname, url]
|
||||
except Exception as e:
|
||||
@ -36,17 +40,17 @@ def ytsearch(query):
|
||||
|
||||
async def ytdl(link):
|
||||
proc = await asyncio.create_subprocess_exec(
|
||||
'yt-dlp',
|
||||
'-g',
|
||||
'-f',
|
||||
'best[height<=?720][width<=?1280]',
|
||||
f'{link}',
|
||||
"yt-dlp",
|
||||
"-g",
|
||||
"-f",
|
||||
"best[height<=?720][width<=?1280]",
|
||||
f"{link}",
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await proc.communicate()
|
||||
if stdout:
|
||||
return 1, stdout.decode().split('\n')[0]
|
||||
return 1, stdout.decode().split("\n")[0]
|
||||
else:
|
||||
return 0, stderr.decode()
|
||||
|
||||
@ -58,11 +62,11 @@ async def vplay(client, m: Message):
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="✨ ɢʀᴏᴜᴘ",
|
||||
url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ",
|
||||
url=f"https://t.me/{UPDATES_CHANNEL}")
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
]
|
||||
]
|
||||
)
|
||||
@ -82,7 +86,9 @@ async def vplay(client, m: Message):
|
||||
Q = int(pq)
|
||||
else:
|
||||
Q = 720
|
||||
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:
|
||||
songname = replied.video.file_name[:60] + "..."
|
||||
@ -106,11 +112,7 @@ async def vplay(client, m: Message):
|
||||
amaze = LowQualityVideo()
|
||||
await call_py.join_group_call(
|
||||
chat_id,
|
||||
AudioVideoPiped(
|
||||
dl,
|
||||
HighQualityAudio(),
|
||||
amaze
|
||||
),
|
||||
AudioVideoPiped(dl, HighQualityAudio(), amaze),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, songname, dl, link, "Video", Q)
|
||||
@ -122,7 +124,9 @@ async def vplay(client, m: Message):
|
||||
)
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply("» reply to an **video file** or **give something to search.**")
|
||||
await m.reply(
|
||||
"» reply to an **video file** or **give something to search.**"
|
||||
)
|
||||
else:
|
||||
loser = await m.reply("🔎 **searching...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
@ -139,7 +143,9 @@ async def vplay(client, m: Message):
|
||||
await loser.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
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.delete()
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_1}",
|
||||
@ -150,11 +156,7 @@ async def vplay(client, m: Message):
|
||||
try:
|
||||
await call_py.join_group_call(
|
||||
chat_id,
|
||||
AudioVideoPiped(
|
||||
ytlink,
|
||||
HighQualityAudio(),
|
||||
amaze
|
||||
),
|
||||
AudioVideoPiped(ytlink, HighQualityAudio(), amaze),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
|
||||
@ -169,7 +171,9 @@ async def vplay(client, m: Message):
|
||||
|
||||
else:
|
||||
if len(m.command) < 2:
|
||||
await m.reply("» reply to an **video file** or **give something to search.**")
|
||||
await m.reply(
|
||||
"» reply to an **video file** or **give something to search.**"
|
||||
)
|
||||
else:
|
||||
loser = await m.reply("🔎 **searching...**")
|
||||
query = m.text.split(None, 1)[1]
|
||||
@ -197,11 +201,7 @@ async def vplay(client, m: Message):
|
||||
try:
|
||||
await call_py.join_group_call(
|
||||
chat_id,
|
||||
AudioVideoPiped(
|
||||
ytlink,
|
||||
HighQualityAudio(),
|
||||
amaze
|
||||
),
|
||||
AudioVideoPiped(ytlink, HighQualityAudio(), amaze),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
|
||||
@ -222,11 +222,11 @@ async def vstream(client, m: Message):
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="✨ ɢʀᴏᴜᴘ",
|
||||
url=f"https://t.me/{GROUP_SUPPORT}"),
|
||||
text="✨ ɢʀᴏᴜᴘ", url=f"https://t.me/{GROUP_SUPPORT}"
|
||||
),
|
||||
InlineKeyboardButton(
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ",
|
||||
url=f"https://t.me/{UPDATES_CHANNEL}")
|
||||
text="🌻 ᴄʜᴀɴɴᴇʟ", url=f"https://t.me/{UPDATES_CHANNEL}"
|
||||
),
|
||||
]
|
||||
]
|
||||
)
|
||||
@ -247,7 +247,9 @@ async def vstream(client, m: Message):
|
||||
Q = int(quality)
|
||||
else:
|
||||
Q = 720
|
||||
await m.reply("» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**")
|
||||
await m.reply(
|
||||
"» __only 720, 480, 360 allowed__ \n💡 **now streaming video in 720p**"
|
||||
)
|
||||
loser = await m.reply("🔄 **processing stream...**")
|
||||
else:
|
||||
await m.reply("**/vstream {link} {720/480/360}**")
|
||||
@ -281,11 +283,7 @@ async def vstream(client, m: Message):
|
||||
try:
|
||||
await call_py.join_group_call(
|
||||
chat_id,
|
||||
AudioVideoPiped(
|
||||
livelink,
|
||||
HighQualityAudio(),
|
||||
amaze
|
||||
),
|
||||
AudioVideoPiped(livelink, HighQualityAudio(), amaze),
|
||||
stream_type=StreamType().pulse_stream,
|
||||
)
|
||||
add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
|
||||
|
@ -1 +1 @@
|
||||
python-3.9.7
|
||||
python-3.10.0
|
||||
|
Loading…
Reference in New Issue
Block a user