from cache.admins import admins from driver.veez import call_py from pyrogram import Client, filters 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, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL from pyrogram.types import ( CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, Message, ) bttn = InlineKeyboardMarkup( [[InlineKeyboardButton("๐Ÿ”™ Go Back", callback_data="cbmenu")]] ) bcl = InlineKeyboardMarkup( [[InlineKeyboardButton("๐Ÿ—‘ Close", callback_data="cls")]] ) @Client.on_message(command(["reload", f"reload@{BOT_USERNAME}"]) & other_filters) @authorized_users_only async def update_admin(client, message): global admins new_admins = [] new_ads = await client.get_chat_members(message.chat.id, filter="administrators") for u in new_ads: new_admins.append(u.user.id) admins[message.chat.id] = new_admins await message.reply_text( "โœ… Bot **reloaded correctly !**\nโœ… **Admin list** has been **updated !**" ) @Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters) @authorized_users_only async def skip(client, m: Message): keyboard = InlineKeyboardMarkup( [ [ InlineKeyboardButton( text="โ€ข Mแด‡ษดแดœ", callback_data="cbmenu" ), InlineKeyboardButton( text="โ€ข CสŸแดsแด‡", callback_data="cls" ), ] ] ) chat_id = m.chat.id if len(m.command) < 2: op = await skip_current_song(chat_id) if op == 0: await m.reply("โŒ nothing is currently playing") elif op == 1: await m.reply("โœ… __Queues__ **is empty.**\n\n**โ€ข userbot leaving voice chat**") elif op == 2: await m.reply("๐Ÿ—‘๏ธ **Clearing the Queues**\n\n**โ€ข userbot leaving voice chat**") 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๐Ÿ’ก **Status:** `Playing`\n๐ŸŽง **Request by:** {m.from_user.mention()}", reply_markup=keyboard, ) else: skip = m.text.split(None, 1)[1] OP = "๐Ÿ—‘ **removed song from queue:**" if chat_id in QUEUE: items = [int(x) for x in skip.split(" ") if x.isdigit()] items.sort(reverse=True) for x in items: if x == 0: pass else: hm = await skip_item(chat_id, x) if hm == 0: pass else: OP = OP + "\n" + f"**#{x}** - {hm}" await m.reply(OP) @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 if chat_id in QUEUE: try: await call_py.leave_group_call(chat_id) clear_queue(chat_id) await m.reply("โœ… **streaming has ended.**") except Exception as e: await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing in streaming**") @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." ) 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 ) @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." ) except Exception as e: await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing in streaming**") @Client.on_message( command(["mute", f"mute@{BOT_USERNAME}", "vmute"]) & other_filters ) @authorized_users_only async def mute(client, m: Message): chat_id = m.chat.id if chat_id in QUEUE: try: await call_py.mute_stream(chat_id) await m.reply( "๐Ÿ”‡ **Userbot muted.**\n\nโ€ข **To unmute the userbot, use the**\nยป /unmute command." ) except Exception as e: await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing in streaming**") @Client.on_message( command(["unmute", f"unmute@{BOT_USERNAME}", "vunmute"]) & other_filters ) @authorized_users_only async def unmute(client, m: Message): chat_id = m.chat.id if chat_id in QUEUE: try: await call_py.unmute_stream(chat_id) await m.reply( "๐Ÿ”Š **Userbot unmuted.**\n\nโ€ข **To mute the userbot, use the**\nยป /mute command." ) except Exception as e: await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing in streaming**") @Client.on_callback_query(filters.regex("cbpause")) async def cbpause(_, query: CallbackQuery): if query.message.sender_chat: return await query.answer("you're an Anonymous Admin !\n\nยป revert back to user account from admin rights.") 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 voice chats permission that can tap this button !", show_alert=True) chat_id = query.message.chat.id if chat_id in QUEUE: try: await call_py.pause_stream(chat_id) await query.edit_message_text( "โธ the streaming has paused", reply_markup=bttn ) except Exception as e: await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=bcl) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @Client.on_callback_query(filters.regex("cbresume")) async def cbresume(_, query: CallbackQuery): if query.message.sender_chat: return await query.answer("you're an Anonymous Admin !\n\nยป revert back to user account from admin rights.") 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 voice chats permission that can tap this button !", show_alert=True) chat_id = query.message.chat.id if chat_id in QUEUE: try: await call_py.resume_stream(chat_id) await query.edit_message_text( "โ–ถ๏ธ the streaming has resumed", reply_markup=bttn ) except Exception as e: await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=bcl) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @Client.on_callback_query(filters.regex("cbstop")) async def cbstop(_, query: CallbackQuery): if query.message.sender_chat: return await query.answer("you're an Anonymous Admin !\n\nยป revert back to user account from admin rights.") 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 voice chats permission that can tap this button !", show_alert=True) chat_id = query.message.chat.id if chat_id in QUEUE: try: await call_py.leave_group_call(chat_id) clear_queue(chat_id) await query.edit_message_text("โœ… **this streaming has ended**", reply_markup=bcl) except Exception as e: await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=bcl) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @Client.on_callback_query(filters.regex("cbmute")) async def cbmute(_, query: CallbackQuery): if query.message.sender_chat: return await query.answer("you're an Anonymous Admin !\n\nยป revert back to user account from admin rights.") 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 voice chats permission that can tap this button !", show_alert=True) chat_id = query.message.chat.id if chat_id in QUEUE: try: await call_py.mute_stream(chat_id) await query.edit_message_text( "๐Ÿ”‡ userbot succesfully muted", reply_markup=bttn ) except Exception as e: await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=bcl) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @Client.on_callback_query(filters.regex("cbunmute")) async def cbunmute(_, query: CallbackQuery): if query.message.sender_chat: return await query.answer("you're an Anonymous Admin !\n\nยป revert back to user account from admin rights.") 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 voice chats permission that can tap this button !", show_alert=True) chat_id = query.message.chat.id if chat_id in QUEUE: try: await call_py.unmute_stream(chat_id) await query.edit_message_text( "๐Ÿ”Š userbot succesfully unmuted", reply_markup=bttn ) except Exception as e: await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=bcl) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @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 if chat_id in QUEUE: 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}`") else: await m.reply("โŒ **nothing in streaming**")