From 3e99688509a16ad65eb5f72de1ef5c957f0526b6 Mon Sep 17 00:00:00 2001 From: b miao Date: Sat, 6 Mar 2021 21:20:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?killallmembers=20v1.02=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=A2=91=E7=B9=81edit=E5=AF=BC=E8=87=B4=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- killallmembers.py | 3 ++- list.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/killallmembers.py b/killallmembers.py index 1b624b0..f4c2c97 100644 --- a/killallmembers.py +++ b/killallmembers.py @@ -35,7 +35,8 @@ async def killallmembers(context): try: await bot.edit_permissions(context.chat_id, user_id, view_messages=False) i += 1 - await context.edit(f'进度:{i}/{len(users_wo_admins)}') + if i % 10 == 0: + await context.edit(f'进度:{i}/{len(users_wo_admins)}') except: await context.edit('发生错误') await sleep(10) diff --git a/list.json b/list.json index a739f71..50d37ef 100644 --- a/list.json +++ b/list.json @@ -292,7 +292,7 @@ }, { "name": "killallmembers", - "version": "1.01", + "version": "1.02", "section": "chat", "maintainer": "Pentacene", "size": "idk", From 4170c60b814b3d751fce80ec3695bb39e925f61d Mon Sep 17 00:00:00 2001 From: b miao Date: Sat, 6 Mar 2021 21:26:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?killallmembers=20v1.02=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=A2=91=E7=B9=81edit=E5=AF=BC=E8=87=B4=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- killallmembers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/killallmembers.py b/killallmembers.py index f4c2c97..a1f90c0 100644 --- a/killallmembers.py +++ b/killallmembers.py @@ -1,7 +1,6 @@ """ PagerMaid Plugin killallmembers """ from asyncio import sleep from telethon.tl.types import ChannelParticipantsAdmins -from pagermaid import bot from pagermaid.listener import listener @listener(is_plugin=True, outgoing=True, command="killallmembers", @@ -33,10 +32,12 @@ async def killallmembers(context): i = 0 for user_id in users_wo_admins: try: - await bot.edit_permissions(context.chat_id, user_id, view_messages=False) + await context.client.edit_permissions(context.chat_id, user_id, view_messages=False) i += 1 - if i % 10 == 0: - await context.edit(f'进度:{i}/{len(users_wo_admins)}') + if i == len(users_wo_admins): + await context.edit(f'完成!\n进度:{i}/{len(users_wo_admins)}') + elif (i < 10) or (i % 10 == 0): + await context.edit(f'进度:{i}/{len(users_wo_admins)}\n{'percent: {:.0f}%'.format(i/len(users_wo_admins))') except: await context.edit('发生错误') await sleep(10)