fix(tgbot): apply bot settings on panel restart without full service restart

The Telegram bot's config (enable flag, token, proxy, API server) was read
only during a full server.Start(). The in-process "Restart Panel" path
(StopPanelOnly/StartPanelOnly -> stop/start with the bot flag false) skipped
the bot entirely, so enabling the bot or changing its proxy did not take
effect until a full OS-level `systemctl restart x-ui`.

Cycle the Telegram bot in the panel-only restart path while still leaving
Xray and the traffic writer untouched (preserving the #4265 freeze fix), so
"Restart Panel" reconciles the bot with the latest settings.

Fixes #5033
This commit is contained in:
Sanaei
2026-06-08 22:37:37 +02:00
parent abf6b8799e
commit 3d6ff2b60c
+2 -4
View File
@@ -358,9 +358,8 @@ func (s *Server) Start() (err error) {
return s.start(true, true)
}
// StartPanelOnly initializes the panel during an in-process panel restart without cycling Xray.
func (s *Server) StartPanelOnly() (err error) {
return s.start(false, false)
return s.start(false, true)
}
func (s *Server) start(restartXray bool, startTgBot bool) (err error) {
@@ -465,9 +464,8 @@ func (s *Server) Stop() error {
return s.stop(true, true)
}
// StopPanelOnly stops only panel-owned HTTP/background resources for an in-process panel restart.
func (s *Server) StopPanelOnly() error {
return s.stop(false, false)
return s.stop(false, true)
}
func (s *Server) stop(stopXray bool, stopTgBot bool) error {