update
This commit is contained in:
@@ -41,4 +41,5 @@ func init() {
|
||||
}
|
||||
initSys()
|
||||
Duration = time.Duration(sillyGirl.GetInt("duration", 5)) * time.Second
|
||||
sillyGirl.Set("started_at", time.Now().Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
@@ -22,9 +21,6 @@ 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 err != nil {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
@@ -55,6 +56,7 @@ func CompileCode() error {
|
||||
if err != nil {
|
||||
return errors.New("编译失败:" + err.Error() + "。")
|
||||
}
|
||||
sillyGirl.Set("compiled_at", time.Now().Format("2006-01-02 15:04:05"))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,18 @@ func initSys() {
|
||||
return fmt.Sprint(s.GetUserID())
|
||||
},
|
||||
},
|
||||
{
|
||||
Rules: []string{"raw ^compiled_at$"},
|
||||
Handle: func(s Sender) interface{} {
|
||||
return sillyGirl.Get("compiled_at")
|
||||
},
|
||||
},
|
||||
{
|
||||
Rules: []string{"raw ^started_at$"},
|
||||
Handle: func(s Sender) interface{} {
|
||||
return sillyGirl.Get("started_at")
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user