group_helper/main.go
2020-04-11 23:35:40 +02:00

49 lines
1.1 KiB
Go

package main
import (
"git.dragon-labs.de/alphyron/group_helper/config"
"git.dragon-labs.de/alphyron/group_helper/logic"
"git.dragon-labs.de/alphyron/group_helper/repository"
"log"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)
func main() {
dbConfig := config.DatabaseConfig{}
err := dbConfig.LoadConfig()
if err != nil {
log.Println("Problem while loading database environment variables")
log.Fatal(err)
}
tgConfig := config.TelegramConfig{}
err = tgConfig.LoadConfig()
if err != nil {
log.Println("Problem while loading telegram environment variables")
log.Fatal(err)
}
bot, err := tgbotapi.NewBotAPI(tgConfig.TelegramKey)
if err != nil {
log.Println("Problem while authenticate at telegram")
log.Fatal(err)
}
bot.Debug = tgConfig.TelegramDebug
log.Printf("Authorized on account %s", bot.Self.UserName)
groupHelperRepo, err := repository.NewUserHelperRepository()
if err != nil {
log.Println("Problem while connection to the Database")
log.Fatal(err)
}
/* groupHelperService := */
logic.NewGroupHelperService(groupHelperRepo)
}