diff --git a/app/bot.php b/app/bot.php index d57609e..41759a3 100644 --- a/app/bot.php +++ b/app/bot.php @@ -139,6 +139,9 @@ class Bot case preg_match('~^/mirror$~', $this->input['message'], $m): $this->menu('mirror'); break; + case preg_match('~^/autoupdate$~', $this->input['message'], $m): + $this->autoupdate(); + break; case preg_match('~^/appOutbound$~', $this->input['callback'], $m): $this->appOutbound(); break; @@ -1090,6 +1093,10 @@ class Bot ] ]); } + if ($this->getPacConf()['autoupdate']) { + $this->input['chat'] = $this->input['from'] = $c['admin'][0]; + $this->applyupdatebot(); + } } } } @@ -5882,6 +5889,14 @@ DNS-over-HTTPS with IP: return true; } + public function autoupdate() + { + $p = $this->getPacConf(); + $p['autoupdate'] = !$p['autoupdate']; + $this->setPacConf($p); + $this->send($this->input['from'], $this->i18n('autoupdate') . ' ' . $this->i18n($p['autoupdate'] ? 'on' : 'off')); + } + public function disconnect(...$args) { $this->send($this->input['chat'], "disconnect: \n" . var_export($args, true) . "\n", $this->input['message_id']);