Select correct lang in request, use timeout for request, fix sighandler panic

This commit is contained in:
eleksir
2026-05-03 16:41:32 +03:00
parent 7d3c083cea
commit 11ea7b8398
5 changed files with 19 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ package holy
import (
"encoding/json"
"errors"
"fmt"
"os"
"tg-holy-bot/internal/log"
@@ -103,6 +104,13 @@ func ReadConfig() error {
return errors.New("Amount of user_agent strings in config must be exactly 31! Refusing to start") //nolint: staticcheck // Looks like golangci-lint ignoring settings about fucking ST1005 check. We want readable errors despite what wants author of linter or assholes from go dev team.
}
// Validate that all user agent strings are non-empty
for i, userAgent := range sampleConfig.UserAgents {
if userAgent == "" {
return fmt.Errorf("User agent string at index %d is empty! Refusing to start", i) //nolint: staticcheck // Looks like golangci-lint ignoring settings about fucking ST1005 check. We want readable errors despite what wants author of linter or assholes from go dev team.
}
}
log.Infof("Using %s as config file", location)
Config = sampleConfig