2022-07-21 13:40:55 +00:00
|
|
|
|
from pyrogram.enums import ChatMembersFilter
|
|
|
|
|
|
|
|
|
|
from pagermaid.listener import listener
|
2022-09-01 08:28:48 +00:00
|
|
|
|
from pagermaid.enums import Client, Message
|
2022-07-21 13:40:55 +00:00
|
|
|
|
|
|
|
|
|
|
2023-07-01 12:18:58 +00:00
|
|
|
|
@listener(
|
|
|
|
|
command="atadmins",
|
|
|
|
|
description="一键 AT 本群管理员(仅在群组中有效)",
|
|
|
|
|
groups_only=True,
|
|
|
|
|
parameters="[要说的话]",
|
|
|
|
|
)
|
2022-09-01 08:28:48 +00:00
|
|
|
|
async def at_admins(client: Client, message: Message):
|
2022-07-21 13:40:55 +00:00
|
|
|
|
admins = []
|
2023-07-01 12:18:58 +00:00
|
|
|
|
async for m in client.get_chat_members(
|
|
|
|
|
message.chat.id, filter=ChatMembersFilter.ADMINISTRATORS
|
|
|
|
|
):
|
2022-07-21 13:40:55 +00:00
|
|
|
|
if not m.user.is_bot and not m.user.is_deleted:
|
|
|
|
|
admins.append(m.user.mention)
|
|
|
|
|
if not admins:
|
|
|
|
|
return await message.edit("❌ 没有管理员")
|
|
|
|
|
say = message.arguments or "召唤本群所有管理员"
|
2023-07-01 12:18:58 +00:00
|
|
|
|
send_list = " , ".join(admins)
|
|
|
|
|
await client.send_message(
|
|
|
|
|
message.chat.id,
|
|
|
|
|
"%s:\n\n%s" % (say, send_list),
|
2024-02-04 07:56:06 +00:00
|
|
|
|
reply_to_message_id=message.reply_to_message_id,
|
|
|
|
|
message_thread_id=message.message_thread_id,
|
2023-07-01 12:18:58 +00:00
|
|
|
|
)
|
2022-07-21 13:40:55 +00:00
|
|
|
|
await message.safe_delete()
|