diff --git a/get_updates_channel.go b/get_updates_channel.go index 76f51ab..98346b2 100644 --- a/get_updates_channel.go +++ b/get_updates_channel.go @@ -42,9 +42,7 @@ func getUpdatesChannel() tg.UpdatesChannel { ) log.Ln("Creating new webhook...") - webhook := tg.NewWebhook( - fmt.Sprint(set, listen, bot.AccessToken), nil, - ) + webhook := tg.NewWebhook(fmt.Sprint(set, listen, bot.AccessToken), nil) webhook.MaxConnections = 40 webhook.AllowedUpdates = allowedUpdates diff --git a/main.go b/main.go index ec258d1..55bb60a 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,10 @@ func main() { var err error go dbInit() + defer func() { + err = db.Close() + errCheck(err) + }() log.Ln("Initializing new bot via checking access_token...") bot, err = tg.NewBot(cfg.UString("telegram.token")) @@ -35,7 +39,4 @@ func main() { log.D(update) } } - - err = db.Close() - errCheck(err) }