From 45b718270133478ac8a66d35010f01de57019517 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 15 Feb 2021 12:39:10 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20xtao-some=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=A2=91=E9=81=93/=E7=BE=A4=E7=BB=84?= =?UTF-8?q?=E6=AD=BB=E5=8F=B7=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 6 +++--- xtao-some.py | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/list.json b/list.json index 028fcc2..aef199d 100644 --- a/list.json +++ b/list.json @@ -62,13 +62,13 @@ }, { "name": "xtao-some", - "version": "1.14", + "version": "1.154", "section": "daily", "maintainer": "xtaodada", "size": "18.8 kb", "supported": true, "des-short": "一大堆便民功能。", - "des": "超多功能 例如 -ip -ipping -guess 等。" + "des": "超多功能 例如 -ip -ipping -guess -t -getdel 等。" }, { "name": "yb-dl", @@ -362,7 +362,7 @@ }, { "name": "keyword", - "version": "2.55", + "version": "2.551", "section": "chat", "maintainer": "c3b2a,xtaodada", "size": "36.7 kb", diff --git a/xtao-some.py b/xtao-some.py index 9fda6e3..a189d32 100644 --- a/xtao-some.py +++ b/xtao-some.py @@ -1,11 +1,10 @@ """ Pagermaid plugin base. """ import json, requests, re -from translate import Translator as trans from urllib.parse import urlparse from pagermaid import bot, log from pagermaid.listener import listener, config from pagermaid.utils import clear_emojis, obtain_message, attach_log -from telethon.tl.types import ChannelParticipantsAdmins +from telethon.errors import ChatAdminRequiredError from os import remove @@ -254,3 +253,24 @@ async def tx_t(context): await attach_log(result, context.chat_id, "translation.txt", context.id) return await context.edit(result) + + +@listener(is_plugin=True, outgoing=True, command="getdel", + description="获取当前群组/频道的死号数。") +async def getdel(context): + """ PagerMaid getdel. """ + cid = str(context.chat_id) + pri = cid.startswith('-100') + if pri: + member_count = 0 + try: + await context.edit('遍历成员中。。。') + chat = await context.get_chat() + async for member in bot.iter_participants(chat): + if member.deleted: + member_count += 1 + await context.edit(f'此频道/群组的死号数:`{member_count}`') + except ChatAdminRequiredError: + await context.edit('未加入此频道。') + else: + await context.edit("请在在群组/频道发送。")