diff --git a/README.md b/README.md index 61fa06c7..354581f8 100644 --- a/README.md +++ b/README.md @@ -444,7 +444,7 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 查弹幕 [xxx] 2 (最后一个参数是页码) - - [x] 设置b站cookie SESSDATA=82da790d,1663822823,06ecf\*31 (最好把cookie设全) + - [x] 设置b站cookie b_ut=7;buvid3=0;i-wanna-go-back=-1;innersign=0; (最好把cookie设全) 获取Cookie可以使用[这个工具](https://github.com/XiaoMiku01/login_bili_go) diff --git a/plugin/bilibili/bilibili.go b/plugin/bilibili/bilibili.go index bd46803f..aa02a608 100644 --- a/plugin/bilibili/bilibili.go +++ b/plugin/bilibili/bilibili.go @@ -53,7 +53,7 @@ func init() { "- >user info [xxx]\n" + "- 查成分 [xxx]\n" + "- 查弹幕 [xxx]\n" + - "- 设置b站cookie [xxx]\n" + + "- 设置b站cookie b_ut=7;buvid3=0;i-wanna-go-back=-1;innersign=0;\n" + "- 更新vup", PublicDataFolder: "Bilibili", }) diff --git a/plugin/danbooru/main.go b/plugin/danbooru/main.go index c82ce094..743a37a1 100644 --- a/plugin/danbooru/main.go +++ b/plugin/danbooru/main.go @@ -4,11 +4,13 @@ package deepdanbooru import ( "crypto/md5" "encoding/hex" + "strings" "github.com/FloatTech/floatbox/file" "github.com/FloatTech/floatbox/img/writer" ctrl "github.com/FloatTech/zbpctrl" "github.com/FloatTech/zbputils/control" + "github.com/FloatTech/zbputils/ctxext" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/utils/helper" @@ -29,7 +31,7 @@ func init() { // 插件主体 Handle(func(ctx *zero.Ctx) { ctx.SendChain(message.Text("少女祈祷中...")) for _, url := range ctx.State["image_url"].([]string) { - t, err := tagurl("", url) + t, st, err := tagurl("", url) if err != nil { ctx.SendChain(message.Text("ERROR: ", err)) return @@ -39,7 +41,11 @@ func init() { // 插件主体 if file.IsNotExist(f) { _ = writer.SavePNG2Path(f, t) } - ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + f)) + m := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Image("file:///"+file.BOTPATH+"/"+f))} + m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Text("tags: ", strings.Join(st.tseq, ",")))) + if id := ctx.Send(m).ID(); id == 0 { + ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待")) + } } }) } diff --git a/plugin/danbooru/tag.go b/plugin/danbooru/tag.go index d726a7b7..f4258a98 100644 --- a/plugin/danbooru/tag.go +++ b/plugin/danbooru/tag.go @@ -46,7 +46,7 @@ func (s *sorttags) Swap(i, j int) { s.tseq[j], s.tseq[i] = s.tseq[i], s.tseq[j] } -func tagurl(name, u string) (im image.Image, err error) { +func tagurl(name, u string) (im image.Image, st *sorttags, err error) { ch := make(chan []byte, 1) go func() { var data []byte @@ -72,7 +72,7 @@ func tagurl(name, u string) (im image.Image, err error) { } longestlen++ - st := newsorttags(tags) + st = newsorttags(tags) sort.Sort(st) _, err = file.GetLazyData(text.BoldFontFile, true)