mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 10:10:25 +00:00
⚡️ 🎨 🔥 优化代码结构
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
package sleepmanage
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/zbputils/control/order"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
defer order.DoneOnExit()()
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
model.Initialize(dbfile)
|
||||
}()
|
||||
}
|
||||
@@ -16,14 +16,13 @@ import (
|
||||
"github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage/model"
|
||||
)
|
||||
|
||||
const dbpath = "data/sleep/"
|
||||
const dbfile = dbpath + "manage.db"
|
||||
|
||||
func init() {
|
||||
engine := control.Register("sleepmanage", order.AcquirePrio(), &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "sleepmanage\n- 早安\n- 晚安",
|
||||
DisableOnDefault: false,
|
||||
Help: "sleepmanage\n- 早安\n- 晚安",
|
||||
PrivateDataFolder: "sleep",
|
||||
})
|
||||
dbfile := engine.DataFolder() + "manage.db"
|
||||
engine.OnFullMatch("早安", isMorning, zero.OnlyGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
db, err := model.Open(dbfile)
|
||||
|
||||
Reference in New Issue
Block a user