🐛 Fix redeem cooldown error

This commit is contained in:
xtaodada 2023-09-30 15:27:28 +08:00
parent 70f9c41ed8
commit 78b1b1ba15
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 7 additions and 3 deletions

@ -1 +1 @@
Subproject commit fb6a1b6c7c271f73235783267290e849a198d5a8
Subproject commit c8e481518e29aff43244afdee1048604ab1e8148

View File

@ -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)

View File

@ -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)