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
5a6f4c19f0
commit
f2b091e1fd
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)
|
||||
else:
|
||||
plugin.id = module2id[plugin.module_path]
|
||||
# 确保menu_type字段包含在更新列表中
|
||||
# 确保只更新应该来自插件元数据的字段
|
||||
await plugin.save(
|
||||
update_fields=[
|
||||
"name",
|
||||
"author",
|
||||
"version",
|
||||
"admin_level",
|
||||
"plugin_type",
|
||||
"admin_level",
|
||||
"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)
|
||||
if updated_plugin.menu_type != plugin.menu_type:
|
||||
logger.warning(f"插件 {plugin.name} 的menu_type更新失败: 期望值 '{plugin.menu_type}', 实际值 '{updated_plugin.menu_type}'")
|
||||
# 尝试单独更新menu_type
|
||||
updated_plugin.menu_type = plugin.menu_type
|
||||
await updated_plugin.save(update_fields=["menu_type"])
|
||||
# # 验证更新是否成功
|
||||
# updated_plugin = await PluginInfo.get(id=plugin.id)
|
||||
# if updated_plugin.menu_type != plugin.menu_type:
|
||||
# logger.warning(f"插件 {plugin.name} 的menu_type更新失败: 期望值 '{plugin.menu_type}', 实际值 '{updated_plugin.menu_type}'")
|
||||
# # 尝试单独更新menu_type
|
||||
# updated_plugin.menu_type = plugin.menu_type
|
||||
# await updated_plugin.save(update_fields=["menu_type"])
|
||||
|
||||
update_list.append(plugin)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user