From 1f7afaba0767bc7f1e21da3b03e8446f587f1733 Mon Sep 17 00:00:00 2001 From: Saboteur7 Date: Mon, 8 Jul 2024 18:57:27 +0800 Subject: [PATCH] fix: client cmd config bug --- common/linkai_client.py | 7 +++++-- plugins/plugin.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/linkai_client.py b/common/linkai_client.py index 3329f74..0a922f3 100644 --- a/common/linkai_client.py +++ b/common/linkai_client.py @@ -45,8 +45,11 @@ class ChatClient(LinkAIClient): elif reply_voice_mode == "always_reply_voice": local_config["always_reply_voice"] = True - if config.get("admin_password") and plugin_config.get("Godcmd"): - plugin_config["Godcmd"]["password"] = config.get("admin_password") + if config.get("admin_password"): + if not plugin_config.get("Godcmd"): + plugin_config["Godcmd"] = {"password": config.get("admin_password"), "admin_users": []} + else: + plugin_config["Godcmd"]["password"] = config.get("admin_password") PluginManager().instances["GODCMD"].reload() if config.get("group_app_map") and pconf("linkai"): diff --git a/plugins/plugin.py b/plugins/plugin.py index f4c9618..028e221 100644 --- a/plugins/plugin.py +++ b/plugins/plugin.py @@ -18,6 +18,7 @@ class Plugin: if not plugin_conf: # 全局配置不存在,则获取插件目录下的配置 plugin_config_path = os.path.join(self.path, "config.json") + logger.debug(f"loading plugin config, plugin_config_path={plugin_config_path}, exist={os.path.exists(plugin_config_path)}") if os.path.exists(plugin_config_path): with open(plugin_config_path, "r", encoding="utf-8") as f: plugin_conf = json.load(f)