mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-29 11:44:26 +00:00
Merge pull request #130 from Pentacene/master
killallmembers v1.02 修复频繁edit导致的报错
This commit is contained in:
commit
009b98e365
@ -1,7 +1,6 @@
|
|||||||
""" PagerMaid Plugin killallmembers """
|
""" PagerMaid Plugin killallmembers """
|
||||||
from asyncio import sleep
|
from asyncio import sleep
|
||||||
from telethon.tl.types import ChannelParticipantsAdmins
|
from telethon.tl.types import ChannelParticipantsAdmins
|
||||||
from pagermaid import bot
|
|
||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
|
|
||||||
@listener(is_plugin=True, outgoing=True, command="killallmembers",
|
@listener(is_plugin=True, outgoing=True, command="killallmembers",
|
||||||
@ -33,9 +32,12 @@ async def killallmembers(context):
|
|||||||
i = 0
|
i = 0
|
||||||
for user_id in users_wo_admins:
|
for user_id in users_wo_admins:
|
||||||
try:
|
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
|
i += 1
|
||||||
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:
|
except:
|
||||||
await context.edit('发生错误')
|
await context.edit('发生错误')
|
||||||
await sleep(10)
|
await sleep(10)
|
||||||
|
Loading…
Reference in New Issue
Block a user