20 lines
545 B
Python
20 lines
545 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)
|
|
data.restore()
|
|
if not force and data.time + 60 * 5 > int(time.time()):
|
|
return "刷新过快,请稍等一会儿再试"
|
|
text = await data.update_char()
|
|
if not text:
|
|
return "数据刷新失败,请重试"
|
|
try:
|
|
data.update_name()
|
|
except FileNotFoundError:
|
|
return "数据刷新失败,请重试"
|
|
sqlite[uid] = data.export()
|
|
return text
|