mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
feat: 添加指令权限配置文件
This commit is contained in:
28
cmdpriv-template.json
Normal file
28
cmdpriv-template.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"comment": "以下为命令权限,请设置到cmdpriv.json中: 1为所有用户可用,2为仅管理员可用。",
|
||||||
|
"draw": 1,
|
||||||
|
"plugin": 2,
|
||||||
|
"plugin.get": 2,
|
||||||
|
"plugin.update": 2,
|
||||||
|
"plugin.del": 2,
|
||||||
|
"plugin.off": 2,
|
||||||
|
"plugin.on": 2,
|
||||||
|
"default": 1,
|
||||||
|
"default.set": 2,
|
||||||
|
"del": 1,
|
||||||
|
"del.all": 1,
|
||||||
|
"delhst": 2,
|
||||||
|
"delhst.all": 2,
|
||||||
|
"last": 1,
|
||||||
|
"list": 1,
|
||||||
|
"next": 1,
|
||||||
|
"prompt": 1,
|
||||||
|
"resend": 1,
|
||||||
|
"reset": 1,
|
||||||
|
"cfg": 2,
|
||||||
|
"help": 1,
|
||||||
|
"reload": 2,
|
||||||
|
"update": 2,
|
||||||
|
"usage": 1,
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
17
generate_cmdpriv_template.py
Normal file
17
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中: 1为所有用户可用,2为仅管理员可用。",
|
||||||
|
}
|
||||||
|
|
||||||
|
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))
|
||||||
Reference in New Issue
Block a user