Skip to content

Commit

Permalink
🚧 move tag & nsfw to azfun
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Apr 5, 2022
1 parent 56e53b7 commit d8a429d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/FloatTech/ZeroBot-Plugin
go 1.18

require (
github.com/FloatTech/AnimeAPI v1.3.3-0.20220404063515-276c66b6465b
github.com/FloatTech/AnimeAPI v1.3.3-0.20220405074902-947bbc912682
github.com/FloatTech/sqlite v0.2.1
github.com/FloatTech/zbputils v1.3.3-0.20220404063419-35ea3d038087
github.com/antchfx/htmlquery v1.2.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/FloatTech/AnimeAPI v1.3.3-0.20220404063515-276c66b6465b h1:dnCOvui63+Nzx2x9AbktsX2B02GOMznphgO58KC0SaQ=
github.com/FloatTech/AnimeAPI v1.3.3-0.20220404063515-276c66b6465b/go.mod h1:YhosmTPUUN8NTwUy3YQCXM9ESQ14x3NUi81cAIbklUs=
github.com/FloatTech/AnimeAPI v1.3.3-0.20220405074902-947bbc912682 h1:5pjrW6uotrtHbVITQFeZJdKc4ZlwPdiA25nx90BBD84=
github.com/FloatTech/AnimeAPI v1.3.3-0.20220405074902-947bbc912682/go.mod h1:YhosmTPUUN8NTwUy3YQCXM9ESQ14x3NUi81cAIbklUs=
github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U=
github.com/FloatTech/zbputils v1.3.3-0.20220404063419-35ea3d038087 h1:yq9lwq5tbKuFEr9eiPeZsORmWKSAErFrzAIPc/1hmuA=
Expand Down
12 changes: 6 additions & 6 deletions plugin/nsfw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func init() {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {
ctx.SendChain(message.Text("少女祈祷中..."))
p, err := nsfw.Classify(url...)
p, err := nsfw.Classify(url[0])
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(judge(p[0]))))
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(judge(p))))
}
})
control.Register("nsfwauto", &control.Options{
Expand All @@ -39,17 +39,17 @@ func init() {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {
process.SleepAbout1sTo2s()
p, err := nsfw.Classify(url...)
p, err := nsfw.Classify(url[0])
if err != nil {
return
}
process.SleepAbout1sTo2s()
autojudge(ctx, p[0])
autojudge(ctx, p)
}
})
}

func judge(p nsfw.Picture) string {
func judge(p *nsfw.Picture) string {
if p.Neutral > 0.3 {
return "普通哦"
}
Expand All @@ -71,7 +71,7 @@ func judge(p nsfw.Picture) string {
return c
}

func autojudge(ctx *zero.Ctx, p nsfw.Picture) {
func autojudge(ctx *zero.Ctx, p *nsfw.Picture) {
if p.Neutral > 0.3 {
return
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/scale/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func init() {
ctx.SendChain(message.Text("ERROR:", err))
return
}
if p[0].Drawings < 0.1 || p[0].Neutral > 0.8 {
if p.Drawings < 0.1 || p.Neutral > 0.8 {
ctx.SendChain(message.Text("请发送二次元图片!"))
return
}
Expand Down

0 comments on commit d8a429d

Please sign in to comment.