36 lines
755 B
Go
36 lines
755 B
Go
package main
|
|
|
|
import (
|
|
"git.dragon-labs.de/alphyron/group_helper/config"
|
|
"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)
|
|
}
|