mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-07 20:45:49 +08:00
🎨 调整刷新逻辑 (#497)
This commit is contained in:
parent
e1c79fdcef
commit
5b936db344
@ -35,7 +35,7 @@ async def sned_fresh_all_list(bot: Bot, ev: Event):
|
|||||||
await bot.send('执行完成!')
|
await bot.send('执行完成!')
|
||||||
|
|
||||||
|
|
||||||
@sv_get_enka.on_fullmatch('刷新圣遗物仓库')
|
@sv_get_enka.on_fullmatch(('刷新圣遗物仓库', '强制刷新圣遗物仓库'))
|
||||||
async def sned_fresh_list(bot: Bot, ev: Event):
|
async def sned_fresh_list(bot: Bot, ev: Event):
|
||||||
# 获取uid
|
# 获取uid
|
||||||
uid = await get_uid(bot, ev)
|
uid = await get_uid(bot, ev)
|
||||||
@ -43,7 +43,11 @@ async def sned_fresh_list(bot: Bot, ev: Event):
|
|||||||
return await bot.send(UID_HINT)
|
return await bot.send(UID_HINT)
|
||||||
logger.info(f'[刷新圣遗物仓库]uid: {uid}')
|
logger.info(f'[刷新圣遗物仓库]uid: {uid}')
|
||||||
await bot.send(f'UID{uid}开始刷新, 请勿重复触发!')
|
await bot.send(f'UID{uid}开始刷新, 请勿重复触发!')
|
||||||
await bot.send(await refresh_player_list(uid))
|
if ev.command.startswith('强制'):
|
||||||
|
is_force = True
|
||||||
|
else:
|
||||||
|
is_force = False
|
||||||
|
await bot.send(await refresh_player_list(uid, is_force))
|
||||||
|
|
||||||
|
|
||||||
@sv_get_enka.on_fullmatch('圣遗物仓库')
|
@sv_get_enka.on_fullmatch('圣遗物仓库')
|
||||||
|
@ -12,7 +12,7 @@ from .to_data import ARTIFACT_DATA, input_artifacts_data
|
|||||||
pattern = r'^[\u4e00-\u9fa5]'
|
pattern = r'^[\u4e00-\u9fa5]'
|
||||||
|
|
||||||
|
|
||||||
async def refresh_player_list(uid: str) -> str:
|
async def refresh_player_list(uid: str, is_force: bool = False) -> str:
|
||||||
player = PLAYER_PATH / uid
|
player = PLAYER_PATH / uid
|
||||||
path = player / 'artifacts.json'
|
path = player / 'artifacts.json'
|
||||||
all_artifacts = deepcopy(ARTIFACT_DATA)
|
all_artifacts = deepcopy(ARTIFACT_DATA)
|
||||||
@ -26,7 +26,7 @@ async def refresh_player_list(uid: str) -> str:
|
|||||||
|
|
||||||
if len(all_list) >= 1 and 'cv_score' not in all_list[0]:
|
if len(all_list) >= 1 and 'cv_score' not in all_list[0]:
|
||||||
path.unlink()
|
path.unlink()
|
||||||
elif len(all_list) >= 1:
|
elif not is_force and len(all_list) >= 1:
|
||||||
return '无需刷新圣遗物列表'
|
return '无需刷新圣遗物列表'
|
||||||
# return '删除旧数据中...请重新刷新!'
|
# return '删除旧数据中...请重新刷新!'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user