mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
fix: Windows上无法读取和应用命令权限配置的问题
This commit is contained in:
parent
00afda452f
commit
f079d7b9fa
|
@ -315,12 +315,16 @@ def register_all():
|
||||||
|
|
||||||
def apply_privileges():
|
def apply_privileges():
|
||||||
"""读取cmdpriv.json并应用指令权限"""
|
"""读取cmdpriv.json并应用指令权限"""
|
||||||
with open('cmdpriv.json', 'r') as f:
|
# 读取内容
|
||||||
data = json.load(f)
|
json_str = ""
|
||||||
for path, priv in data.items():
|
with open('cmdpriv.json', 'r', encoding="utf-8") as f:
|
||||||
if path == 'comment':
|
json_str = f.read()
|
||||||
continue
|
|
||||||
if __command_list__[path]['privilege'] != priv:
|
|
||||||
logging.debug('应用权限: {} -> {}(default: {})'.format(path, priv, __command_list__[path]['privilege']))
|
|
||||||
|
|
||||||
__command_list__[path]['privilege'] = priv
|
data = json.loads(json_str)
|
||||||
|
for path, priv in data.items():
|
||||||
|
if path == 'comment':
|
||||||
|
continue
|
||||||
|
if __command_list__[path]['privilege'] != priv:
|
||||||
|
logging.debug('应用权限: {} -> {}(default: {})'.format(path, priv, __command_list__[path]['privilege']))
|
||||||
|
|
||||||
|
__command_list__[path]['privilege'] = priv
|
||||||
|
|
Loading…
Reference in New Issue
Block a user