Enka_Genshin_bot/plugins/refresh.py

18 lines
783 B
Python
Raw Permalink Normal View History

2022-06-04 04:32:48 +00:00
from pyrogram import filters, Client
from pyrogram.types import Message
from defs.bind import check_bind, get_bind_uid
from ci import app, me
from defs.refresh import refresh_player
@app.on_message(filters.command(["refresh", f"refresh@{me['result']['username']}"]) & filters.private)
async def refresh_command(_: Client, message: Message):
if not check_bind(message.from_user.id):
2022-09-02 16:45:18 +00:00
return await message.reply("请使用 <code>/bind [uid]</code> 绑定游戏 uid", quote=True)
2022-06-04 04:32:48 +00:00
uid = get_bind_uid(message.from_user.id)
2022-09-02 16:45:18 +00:00
if len(message.command) > 1 and message.command[1].isnumeric():
uid = message.command[1]
msg = await message.reply("正在刷新数据,请稍等。。。", quote=True)
2022-06-04 04:32:48 +00:00
text = await refresh_player(uid)
await msg.edit(text)