mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
🐛 MustProvicePicture goroutine 泄漏
This commit is contained in:
parent
27054b9722
commit
8e4c496b54
@ -12,6 +12,8 @@ import (
|
||||
"github.com/FloatTech/zbputils/control/order"
|
||||
)
|
||||
|
||||
const hso = "https://gchat.qpic.cn/gchatpic_new//--4234EDEC5F147A4C319A41149D7E0EA9/0"
|
||||
|
||||
func init() {
|
||||
engine := control.Register("nsfw", order.AcquirePrio(), &control.Options{
|
||||
DisableOnDefault: false,
|
||||
@ -31,11 +33,10 @@ func init() {
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(judge(p[0]))))
|
||||
}
|
||||
})
|
||||
en := control.Register("nsfwauto", order.AcquirePrio(), &control.Options{
|
||||
control.Register("nsfwauto", order.AcquirePrio(), &control.Options{
|
||||
DisableOnDefault: true,
|
||||
Help: "nsfw图片自动识别\n- 当图片属于非 neutral 类别时自动发送评价",
|
||||
})
|
||||
en.OnMessage(zero.IsPicExists).SetBlock(false).
|
||||
}).OnMessage(zero.HasPicture).SetBlock(false).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
url := ctx.State["image_url"].([]string)
|
||||
if len(url) > 0 {
|
||||
@ -96,6 +97,6 @@ func autojudge(ctx *zero.Ctx, p nsfw.Picture) {
|
||||
i++
|
||||
}
|
||||
if i > 0 {
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(c)))
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(c, "\n"), message.Image(hso)))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user