mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-28 16:24:51 +08:00
feat: 插件启用停用检测
This commit is contained in:
parent
ac234544a3
commit
5d7c201018
@ -236,7 +236,7 @@ async def pre_handle(event: Event, matcher: Matcher):
|
|||||||
raise IgnoredException("Plugin disabled in session")
|
raise IgnoredException("Plugin disabled in session")
|
||||||
|
|
||||||
|
|
||||||
@Bot.on_calling_api
|
# @Bot.on_calling_api
|
||||||
async def _(bot: Bot, api: str, data: dict[str, any]):
|
# async def _(bot: Bot, api: str, data: dict[str, any]):
|
||||||
# TODO 插件启用/停用检查hook
|
# # TODO 插件启用/停用检查hook
|
||||||
nonebot.logger.info(f"Plugin Callapi: {api}: {data}")
|
# nonebot.logger.info(f"Plugin Callapi: {api}: {data}")
|
||||||
|
@ -238,9 +238,9 @@ class Database:
|
|||||||
# 检测缺失字段,由于SQLite是动态类型,所以不需要检测类型
|
# 检测缺失字段,由于SQLite是动态类型,所以不需要检测类型
|
||||||
for n_field, n_type in new_structure.items():
|
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"]:
|
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(
|
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)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# 检测多余字段进行删除
|
# 检测多余字段进行删除
|
||||||
|
Loading…
Reference in New Issue
Block a user