add Admin config variables

This commit is contained in:
lyx0 2022-03-07 16:45:16 +01:00
parent fab09d68ae
commit 61946d6402
2 changed files with 21 additions and 3 deletions

View file

@ -26,6 +26,10 @@ func main() {
nb.TwitchClient.Join("nourybot") nb.TwitchClient.Join("nourybot")
nb.TwitchClient.OnConnect(func() {
nb.TwitchClient.Say("nourybot", "xd")
})
err := nb.TwitchClient.Connect() err := nb.TwitchClient.Connect()
if err != nil { if err != nil {
panic(err) panic(err)

View file

@ -8,10 +8,17 @@ import (
) )
type Config struct { type Config struct {
// Bot
Username string Username string
Oauth string
BotUserId string BotUserId string
MongoURI string Oauth string
// Admin
AdminUsername string
AdminUserId string
// DB
MongoURI string
} }
func LoadConfig() *Config { func LoadConfig() *Config {
@ -22,10 +29,17 @@ func LoadConfig() *Config {
} }
cfg := &Config{ cfg := &Config{
// Bot
Username: os.Getenv("BOT_USERNAME"), Username: os.Getenv("BOT_USERNAME"),
Oauth: os.Getenv("BOT_PASS"), Oauth: os.Getenv("BOT_PASS"),
BotUserId: os.Getenv("BOT_USER_ID"), BotUserId: os.Getenv("BOT_USER_ID"),
MongoURI: os.Getenv("MONGO_URI"),
// Admin
AdminUsername: os.Getenv("ADMIN_USER_NAME"),
AdminUserId: os.Getenv("ADMIN_USER_ID"),
// DB
MongoURI: os.Getenv("MONGO_URI"),
} }
log.Info("Config loaded succesfully") log.Info("Config loaded succesfully")