fuckmember fix edit too quick bug.

This commit is contained in:
xtaodada 2021-07-12 18:24:15 +08:00
parent 6b21ff3d1e
commit bd2340d983
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,7 @@
from pagermaid.listener import listener
from pagermaid.utils import alias_command
from telethon.tl.types import ChannelParticipantsAdmins
from telethon.errors.rpcerrorlist import UserAdminInvalidError
def eval_time(context, msg, day):
@ -54,18 +55,26 @@ async def fuck_member(context):
if time:
count += 1
if kick_mode:
await context.client.kick_participant(context.chat_id, x)
try:
await context.client.kick_participant(context.chat_id, x)
except UserAdminInvalidError:
await context.edit('无管理员权限,停止查询。')
return
if msg == 1:
msg = 0
else:
counts += 1
if kick_mode:
await context.client.kick_participant(context.chat_id, x)
# 每二十人修改一次
if members == 20:
try:
await context.client.kick_participant(context.chat_id, x)
except UserAdminInvalidError:
await context.edit('无管理员权限,停止查询。')
return
# 每一百人修改一次
if members == 100:
members_count += 1
members = 0
await context.edit(text + f'\n已查找 {members_count * 20} 人。')
await context.edit(text + f'\n已查找 {members_count * 100} 人。')
text = ''
if count > 0:
text += f'查找到了 {count} 个未发言超过 {day} 天的群成员。\n'

View File

@ -592,7 +592,7 @@
},
{
"name": "fuckmember",
"version": "1.0",
"version": "1.01",
"section": "daily",
"maintainer": "xtaodada",
"size": "3.0 kb",