This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
PermissionGacha/modules/config/config.go

56 lines
1.3 KiB
Go

package config
import (
"encoding/json"
"io/ioutil"
)
type config struct {
ActiveNerf activeNerf `json:"activeNerf"`
CommandPrefix string `json:"prefix"`
GuildID string `json:"guildID"`
PrestigeRequirement int `json:"prestigeFactor"`
StarChannel string `json:"starChannel"`
BotToken string `json:"token"`
LevelRoles []string `json:"roles"`
}
type activeNerf struct {
GeneralChannelID string `json:"channelID"`
NotInGeneralNerf int `json:"nerfFactor"`
}
func init() {
configFile, err := ioutil.ReadFile("config.json")
if err != nil {
panic(err)
}
var output config
err = json.Unmarshal([]byte(configFile), &output)
if err != nil {
panic(err)
}
//Place everything into high level variables
GeneralChannelID = output.ActiveNerf.GeneralChannelID
NotInGeneralNerf = output.ActiveNerf.NotInGeneralNerf
CommandPrefix = output.CommandPrefix
GuildID = output.GuildID
PrestigeRequirement = output.PrestigeRequirement
StarChannel = output.StarChannel
BotToken = output.BotToken
LevelRoles = output.LevelRoles
}
//Exposed Variables
var (
GeneralChannelID string
NotInGeneralNerf int
)
var CommandPrefix string
var GuildID string
var PrestigeRequirement int
var StarChannel string
var BotToken string
var LevelRoles []string