From 6b1514bc51ec6e961f5e765c35257b9b7b06debb Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 2 Aug 2021 23:39:58 +0800 Subject: [PATCH] =?UTF-8?q?groupindex=20=E9=9D=9E=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=8A=A0=E5=85=A5\?= =?UTF-8?q?=E9=80=80=E5=87=BA=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- groupindex.py | 10 ++++++---- list.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/groupindex.py b/groupindex.py index 6d9e9bc..973771a 100644 --- a/groupindex.py +++ b/groupindex.py @@ -32,6 +32,7 @@ async def group_index(context): join_count = 0 leave_count = 0 # 读取管理员操作日志 + admin = True try: async for i in context.client.iter_admin_log(context.chat_id, join=True): utc_time = i.date.replace(tzinfo=utc_tz) @@ -48,7 +49,7 @@ async def group_index(context): break leave_count += 1 except: - pass + admin = False await context.edit('正在分析群组数据中...(2/3)') async for i in context.client.iter_messages(context.chat_id, offset_date=search, reverse=True): uid = i.sender_id @@ -68,9 +69,10 @@ async def group_index(context): msg_counts = end_id - start_id member_counts = len(all_members) text += f'活跃人数:{member_counts} 人\n' \ - f'总消息数:{msg_counts}\n 条' \ - f'加群 {join_count} 人,退群 {leave_count} 人\n' \ - f'最活跃的小可爱们:\n' + f'总消息数:{msg_counts} 条\n' + if admin: + text += f'加群 {join_count} 人,退群 {leave_count} 人\n' \ + text += f'最活跃的小可爱们:\n' # 字典倒序排序 member_count = sorted(member_count.items(), key=lambda x: x[1], reverse=True) # 遍历列表 diff --git a/list.json b/list.json index efe81cd..f063852 100644 --- a/list.json +++ b/list.json @@ -692,7 +692,7 @@ }, { "name": "groupindex", - "version": "1.0", + "version": "1.1", "section": "daily", "maintainer": "xtaodada", "size": "3.1 kb",