From 7b349011ed092f28296363089b3a4a194fe3986b Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 3 Oct 2021 11:56:50 +0800 Subject: [PATCH] =?UTF-8?q?portball=20groupindex=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- groupindex.py | 4 +++- list.json | 4 ++-- portball.py | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/groupindex.py b/groupindex.py index 8e94ece..7c8297f 100644 --- a/groupindex.py +++ b/groupindex.py @@ -86,6 +86,8 @@ async def group_index(context): for i in range(min(len(member_count), 5)): # 获取用户信息 target_user = await context.client(GetFullUserRequest(member_count[i][0])) - first_name = target_user.user.first_name.replace("\u2060", "") + first_name = target_user.user.first_name + if first_name: + first_name = first_name.replace("\u2060", "") text += f'{first_name} `{member_count[i][1]}`\n' await context.edit(text) diff --git a/list.json b/list.json index 36b3bd0..22abb63 100644 --- a/list.json +++ b/list.json @@ -152,7 +152,7 @@ }, { "name": "portball", - "version": "1.451", + "version": "1.452", "section": "chat", "maintainer": "Pentacene", "size": "2.8 kb", @@ -692,7 +692,7 @@ }, { "name": "groupindex", - "version": "1.12", + "version": "1.121", "section": "daily", "maintainer": "xtaodada", "size": "3.2 kb", diff --git a/portball.py b/portball.py index a5480a0..eb5997c 100644 --- a/portball.py +++ b/portball.py @@ -1,4 +1,4 @@ -from pagermaid import bot, log +from pagermaid import bot, log, user_id from pagermaid.listener import listener from telethon.errors import rpcerrorlist from asyncio import sleep @@ -19,6 +19,9 @@ async def portball(context): last_name = '' else: last_name = reply.sender.last_name + if reply.sender.id == user_id: + await context.edit('无法禁言自己。') + return else: await context.edit('无法获取所回复的用户。') return