From 78b1b1ba15f01f8764d5c05c5aba28db905f6c4b Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 30 Sep 2023 15:27:28 +0800 Subject: [PATCH] :bug: Fix redeem cooldown error --- modules/playercards/metadata | 2 +- plugins/app/start.py | 4 +++- plugins/genshin/redeem.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/playercards/metadata b/modules/playercards/metadata index fb6a1b6c..c8e48151 160000 --- a/modules/playercards/metadata +++ b/modules/playercards/metadata @@ -1 +1 @@ -Subproject commit fb6a1b6c7c271f73235783267290e849a198d5a8 +Subproject commit c8e481518e29aff43244afdee1048604ab1e8148 diff --git a/plugins/app/start.py b/plugins/app/start.py index 5cd3f67f..f7fd2a20 100644 --- a/plugins/app/start.py +++ b/plugins/app/start.py @@ -1,6 +1,6 @@ from typing import Optional, TYPE_CHECKING -from simnet.errors import RedemptionInvalid, RegionNotSupported, RedemptionClaimed +from simnet.errors import RedemptionInvalid, RegionNotSupported, RedemptionClaimed, RedemptionCooldown from telegram import Update, ReplyKeyboardRemove, Message, User, WebAppInfo, ReplyKeyboardMarkup, KeyboardButton from telegram.constants import ChatAction from telegram.ext import CallbackContext, CommandHandler @@ -160,4 +160,6 @@ class StartPlugin(Plugin): msg = "兑换码格式不正确,请确认。" except RedemptionClaimed: msg = "此兑换码已经兑换过了。" + except RedemptionCooldown as e: + msg = e.message await message.reply_text(msg) diff --git a/plugins/genshin/redeem.py b/plugins/genshin/redeem.py index 3e2b45cb..e9828a53 100644 --- a/plugins/genshin/redeem.py +++ b/plugins/genshin/redeem.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from simnet.errors import RedemptionInvalid, RedemptionClaimed, RegionNotSupported +from simnet.errors import RedemptionInvalid, RedemptionClaimed, RegionNotSupported, RedemptionCooldown from telegram import Update from telegram.ext import CallbackContext from telegram.ext import filters @@ -45,6 +45,8 @@ class Redeem(Plugin): msg = "兑换码格式不正确,请确认。" except RedemptionClaimed: msg = "此兑换码已经兑换过了。" + except RedemptionCooldown as e: + msg = e.message reply_message = await message.reply_text(msg) if filters.ChatType.GROUPS.filter(reply_message): self.add_delete_message_job(reply_message)