mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
✨ add plugin 渲染任意文字到图片
This commit is contained in:
@@ -86,13 +86,13 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Text("INFO: 正在填充弹药......"))
|
||||
time.Sleep(time.Second * 10)
|
||||
if pool.size(imgtype) == 0 {
|
||||
ctx.SendChain(message.Text("ERROR: 等待填充,请稍后再试......"))
|
||||
ctx.SendChain(message.Text("ERROR:等待填充,请稍后再试......"))
|
||||
return
|
||||
}
|
||||
}
|
||||
// 从缓冲池里抽一张
|
||||
if id := ctx.SendChain(*pool.pop(imgtype)); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -118,7 +118,7 @@ func init() { // 插件主体
|
||||
)
|
||||
// 查询数据库
|
||||
if err := pool.remove(imgtype, id); err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text("删除成功"))
|
||||
@@ -159,7 +159,7 @@ func (p *imgpool) push(ctx *zero.Ctx, imgtype string, illust *pixiv.Illust) {
|
||||
if fileutil.IsNotExist(f) {
|
||||
// 下载图片
|
||||
if err := illust.DownloadToCache(0); err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ func (p *imgpool) fill(ctx *zero.Ctx, imgtype string) {
|
||||
illust := &pixiv.Illust{}
|
||||
// 查询出一张图片
|
||||
if err := p.db.Pick(imgtype, illust); err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
continue
|
||||
}
|
||||
// 向缓冲池添加一张图片
|
||||
|
||||
Reference in New Issue
Block a user