From 2efe4c1d25df2b92c066fe43a20d06c04944323c Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 5 Dec 2021 16:40:39 +0800 Subject: [PATCH] =?UTF-8?q?fuck=20eat=20=E4=BF=AE=E5=A4=8D=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eat.py | 2 +- fuck.py | 32 ++++++++++++++++++++++++-------- list.json | 4 ++-- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/eat.py b/eat.py index 07bde6e..0762034 100644 --- a/eat.py +++ b/eat.py @@ -243,7 +243,7 @@ async def eat(context: NewMessage.Event): if user.isnumeric(): user = int(user) else: - user = user_object.id + user = from_user_id if context.message.entities is not None: if isinstance(context.message.entities[0], MessageEntityMentionName): target_user = await context.client(GetFullUserRequest(context.message.entities[0].user_id)) diff --git a/fuck.py b/fuck.py index e35c74a..f50e8d5 100644 --- a/fuck.py +++ b/fuck.py @@ -21,10 +21,17 @@ async def fuck(context): if context.is_group: if reply: if reply.sender: - if reply.sender.last_name is None: - reply_last_name = '' - else: - reply_last_name = reply.sender.last_name + try: + if reply.sender.last_name is None: + reply_last_name = '' + else: + reply_last_name = reply.sender.last_name + except AttributeError: + try: + await context.edit('无法获取所回复的用户。') + except: + pass + return else: try: await context.edit('无法获取所回复的用户。') @@ -32,10 +39,17 @@ async def fuck(context): pass return if context.sender: - if context.sender.last_name is None: - context_last_name = '' - else: - context_last_name = context.sender.last_name + try: + if context.sender.last_name is None: + context_last_name = '' + else: + context_last_name = context.sender.last_name + except AttributeError: + try: + await context.edit('无法获取所回复的用户。') + except: + pass + return else: try: await context.edit('无法获取所回复的用户。') @@ -76,6 +90,8 @@ async def fuck(context): else: try: userid = int(context.arguments) + if userid < 0: + return await context.edit('输入值错误。') except ValueError: await context.edit('输入值错误。') return diff --git a/list.json b/list.json index 048c3f8..3157a7c 100644 --- a/list.json +++ b/list.json @@ -202,7 +202,7 @@ }, { "name": "eat", - "version": "1.042", + "version": "1.043", "section": "profile", "maintainer": "SF_PICK", "size": "22.3 kb", @@ -502,7 +502,7 @@ }, { "name": "fuck", - "version": "1.022", + "version": "1.023", "section": "chat", "maintainer": "Pentacene", "size": "4.0 kb",