detect Anonymous Admin

added to callback query too
This commit is contained in:
levina 2021-11-05 17:24:01 +07:00 committed by GitHub
parent 20bedcb432
commit 50ef69cde3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,6 +178,8 @@ 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.edit_message_text("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 voice chats permission that can tap this button !", show_alert=True)
@ -196,6 +198,8 @@ async def cbpause(_, query: CallbackQuery):
@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.edit_message_text("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 voice chats permission that can tap this button !", show_alert=True)
@ -214,6 +218,8 @@ async def cbresume(_, query: CallbackQuery):
@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.edit_message_text("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 voice chats permission that can tap this button !", show_alert=True)
@ -231,6 +237,8 @@ async def cbstop(_, query: CallbackQuery):
@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.edit_message_text("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 voice chats permission that can tap this button !", show_alert=True)
@ -249,6 +257,8 @@ async def cbmute(_, query: CallbackQuery):
@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.edit_message_text("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 voice chats permission that can tap this button !", show_alert=True)