diff --git a/GenshinUID/genshinuid_enka/__init__.py b/GenshinUID/genshinuid_enka/__init__.py index a98e7f8d..f82080e0 100644 --- a/GenshinUID/genshinuid_enka/__init__.py +++ b/GenshinUID/genshinuid_enka/__init__.py @@ -35,7 +35,7 @@ async def sned_fresh_all_list(bot: Bot, ev: Event): await bot.send('执行完成!') -@sv_get_enka.on_fullmatch('刷新圣遗物仓库') +@sv_get_enka.on_fullmatch(('刷新圣遗物仓库', '强制刷新圣遗物仓库')) async def sned_fresh_list(bot: Bot, ev: Event): # 获取uid 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) logger.info(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('圣遗物仓库') diff --git a/GenshinUID/genshinuid_enka/start.py b/GenshinUID/genshinuid_enka/start.py index 8af02ef8..62f13f73 100644 --- a/GenshinUID/genshinuid_enka/start.py +++ b/GenshinUID/genshinuid_enka/start.py @@ -12,7 +12,7 @@ from .to_data import ARTIFACT_DATA, input_artifacts_data 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 path = player / 'artifacts.json' 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]: path.unlink() - elif len(all_list) >= 1: + elif not is_force and len(all_list) >= 1: return '无需刷新圣遗物列表' # return '删除旧数据中...请重新刷新!'