From 3936c14d005b3b2f9dcd90080a1f868bb05975e2 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 12 Apr 2024 22:34:22 +0800 Subject: [PATCH] :bug: Fix stats plugin player_id check --- plugins/genshin/stats.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/genshin/stats.py b/plugins/genshin/stats.py index 72b83785..874d0168 100644 --- a/plugins/genshin/stats.py +++ b/plugins/genshin/stats.py @@ -36,13 +36,8 @@ class PlayerStatsPlugins(Plugin): uid: Optional[int] = None try: args = context.args - if args is not None and len(args) >= 1: + if args is not None and len(args) == 9: uid = int(args[0]) - except ValueError as exc: - logger.warning("获取 uid 发生错误! 错误信息为 %s", str(exc)) - await message.reply_text("输入错误") - return - try: async with self.helper.genshin_or_public(user_id) as client: if not client.public: await client.get_record_cards() @@ -55,6 +50,10 @@ class PlayerStatsPlugins(Plugin): logger.exception(exc) await message.reply_text("角色数据有误 估计是派蒙晕了") return + except ValueError as exc: + logger.warning("获取 uid 发生错误! 错误信息为 %s", str(exc)) + await message.reply_text("输入错误") + return await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) await render_result.reply_photo(message, filename=f"{client.player_id}.png", allow_sending_without_reply=True)