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
3cc497d6a6
commit
2c4611fb46
@ -14,7 +14,6 @@ from nonebot_plugin_alconna import (
|
|||||||
on_alconna,
|
on_alconna,
|
||||||
store_true,
|
store_true,
|
||||||
)
|
)
|
||||||
from nonebot_plugin_session import EventSession
|
|
||||||
from nonebot_plugin_uninfo import Uninfo
|
from nonebot_plugin_uninfo import Uninfo
|
||||||
|
|
||||||
from zhenxun.configs.utils import BaseBlock, PluginExtraData
|
from zhenxun.configs.utils import BaseBlock, PluginExtraData
|
||||||
@ -23,6 +22,7 @@ from zhenxun.utils.depends import UserName
|
|||||||
from zhenxun.utils.enum import BlockType, PluginType
|
from zhenxun.utils.enum import BlockType, PluginType
|
||||||
from zhenxun.utils.exception import GoodsNotFound
|
from zhenxun.utils.exception import GoodsNotFound
|
||||||
from zhenxun.utils.message import MessageUtils
|
from zhenxun.utils.message import MessageUtils
|
||||||
|
from zhenxun.utils.platform import PlatformUtils
|
||||||
|
|
||||||
from ._data_source import ShopManage, gold_rank
|
from ._data_source import ShopManage, gold_rank
|
||||||
|
|
||||||
@ -107,35 +107,31 @@ _matcher.shortcut(
|
|||||||
|
|
||||||
|
|
||||||
@_matcher.assign("$main")
|
@_matcher.assign("$main")
|
||||||
async def _(session: EventSession, arparma: Arparma):
|
async def _(session: Uninfo, arparma: Arparma):
|
||||||
image = await ShopManage.build_shop_image()
|
image = await ShopManage.build_shop_image()
|
||||||
logger.info("查看商店", arparma.header_result, session=session)
|
logger.info("查看商店", arparma.header_result, session=session)
|
||||||
await MessageUtils.build_message(image).send()
|
await MessageUtils.build_message(image).send()
|
||||||
|
|
||||||
|
|
||||||
@_matcher.assign("my-cost")
|
@_matcher.assign("my-cost")
|
||||||
async def _(session: EventSession, arparma: Arparma):
|
async def _(session: Uninfo, arparma: Arparma):
|
||||||
if session.id1:
|
|
||||||
logger.info("查看金币", arparma.header_result, session=session)
|
logger.info("查看金币", arparma.header_result, session=session)
|
||||||
gold = await ShopManage.my_cost(session.id1, session.platform)
|
gold = await ShopManage.my_cost(
|
||||||
|
session.user.id, PlatformUtils.get_platform(session)
|
||||||
|
)
|
||||||
await MessageUtils.build_message(f"你的当前余额: {gold}").send(reply_to=True)
|
await MessageUtils.build_message(f"你的当前余额: {gold}").send(reply_to=True)
|
||||||
else:
|
|
||||||
await MessageUtils.build_message("用户id为空...").send(reply_to=True)
|
|
||||||
|
|
||||||
|
|
||||||
@_matcher.assign("my-props")
|
@_matcher.assign("my-props")
|
||||||
async def _(session: EventSession, arparma: Arparma, nickname: str = UserName()):
|
async def _(session: Uninfo, arparma: Arparma, nickname: str = UserName()):
|
||||||
if session.id1:
|
|
||||||
logger.info("查看道具", arparma.header_result, session=session)
|
logger.info("查看道具", arparma.header_result, session=session)
|
||||||
if image := await ShopManage.my_props(
|
if image := await ShopManage.my_props(
|
||||||
session.id1,
|
session.user.id,
|
||||||
nickname,
|
nickname,
|
||||||
session.platform,
|
PlatformUtils.get_platform(session),
|
||||||
):
|
):
|
||||||
await MessageUtils.build_message(image.pic2bytes()).finish(reply_to=True)
|
await MessageUtils.build_message(image.pic2bytes()).finish(reply_to=True)
|
||||||
return await MessageUtils.build_message("你的道具为空捏...").send(reply_to=True)
|
return await MessageUtils.build_message("你的道具为空捏...").send(reply_to=True)
|
||||||
else:
|
|
||||||
await MessageUtils.build_message("用户id为空...").send(reply_to=True)
|
|
||||||
|
|
||||||
|
|
||||||
@_matcher.assign("buy")
|
@_matcher.assign("buy")
|
||||||
@ -163,7 +159,7 @@ async def _(
|
|||||||
bot: Bot,
|
bot: Bot,
|
||||||
event: Event,
|
event: Event,
|
||||||
message: UniMsg,
|
message: UniMsg,
|
||||||
session: EventSession,
|
session: Uninfo,
|
||||||
arparma: Arparma,
|
arparma: Arparma,
|
||||||
name: Match[str],
|
name: Match[str],
|
||||||
num: Query[int] = AlconnaQuery("num", 1),
|
num: Query[int] = AlconnaQuery("num", 1),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user