mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
🎨 改进代码样式
This commit is contained in:
parent
3fba704c77
commit
6b4045db45
@ -5,10 +5,11 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||
"github.com/fumiama/cron"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||
)
|
||||
|
||||
type follower struct {
|
||||
|
||||
@ -4,12 +4,13 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||
"github.com/FloatTech/ZeroBot-Plugin/utils/rule"
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||
"github.com/FloatTech/ZeroBot-Plugin/utils/rule"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@ -37,5 +37,4 @@ func init() {
|
||||
}
|
||||
log.Printf("[kuji]读取%d条签文", n)
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
@ -7,9 +7,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
@ -16,11 +16,9 @@ func init() {
|
||||
if err := recover(); err != nil { //产生了panic异常
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
}() //别忘了(), 调用此匿名函数
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
model.Initialize(dbfile)
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
@ -38,7 +38,6 @@ func init() {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(fmt.Sprintf("早安成功!你的睡眠时长为%d时%d分%d秒,你是今天第%d个起床的", hour, minute, second, position)))
|
||||
}
|
||||
db.Close()
|
||||
|
||||
})
|
||||
engine.OnFullMatch("晚安", isEvening, zero.OnlyGroup).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
@ -56,7 +55,6 @@ func init() {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(fmt.Sprintf("晚安成功!你的清醒时长为%d时%d分%d秒,你是今天第%d个睡觉的", hour, minute, second, position)))
|
||||
}
|
||||
db.Close()
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -237,7 +237,6 @@ func (vdb *VtbDB) GetVtbList() (uidList []string) {
|
||||
logrus.Println(fc)
|
||||
|
||||
if err := db.Debug().Model(&FirstCategory{}).Where("first_category_uid = ?", fc.FirstCategoryUid).First(&fc).Error; err != nil {
|
||||
|
||||
if gorm.IsRecordNotFoundError(err) {
|
||||
db.Debug().Model(&FirstCategory{}).Create(&fc) // newUser not user
|
||||
}
|
||||
@ -330,7 +329,6 @@ func (vdb *VtbDB) StoreVtb(uid string) {
|
||||
|
||||
if err := db.Debug().Model(&ThirdCategory{}).Where("first_category_uid = ? and second_category_index = ? and third_category_index = ?",
|
||||
uid, secondIndex, thirdIndex).First(&tc).Error; err != nil {
|
||||
|
||||
if gorm.IsRecordNotFoundError(err) {
|
||||
db.Debug().Model(&ThirdCategory{}).Create(&tc) // newUser not user
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user