更新配置参数化
This commit is contained in:
@@ -4,3 +4,4 @@ commands = ["更新系统", "系统更新", "重启系统", "更新重启"]
|
|||||||
wait_time = 5
|
wait_time = 5
|
||||||
# 设置管理员微信ID,只有这些ID可以执行更新操作
|
# 设置管理员微信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"
|
||||||
@@ -53,6 +53,7 @@ class SystemUpdaterPlugin(MessagePluginInterface):
|
|||||||
# 从配置中获取命令和其他设置
|
# 从配置中获取命令和其他设置
|
||||||
plugin_config = self._config.get("SystemUpdater", {})
|
plugin_config = self._config.get("SystemUpdater", {})
|
||||||
self._commands = plugin_config.get("commands", ["更新系统", "系统更新"])
|
self._commands = plugin_config.get("commands", ["更新系统", "系统更新"])
|
||||||
|
self._shell_path = plugin_config.get("shell_path", "")
|
||||||
self.wait_time = plugin_config.get("wait_time", 5)
|
self.wait_time = plugin_config.get("wait_time", 5)
|
||||||
self.admin_wxids = plugin_config.get("admin_wxids", [])
|
self.admin_wxids = plugin_config.get("admin_wxids", [])
|
||||||
self.enable = plugin_config.get("enable", True)
|
self.enable = plugin_config.get("enable", True)
|
||||||
@@ -133,7 +134,7 @@ class SystemUpdaterPlugin(MessagePluginInterface):
|
|||||||
try:
|
try:
|
||||||
# 使用相对路径调用 restart.sh 脚本
|
# 使用相对路径调用 restart.sh 脚本
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["/home/liuwei/abot/restart.sh"], # 使用绝对路径
|
[self._shell_path], # 使用绝对路径
|
||||||
check=True,
|
check=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE
|
stderr=subprocess.PIPE
|
||||||
|
|||||||
Reference in New Issue
Block a user