mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 06:20:08 +08:00
✨ aifalse 增加 清理缓存
This commit is contained in:
parent
4df30a56a3
commit
1d469a40d5
@ -114,6 +114,7 @@
|
|||||||
- [x] [回复]查重
|
- [x] [回复]查重
|
||||||
- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"`
|
- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"`
|
||||||
- [x] 查询计算机当前活跃度 [身体检查]
|
- [x] 查询计算机当前活跃度 [身体检查]
|
||||||
|
- [x] 清理缓存
|
||||||
- [ ] 简易语音
|
- [ ] 简易语音
|
||||||
- [ ] 爬图合成 [@xxx]
|
- [ ] 爬图合成 [@xxx]
|
||||||
- **minecraft** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft"`
|
- **minecraft** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft"`
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package aifalse
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/cpu"
|
"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 {
|
func cpuPercent() float64 {
|
||||||
|
|||||||
@ -48,6 +48,8 @@ func newPools() *imgpool {
|
|||||||
Pool: map[string][]*pixiv.Illust{},
|
Pool: map[string][]*pixiv.Illust{},
|
||||||
Form: 0,
|
Form: 0,
|
||||||
}
|
}
|
||||||
|
// 每次启动清理缓存
|
||||||
|
os.RemoveAll(cache.Path)
|
||||||
err := os.MkdirAll(cache.Path, 0755)
|
err := os.MkdirAll(cache.Path, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user