This commit is contained in:
xtaodada 2022-06-04 14:14:53 +08:00
parent ba5cbfcc68
commit b8a3fc487d
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 22 additions and 10 deletions

View File

@ -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"请使用 <code>/bind [uid]</code> 绑定游戏 uid", quote=True)
if not message.command[1].isdigit():

20
plugins/info.py Normal file
View File

@ -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"请使用 <code>/bind [uid]</code> 绑定游戏 uid", quote=True)