mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-22 08:10:09 +08:00
fix: fortune
This commit is contained in:
parent
e231235ed1
commit
bdc4138d78
@ -43,6 +43,7 @@ var (
|
|||||||
index = make(map[string]uint8)
|
index = make(map[string]uint8)
|
||||||
// 签文
|
// 签文
|
||||||
omikujis []map[string]string
|
omikujis []map[string]string
|
||||||
|
fontdata []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -98,12 +99,13 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
fontdata, err := file.GetLazyData("data/Font/sakura.ttf", control.Md5File, true)
|
if fontdata == nil {
|
||||||
|
fontdata, err = file.GetLazyData("data/Font/sakura.ttf", control.Md5File, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
ctx.State["fontdata"] = fontdata
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
)).Limit(ctxext.LimitByGroup).SetBlock(true).
|
)).Limit(ctxext.LimitByGroup).SetBlock(true).
|
||||||
@ -149,7 +151,7 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = draw(background, ctx.State["fontdata"].([]byte), title, text, f)
|
_, err = draw(background, fontdata, title, text, f)
|
||||||
_ = f.Close()
|
_ = f.Close()
|
||||||
return err
|
return err
|
||||||
}, ctxext.Send(ctx), ctxext.GetMessage(ctx))
|
}, ctxext.Send(ctx), ctxext.GetMessage(ctx))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user