更新配置参数化

This commit is contained in:
liuwei
2025-06-04 10:30:06 +08:00
parent 84f2a11a5e
commit e200c5e7d7
2 changed files with 4 additions and 2 deletions

View File

@@ -3,4 +3,5 @@ enable = true
commands = ["更新系统", "系统更新", "重启系统", "更新重启"]
wait_time = 5
# 设置管理员微信ID只有这些ID可以执行更新操作
admin_wxids = ["Jyunere"] # 在此添加管理员微信ID例如 ["wxid_123456", "wxid_abcdef"]
admin_wxids = ["Jyunere"] # 在此添加管理员微信ID例如 ["wxid_123456", "wxid_abcdef"]
shell_path= "/home/liuwei/abot/restart.sh"

View File

@@ -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