mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 02:00:24 +00:00
增加文字转图片&拟声鸟 (#96)
* feat:添加文字转图片,改造长文字 * fix:修改log * fix:修改条件 * fix:不保存图片 * fix:增加block和优先级 * fix:文件夹首字母大写 * fix:修改解签为图片 * feat:添加拟声鸟 * fix:清理缓存 * fix:换一个音频 * fix:小修格式 * fix:修一下lint * fix:修一下lint * fix:修一下lint * fix:修一下lint * fix:修一下lint * fix:修一下lint * fix:修一下lint * fix:修一下lint * fix:10s一次 * fix:10s一次 * fix:修lint
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
package shindan
|
||||
|
||||
import (
|
||||
"github.com/FloatTech/ZeroBot-Plugin/utils/txt2img"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/shindanmaker"
|
||||
@@ -47,7 +50,18 @@ func handle(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
}
|
||||
// TODO: 可注入
|
||||
ctx.Send(text)
|
||||
switch ctx.State["id"].(int64) {
|
||||
case 587874, 162207:
|
||||
data, err := txt2img.RenderToBase64(text, 40, 20)
|
||||
if err != nil {
|
||||
log.Errorln("[shindan]:", err)
|
||||
}
|
||||
if id := ctx.SendChain(message.Image("base64://" + helper.BytesToString(data))); id == 0 {
|
||||
ctx.SendChain(message.Text("ERROR: 可能被风控了"))
|
||||
}
|
||||
default:
|
||||
ctx.Send(text)
|
||||
}
|
||||
}
|
||||
|
||||
// 传入 shindanmaker id
|
||||
|
||||
Reference in New Issue
Block a user