From cf2a0defb1156dd05a08dc755b9e60cf936c9216 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Wed, 16 Jun 2021 15:55:09 +0800 Subject: [PATCH] =?UTF-8?q?xtao-some=20=E6=94=AF=E6=8C=81=E6=B8=85?= =?UTF-8?q?=E7=90=86=E7=BE=A4=E5=86=85=E6=AD=BB=E5=8F=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 4 ++-- rape.py | 14 ++++++++++---- xtao-some.py | 12 +++++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/list.json b/list.json index 5e0d938..93e380c 100644 --- a/list.json +++ b/list.json @@ -62,7 +62,7 @@ }, { "name": "xtao-some", - "version": "1.161", + "version": "1.17", "section": "daily", "maintainer": "xtaodada", "size": "18.8 kb", @@ -492,7 +492,7 @@ }, { "name": "rape", - "version": "1.01", + "version": "1.02", "section": "chat", "maintainer": "Pentacene", "size": "4.0 kb", diff --git a/rape.py b/rape.py index 4549885..72ba26c 100644 --- a/rape.py +++ b/rape.py @@ -19,11 +19,11 @@ async def rape(context): reply = await context.get_reply_message() if context.is_group: if reply: - if reply.sender.last_name == None: + if reply.sender.last_name is None: reply_last_name = '' else: reply_last_name = reply.sender.last_name - if context.sender.last_name == None: + if context.sender.last_name is None: context_last_name = '' else: context_last_name = context.sender.last_name @@ -48,13 +48,18 @@ async def rape(context): pin_messages=False) await context.client.send_message( context.chat_id, - f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒', + f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) ' + f'由于乱玩管理员命令 已被禁言60秒', reply_to=reply.id ) await context.delete() except: pass else: + if context.sender.last_name is None: + context_last_name = '' + else: + context_last_name = context.sender.last_name if context.arguments == '': return else: @@ -80,7 +85,8 @@ async def rape(context): change_info=False, pin_messages=False) await context.client.send_message( context.chat_id, - f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒', + f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) ' + f'由于乱玩管理员命令 已被禁言60秒', reply_to=context.id ) await context.delete() diff --git a/xtao-some.py b/xtao-some.py index c7aab8f..b8bcd64 100644 --- a/xtao-some.py +++ b/xtao-some.py @@ -5,6 +5,7 @@ from pagermaid import bot, log from pagermaid.listener import listener, config from pagermaid.utils import clear_emojis, obtain_message, attach_log, alias_command from telethon.errors import ChatAdminRequiredError +from telethon.tl.types import ChannelParticipantsAdmins @listener(is_plugin=True, outgoing=True, command=alias_command("guess"), @@ -282,10 +283,19 @@ async def getdel(context): try: await context.edit('遍历成员中。。。') chat = await context.get_chat() + admins = await context.client.get_participants(context.chat, filter=ChannelParticipantsAdmins) + need_kick = False + if context.sender in admins: + need_kick = True async for member in bot.iter_participants(chat): if member.deleted: member_count += 1 - await context.edit(f'此频道/群组的死号数:`{member_count}`') + if need_kick: + await context.client.kick_participant(context.chat_id, member.id) + if need_kick: + await context.edit(f'此频道/群组的死号数:`{member_count}`,并且已经清理完毕。') + else: + await context.edit(f'此频道/群组的死号数:`{member_count}`。') except ChatAdminRequiredError: await context.edit('未加入此频道。') else: