From c1b3ac447fd82aa494836409db49299ed7df7684 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Fri, 12 Nov 2021 06:30:14 +0700 Subject: [PATCH] setup --- program/callback.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/program/callback.py b/program/callback.py index 59f253d..652ed20 100644 --- a/program/callback.py +++ b/program/callback.py @@ -1,6 +1,7 @@ # Copyright (C) 2021 By VeezMusicProject from pyrogram import Client, filters +from driver.queues import QUEUE from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup from config import ( ASSISTANT_NAME, @@ -170,21 +171,26 @@ async def cbmenu(_, 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 voice chats permission that can tap this button !", show_alert=True) - 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")], - ] - ), - ) + chat_id = query.message.chat.id + if chat_id in QUEUE: + try: + 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")], + ] + ), + ) + else: + await query.answer("āŒ nothing is currently streaming", show_alert=True) @Client.on_callback_query(filters.regex("cls"))