aifalse 增加 清理缓存

This commit is contained in:
fumiama
2021-09-27 21:51:05 +08:00
parent 4df30a56a3
commit 1d469a40d5
3 changed files with 13 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package aifalse
import (
"math"
"os"
"time"
"github.com/shirou/gopsutil/cpu"
@@ -30,6 +31,15 @@ func init() { // 插件主体
),
)
})
engine.OnFullMatch("清理缓存", zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
err := os.RemoveAll("data/cache/*")
if err != nil {
ctx.Send("错误: " + err.Error())
} else {
ctx.Send("成功!")
}
})
}
func cpuPercent() float64 {