From b22b624d28c6cdddbaa464ff736a8961c42f66f7 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Sun, 21 Jun 2026 14:50:01 +0200 Subject: [PATCH] fix(telegram): keep a failed promo-bot construction non-fatal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tgbot.New validates the token with getMe, so a bad or unreachable promo token would otherwise return an error from run() and crash-loop the whole bot process — taking the main game bot down with it, since they share the container. Log it and skip the promo bot instead; the main bot and bot-link are unaffected. --- platform/telegram/cmd/bot/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/telegram/cmd/bot/main.go b/platform/telegram/cmd/bot/main.go index bca70a9..17db610 100644 --- a/platform/telegram/cmd/bot/main.go +++ b/platform/telegram/cmd/bot/main.go @@ -103,6 +103,10 @@ func run(ctx context.Context, cfg config.BotConfig, logger *zap.Logger) error { // bot-link, no gateway — so onboarding works even when the game is down. var promo *promobot.Bot if cfg.PromoBotToken != "" { + // The promo bot is auxiliary and shares this process with the main bot, so its + // construction failure (a bad or unreachable promo token — tgbot.New validates it + // with getMe) is logged and the promo bot is skipped, never fatal: it must not + // take the main game bot down with it. promo, err = promobot.New(promobot.Config{ Token: cfg.PromoBotToken, APIBaseURL: cfg.APIBaseURL, @@ -112,7 +116,8 @@ func run(ctx context.Context, cfg config.BotConfig, logger *zap.Logger) error { SendRatePerSecond: cfg.SendRatePerSecond, }, logger) if err != nil { - return err + logger.Error("promo bot disabled: construction failed (the main bot is unaffected)", zap.Error(err)) + promo = nil } }