From 33b5f3b3bdf8f0d62c503985f1c4e4703cfbfb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Tue, 14 Feb 2023 15:21:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Handling=20Genshin=20Exception?= =?UTF-8?q?=20Return=20Code=20-120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/ledger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/genshin/ledger.py b/plugins/genshin/ledger.py index 5493405..1336b69 100644 --- a/plugins/genshin/ledger.py +++ b/plugins/genshin/ledger.py @@ -153,5 +153,10 @@ class Ledger(Plugin, BasePlugin): self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id, 30) self._add_delete_message_job(context, message.chat_id, message.message_id, 30) return + except GenshinException as exc: + if exc.retcode == -120: + await message.reply_text("当前角色冒险等阶不足,暂时无法获取信息") + return + raise exc await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) await render_result.reply_photo(message, filename=f"{client.uid}.png", allow_sending_without_reply=True)