From d1a889cdc0ef3d022c62bfad5e0a7ea6f3b67b16 Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Fri, 17 Nov 2023 11:08:44 +0700 Subject: [PATCH] Forgot to push this commit hehehe.. Signed-off-by: Yasir Aris M --- misskaty/plugins/admin.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/misskaty/plugins/admin.py b/misskaty/plugins/admin.py index 3f35b6fc..f13e18af 100644 --- a/misskaty/plugins/admin.py +++ b/misskaty/plugins/admin.py @@ -835,3 +835,28 @@ async def set_chat_photo(_, ctx: Message): except Exception as err: await ctx.reply(f"Failed changed group photo. ERROR: {err}") os.remove(photo) + + +from pyrogram import Client, types, filters, enums + +NUM = 4 + + +@app.on_message(filters.group & filters.command('mentionall', COMMAND_HANDLER)) +async def mention(app: Client, msg: types.Message): + NUM = 4 + user = await msg.chat.get_member(msg.from_user.id) + if user.status in (enums.ChatMemberStatus.OWNER, enums.ChatMemberStatus.ADMINISTRATOR): + total = [] + async for member in app.get_chat_members(msg.chat.id): + member: types.ChatMember + if member.user.username: + total.append(f'@{member.user.username}') + else: + total.append(member.user.mention()) + + for i in range(0, len(total), NUM): + message = ' '.join(total[i:i+NUM]) + await app.send_message(msg.chat.id, message) + else: + await app.send_message(msg.chat.id, 'Admins only can do that !', reply_to_message_id=msg.id) \ No newline at end of file