mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 14:30:10 +08:00
* 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
29 lines
756 B
Go
29 lines
756 B
Go
package shadiao
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/tidwall/gjson"
|
|
zero "github.com/wdvxdr1123/ZeroBot"
|
|
"github.com/wdvxdr1123/ZeroBot/message"
|
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
|
|
|
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
|
)
|
|
|
|
func init() {
|
|
engine.OnFullMatch("讲个段子").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
|
return
|
|
}
|
|
data, err := web.ReqWith(yduanziURL, "POST", yduanziReferer, ua)
|
|
if err != nil {
|
|
ctx.SendChain(message.Text("ERROR:", err))
|
|
return
|
|
}
|
|
text := gjson.Get(helper.BytesToString(data), "duanzi").String()
|
|
text = strings.ReplaceAll(text, "<br>", "\n")
|
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
|
})
|
|
}
|