From ac936097a9873a2fcc597b72ed7b7e4d497a0642 Mon Sep 17 00:00:00 2001 From: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:13:36 +0800 Subject: [PATCH] =?UTF-8?q?eat=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eat/main.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eat/main.py b/eat/main.py index 3767a10..5c199fa 100644 --- a/eat/main.py +++ b/eat/main.py @@ -7,7 +7,7 @@ from random import randint from pyrogram import Client from pyrogram.enums import MessageEntityType -from pyrogram.errors import PeerIdInvalid, UsernameNotOccupied +from pyrogram.errors import UsernameNotOccupied, UsernameInvalid from pyrogram.types import User, Chat from pagermaid.single_utils import sqlite, safe_remove @@ -249,14 +249,12 @@ async def eat(client_: Client, context: Message): user = await client_.get_users(user) except IndexError: user = await client_.get_chat(user) # noqa - except PeerIdInvalid: - return await context.edit(f"{lang('error_prefix')}{lang('profile_e_nof')}") - except UsernameNotOccupied: + except (UsernameNotOccupied, UsernameInvalid): return await context.edit(f"{lang('error_prefix')}{lang('profile_e_nou')}") except OverflowError: return await context.edit(f"{lang('error_prefix')}{lang('profile_e_long')}") except Exception as exception: - raise exception + return await context.edit(f"{lang('error_prefix')}{lang('profile_e_nof')}") target_user_id = user.id if not user.photo: return await context.edit("出错了呜呜呜 ~ 此用户无头像。")