From a2dfc54068ef1f758cfc2e34f331636ce75e332f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Mon, 13 Jun 2022 12:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20b14=20decode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 6 +++--- go.sum | 12 ++++++------ plugin/ai_reply/ai_tts.go | 4 ++-- plugin/fortune/fortune.go | 4 ++-- plugin/nativesetu/main.go | 4 ++-- plugin/omikuji/sensou.go | 4 ++-- plugin/setutime/setu_geter.go | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 72f19a01..0093d015 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,15 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.18 require ( - github.com/FloatTech/AnimeAPI v1.4.1-0.20220610072926-7b30ff4586ec + github.com/FloatTech/AnimeAPI v1.4.1-0.20220613042537-0adf8c5616ec github.com/FloatTech/sqlite v0.3.2 github.com/FloatTech/zbpctrl v1.4.1-0.20220610074608-425160596f27 - github.com/FloatTech/zbputils v1.4.1-0.20220610074642-09004f278b03 + github.com/FloatTech/zbputils v1.4.1-0.20220613042833-33e22060e8d9 github.com/antchfx/htmlquery v1.2.5 github.com/corona10/goimagehash v1.0.3 github.com/fogleman/gg v1.3.0 github.com/fumiama/cron v1.3.0 - github.com/fumiama/go-base16384 v1.5.2 + github.com/fumiama/go-base16384 v1.5.3 github.com/fumiama/go-registry v0.1.6 github.com/fumiama/gofastTEA v0.0.10 github.com/fumiama/gotracemoe v0.0.3 diff --git a/go.sum b/go.sum index 02bda3f2..fea79edb 100644 --- a/go.sum +++ b/go.sum @@ -8,14 +8,14 @@ dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1 dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/FloatTech/AnimeAPI v1.4.1-0.20220610072926-7b30ff4586ec h1:10h8e85tJ9v+ZQ+ShFQW4L2KP1x88+ntaZdVt9XHkwE= -github.com/FloatTech/AnimeAPI v1.4.1-0.20220610072926-7b30ff4586ec/go.mod h1:z7gyiirY3EMH4QHfymYl21KNanSB2Ni4jwtFp9e/raA= +github.com/FloatTech/AnimeAPI v1.4.1-0.20220613042537-0adf8c5616ec h1:Hl/BxaQoQFEJUIGmdhR0NyBvZChb7qkfCrF916bNxnI= +github.com/FloatTech/AnimeAPI v1.4.1-0.20220613042537-0adf8c5616ec/go.mod h1:MrCZ7P6WvF0JWHMeedAx6fVm5BP1s6/RUy0r0Jvqrds= github.com/FloatTech/sqlite v0.3.2 h1:iTg2ZKnzjjZAdlSN3hXmpCBn15odc4Ud484OoM3yXGA= github.com/FloatTech/sqlite v0.3.2/go.mod h1:VFtLofV5qxw5eBneZRbWwD451SLSm50o9J3J43iB1iw= github.com/FloatTech/zbpctrl v1.4.1-0.20220610074608-425160596f27 h1:C+D30vpxfgbJetTFXWAHzuU8GydbFb/A8Kv6E3PdRS4= github.com/FloatTech/zbpctrl v1.4.1-0.20220610074608-425160596f27/go.mod h1:5FDkrlVaQCxUfeqH7XJPTfej0q+y9fzImhvZI4ofu9Y= -github.com/FloatTech/zbputils v1.4.1-0.20220610074642-09004f278b03 h1:OeVhJvlf3gMac+B5CMOQoJOM3I/uz/wCMgX6o6OgtFE= -github.com/FloatTech/zbputils v1.4.1-0.20220610074642-09004f278b03/go.mod h1:6Y34s+MbssTT4AWBKfJCMifFyFhtB3RGC1qo+8EVGZ4= +github.com/FloatTech/zbputils v1.4.1-0.20220613042833-33e22060e8d9 h1:IeUs08sUqdR/g8DfxPNTSBfsE1g0OtmffLNgKzbrVZ4= +github.com/FloatTech/zbputils v1.4.1-0.20220613042833-33e22060e8d9/go.mod h1:A9AeVHZsv5chyw8p4fDI0cHnEOfMpmsTLoLWqUT7TO4= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c h1:cNPOdTNiVwxLpROLjXCgbIPvdkE+BwvxDvgmdYmWx6Q= github.com/RomiChan/syncx v0.0.0-20220404072119-d7ea0ae15a4c/go.mod h1:KqZzu7slNKROh3TSYEH/IUMG6f4M+1qubZ5e52QypsE= @@ -57,8 +57,8 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo= github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY= -github.com/fumiama/go-base16384 v1.5.2 h1:cbxXTcDH92PNgG7bEBwiCEoWb5O+nwZKxKOG94ilFo8= -github.com/fumiama/go-base16384 v1.5.2/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM= +github.com/fumiama/go-base16384 v1.5.3 h1:IUZUlm2ajJB1nEJzauP6yD5IeJoVHyBEkzKJf9O82zs= +github.com/fumiama/go-base16384 v1.5.3/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM= github.com/fumiama/go-registry v0.1.6 h1:Ee/tXCCIR/xt8celhbbw0W/xDMdhAXLwy2YFBB/LWFk= github.com/fumiama/go-registry v0.1.6/go.mod h1:dIUVbiOgfk9oZcsgwDvNLC72i+ctibVukSXR/9bLviI= github.com/fumiama/gofastTEA v0.0.10 h1:JJJ+brWD4kie+mmK2TkspDXKzqq0IjXm89aGYfoGhhQ= diff --git a/plugin/ai_reply/ai_tts.go b/plugin/ai_reply/ai_tts.go index 12524665..0ba5fa32 100644 --- a/plugin/ai_reply/ai_tts.go +++ b/plugin/ai_reply/ai_tts.go @@ -88,7 +88,7 @@ func init() { } } }) - engine.OnRegex(`^设置语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true). + engine.OnRegex(`^设置语音模式(.*)$`, ctxext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, t)).SetBlock(true). Handle(func(ctx *zero.Ctx) { param := ctx.State["regex_matched"].([]string)[1] err := t.setSoundMode(ctx, param) @@ -98,7 +98,7 @@ func init() { } ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("设置成功,当前模式为", param)) }) - engine.OnRegex(`^设置默认语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true). + engine.OnRegex(`^设置默认语音模式(.*)$`, ctxext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, t)).SetBlock(true). Handle(func(ctx *zero.Ctx) { param := ctx.State["regex_matched"].([]string)[1] t.setDefaultSoundMode(param) diff --git a/plugin/fortune/fortune.go b/plugin/fortune/fortune.go index 0ed2cbee..a964fa12 100644 --- a/plugin/fortune/fortune.go +++ b/plugin/fortune/fortune.go @@ -139,7 +139,7 @@ func init() { } // 随机获取签文 - randtextindex := ctxext.RandSenderPerDayN(ctx, len(omikujis)) + randtextindex := ctxext.RandSenderPerDayN(ctx.Event.UserID, len(omikujis)) title, text := omikujis[randtextindex]["title"], omikujis[randtextindex]["content"] digest := md5.Sum(helper.StringToBytes(zipfile + strconv.Itoa(index) + title + text)) cachefile := cache + hex.EncodeToString(digest[:]) @@ -171,7 +171,7 @@ func randimage(path string, ctx *zero.Ctx) (im image.Image, index int, err error } defer reader.Close() - file := reader.File[ctxext.RandSenderPerDayN(ctx, len(reader.File))] + file := reader.File[ctxext.RandSenderPerDayN(ctx.Event.UserID, len(reader.File))] f, err := file.Open() if err != nil { return diff --git a/plugin/nativesetu/main.go b/plugin/nativesetu/main.go index 6893301c..1e5fe6d4 100644 --- a/plugin/nativesetu/main.go +++ b/plugin/nativesetu/main.go @@ -42,7 +42,7 @@ func init() { } } - engine.OnRegex(`^本地(.*)$`, ctxext.FirstValueInList(ns)).SetBlock(true). + engine.OnRegex(`^本地(.*)$`, ctxext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, ns)).SetBlock(true). Handle(func(ctx *zero.Ctx) { imgtype := ctx.State["regex_matched"].([]string)[1] sc := new(setuclass) @@ -63,7 +63,7 @@ func init() { ctx.SendChain(message.Text(imgtype, ": ", sc.Name, "\n"), message.Image(p)) } }) - engine.OnRegex(`^刷新本地(.*)$`, ctxext.FirstValueInList(ns), zero.SuperUserPermission).SetBlock(true). + engine.OnRegex(`^刷新本地(.*)$`, ctxext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, ns), zero.SuperUserPermission).SetBlock(true). Handle(func(ctx *zero.Ctx) { imgtype := ctx.State["regex_matched"].([]string)[1] err := ns.scanclass(os.DirFS(setupath), imgtype, imgtype) diff --git a/plugin/omikuji/sensou.go b/plugin/omikuji/sensou.go index 7528112f..0835455c 100644 --- a/plugin/omikuji/sensou.go +++ b/plugin/omikuji/sensou.go @@ -28,7 +28,7 @@ func init() { // 插件主体 engine.OnFullMatchGroup([]string{"求签", "占卜"}).SetBlock(true). Handle(func(ctx *zero.Ctx) { - i := ctxext.RandSenderPerDayN(ctx, 100) + 1 + i := ctxext.RandSenderPerDayN(ctx.Event.UserID, 100) + 1 ctx.SendChain( message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, i, 0)), @@ -65,7 +65,7 @@ func init() { // 插件主体 Handle(func(ctx *zero.Ctx) { kujiBytes, err := text.RenderToBase64( getKujiByBango( - uint8(ctxext.RandSenderPerDayN(ctx, 100)+1), + uint8(ctxext.RandSenderPerDayN(ctx.Event.UserID, 100)+1), ), text.FontFile, 400, 20, ) diff --git a/plugin/setutime/setu_geter.go b/plugin/setutime/setu_geter.go index 71aca06f..fbe476a2 100644 --- a/plugin/setutime/setu_geter.go +++ b/plugin/setutime/setu_geter.go @@ -78,7 +78,7 @@ func init() { // 插件主体 return true }) - engine.OnRegex(`^来份(.+)$`, getdb, ctxext.FirstValueInList(pool)).SetBlock(true).Limit(ctxext.LimitByUser). + engine.OnRegex(`^来份(.+)$`, getdb, ctxext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, pool)).SetBlock(true).Limit(ctxext.LimitByUser). Handle(func(ctx *zero.Ctx) { var imgtype = ctx.State["regex_matched"].([]string)[1] // 补充池子 @@ -112,7 +112,7 @@ func init() { // 插件主体 ctx.SendChain(message.Text("成功向分类", imgtype, "添加图片", id)) }) - engine.OnRegex(`^删除\s*([^0-9\s]+)\s*(\d+)$`, getdb, ctxext.FirstValueInList(pool), zero.SuperUserPermission).SetBlock(true). + engine.OnRegex(`^删除\s*([^0-9\s]+)\s*(\d+)$`, getdb, ctxext.ValueInList(func(ctx *zero.Ctx) string { return ctx.State["regex_matched"].([]string)[1] }, pool), zero.SuperUserPermission).SetBlock(true). Handle(func(ctx *zero.Ctx) { var ( imgtype = ctx.State["regex_matched"].([]string)[1]