-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (31 loc) · 884 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
40
package main
import (
"github.com/JamesTiberiusKirk/ShoppingListsBot/config"
"github.com/JamesTiberiusKirk/ShoppingListsBot/db"
"github.com/JamesTiberiusKirk/ShoppingListsBot/handlers"
"github.com/JamesTiberiusKirk/tgf"
)
var version = "development"
func GetVersion() string {
return version
}
func main() {
c := config.GetConfig()
dbc, err := db.NewDBClient(c.DbUrl)
if err != nil {
panic(err)
}
js := db.NewDBJourneyStore(dbc)
// The debug for the tgapi lib is was too verbose so for now just setting debug to false
botAPI, err := tgf.InitBotAPI(c.TelegramToken, c.TelegramWebHookURL, false)
if err != nil {
panic(err)
}
commands := handlers.GetHandlerCommandList()
journeys := handlers.NewHandlerJounreyMap(botAPI, dbc, GetVersion)
bot := tgf.NewBot(botAPI, commands, journeys, nil, js)
err = bot.StartBot(c.Debug)
if err != nil {
panic(err)
}
}