Skip to content

Commit

Permalink
score
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiang-Red committed Apr 5, 2023
1 parent 1db965e commit 7a46143
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions plugin/score/sign_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,19 @@ var (
func init() {
cachePath := engine.DataFolder() + "cache/"
go func() {
_ = os.Mkdir(cachePath, 0777)
ok := file.IsExist(cachePath)
if !ok {
err := os.MkdirAll(cachePath, 0777)
if err != nil {
panic(err)
}
return
}
files, err := os.ReadDir(cachePath)
if err == nil {
for _, f := range files {
if !strings.Contains(f.Name(), time.Now().Format("20060102")) {
os.Remove(cachePath + f.Name())
_ = os.Remove(cachePath + f.Name())
}
}
}
Expand Down Expand Up @@ -276,7 +283,6 @@ func init() {
engine.OnRegex(`^设置(默认)?签到预设\s?(\d*)$`, zero.SuperUserPermission).Limit(ctxext.LimitByUser).SetBlock(true).Handle(func(ctx *zero.Ctx) {
if key := ctx.State["regex_matched"].([]string)[2]; key == "" {
ctx.SendChain(message.Text("设置失败, 数据为空"))
return
} else {
s := ctx.State["regex_matched"].([]string)[1]
_, ok := stylemap[key]
Expand Down

0 comments on commit 7a46143

Please sign in to comment.