diff --git a/nonebot_plugin_arktools/src/utils/__init__.py b/nonebot_plugin_arktools/src/utils/__init__.py index f737719..eb5a7c5 100644 --- a/nonebot_plugin_arktools/src/utils/__init__.py +++ b/nonebot_plugin_arktools/src/utils/__init__.py @@ -37,7 +37,9 @@ async def _(args: Message = CommandArg()): if args.extract_plain_text().strip() == "-D": await ArknightsDB.drop_data() await update_game_resource.send("已彻底删除原表,开始重新写入数据库……") - await ArknightsDB.init_data(force=True) + await ArknightsDB.init_db() + else: + await ArknightsDB.init_data(force=True) await update_game_resource.finish("游戏数据库更新完成!") diff --git a/nonebot_plugin_arktools/src/utils/database.py b/nonebot_plugin_arktools/src/utils/database.py index 5d3b374..b426c21 100644 --- a/nonebot_plugin_arktools/src/utils/database.py +++ b/nonebot_plugin_arktools/src/utils/database.py @@ -78,7 +78,7 @@ async def init_data(force: bool = False): await ArknightsDB._init_skill(force) await ArknightsDB._init_skin(force) await ArknightsDB._init_stage(force) - except tortoise.exceptions.BaseORMException as e: + except (tortoise.exceptions.OperationalError, tortoise.exceptions.FieldError) as e: logger.error(f"数据库初始化出错: {e}") await ArknightsDB.drop_data() await ArknightsDB.init_db()