Enka_Panel_Bot/defs/refresh.py
2023-01-14 21:59:43 +08:00

16 lines
435 B
Python

from defs.player import Player
from ci import sqlite
import time
async def refresh_player(uid: str, force=False) -> str:
data = Player(uid)
if not force and data.time + 60 * 5 > int(time.time()):
return "刷新过快,请稍等一会儿再试"
text = await data.update_char()
if not text:
return "数据刷新失败,请重试"
data.update_name()
sqlite[uid] = data.export()
return text