update
This commit is contained in:
+5
-1
@@ -5,6 +5,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
@@ -14,6 +15,9 @@ import (
|
||||
var c *cron.Cron
|
||||
|
||||
func init() {
|
||||
if runtime.GOOS != "windows" {
|
||||
pname = regexp.MustCompile(`/([^/\s]+)$`).FindStringSubmatch(os.Args[0])[1]
|
||||
}
|
||||
c = cron.New()
|
||||
c.Start()
|
||||
}
|
||||
@@ -26,7 +30,7 @@ type Function struct {
|
||||
Cron string
|
||||
}
|
||||
|
||||
var pname = regexp.MustCompile(`/([^/\s]+)$`).FindStringSubmatch(os.Args[0])[1]
|
||||
var pname = ""
|
||||
|
||||
var name = func() string {
|
||||
return sillyGirl.Get("name", "傻妞")
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
initStore()
|
||||
ReadYaml(ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
|
||||
ReadYaml("conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
|
||||
InitReplies()
|
||||
initToHandleMessage()
|
||||
file, err := os.Open("/etc/sillyGirl/sets.conf")
|
||||
|
||||
+4
-3
@@ -27,9 +27,10 @@ func init() {
|
||||
var OttoFuncs = map[string]func(string) string{}
|
||||
|
||||
func init123() {
|
||||
files, err := ioutil.ReadDir(ExecPath + "/develop/replies")
|
||||
files, err := ioutil.ReadDir("develop/replies")
|
||||
if err != nil {
|
||||
logs.Warn("打开文件夹%s错误,%v", ExecPath+"/develop/replies", err)
|
||||
os.MkdirAll("develop/replies", os.ModePerm)
|
||||
// logs.Warn("打开文件夹%s错误,%v", "develop/replies", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -114,7 +115,7 @@ func init123() {
|
||||
if v.IsDir() {
|
||||
continue
|
||||
}
|
||||
jr := string(ExecPath + "/develop/replies/" + v.Name())
|
||||
jr := string("develop/replies/" + v.Name())
|
||||
data := ""
|
||||
if strings.Contains(jr, "http") {
|
||||
data, err = httplib.Get(jr).String()
|
||||
|
||||
+6
-4
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
@@ -23,11 +24,12 @@ func NewBucket(name string) Bucket {
|
||||
}
|
||||
|
||||
func initStore() {
|
||||
// if _, err := os.Stat(ExecPath + "/sillyGirl.cache"); err == nil {
|
||||
// os.Rename(ExecPath+"/sillyGirl.cache", "/etc/sillyGirl/sillyGirl.cache")
|
||||
// }
|
||||
var err error
|
||||
db, err = bolt.Open("/etc/sillyGirl/sillyGirl.cache", 0600, nil)
|
||||
if runtime.GOOS != "windows" {
|
||||
db, err = bolt.Open("/etc/sillyGirl/sillyGirl.cache", 0600, nil)
|
||||
} else {
|
||||
db, err = bolt.Open(`C:\ProgramData\sillyGirl.cache`, 0600, nil)
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -58,6 +59,9 @@ func initSys() {
|
||||
Cron: "*/1 * * * *",
|
||||
Admin: true,
|
||||
Handle: func(s Sender) interface{} {
|
||||
if runtime.GOOS == "windows" {
|
||||
return "windows系统不支持此命令"
|
||||
}
|
||||
if s.GetImType() == "fake" && !sillyGirl.GetBool("auto_update", true) {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user