mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-14 16:49:59 +08:00
refactor code
This commit is contained in:
@@ -6,7 +6,7 @@ from models.bag_user import BagUser
|
||||
from nonebot.adapters.cqhttp.permission import GROUP
|
||||
|
||||
|
||||
__plugin_name__ = '商店基础显示'
|
||||
__plugin_name__ = "商店基础显示"
|
||||
|
||||
|
||||
my_props = on_command("我的道具", priority=5, block=True, permission=GROUP)
|
||||
@@ -18,29 +18,18 @@ async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
|
||||
if props:
|
||||
pname_list = []
|
||||
pnum_list = []
|
||||
rst = ''
|
||||
props = props[:-1].split(',')
|
||||
rst = ""
|
||||
props = props[:-1].split(",")
|
||||
for p in props:
|
||||
if p != '':
|
||||
if p != "":
|
||||
if p in pname_list:
|
||||
pnum_list[pname_list.index(p)] += 1
|
||||
else:
|
||||
pname_list.append(p)
|
||||
pnum_list.append(1)
|
||||
for i in range(len(pname_list)):
|
||||
rst += f'{i+1}.{pname_list[i]}\t×{pnum_list[i]}\n'
|
||||
await my_props.send('\n' + rst[:-1], at_sender=True)
|
||||
logger.info(f'USER {event.user_id} GROUP {event.group_id} 查看我的道具')
|
||||
rst += f"{i+1}.{pname_list[i]}\t×{pnum_list[i]}\n"
|
||||
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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
await my_props.finish("您的背包里没有任何的道具噢~", at_sender=True)
|
||||
|
||||
Reference in New Issue
Block a user