This commit is contained in:
levina 2022-01-19 17:00:22 +07:00 committed by GitHub
parent 43ce54f769
commit f14c9bb028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,13 @@
from cache.admins import admins from cache.admins import admins
from driver.veez import call_py from driver.veez import call_py
from pyrogram import Client, filters 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.queues import QUEUE, clear_queue
from driver.filters import command, other_filters
from driver.decorators import authorized_users_only
from driver.utils import skip_current_song, skip_item from driver.utils import skip_current_song, skip_item
from program.utils.inline import stream_markup, close_mark, back_mark
from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL from config import BOT_USERNAME, GROUP_SUPPORT, IMG_3, UPDATES_CHANNEL
from pyrogram.types import ( from pyrogram.types import (
CallbackQuery, CallbackQuery,
InlineKeyboardButton, InlineKeyboardButton,
@ -14,16 +16,6 @@ from pyrogram.types import (
) )
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) @Client.on_message(command(["reload", f"reload@{BOT_USERNAME}"]) & other_filters)
@authorized_users_only @authorized_users_only
async def update_admin(client, message): async def update_admin(client, message):
@ -41,20 +33,8 @@ async def update_admin(client, message):
@Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters) @Client.on_message(command(["skip", f"skip@{BOT_USERNAME}", "vskip"]) & other_filters)
@authorized_users_only @authorized_users_only
async def skip(client, m: Message): async def skip(client, m: Message):
await m.delete()
keyboard = InlineKeyboardMarkup( user_id = m.from_user.id
[
[
InlineKeyboardButton(
text="• Mᴇɴ", callback_data="cbmenu"
),
InlineKeyboardButton(
text="• Cʟsᴇ", callback_data="cls"
),
]
]
)
chat_id = m.chat.id chat_id = m.chat.id
if len(m.command) < 2: if len(m.command) < 2:
op = await skip_current_song(chat_id) op = await skip_current_song(chat_id)
@ -65,10 +45,12 @@ async def skip(client, m: Message):
elif op == 2: elif op == 2:
await m.reply("🗑️ **Clearing the Queues**\n\n**• userbot leaving voice chat**") await m.reply("🗑️ **Clearing the Queues**\n\n**• userbot leaving voice chat**")
else: else:
await m.reply_photo( buttons = stream_markup(user_id)
await m.send_photo(
chat_id,
photo=f"{IMG_3}", photo=f"{IMG_3}",
reply_markup=InlineKeyboardMarkup(buttons),
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()}", 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: else:
skip = m.text.split(None, 1)[1] skip = m.text.split(None, 1)[1]
@ -180,99 +162,89 @@ async def unmute(client, m: Message):
@Client.on_callback_query(filters.regex("cbpause")) @Client.on_callback_query(filters.regex("cbpause"))
async def cbpause(_, query: CallbackQuery): 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) a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats: 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) 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 chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
await call_py.pause_stream(chat_id) await call_py.pause_stream(chat_id)
await query.edit_message_text( await query.edit_message_text(
"⏸ the streaming has paused", reply_markup=bttn "⏸ the streaming has paused", reply_markup=back_mark
) )
except Exception as e: except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl) await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("❌ nothing is currently streaming", show_alert=True) await query.answer("❌ nothing is currently streaming", show_alert=True)
@Client.on_callback_query(filters.regex("cbresume")) @Client.on_callback_query(filters.regex("cbresume"))
async def cbresume(_, query: CallbackQuery): 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) a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats: 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) 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 chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
await call_py.resume_stream(chat_id) await call_py.resume_stream(chat_id)
await query.edit_message_text( await query.edit_message_text(
"▶️ the streaming has resumed", reply_markup=bttn "▶️ the streaming has resumed", reply_markup=back_mark
) )
except Exception as e: except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl) await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("❌ nothing is currently streaming", show_alert=True) await query.answer("❌ nothing is currently streaming", show_alert=True)
@Client.on_callback_query(filters.regex("cbstop")) @Client.on_callback_query(filters.regex("cbstop"))
async def cbstop(_, query: CallbackQuery): 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) a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats: 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) 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 chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
await call_py.leave_group_call(chat_id) await call_py.leave_group_call(chat_id)
clear_queue(chat_id) clear_queue(chat_id)
await query.edit_message_text("✅ **this streaming has ended**", reply_markup=bcl) await query.edit_message_text("✅ **this streaming has ended**", reply_markup=close_mark)
except Exception as e: except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl) await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("❌ nothing is currently streaming", show_alert=True) await query.answer("❌ nothing is currently streaming", show_alert=True)
@Client.on_callback_query(filters.regex("cbmute")) @Client.on_callback_query(filters.regex("cbmute"))
async def cbmute(_, query: CallbackQuery): 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) a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats: 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) 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 chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
await call_py.mute_stream(chat_id) await call_py.mute_stream(chat_id)
await query.edit_message_text( await query.edit_message_text(
"🔇 userbot succesfully muted", reply_markup=bttn "🔇 userbot succesfully muted", reply_markup=back_mark
) )
except Exception as e: except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl) await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("❌ nothing is currently streaming", show_alert=True) await query.answer("❌ nothing is currently streaming", show_alert=True)
@Client.on_callback_query(filters.regex("cbunmute")) @Client.on_callback_query(filters.regex("cbunmute"))
async def cbunmute(_, query: CallbackQuery): 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) a = await _.get_chat_member(query.message.chat.id, query.from_user.id)
if not a.can_manage_voice_chats: 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) 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 chat_id = query.message.chat.id
if chat_id in QUEUE: if chat_id in QUEUE:
try: try:
await call_py.unmute_stream(chat_id) await call_py.unmute_stream(chat_id)
await query.edit_message_text( await query.edit_message_text(
"🔊 userbot succesfully unmuted", reply_markup=bttn "🔊 userbot succesfully unmuted", reply_markup=back_mark
) )
except Exception as e: except Exception as e:
await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=bcl) await query.edit_message_text(f"🚫 **error:**\n\n`{e}`", reply_markup=close_mark)
else: else:
await query.answer("❌ nothing is currently streaming", show_alert=True) await query.answer("❌ nothing is currently streaming", show_alert=True)