From 4747f7dc4b27f660c8d8db5f8390c952ba5dee47 Mon Sep 17 00:00:00 2001 From: thedmdim Date: Thu, 16 May 2024 12:23:08 +0400 Subject: [PATCH] small changes --- cmd/tele/main.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/tele/main.go b/cmd/tele/main.go index 6a55c11..1a3c441 100644 --- a/cmd/tele/main.go +++ b/cmd/tele/main.go @@ -30,18 +30,23 @@ func main() { log.Fatal("no dsn provided") } - db, err := sqlitex.NewPool(dsn, sqlitex.PoolOptions{PoolSize: 100}) + db, err := sqlitex.NewPool(dsn, sqlitex.PoolOptions{PoolSize: 50}) if err != nil { log.Fatal("cannot open db", err) } api := echotron.NewAPI(token) + res, err := api.GetMe() + if err != nil { + log.Fatal("cannot get my username", err) + } + me := res.Result.Username + for u := range echotron.PollingUpdates(token) { visitor := strconv.FormatInt(u.ChatID(), 10) - - if u.Message != nil && u.Message.Text == "/start" { + if u.Message != nil && (u.Message.Text == "/start" || u.Message.Text == "/start@"+me ) { sc := &handlers.SearchCriteria{ YearsFrom: strconv.Itoa(DefaultYear),