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