1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 17:42:48 +00:00
This commit is contained in:
2017-01-13 23:32:18 +01:00
commit 449396b94c
6 changed files with 152 additions and 0 deletions

37
config/config.go Normal file
View File

@@ -0,0 +1,37 @@
package config
import (
"encoding/json"
"io/ioutil"
"log"
"os"
)
// Variables used for command line parameters
var Config configStruct
type configStruct struct {
Token string `json:"Token"`
AlertRoomID string `json:"AlertRoomID"`
}
func Configure() {
log.Println("Reading config file...")
file, e := ioutil.ReadFile("./config.json")
if e != nil {
log.Printf("File error: %v\n", e)
os.Exit(1)
}
log.Printf("%s\n", string(file))
err := json.Unmarshal(file, &Config)
if err != nil {
log.Println(err)
}
}