From 5d7c201018161e067754540b4d06ee4206f5be3e Mon Sep 17 00:00:00 2001 From: snowy Date: Tue, 26 Mar 2024 22:36:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=92=E4=BB=B6=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E5=81=9C=E7=94=A8=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/plugins/liteyuki_npm/manager.py | 8 ++++---- liteyuki/utils/data.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/liteyuki/plugins/liteyuki_npm/manager.py b/liteyuki/plugins/liteyuki_npm/manager.py index ff2ceef..4e84a85 100644 --- a/liteyuki/plugins/liteyuki_npm/manager.py +++ b/liteyuki/plugins/liteyuki_npm/manager.py @@ -236,7 +236,7 @@ async def pre_handle(event: Event, matcher: Matcher): raise IgnoredException("Plugin disabled in session") -@Bot.on_calling_api -async def _(bot: Bot, api: str, data: dict[str, any]): - # TODO 插件启用/停用检查hook - nonebot.logger.info(f"Plugin Callapi: {api}: {data}") +# @Bot.on_calling_api +# async def _(bot: Bot, api: str, data: dict[str, any]): +# # TODO 插件启用/停用检查hook +# nonebot.logger.info(f"Plugin Callapi: {api}: {data}") diff --git a/liteyuki/utils/data.py b/liteyuki/utils/data.py index dbd520c..c22361d 100644 --- a/liteyuki/utils/data.py +++ b/liteyuki/utils/data.py @@ -238,9 +238,9 @@ class Database: # 检测缺失字段,由于SQLite是动态类型,所以不需要检测类型 for n_field, n_type in new_structure.items(): if n_field not in existing_structure.keys() and n_field.lower() not in ["id", "table_name"]: - print(n_type, self.DEFAULT_MAPPING.get(n_type, '')) + default_value = self.DEFAULT_MAPPING.get(n_type, "''") self.cursor.execute( - f"ALTER TABLE '{model.TABLE_NAME}' ADD COLUMN {n_field} {n_type} DEFAULT {self.DEFAULT_MAPPING.get(n_type, '')}" + f"ALTER TABLE '{model.TABLE_NAME}' ADD COLUMN {n_field} {n_type} DEFAULT {self.DEFAULT_MAPPING.get(n_type, default_value)}" ) # 检测多余字段进行删除