update
This commit is contained in:
@@ -41,4 +41,5 @@ func init() {
|
|||||||
}
|
}
|
||||||
initSys()
|
initSys()
|
||||||
Duration = time.Duration(sillyGirl.GetInt("duration", 5)) * time.Second
|
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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
@@ -22,9 +21,6 @@ func NewBucket(name string) Bucket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initStore() {
|
func initStore() {
|
||||||
if _, err := os.Stat(ExecPath + "/sillyGirl.cache"); err == nil {
|
|
||||||
os.Rename(ExecPath+"/sillyGirl.cache", "/etc/sillyGirl/sillyGirl.cache")
|
|
||||||
}
|
|
||||||
var err error
|
var err error
|
||||||
db, err = bolt.Open("/etc/sillyGirl/sillyGirl.cache", 0600, nil)
|
db, err = bolt.Open("/etc/sillyGirl/sillyGirl.cache", 0600, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/astaxie/beego/logs"
|
"github.com/astaxie/beego/logs"
|
||||||
)
|
)
|
||||||
@@ -55,6 +56,7 @@ func CompileCode() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("编译失败:" + err.Error() + "。")
|
return errors.New("编译失败:" + err.Error() + "。")
|
||||||
}
|
}
|
||||||
|
sillyGirl.Set("compiled_at", time.Now().Format("2006-01-02 15:04:05"))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,18 @@ func initSys() {
|
|||||||
return fmt.Sprint(s.GetUserID())
|
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