mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 新增 inverted_index.json 和 record.json 文件,并更新 init_plugin.py 中的字段更新逻辑,移除 menu_type 字段的更新,确保只更新必要的插件元数据字段。
This commit is contained in:
parent
4e85a7a434
commit
04b9df04c9
1
inverted_index.json
Normal file
1
inverted_index.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
record.json
Normal file
1
record.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@ -139,26 +139,28 @@ async def _():
|
|||||||
create_list.append(plugin)
|
create_list.append(plugin)
|
||||||
else:
|
else:
|
||||||
plugin.id = module2id[plugin.module_path]
|
plugin.id = module2id[plugin.module_path]
|
||||||
# 确保menu_type字段包含在更新列表中
|
# 确保只更新应该来自插件元数据的字段
|
||||||
await plugin.save(
|
await plugin.save(
|
||||||
update_fields=[
|
update_fields=[
|
||||||
"name",
|
"name",
|
||||||
"author",
|
"author",
|
||||||
"version",
|
"version",
|
||||||
"admin_level",
|
|
||||||
"plugin_type",
|
"plugin_type",
|
||||||
|
"admin_level",
|
||||||
"is_show",
|
"is_show",
|
||||||
"menu_type", # 添加menu_type到更新列表
|
"ignore_prompt",
|
||||||
|
# 移除了 menu_type
|
||||||
|
# 确保 level, default_status, limit_superuser, cost_gold, impression, status, block_type 等用户配置不在此列表
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
# 验证更新是否成功
|
# # 验证更新是否成功
|
||||||
updated_plugin = await PluginInfo.get(id=plugin.id)
|
# updated_plugin = await PluginInfo.get(id=plugin.id)
|
||||||
if updated_plugin.menu_type != plugin.menu_type:
|
# if updated_plugin.menu_type != plugin.menu_type:
|
||||||
logger.warning(f"插件 {plugin.name} 的menu_type更新失败: 期望值 '{plugin.menu_type}', 实际值 '{updated_plugin.menu_type}'")
|
# logger.warning(f"插件 {plugin.name} 的menu_type更新失败: 期望值 '{plugin.menu_type}', 实际值 '{updated_plugin.menu_type}'")
|
||||||
# 尝试单独更新menu_type
|
# # 尝试单独更新menu_type
|
||||||
updated_plugin.menu_type = plugin.menu_type
|
# updated_plugin.menu_type = plugin.menu_type
|
||||||
await updated_plugin.save(update_fields=["menu_type"])
|
# await updated_plugin.save(update_fields=["menu_type"])
|
||||||
|
|
||||||
update_list.append(plugin)
|
update_list.append(plugin)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user