mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 22:40:23 +08:00
🐛 fix new user error
This commit is contained in:
parent
d3fafa7b9a
commit
9b4494a24f
@ -48,10 +48,7 @@ func init() {
|
|||||||
si := sdb.GetSignInByUID(uid)
|
si := sdb.GetSignInByUID(uid)
|
||||||
siUpdateTimeStr := si.UpdatedAt.Format("20060102")
|
siUpdateTimeStr := si.UpdatedAt.Format("20060102")
|
||||||
if siUpdateTimeStr != today {
|
if siUpdateTimeStr != today {
|
||||||
if err := sdb.InsertOrUpdateSignInCountByUID(uid, 0); err != nil {
|
_ = sdb.InsertOrUpdateSignInCountByUID(uid, 0)
|
||||||
ctx.SendChain(message.Text("ERROR:", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawedFile := cachePath + strconv.FormatInt(uid, 10) + today + "signin.png"
|
drawedFile := cachePath + strconv.FormatInt(uid, 10) + today + "signin.png"
|
||||||
@ -66,10 +63,8 @@ func init() {
|
|||||||
picFile := cachePath + strconv.FormatInt(uid, 10) + today + ".png"
|
picFile := cachePath + strconv.FormatInt(uid, 10) + today + ".png"
|
||||||
initPic(picFile)
|
initPic(picFile)
|
||||||
|
|
||||||
if err := sdb.InsertOrUpdateSignInCountByUID(uid, si.Count+1); err != nil {
|
_ = sdb.InsertOrUpdateSignInCountByUID(uid, si.Count+1)
|
||||||
ctx.SendChain(message.Text("ERROR:", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
back, err := gg.LoadImage(picFile)
|
back, err := gg.LoadImage(picFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("ERROR:", err))
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
@ -102,10 +97,7 @@ func init() {
|
|||||||
score = SCOREMAX
|
score = SCOREMAX
|
||||||
ctx.SendChain(message.At(uid), message.Text("你获得的小熊饼干已经达到上限"))
|
ctx.SendChain(message.At(uid), message.Text("你获得的小熊饼干已经达到上限"))
|
||||||
}
|
}
|
||||||
if err := sdb.InsertOrUpdateScoreByUID(uid, score); err != nil {
|
_ = sdb.InsertOrUpdateScoreByUID(uid, score)
|
||||||
ctx.SendChain(message.Text("ERROR:", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
level := getLevel(score)
|
level := getLevel(score)
|
||||||
canvas.DrawString("当前小熊饼干:"+strconv.FormatInt(int64(score), 10), float64(back.Bounds().Size().X)*0.1, float64(back.Bounds().Size().Y)*1.4)
|
canvas.DrawString("当前小熊饼干:"+strconv.FormatInt(int64(score), 10), float64(back.Bounds().Size().X)*0.1, float64(back.Bounds().Size().Y)*1.4)
|
||||||
canvas.DrawString("LEVEL:"+strconv.FormatInt(int64(level), 10), float64(back.Bounds().Size().X)*0.1, float64(back.Bounds().Size().Y)*1.5)
|
canvas.DrawString("LEVEL:"+strconv.FormatInt(int64(level), 10), float64(back.Bounds().Size().X)*0.1, float64(back.Bounds().Size().Y)*1.5)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user