# Copyright (C) 2021 By VeezMusicProject from driver.core import me_bot from driver.decorators import check_blacklist from driver.queues import QUEUE from driver.database.dbpunish import is_gbanned_user from pyrogram import Client, filters from program.utils.inline import menu_markup, stream_markup from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup from config import ( BOT_USERNAME, GROUP_SUPPORT, OWNER_USERNAME, UPDATES_CHANNEL, SUDO_USERS, OWNER_ID, ) @Client.on_callback_query(filters.regex("home_start")) @check_blacklist() async def start_set(_, query: CallbackQuery): BOT_NAME = me_bot.first_name await query.answer("home start") await query.edit_message_text( f"""āœØ **Welcome [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !**\n šŸ’­ [{BOT_NAME}](https://t.me/{BOT_USERNAME}) **Is a bot to play music and video in groups, through the Telegram Group video chat!** šŸ’” **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!**""", reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton( "āž• Add me to your Group āž•", url=f"https://t.me/{BOT_USERNAME}?startgroup=true", ) ], [InlineKeyboardButton("ā“ Basic Guide", callback_data="user_guide")], [ InlineKeyboardButton("šŸ“š Commands", callback_data="command_list"), InlineKeyboardButton("ā¤ Donate", url=f"https://t.me/{OWNER_USERNAME}"), ], [ 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" ) ], ] ), disable_web_page_preview=True, ) @Client.on_callback_query(filters.regex("quick_use")) @check_blacklist() async def quick_set(_, query: CallbackQuery): await query.answer("quick bot usage") await query.edit_message_text( f"""ā„¹ļø Quick use Guide bot, please read fully ! šŸ‘©šŸ»ā€šŸ’¼ Ā» /play - Type this with give the song title or youtube link or audio file to play Music. (Remember to don't play YouTube live stream by using this command!, because it will cause unforeseen problems.) šŸ‘©šŸ»ā€šŸ’¼ Ā» /vplay - Type this with give the song title or youtube link or video file to play Video. (Remember to don't play YouTube live video by using this command!, because it will cause unforeseen problems.) šŸ‘©šŸ»ā€šŸ’¼ Ā» /vstream - Type this with give the YouTube live stream video link or m3u8 link to play live Video. (Remember to don't play local audio/video files or non-live YouTube video by using this command!, because it will cause unforeseen problems.) ā“ Have questions? Contact us in [Support Group](https://t.me/{GROUP_SUPPORT}).""", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("šŸ”™ Go Back", callback_data="user_guide")]] ), disable_web_page_preview=True, ) @Client.on_callback_query(filters.regex("user_guide")) @check_blacklist() async def guide_set(_, query: CallbackQuery): ass_uname = me_bot.first_name await query.answer("user guide") await query.edit_message_text( f"""ā“ How to use this Bot ?, read the Guide below ! 1.) First, add this bot to your Group. 2.) Then, promote this bot as administrator on the Group also give all permissions except Anonymous admin. 3.) After promoting this bot, type /reload in Group to update the admin data. 3.) Invite @{ass_uname} to your group or type /userbotjoin to invite her, unfortunately the userbot will joined by itself when you type `/play (song name)` or `/vplay (song name)`. 4.) Turn on/Start the video chat first before start to play video/music. `- END, EVERYTHING HAS BEEN SETUP -` šŸ“Œ If the userbot not joined to video chat, make sure if the video chat already turned on and the userbot in the chat. šŸ’” If you have a follow-up questions about this bot, you can tell it on my support chat here: @{GROUP_SUPPORT}.""", reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton("Ā» Quick use Guide Ā«", callback_data="quick_use") ],[ InlineKeyboardButton("šŸ”™ Go Back", callback_data="home_start") ], ] ), ) @Client.on_callback_query(filters.regex("command_list")) @check_blacklist() async def commands_set(_, query: CallbackQuery): user_id = query.from_user.id await query.answer("commands menu") await query.edit_message_text( f"""āœØ **Hello [{query.message.chat.first_name}](tg://user?id={query.message.chat.id}) !** Ā» Check out the menu below to read the module information & see the list of available Commands ! All commands can be used with (`! / .`) handler""", reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton("šŸ‘®šŸ»ā€ā™€ļø Admins Commands", callback_data="admin_command"), ],[ InlineKeyboardButton("šŸ‘©šŸ»ā€šŸ’¼ Users Commands", callback_data="user_command"), ],[ InlineKeyboardButton("Sudo Commands", callback_data="sudo_command"), InlineKeyboardButton("Owner Commands", callback_data="owner_command"), ],[ InlineKeyboardButton("šŸ”™ Go Back", callback_data="home_start") ], ] ), ) @Client.on_callback_query(filters.regex("user_command")) @check_blacklist() async def user_set(_, query: CallbackQuery): BOT_NAME = me_bot.first_name await query.answer("basic commands") await query.edit_message_text( f"""āœļø Command list for all user. Ā» /play (song name/link) - play music on video chat Ā» /vplay (video name/link) - play video on video chat Ā» /vstream (m3u8/yt live link) - play live stream video Ā» /playlist - see the current playing song Ā» /lyric (query) - scrap the song lyric Ā» /video (query) - download video from youtube Ā» /song (query) - download song from youtube Ā» /search (query) - search a youtube video link Ā» /ping - show the bot ping status Ā» /uptime - show the bot uptime status Ā» /alive - show the bot alive info (in Group only) āš”ļø __Powered by {BOT_NAME} AI__""", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("šŸ”™ Go Back", callback_data="command_list")]] ), ) @Client.on_callback_query(filters.regex("admin_command")) @check_blacklist() async def admin_set(_, query: CallbackQuery): BOT_NAME = me_bot.first_name await query.answer("admin commands") await query.edit_message_text( f"""āœļø Command list for group admin. Ā» /pause - pause the current track being played Ā» /resume - play the previously paused track Ā» /skip - goes to the next track Ā» /stop - stop playback of the track and clears the queue Ā» /vmute - mute the streamer userbot on group call Ā» /vunmute - unmute the streamer userbot on group call Ā» /volume `1-200` - adjust the volume of music (userbot must be admin) Ā» /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="command_list")]] ), ) @Client.on_callback_query(filters.regex("sudo_command")) @check_blacklist() async def sudo_set(_, query: CallbackQuery): user_id = query.from_user.id BOT_NAME = me_bot.first_name if user_id not in SUDO_USERS: await query.answer("āš ļø You don't have permissions to click this button\n\nĀ» This button is reserved for sudo members of this bot.", show_alert=True) return await query.answer("sudo commands") await query.edit_message_text( f"""āœļø Command list for sudo user. Ā» /stats - get the bot current statistic Ā» /calls - show you the list of all active group call in database Ā» /block (`chat_id`) - use this to blacklist any group from using your bot Ā» /unblock (`chat_id`) - use this to whitelist any group from using your bot Ā» /blocklist - show you the list of all blacklisted chat Ā» /speedtest - run the bot server speedtest Ā» /sysinfo - show the system information Ā» /eval - execute any code (`developer stuff`) Ā» /sh - run any command (`developer stuff`) āš” __Powered by {BOT_NAME} AI__""", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("šŸ”™ Go Back", callback_data="command_list")]] ), ) @Client.on_callback_query(filters.regex("owner_command")) @check_blacklist() async def owner_set(_, query: CallbackQuery): user_id = query.from_user.id BOT_NAME = me_bot.first_name if user_id not in OWNER_ID: await query.answer("āš ļø You don't have permissions to click this button\n\nĀ» This button is reserved for owner of this bot.", show_alert=True) return await query.answer("owner commands") await query.edit_message_text( f"""āœļø Command list for bot owner. Ā» /gban (`username` or `user_id`) - for global banned people, can be used only in group Ā» /ungban (`username` or `user_id`) - for un-global banned people, can be used only in group Ā» /update - update your bot to latest version Ā» /restart - restart your bot directly Ā» /leaveall - order userbot to leave from all group Ā» /leavebot (`chat id`) - order bot to leave from the group you specify Ā» /broadcast (`message`) - send a broadcast message to all groups in bot database Ā» /broadcast_pin (`message`) - send a broadcast message to all groups in bot database with the chat pin āš” __Powered by {BOT_NAME} AI__""", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("šŸ”™ Go Back", callback_data="command_list")]] ), ) @Client.on_callback_query(filters.regex("stream_menu_panel")) @check_blacklist() async def at_set_markup_menu(_, query: CallbackQuery): user_id = query.from_user.id a = await _.get_chat_member(query.message.chat.id, query.from_user.id) if not a.can_manage_voice_chats: return await query.answer("šŸ’” Only admin with manage video chat permission that can tap this button !", show_alert=True) chat_id = query.message.chat.id user_id = query.message.from_user.id buttons = menu_markup(user_id) if chat_id in QUEUE: await query.answer("control panel opened") await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons)) else: await query.answer("āŒ nothing is currently streaming", show_alert=True) @Client.on_callback_query(filters.regex("stream_home_panel")) @check_blacklist() async def is_set_home_menu(_, query: CallbackQuery): a = await _.get_chat_member(query.message.chat.id, query.from_user.id) if not a.can_manage_voice_chats: return await query.answer("šŸ’” Only admin with manage video chat permission that can tap this button !", show_alert=True) await query.answer("control panel closed") user_id = query.message.from_user.id buttons = stream_markup(user_id) await query.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons)) @Client.on_callback_query(filters.regex("set_close")) @check_blacklist() async def on_close_menu(_, query: CallbackQuery): a = await _.get_chat_member(query.message.chat.id, query.from_user.id) if not a.can_manage_voice_chats: return await query.answer("šŸ’” Only admin with manage video chat permission that can tap this button !", show_alert=True) await query.message.delete() @Client.on_callback_query(filters.regex("close_panel")) @check_blacklist() async def in_close_panel(_, query: CallbackQuery): await query.message.delete()