video-stream/program/callback.py

204 lines
8.0 KiB
Python
Raw Normal View History

2021-10-11 03:16:54 +00:00
# Copyright (C) 2021 By VeezMusicProject
2021-11-11 23:30:14 +00:00
from driver.queues import QUEUE
2021-11-12 00:06:05 +00:00
from pyrogram import Client, filters
2021-10-25 11:42:34 +00:00
from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup
from config import (
ASSISTANT_NAME,
BOT_NAME,
BOT_USERNAME,
GROUP_SUPPORT,
OWNER_NAME,
UPDATES_CHANNEL,
)
2021-10-11 03:16:54 +00:00
@Client.on_callback_query(filters.regex("cbstart"))
async def cbstart(_, query: CallbackQuery):
await query.edit_message_text(
2021-10-25 11:42:34 +00:00
f"""✨ **Welcome [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n
2021-10-25 11:57:25 +00:00
💭 **[{BOT_NAME}](https://t.me/{BOT_USERNAME}) allows you to play music and video on groups through the new Telegram's video chats!**
2021-10-11 03:16:54 +00:00
2021-10-25 11:42:34 +00:00
💡 **Find out all the Bot's commands and how they work by clicking on the » 📚 Commands button!**
2021-10-11 03:16:54 +00:00
2021-10-30 13:17:50 +00:00
🔖 **To know how to use this bot, please click on the » Basic Guide button!**""",
2021-10-11 03:16:54 +00:00
reply_markup=InlineKeyboardMarkup(
2021-10-25 11:42:34 +00:00
[
[
InlineKeyboardButton(
" Add me to your Group ",
url=f"https://t.me/{BOT_USERNAME}?startgroup=true",
)
],
[InlineKeyboardButton("❓ Basic Guide", callback_data="cbhowtouse")],
[
InlineKeyboardButton("📚 Commands", callback_data="cbcmds"),
InlineKeyboardButton("❤ Donate", url=f"https://t.me/{OWNER_NAME}"),
],
[
InlineKeyboardButton(
"👥 Official Group", url=f"https://t.me/{GROUP_SUPPORT}"
),
InlineKeyboardButton(
"📣 Official Channel", url=f"https://t.me/{UPDATES_CHANNEL}"
),
],
[
InlineKeyboardButton(
"🌐 Source Code", url="https://github.com/levina-lab/video-stream"
)
],
]
2021-10-11 03:16:54 +00:00
),
2021-10-25 11:42:34 +00:00
disable_web_page_preview=True,
2021-10-11 03:16:54 +00:00
)
2021-10-25 11:42:34 +00:00
@Client.on_callback_query(filters.regex("cbhowtouse"))
async def cbguides(_, query: CallbackQuery):
2021-10-11 03:16:54 +00:00
await query.edit_message_text(
2021-10-25 11:42:34 +00:00
f"""❓ **Basic Guide for using this bot:**
2021-10-11 03:16:54 +00:00
2021-10-30 12:55:39 +00:00
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.**
2021-10-11 03:16:54 +00:00
2021-10-25 11:42:34 +00:00
💡 **If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}**
2021-10-11 03:16:54 +00:00
2021-10-25 11:42:34 +00:00
__Powered by {BOT_NAME} A.I__""",
reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbstart")]]
),
)
2021-10-11 03:16:54 +00:00
2021-10-25 11:42:34 +00:00
@Client.on_callback_query(filters.regex("cbcmds"))
2021-10-30 12:55:39 +00:00
async def cbcmds(_, query: CallbackQuery):
await query.edit_message_text(
f"""✨ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**
» **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):
2021-10-25 11:42:34 +00:00
await query.edit_message_text(
2021-10-30 12:55:39 +00:00
f"""🏮 here is the basic commands:
2021-10-25 11:42:34 +00:00
2021-11-18 00:05:38 +00:00
» /mplay (song name/link) - play music on video chat
2021-10-30 22:53:03 +00:00
» /stream (query/link) - stream the yt live/radio live music
2021-10-30 12:55:39 +00:00
» /vplay (video name/link) - play video on video chat
2021-11-01 13:31:55 +00:00
» /vstream - play live video from yt live/m3u8
2021-10-26 15:07:52 +00:00
» /playlist - show you the playlist
2021-10-25 11:53:50 +00:00
» /video (query) - download video from youtube
» /song (query) - download song from youtube
» /lyric (query) - scrap the song lyric
2021-10-25 11:56:24 +00:00
» /search (query) - search a youtube video link
2021-10-30 12:55:39 +00:00
» /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
2021-10-31 13:28:53 +00:00
» /vmute - mute the userbot on voice chat
» /vunmute - unmute the userbot on voice chat
2021-11-03 11:10:27 +00:00
» /volume `1-200` - adjust the volume of music (userbot must be admin)
2021-10-30 12:55:39 +00:00
» /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
2021-11-15 09:05:32 +00:00
» /sysinfo - show the system information
2021-11-15 10:56:16 +00:00
» /update - update your bot to latest version
2021-11-15 23:19:38 +00:00
» /restart - restart your bot
2021-10-30 12:55:39 +00:00
» /leaveall - order userbot to leave from all group
2021-10-25 11:42:34 +00:00
__Powered by {BOT_NAME} AI__""",
2021-10-11 03:16:54 +00:00
reply_markup=InlineKeyboardMarkup(
2021-10-30 12:55:39 +00:00
[[InlineKeyboardButton("🔙 Go Back", callback_data="cbcmds")]]
2021-10-25 11:42:34 +00:00
),
)
2021-10-11 03:16:54 +00:00
2021-11-01 08:07:47 +00:00
@Client.on_callback_query(filters.regex("cbmenu"))
async def cbmenu(_, query: CallbackQuery):
2021-11-05 10:26:28 +00:00
if query.message.sender_chat:
return await query.answer("you're an Anonymous Admin !\n\n» revert back to user account from admin rights.")
2021-11-01 08:59:12 +00:00
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
2021-11-01 11:25:22 +00:00
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
2021-11-11 23:30:14 +00:00
chat_id = query.message.chat.id
if chat_id in QUEUE:
2021-11-12 00:06:05 +00:00
await query.edit_message_text(
f"⚙️ **settings of** {query.message.chat.title}\n\n⏸ : pause stream\n▶️ : resume stream\n🔇 : mute userbot\n🔊 : unmute userbot\n⏹ : stop stream",
reply_markup=InlineKeyboardMarkup(
[[
InlineKeyboardButton("", callback_data="cbstop"),
InlineKeyboardButton("", callback_data="cbpause"),
InlineKeyboardButton("▶️", callback_data="cbresume"),
],[
InlineKeyboardButton("🔇", callback_data="cbmute"),
InlineKeyboardButton("🔊", callback_data="cbunmute"),
],[
InlineKeyboardButton("🗑 Close", callback_data="cls")],
]
),
)
2021-11-11 23:30:14 +00:00
else:
await query.answer("❌ nothing is currently streaming", show_alert=True)
2021-11-01 08:07:47 +00:00
2021-10-11 03:16:54 +00:00
@Client.on_callback_query(filters.regex("cls"))
async def close(_, query: CallbackQuery):
2021-11-01 08:59:12 +00:00
a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats:
2021-11-01 11:25:22 +00:00
return await query.answer("💡 only admin with manage voice chats permission that can tap this button !", show_alert=True)
2021-10-11 03:16:54 +00:00
await query.message.delete()