refactor + fix добавление проекта

This commit is contained in:
Artem Tsyrulnikov
2026-01-20 15:16:06 +03:00
parent 7f6527652b
commit 4e4f9810d9
10 changed files with 251 additions and 235 deletions

View File

@@ -17,12 +17,10 @@ func main() {
initLogger()
botToken := mustEnv("TELEGRAM__TOKEN")
loginURL := mustEnv("LOGIN_URL")
baseURL := os.Getenv("BACKEND__BASE_URL")
backendClient := backend.New(backend.Config{
BaseURL: baseURL,
LoginURL: loginURL,
BaseURL: mustEnv("BACKEND__BASE_URL"),
LoginURL: mustEnv("LOGIN_URL"),
})
var commandRouter = func(command string) bot.State {
@@ -55,8 +53,6 @@ func main() {
dsp := echotron.NewDispatcher(botToken, newBot)
log.Info().Msg("bot starting...")
updateOpts := echotron.UpdateOptions{
AllowedUpdates: []echotron.UpdateType{
echotron.MessageUpdate,
@@ -70,7 +66,8 @@ func main() {
echotron.SetChatRequestLimit(0, 0)
for {
if err := dsp.PollOptions(false, updateOpts); err != nil {
err := dsp.PollOptions(false, updateOpts)
if err != nil {
log.Error().Err(err).Msg("dsp.Poll failed, retrying in 5 seconds...")
time.Sleep(5 * time.Second)
continue