-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 758 Bytes
/
main.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
package main
import (
"log"
"github.com/getsentry/sentry-go"
"github.com/mymmrac/telego"
th "github.com/mymmrac/telego/telegohandler"
"github.com/ariel17/golang-telegram-group-manager/config"
"github.com/ariel17/golang-telegram-group-manager/handlers"
)
func main() {
defer sentry.Recover()
bot, err := telego.NewBot(config.GetTelegramApiToken(), telego.WithDefaultDebugLogger())
if err != nil {
panic(err)
}
me, err := bot.GetMe()
if err != nil {
panic(err)
}
log.Printf("Authorized on account %s", me.Username)
updates, err := bot.UpdatesViaLongPulling(nil)
if err != nil {
panic(err)
}
defer bot.StopLongPulling()
bh, err := th.NewBotHandler(bot, updates)
if err != nil {
panic(err)
}
handlers.ConfigureHandlers(bh)
}