mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
chore: 将工作流脚本移动到res/scripts
This commit is contained in:
17
res/scripts/generate_cmdpriv_template.py
Normal file
17
res/scripts/generate_cmdpriv_template.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import pkg.qqbot.cmds.mgr as cmdsmgr
|
||||
import json
|
||||
|
||||
# 执行命令模块的注册
|
||||
cmdsmgr.register_all()
|
||||
|
||||
# 生成限权文件模板
|
||||
template: dict[str, int] = {
|
||||
"comment": "以下为命令权限,请设置到cmdpriv.json中。关于此功能的说明,请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E5%91%BD%E4%BB%A4%E6%9D%83%E9%99%90%E6%8E%A7%E5%88%B6",
|
||||
}
|
||||
|
||||
for key in cmdsmgr.__command_list__:
|
||||
template[key] = cmdsmgr.__command_list__[key]['privilege']
|
||||
|
||||
# 写入cmdpriv-template.json
|
||||
with open('../../cmdpriv-template.json', 'w') as f:
|
||||
f.write(json.dumps(template, indent=4, ensure_ascii=False))
|
||||
23
res/scripts/generate_override_all.py
Normal file
23
res/scripts/generate_override_all.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# 使用config-template生成override.json的字段全集模板文件override-all.json
|
||||
# 关于override.json机制,请参考:https://github.com/RockChinQ/QChatGPT/pull/271
|
||||
import json
|
||||
import importlib
|
||||
|
||||
|
||||
template = importlib.import_module("config-template")
|
||||
output_json = {
|
||||
"comment": "这是override.json支持的字段全集, 关于override.json机制, 请查看https://github.com/RockChinQ/QChatGPT/pull/271"
|
||||
}
|
||||
|
||||
|
||||
for k, v in template.__dict__.items():
|
||||
if k.startswith("__"):
|
||||
continue
|
||||
# 如果是module
|
||||
if type(v) == type(template):
|
||||
continue
|
||||
print(k, v, type(v))
|
||||
output_json[k] = v
|
||||
|
||||
with open("../../override-all.json", "w", encoding="utf-8") as f:
|
||||
json.dump(output_json, f, indent=4, ensure_ascii=False)
|
||||
Reference in New Issue
Block a user