50 lines
1.1 KiB
Go
50 lines
1.1 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"`
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
//Exposed Variables
|
||
|
var (
|
||
|
GeneralChannelID string
|
||
|
NotInGeneralNerf int
|
||
|
)
|
||
|
var CommandPrefix string
|
||
|
var GuildID string
|
||
|
var PrestigeRequirement int
|
||
|
var StarChannel string
|