Enka_Panel_Bot/plugins/info.py

23 lines
911 B
Python
Raw Normal View History

2022-09-03 14:50:36 +00:00
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 not check_bind(message.from_user.id):
return await message.reply("请使用 <code>/bind [uid]</code> 绑定游戏 uid", quote=True)
uid = get_bind_uid(message.from_user.id)
if len(message.command) > 1 and message.command[1].isnumeric():
uid = message.command[1]
data = Player(uid)
2023-01-14 13:59:43 +00:00
return await message.reply(
f"游戏 uid 为 {uid} 的角色缓存有:\n\n{data.gen_all_char()}",
quote=True,
) if data.all_char else await message.reply(
"没有可展示的角色,可能是数据未刷新",
quote=True,
)