From b8a3fc487d0827f078f4c665bec398fbce3d2e3d Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 4 Jun 2022 14:14:53 +0800 Subject: [PATCH] fix --- plugins/bind.py | 12 ++---------- plugins/info.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 plugins/info.py diff --git a/plugins/bind.py b/plugins/bind.py index e0548f4..bfc05d1 100644 --- a/plugins/bind.py +++ b/plugins/bind.py @@ -1,7 +1,6 @@ from pyrogram import filters, Client from pyrogram.types import Message -from defs.bind import check_bind, get_bind_uid, set_bind, remove_bind -from defs.player import Player +from defs.bind import check_bind, set_bind, remove_bind from ci import app, me @@ -9,14 +8,7 @@ from ci import app, me async def bind_command(_: Client, message: Message): if len(message.command) == 1: if check_bind(message.from_user.id): - uid = get_bind_uid(message.from_user.id) - if len(message.command) == 1: - if message.command[1].isnumeric(): - uid = message.command[1] - data = Player(uid) - data.restore() - return await message.reply(f"游戏 uid 为 {uid} 的角色缓存有:\n\n" - f"{data.gen_all_char()}", quote=True) + return await message.reply(f"使用 `/info [uid(可选)]` 查询角色缓存状态", quote=True) else: return await message.reply(f"请使用 /bind [uid] 绑定游戏 uid", quote=True) if not message.command[1].isdigit(): diff --git a/plugins/info.py b/plugins/info.py new file mode 100644 index 0000000..233c4dd --- /dev/null +++ b/plugins/info.py @@ -0,0 +1,20 @@ +from pyrogram import filters, Client +from pyrogram.types import Message +from defs.bind import check_bind, get_bind_uid +from defs.player import Player +from ci import app, me + + +@app.on_message(filters.command(["info", f"info@{me['result']['username']}"]) & filters.private) +async def info_command(_: Client, message: Message): + if check_bind(message.from_user.id): + uid = get_bind_uid(message.from_user.id) + if len(message.command) == 1: + if message.command[1].isnumeric(): + uid = message.command[1] + data = Player(uid) + data.restore() + return await message.reply(f"游戏 uid 为 {uid} 的角色缓存有:\n\n" + f"{data.gen_all_char()}", quote=True) + else: + return await message.reply(f"请使用 /bind [uid] 绑定游戏 uid", quote=True)