-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.go
40 lines (30 loc) · 817 Bytes
/
bot.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"log"
"main/handlers"
"main/models"
"main/states"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
)
func main() {
models.Main()
userState := states.NewUserState()
bot, err := tgbotapi.NewBotAPI("7362762333:AAF0KMRRjtvea7KDeyzuiscbA-9_Z7i4IQo")
if err != nil {
log.Panic(err)
}
bot.Debug = true
log.Printf("Authorized on account %s", bot.Self.UserName)
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
updates := bot.GetUpdatesChan(u)
for update := range updates {
if update.Message != nil {
handlers.HandleMessage(bot, update.Message, userState)
}
if update.CallbackQuery != nil {
handlers.HandleCallbackQuery(bot, update.CallbackQuery)
// handlers.HandleButtonPress(bot, update.CallbackQuery)
}
}
}