xtao-some getdel 支持只查询不删除

This commit is contained in:
xtaodada 2021-06-18 20:23:22 +08:00
parent c67c9b44ee
commit 96e019538a
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 6 additions and 3 deletions

View File

@ -62,7 +62,7 @@
}, },
{ {
"name": "xtao-some", "name": "xtao-some",
"version": "1.19", "version": "1.20",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "18.8 kb", "size": "18.8 kb",

View File

@ -279,6 +279,9 @@ async def getdel(context):
""" PagerMaid getdel. """ """ PagerMaid getdel. """
cid = str(context.chat_id) cid = str(context.chat_id)
pri = cid.startswith('-100') pri = cid.startswith('-100')
parameter = None
if len(context.parameter) == 1:
parameter = context.parameter[0]
if pri: if pri:
member_count = 0 member_count = 0
try: try:
@ -291,13 +294,13 @@ async def getdel(context):
async for member in bot.iter_participants(chat): async for member in bot.iter_participants(chat):
if member.deleted: if member.deleted:
member_count += 1 member_count += 1
if need_kick: if need_kick and parameter:
try: try:
await context.client.kick_participant(context.chat_id, member.id) await context.client.kick_participant(context.chat_id, member.id)
except FloodWaitError: except FloodWaitError:
await context.edit('处理失败,您已受到 TG 服务器限制。') await context.edit('处理失败,您已受到 TG 服务器限制。')
return return
if need_kick: if need_kick and parameter:
await context.edit(f'此频道/群组的死号数:`{member_count}`,并且已经清理完毕。') await context.edit(f'此频道/群组的死号数:`{member_count}`,并且已经清理完毕。')
else: else:
await context.edit(f'此频道/群组的死号数:`{member_count}`。') await context.edit(f'此频道/群组的死号数:`{member_count}`。')