Skip to content
Snippets Groups Projects
Commit e78e24b3 authored by Reviath's avatar Reviath
Browse files

Fixed GetPrefix function at multiplexer.

parent f86d8bcb
Branches
Tags
No related merge requests found
Pipeline #685 passed
package multiplexer
import (
"encoding/json"
"fmt"
"io/ioutil"
)
var (
BotPrefix string // BotPrefix is bot's prefix to cut prefix's length
config *configStruct // config structure
......@@ -15,23 +9,7 @@ type configStruct struct {
BotPrefix string `json:"BotPrefix"`
}
// GetPrefix returns to Bot's prefix from config.json file
// GetPrefix returns to Bot's prefix from config package
func GetPrefix() string {
file, err := ioutil.ReadFile("./config.json")
if err != nil {
fmt.Println(err.Error())
return "err"
}
err = json.Unmarshal(file, &config)
if err != nil {
fmt.Println(err.Error())
return "err"
}
BotPrefix = config.BotPrefix
return BotPrefix
return config.BotPrefix
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment