This commit is contained in:
cdle
2021-09-17 07:10:14 +08:00
parent d7be38dcf4
commit 57611764ae
4 changed files with 19 additions and 14 deletions
-12
View File
@@ -21,18 +21,6 @@ var ExecPath, _ = filepath.Abs(filepath.Dir(os.Args[0]))
var Config Yaml
func init() {
killp()
for _, arg := range os.Args {
if arg == "-d" {
Daemon()
}
}
ReadYaml(ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
InitReplies()
initToHandleMessage()
}
func ReadYaml(confDir string, conf interface{}, url string) {
path := confDir + "config.yaml"
if _, err := os.Stat(confDir); err != nil {
+17
View File
@@ -0,0 +1,17 @@
package core
import "os"
func init() {
initStore()
killp()
for _, arg := range os.Args {
if arg == "-d" {
Daemon()
}
}
ReadYaml(ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
InitReplies()
initToHandleMessage()
initSys()
}
+1 -1
View File
@@ -20,7 +20,7 @@ func NewBucket(name string) Bucket {
return b
}
func init() {
func initStore() {
var err error
db, err = bolt.Open(ExecPath+"/sillyGirl.cache", 0600, nil)
if err != nil {
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/cdle/sillyGirl/im"
)
func init() {
func initSys() {
AddCommand("", []Function{
{
Rules: []string{"raw ^name$"},