From e200c5e7d72a01b8d5544d0829bea5b25a3a995c Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 4 Jun 2025 10:30:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/system_updater/config.toml | 3 ++- plugins/system_updater/main.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/system_updater/config.toml b/plugins/system_updater/config.toml index 656b185..85262bc 100644 --- a/plugins/system_updater/config.toml +++ b/plugins/system_updater/config.toml @@ -3,4 +3,5 @@ enable = true commands = ["更新系统", "系统更新", "重启系统", "更新重启"] wait_time = 5 # 设置管理员微信ID,只有这些ID可以执行更新操作 -admin_wxids = ["Jyunere"] # 在此添加管理员微信ID,例如 ["wxid_123456", "wxid_abcdef"] \ No newline at end of file +admin_wxids = ["Jyunere"] # 在此添加管理员微信ID,例如 ["wxid_123456", "wxid_abcdef"] +shell_path= "/home/liuwei/abot/restart.sh" \ No newline at end of file diff --git a/plugins/system_updater/main.py b/plugins/system_updater/main.py index 9b183d9..f8dd9ed 100644 --- a/plugins/system_updater/main.py +++ b/plugins/system_updater/main.py @@ -53,6 +53,7 @@ class SystemUpdaterPlugin(MessagePluginInterface): # 从配置中获取命令和其他设置 plugin_config = self._config.get("SystemUpdater", {}) self._commands = plugin_config.get("commands", ["更新系统", "系统更新"]) + self._shell_path = plugin_config.get("shell_path", "") self.wait_time = plugin_config.get("wait_time", 5) self.admin_wxids = plugin_config.get("admin_wxids", []) self.enable = plugin_config.get("enable", True) @@ -133,7 +134,7 @@ class SystemUpdaterPlugin(MessagePluginInterface): try: # 使用相对路径调用 restart.sh 脚本 result = subprocess.run( - ["/home/liuwei/abot/restart.sh"], # 使用绝对路径 + [self._shell_path], # 使用绝对路径 check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE