-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconfig.go
37 lines (34 loc) · 959 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package kokomi
import (
"encoding/json"
"fmt"
"github.com/sirupsen/logrus"
"os"
)
var (
Config config
url string
edition string
Postfix string
)
func init() {
cache, err := os.ReadFile("plugin/kokomi/config.json")
if err != nil {
logrus.Errorln("获取kokomi配置文件错误,请重新配置config.josn文件,若无法解决,请加群解决,678586912")
os.Exit(1)
}
err = json.Unmarshal(cache, &Config)
if err != nil {
logrus.Errorln("解析kokomi配置文件错误,请重新配置config.josn文件,若无法解决,请加群解决,678586912")
os.Exit(1)
}
fmt.Print(
"==========[ZeroBot-Plugin & ", Config.Edition, "]==================",
"\n\n插件配置加载完成,本插件完全免费,作者尽力维护",
"\n若出现问题请加群解决,678586912",
"\n\n============================================================\n\n",
)
url = Config.Apis[Config.Apiid]
edition = Config.Edition
Postfix = Config.Postfix
}