mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 捕获道具无法使用异常
This commit is contained in:
parent
62819ec90e
commit
8604444879
@ -18,6 +18,7 @@ from nonebot_plugin_uninfo import Uninfo
|
||||
|
||||
from zhenxun.configs.utils import BaseBlock, Command, PluginExtraData, RegisterConfig
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.decorator.shop import NotMeetUseConditionsException
|
||||
from zhenxun.utils.depends import UserName
|
||||
from zhenxun.utils.enum import BlockType, PluginType
|
||||
from zhenxun.utils.exception import GoodsNotFound
|
||||
@ -202,6 +203,12 @@ async def _(
|
||||
await MessageUtils.build_message(
|
||||
f"没有找到道具 {name.result} 或道具数量不足..."
|
||||
).send(reply_to=True)
|
||||
except NotMeetUseConditionsException as e:
|
||||
if info := e.get_info():
|
||||
await MessageUtils.build_message(info).finish() # type: ignore
|
||||
await MessageUtils.build_message(
|
||||
f"使用道具 {name.result} 的条件不满足..."
|
||||
).send(reply_to=True)
|
||||
|
||||
|
||||
@_matcher.assign("gold-list")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user