From b7b1651709d907e86390caa69545da617359ca7a Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sat, 21 May 2022 16:39:06 +0800 Subject: [PATCH] fix what_anime --- plugins/alapi/_data_source.py | 2 ++ plugins/mute.py | 1 - plugins/what_anime/__init__.py | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/alapi/_data_source.py b/plugins/alapi/_data_source.py index 69f83aec..0fd0e010 100644 --- a/plugins/alapi/_data_source.py +++ b/plugins/alapi/_data_source.py @@ -23,6 +23,8 @@ async def get_data(url: str, params: Optional[dict] = None) -> Tuple[Union[dict, return "没有搜索到...", 997 return data, 200 else: + if data["code"] == 101: + return "缺失ALAPI TOKEN,请在配置文件中填写!", 999 return f'发生了错误...code:{data["code"]}', 999 except TimeoutError: return "超时了....", 998 diff --git a/plugins/mute.py b/plugins/mute.py index 2e2a970f..dddd28fc 100755 --- a/plugins/mute.py +++ b/plugins/mute.py @@ -161,5 +161,4 @@ async def _(event: GroupMessageEvent, cmd: Tuple[str, ...] = Command(), arg: Mes logger.info( f'USER {event.user_id} GROUP {group_id} {cmd[0]}:{msg}' ) - print(mute_data) save_data() diff --git a/plugins/what_anime/__init__.py b/plugins/what_anime/__init__.py index f7ecbc73..79955442 100755 --- a/plugins/what_anime/__init__.py +++ b/plugins/what_anime/__init__.py @@ -1,8 +1,9 @@ from nonebot.adapters.onebot.v11 import MessageEvent, GroupMessageEvent, Message, Bot +from nonebot.internal.params import ArgStr + from .data_source import get_anime from nonebot import on_command from nonebot.typing import T_State -from nonebot.params import Arg from utils.utils import get_message_img from services.log import logger @@ -38,11 +39,9 @@ async def _(bot: Bot, event: MessageEvent, state: T_State): @what_anime.got("img_url", prompt="虚空识番?来图来图GKD") -async def _(bot: Bot, event: MessageEvent, state: T_State, img_url: Message = Arg("img_url")): - img_url = get_message_img(img_url) +async def _(bot: Bot, event: MessageEvent, state: T_State, img_url: str = ArgStr("img_url")): if not img_url: await what_anime.reject_arg("img_url", "发送的必须是图片!") - img_url = img_url[0] await what_anime.send("开始识别.....") anime_data_report = await get_anime(img_url) if anime_data_report: