🐛 Fix redeem cooldown error

This commit is contained in:
xtaodada 2023-09-30 15:26:17 +08:00
parent 0bff9bbd57
commit fed24a60f4
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 6 additions and 2 deletions

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
@ -156,4 +156,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)