zhenxun_bot/basic_plugins/shop/my_props.py

42 lines
1.2 KiB
Python
Raw Normal View History

2022-01-05 22:32:59 +08:00
from nonebot import on_command
from services.log import logger
2022-02-19 18:20:19 +08:00
from nonebot.adapters.onebot.v11 import GroupMessageEvent
2022-01-05 22:32:59 +08:00
from models.bag_user import BagUser
2022-02-19 18:20:19 +08:00
from nonebot.adapters.onebot.v11.permission import GROUP
2022-01-05 22:32:59 +08:00
__zx_plugin_name__ = "商店 - 我的道具"
__plugin_usage__ = """
usage
我的道具
指令
我的道具
""".strip()
__plugin_des__ = "商店 - 我的道具"
__plugin_cmd__ = ["我的道具"]
__plugin_type__ = ('商店',)
__plugin_version__ = 0.1
__plugin_author__ = "HibiKier"
__plugin_settings__ = {
"level": 5,
"default_status": True,
"limit_superuser": False,
"cmd": ["商店", "我的道具"],
}
my_props = on_command("我的道具", priority=5, block=True, permission=GROUP)
@my_props.handle()
2022-02-19 18:20:19 +08:00
async def _(event: GroupMessageEvent):
2022-01-16 14:52:50 +08:00
props = await BagUser.get_property(event.user_id, event.group_id)
2022-01-05 22:32:59 +08:00
if props:
rst = ""
2022-01-16 14:52:50 +08:00
for i, p in enumerate(props.keys()):
rst += f"{i+1}.{p}\t×{props[p]}\n"
2022-01-05 22:32:59 +08:00
await my_props.send("\n" + rst[:-1], at_sender=True)
logger.info(f"USER {event.user_id} GROUP {event.group_id} 查看我的道具")
else:
await my_props.finish("您的背包里没有任何的道具噢~", at_sender=True)