2020-04-11 18:39:54 +00:00
|
|
|
package main
|
|
|
|
|
2020-04-11 20:27:56 +00:00
|
|
|
import (
|
|
|
|
"git.dragon-labs.de/alphyron/group_helper/config"
|
2020-04-11 21:35:40 +00:00
|
|
|
"git.dragon-labs.de/alphyron/group_helper/logic"
|
|
|
|
"git.dragon-labs.de/alphyron/group_helper/repository"
|
2020-04-11 20:27:56 +00:00
|
|
|
"log"
|
2020-04-11 21:27:24 +00:00
|
|
|
|
|
|
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
|
2020-04-11 20:27:56 +00:00
|
|
|
)
|
2020-04-11 18:39:54 +00:00
|
|
|
|
|
|
|
func main() {
|
2020-04-11 21:27:24 +00:00
|
|
|
dbConfig := config.DatabaseConfig{}
|
|
|
|
err := dbConfig.LoadConfig()
|
2020-04-11 20:27:56 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Println("Problem while loading database environment variables")
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2020-04-11 21:01:14 +00:00
|
|
|
|
2020-04-11 21:27:24 +00:00
|
|
|
tgConfig := config.TelegramConfig{}
|
|
|
|
err = tgConfig.LoadConfig()
|
2020-04-11 21:01:14 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Println("Problem while loading telegram environment variables")
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2020-04-11 21:27:24 +00:00
|
|
|
|
|
|
|
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)
|
2020-04-11 21:35:40 +00:00
|
|
|
|
|
|
|
groupHelperRepo, err := repository.NewUserHelperRepository()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Println("Problem while connection to the Database")
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
/* groupHelperService := */
|
|
|
|
logic.NewGroupHelperService(groupHelperRepo)
|
|
|
|
|
2020-04-11 18:39:54 +00:00
|
|
|
}
|