mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-07 07:40:21 +00:00
Compare commits
69 Commits
v1.3.3
...
v1.4.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07d541be20 | ||
|
|
4a0dc59585 | ||
|
|
b1dd8f52e8 | ||
|
|
6907fe230f | ||
|
|
f2e4071b90 | ||
|
|
452f5e5f83 | ||
|
|
c94b9f54ce | ||
|
|
e993f93cf4 | ||
|
|
e9fac38c1b | ||
|
|
31a49b8ff9 | ||
|
|
7831cdf10c | ||
|
|
c0f176f0af | ||
|
|
dc96a557eb | ||
|
|
7a8c915e62 | ||
|
|
dec42cc72b | ||
|
|
92c9d1d2ce | ||
|
|
de017fcd27 | ||
|
|
1229f62abd | ||
|
|
512852b817 | ||
|
|
5a087000a9 | ||
|
|
6b56d6649e | ||
|
|
5081aab497 | ||
|
|
bbb4afde53 | ||
|
|
d28495c3eb | ||
|
|
1785e0c4a3 | ||
|
|
1e93e75aac | ||
|
|
a3ed7eeee2 | ||
|
|
c3582637df | ||
|
|
3b277b0eb0 | ||
|
|
5e0991681f | ||
|
|
354fbb7cdd | ||
|
|
a166d06096 | ||
|
|
b8a6e07095 | ||
|
|
a8fba6e7b5 | ||
|
|
17a8c10f8c | ||
|
|
7ccd29faac | ||
|
|
d432e48cce | ||
|
|
19091319cc | ||
|
|
d29e12a92c | ||
|
|
5db03b0441 | ||
|
|
f8c7e2bf6d | ||
|
|
a7fdc6a88f | ||
|
|
4aaf5b0779 | ||
|
|
6150e4c736 | ||
|
|
9a3b4b3ecb | ||
|
|
cbaeb4d5f2 | ||
|
|
592c306aa0 | ||
|
|
136e6bddf4 | ||
|
|
0e8bef0541 | ||
|
|
9d8c52303e | ||
|
|
e6ae7df546 | ||
|
|
5b57a759be | ||
|
|
cc96eeae32 | ||
|
|
484fef1228 | ||
|
|
ba4ca11c83 | ||
|
|
9372902348 | ||
|
|
0cc9420570 | ||
|
|
18fa48d283 | ||
|
|
9034fedbd0 | ||
|
|
ec3b6ec5fa | ||
|
|
8cc2a4174e | ||
|
|
8a0014928d | ||
|
|
228ca7f9c0 | ||
|
|
c0fa7efb27 | ||
|
|
3553683bb1 | ||
|
|
ccb58e0a6c | ||
|
|
93253e2188 | ||
|
|
e34bcc9bbd | ||
|
|
72169e3a4d |
BIN
.github/gopher.jpg
vendored
BIN
.github/gopher.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 132 KiB |
BIN
.github/yaya.jpg
vendored
BIN
.github/yaya.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB |
BIN
.github/黒金.jpg
vendored
Normal file
BIN
.github/黒金.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 191 KiB |
2
data
2
data
Submodule data updated: b3d25c45fd...291200d5d4
27
go.mod
27
go.mod
@@ -3,27 +3,28 @@ module github.com/FloatTech/ZeroBot-Plugin
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v1.3.3-0.20220417132103-df55797131af
|
||||
github.com/FloatTech/AnimeAPI v1.4.1-0.20220512034947-4dd25b414348
|
||||
github.com/FloatTech/sqlite v0.2.1
|
||||
github.com/FloatTech/zbputils v1.3.3-0.20220418145633-c1d3c00da628
|
||||
github.com/FloatTech/zbputils v1.4.1-0.20220510155433-a0cc1629b1df
|
||||
github.com/antchfx/htmlquery v1.2.4
|
||||
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.4.0
|
||||
github.com/fumiama/go-registry v0.1.5
|
||||
github.com/fumiama/go-base16384 v1.5.2
|
||||
github.com/fumiama/go-registry v0.1.6
|
||||
github.com/fumiama/gofastTEA v0.0.10
|
||||
github.com/fumiama/gotracemoe v0.0.3
|
||||
github.com/fumiama/sqlite3 v1.14.6
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||
github.com/jinzhu/gorm v1.9.16
|
||||
github.com/jozsefsallai/gophersauce v1.0.1
|
||||
github.com/mroth/weightedrand v0.4.1
|
||||
github.com/pkumza/numcn v1.0.0
|
||||
github.com/shirou/gopsutil/v3 v3.22.3
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/tidwall/gjson v1.14.0
|
||||
github.com/tidwall/gjson v1.14.1
|
||||
github.com/wcharczuk/go-chart/v2 v2.1.0
|
||||
github.com/wdvxdr1123/ZeroBot v1.5.0-mid.0.20220415071800-9e52436ab5c0
|
||||
github.com/wdvxdr1123/ZeroBot v1.5.2-0.20220509035736-f3ad8fa960d7
|
||||
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9
|
||||
)
|
||||
|
||||
@@ -33,25 +34,25 @@ require (
|
||||
github.com/antchfx/xpath v1.2.0 // indirect
|
||||
github.com/disintegration/imaging v1.6.2 // indirect
|
||||
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.0.4 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20220326011226-f1430873d8db // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.12 // indirect
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.10 // indirect
|
||||
github.com/tklauser/numcpus v0.4.0 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
modernc.org/libc v1.15.0 // indirect
|
||||
modernc.org/libc v1.14.6 // indirect
|
||||
modernc.org/mathutil v1.4.1 // indirect
|
||||
modernc.org/memory v1.0.7 // indirect
|
||||
modernc.org/memory v1.0.5 // indirect
|
||||
)
|
||||
|
||||
66
go.sum
66
go.sum
@@ -1,9 +1,9 @@
|
||||
github.com/FloatTech/AnimeAPI v1.3.3-0.20220417132103-df55797131af h1:K7Cdrd1jgiTUe8hcITgmwJeIdwfCMM+phw8DD1tALXA=
|
||||
github.com/FloatTech/AnimeAPI v1.3.3-0.20220417132103-df55797131af/go.mod h1:jUOit4oeiKOtRDy5ZLTJQa7aE0972R/KPF15b22Q3vY=
|
||||
github.com/FloatTech/AnimeAPI v1.4.1-0.20220512034947-4dd25b414348 h1:UQRYPg3hXqF/tcqMMcNKPdgOWkjhfNamC1FXi6e1cek=
|
||||
github.com/FloatTech/AnimeAPI v1.4.1-0.20220512034947-4dd25b414348/go.mod h1:NAGWR4TXLwEVEx0e8yoMj6j5DS0bNWrFcuATozNkT2I=
|
||||
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.20220418145633-c1d3c00da628 h1:NC7m06uyenwt4TRyCEkK5lFNId3TB5gKEeOYNQpYTBI=
|
||||
github.com/FloatTech/zbputils v1.3.3-0.20220418145633-c1d3c00da628/go.mod h1:K2IVrhwmrVKZSHSHmNoO9JthN1As9RcnQplf+stQ5BY=
|
||||
github.com/FloatTech/zbputils v1.4.1-0.20220510155433-a0cc1629b1df h1:zt+Um+D9UqF5SZmYPmklLh7ff/u0ByU53KX1pqlFEhM=
|
||||
github.com/FloatTech/zbputils v1.4.1-0.20220510155433-a0cc1629b1df/go.mod h1:Cf2wAFtq7OUj4RUHcSQtcAYgAspP06wQseKZwtCJRXQ=
|
||||
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=
|
||||
@@ -32,16 +32,18 @@ github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
|
||||
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
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.4.0 h1:4KrtewnmAChrZjPA7/QYc72t+vvsKF+DYB0q1iRPdpo=
|
||||
github.com/fumiama/go-base16384 v1.4.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
|
||||
github.com/fumiama/go-registry v0.1.5 h1:5a7n+JwwKQrnW3U0+gOKSx+2x4Zv+2A3BhyQthJL4Ng=
|
||||
github.com/fumiama/go-registry v0.1.5/go.mod h1:dIUVbiOgfk9oZcsgwDvNLC72i+ctibVukSXR/9bLviI=
|
||||
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-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=
|
||||
github.com/fumiama/gofastTEA v0.0.10/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk=
|
||||
github.com/fumiama/gotracemoe v0.0.3 h1:iI5EbE9A3UUbfukG6+/soYPjp1S31eCNYf4tw7s6/Jc=
|
||||
github.com/fumiama/gotracemoe v0.0.3/go.mod h1:tyqahdUzHf0bQIAVY/GYmDWvYYe5ik1ZbhnGYh+zl40=
|
||||
github.com/fumiama/sqlite3 v1.14.6 h1:+e+iygyiDXQJVi7xeXIviBvR7hAc5y20WA9hRwfKn10=
|
||||
github.com/fumiama/sqlite3 v1.14.6/go.mod h1:Xx9a2/OtHuy9pBjow0N+bE/RhNeZ7zZz5xh25vqbA5A=
|
||||
github.com/gabriel-vasile/mimetype v1.0.4 h1:uBejfH8l3/2f+5vjl1e4xIaSyNEhRBZ5N/ij7ohpNd8=
|
||||
github.com/gabriel-vasile/mimetype v1.0.4/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
@@ -51,9 +53,8 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZ
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
||||
@@ -66,18 +67,18 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
|
||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jozsefsallai/gophersauce v1.0.1 h1:BA3ovtQRrAb1qYU9JoRLbDHpxnDunlNcEkEfhCvDDCM=
|
||||
github.com/jozsefsallai/gophersauce v1.0.1/go.mod h1:YVEI7djliMTmZ1Vh01YPF8bUHi+oKhe3yXgKf1T49vg=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
|
||||
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/lufia/plan9stats v0.0.0-20220326011226-f1430873d8db h1:m2s7Fwo4OwmcheIWUc/Nw9/MZ0eFtP3to0ovTpqOiCQ=
|
||||
github.com/lufia/plan9stats v0.0.0-20220326011226-f1430873d8db/go.mod h1:VgrrWVwBO2+6XKn8ypT3WUqvoxCa8R2M5to2tRzGovI=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
|
||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
||||
github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0=
|
||||
github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mroth/weightedrand v0.4.1 h1:rHcbUBopmi/3x4nnrvwGJBhX9d0vk+KgoLUZeDP6YyI=
|
||||
github.com/mroth/weightedrand v0.4.1/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||
@@ -86,9 +87,8 @@ github.com/pkumza/numcn v1.0.0 h1:ZT5cf9IJkUZgRgEtCiNNykk0RwsrKXSTsvDHOwUTzgE=
|
||||
github.com/pkumza/numcn v1.0.0/go.mod h1:QSeH+al9dWCd8di5HZM/ZqHqhZmUKfph572e9Ev/ETc=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkBTKvR5gQLgA3e0hqjkY9u1wm+iOL45VN/qI=
|
||||
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/shirou/gopsutil/v3 v3.22.3 h1:UebRzEomgMpv61e3hgD1tGooqX5trFbdU/ehphbHd00=
|
||||
@@ -99,8 +99,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/tidwall/gjson v1.14.0 h1:6aeJ0bzojgWLa82gDQHcx3S0Lr/O51I9bJ5nv6JFx5w=
|
||||
github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
|
||||
github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
@@ -111,8 +111,8 @@ github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//
|
||||
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
|
||||
github.com/wcharczuk/go-chart/v2 v2.1.0 h1:tY2slqVQ6bN+yHSnDYwZebLQFkphK4WNrVwnt7CJZ2I=
|
||||
github.com/wcharczuk/go-chart/v2 v2.1.0/go.mod h1:yx7MvAVNcP/kN9lKXM/NTce4au4DFN99j6i1OwDclNA=
|
||||
github.com/wdvxdr1123/ZeroBot v1.5.0-mid.0.20220415071800-9e52436ab5c0 h1:SoNu5MZZsbleecVCBth/s610wLXWKIr18KADhZURCDw=
|
||||
github.com/wdvxdr1123/ZeroBot v1.5.0-mid.0.20220415071800-9e52436ab5c0/go.mod h1:K2vu0mslV8s4qhIAu/a03Z7YW24qjM0j3imIR+k21KI=
|
||||
github.com/wdvxdr1123/ZeroBot v1.5.2-0.20220509035736-f3ad8fa960d7 h1:GDJ+ZhbaGGBdlaT6qljgt61A/rlZdrNtA5fQyb5uVP4=
|
||||
github.com/wdvxdr1123/ZeroBot v1.5.2-0.20220509035736-f3ad8fa960d7/go.mod h1:LJ+VOf523i3IrykuLK53UEeWqnAclRL5d2wGT4sS4Zk=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
|
||||
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
@@ -120,8 +120,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 h1:LRtI4W37N+KFebI/qV0OFiLUv4GLOWeEW5hn/KEJvxE=
|
||||
@@ -133,9 +133,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
|
||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -169,8 +168,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
@@ -188,8 +187,6 @@ modernc.org/cc/v3 v3.35.17/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g
|
||||
modernc.org/cc/v3 v3.35.18/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.35.20/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.35.22/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
|
||||
modernc.org/cc/v3 v3.35.24/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
|
||||
modernc.org/cc/v3 v3.35.25/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
|
||||
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
|
||||
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
|
||||
modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI=
|
||||
@@ -231,13 +228,7 @@ modernc.org/ccgo/v3 v3.13.1/go.mod h1:aBYVOUfIlcSnrsRVU8VRS35y2DIfpgkmVkYZ0tpIXi
|
||||
modernc.org/ccgo/v3 v3.15.9/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0=
|
||||
modernc.org/ccgo/v3 v3.15.10/go.mod h1:wQKxoFn0ynxMuCLfFD09c8XPUCc8obfchoVR9Cn0fI8=
|
||||
modernc.org/ccgo/v3 v3.15.12/go.mod h1:VFePOWoCd8uDGRJpq/zfJ29D0EVzMSyID8LCMWYbX6I=
|
||||
modernc.org/ccgo/v3 v3.15.14/go.mod h1:144Sz2iBCKogb9OKwsu7hQEub3EVgOlyI8wMUPGKUXQ=
|
||||
modernc.org/ccgo/v3 v3.15.15/go.mod h1:z5qltXjU4PJl0pE5nhYQCvA9DhPHiWsl5GWl89+NSYE=
|
||||
modernc.org/ccgo/v3 v3.15.16/go.mod h1:XbKRMeMWMdq712Tr5ECgATYMrzJ+g9zAZEj2ktzBe24=
|
||||
modernc.org/ccgo/v3 v3.15.17/go.mod h1:bofnFkpRFf5gLY+mBZIyTW6FEcp26xi2lgOFk2Rlvs0=
|
||||
modernc.org/ccgo/v3 v3.15.19/go.mod h1:TDJj+DxR26pkDteH2E5WQDj/xlmtsX7JdzkJkaZhOVU=
|
||||
modernc.org/ccorpus v1.11.1/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
|
||||
modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
|
||||
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
|
||||
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
|
||||
@@ -281,23 +272,16 @@ modernc.org/libc v1.14.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk=
|
||||
modernc.org/libc v1.14.2/go.mod h1:MX1GBLnRLNdvmK9azU9LCxZ5lMyhrbEMK8rG3X/Fe34=
|
||||
modernc.org/libc v1.14.3/go.mod h1:GPIvQVOVPizzlqyRX3l756/3ppsAgg1QgPxjr5Q4agQ=
|
||||
modernc.org/libc v1.14.5/go.mod h1:2PJHINagVxO4QW/5OQdRrvMYo+bm5ClpUFfyXCYl9ak=
|
||||
modernc.org/libc v1.14.6 h1:SSiZiE5199iYsGM9gtkDj90xqcXVwubWG8CtoYE+Mnk=
|
||||
modernc.org/libc v1.14.6/go.mod h1:2PJHINagVxO4QW/5OQdRrvMYo+bm5ClpUFfyXCYl9ak=
|
||||
modernc.org/libc v1.14.7/go.mod h1:f8xfWXW8LW41qb4X5+huVQo5dcfPlq7Cbny2TDheMv0=
|
||||
modernc.org/libc v1.14.8/go.mod h1:9+JCLb1MWSY23smyOpIPbd5ED+rSS/ieiDWUpdyO3mo=
|
||||
modernc.org/libc v1.14.10/go.mod h1:y1MtIWhwpJFpLYm6grAThtuXJKEsY6xkdZmXbRngIdo=
|
||||
modernc.org/libc v1.14.12/go.mod h1:fJdoe23MHu2ruPQkFPPqCpToDi5cckzsbmkI6Ez0LqQ=
|
||||
modernc.org/libc v1.15.0 h1:/CTHjQ1QO5mkLDeQICuA9Vh0YvhQTMqtCF2urQTaod8=
|
||||
modernc.org/libc v1.15.0/go.mod h1:H1OKCu+NYa9+uQG8WsP7DndMBP61I4PWH8ivWhbdoWQ=
|
||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
|
||||
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
|
||||
modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14=
|
||||
modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM=
|
||||
modernc.org/memory v1.0.6/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw=
|
||||
modernc.org/memory v1.0.7 h1:UE3cxTRFa5tfUibAV7Jqq8P7zRY0OlJg+yWVIIaluEE=
|
||||
modernc.org/memory v1.0.7/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw=
|
||||
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
|
||||
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
var (
|
||||
info = [...]string{
|
||||
"* OneBot + ZeroBot + Golang",
|
||||
"* Version 1.3.3-beta6 - 2022-04-16 00:34:43 +0800 CST",
|
||||
"* Version 1.4.0-beta7 - 2022-05-12 12:37:47 +0800 CST",
|
||||
"* Copyright © 2020 - 2022 FloatTech. All Rights Reserved.",
|
||||
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
|
||||
}
|
||||
|
||||
3
main.go
3
main.go
@@ -57,7 +57,6 @@ import (
|
||||
// vvvvvvvvvvvvvv //
|
||||
// vvvv //
|
||||
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/acgimage" // 随机图片与AI点评
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/ai_false" // 服务器监控
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/b14" // base16384加解密
|
||||
@@ -97,6 +96,7 @@ import (
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图
|
||||
@@ -105,6 +105,7 @@ import (
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
// Package acgimage 随机图片与AI点评
|
||||
package acgimage
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/classify"
|
||||
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/img/pool"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
)
|
||||
|
||||
const (
|
||||
lolipxy = "https://sayuri.fumiama.top/dice?class=0&loli=true&r18=true"
|
||||
apihead = "https://sayuri.fumiama.top/img?path="
|
||||
apiheadv6 = "http://aikae.v6.army:62002/img?arg=get&name="
|
||||
)
|
||||
|
||||
var (
|
||||
// r18有一定保护,一般不会发出图片
|
||||
randapi = "&loli=true&r18=true"
|
||||
msgof = make(map[int64]message.MessageID)
|
||||
block = false
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
engine := control.Register("acgimage", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "随机图片与AI点评\n" +
|
||||
"- 随机图片(评级大于6的图将私发)\n" +
|
||||
"- 直接随机(无r18检测,务必小心,仅管理可用)\n" +
|
||||
"- 设置随机图片网址[url]\n" +
|
||||
"- 太涩了(撤回最近发的图)\n" +
|
||||
"- 评价图片(发送一张图片让bot评分)",
|
||||
}).ApplySingle(ctxext.DefaultSingle)
|
||||
engine.OnRegex(`^设置随机图片网址(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
url := ctx.State["regex_matched"].([]string)[1]
|
||||
if !strings.HasPrefix(url, "http") {
|
||||
ctx.SendChain(message.Text("URL非法!"))
|
||||
} else {
|
||||
randapi = url
|
||||
ctx.SendChain(message.Text("设置好啦"))
|
||||
}
|
||||
})
|
||||
// 有保护的随机图片
|
||||
engine.OnFullMatch("随机图片", zero.OnlyGroup).Limit(ctxext.LimitByUser).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
class, dhash, _, err := classify.Classify(randapi, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
err = reply(ctx, class, dhash, classify.Comments[class])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
})
|
||||
// 直接随机图片,无r18保护,后果自负。如果出r18图可尽快通过发送"太涩了"撤回
|
||||
engine.OnFullMatch("直接随机", zero.UserOrGrpAdmin).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if block {
|
||||
ctx.SendChain(message.Text("请稍后再试哦"))
|
||||
} else if randapi != "" {
|
||||
block = true
|
||||
var url string
|
||||
if randapi[0] == '&' {
|
||||
url = lolipxy
|
||||
} else {
|
||||
url = randapi
|
||||
}
|
||||
setLastMsg(ctx.Event.GroupID, message.NewMessageIDFromInteger(
|
||||
ctx.SendGroupForwardMessage(ctx.Event.GroupID,
|
||||
message.Message{
|
||||
ctxext.FakeSenderForwardNode(ctx,
|
||||
message.Image(url).Add("cache", "0"),
|
||||
),
|
||||
}).Get("message_id").Int()))
|
||||
block = false
|
||||
}
|
||||
})
|
||||
// 撤回最后的直接随机图片
|
||||
engine.OnFullMatch("太涩了", zero.OnlyGroup).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
msg, ok := msgof[ctx.Event.GroupID]
|
||||
if ok {
|
||||
ctx.DeleteMessage(msg)
|
||||
delete(msgof, ctx.Event.GroupID)
|
||||
}
|
||||
})
|
||||
// 上传一张图进行评价
|
||||
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, zero.MustProvidePicture).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text("少女祈祷中..."))
|
||||
url := ctx.State["image_url"].([]string)[0]
|
||||
class, _, _, err := classify.Classify(url, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(classify.Comments[class]))
|
||||
})
|
||||
engine.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
dhash := ctx.State["regex_matched"].([]string)[1]
|
||||
if len(dhash) == 5*3 {
|
||||
var u string
|
||||
if web.IsSupportIPv6 {
|
||||
u = apiheadv6 + dhash + ".webp"
|
||||
} else {
|
||||
u = apihead + dhash
|
||||
}
|
||||
|
||||
err := pool.SendRemoteImageFromPool(dhash, u, ctxext.Send(ctx), ctxext.GetMessage(ctx))
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func setLastMsg(id int64, msg message.MessageID) {
|
||||
msgof[id] = msg
|
||||
}
|
||||
|
||||
func reply(ctx *zero.Ctx, class int, dhash string, comment string) error {
|
||||
b14, err := url.QueryUnescape(dhash)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var u string
|
||||
if web.IsSupportIPv6 {
|
||||
u = apiheadv6 + dhash + ".webp"
|
||||
} else {
|
||||
u = apihead + dhash
|
||||
}
|
||||
|
||||
var send ctxext.NoCtxSendMsg
|
||||
if class > 5 {
|
||||
send = ctxext.SendTo(ctx, ctx.Event.UserID)
|
||||
if dhash != "" {
|
||||
ctx.SendChain(message.Text(comment + "\n给你点提示哦:" + b14))
|
||||
} else {
|
||||
ctx.SendChain(message.Text(comment))
|
||||
}
|
||||
} else {
|
||||
send = func(msg interface{}) int64 {
|
||||
return ctx.SendGroupForwardMessage(ctx.Event.GroupID, message.Message{
|
||||
ctxext.FakeSenderForwardNode(ctx, append(
|
||||
msg.(message.Message),
|
||||
message.Text(comment))...,
|
||||
),
|
||||
}).Get("message_id").Int()
|
||||
}
|
||||
}
|
||||
|
||||
return pool.SendRemoteImageFromPool(b14, u, send, func(i int64) zero.Message {
|
||||
if class > 5 {
|
||||
return ctxext.GetMessage(ctx)(i)
|
||||
}
|
||||
return ctxext.GetFirstMessageInForward(ctx)(i)
|
||||
})
|
||||
}
|
||||
@@ -60,9 +60,13 @@ func init() {
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
msg := ctx.ExtractPlainText()
|
||||
r := aireply.NewAIReply(getReplyMode(ctx))
|
||||
tts := t.new(t.getSoundMode(ctx))
|
||||
tts, err := t.new(t.getSoundMode(ctx))
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if tts != nil {
|
||||
ctx.SendChain(message.Record(tts.Speak(ctx.Event.UserID, func() string {
|
||||
rec, err := tts.Speak(ctx.Event.UserID, func() string {
|
||||
reply := r.TalkPlain(msg, zero.BotConfig.NickName[0])
|
||||
reply = re.ReplaceAllStringFunc(reply, func(s string) string {
|
||||
f, err := strconv.ParseFloat(s, 64)
|
||||
@@ -74,7 +78,10 @@ func init() {
|
||||
})
|
||||
log.Debugln("[tts]:", reply)
|
||||
return reply
|
||||
})))
|
||||
})
|
||||
if err == nil {
|
||||
ctx.SendChain(message.Record(rec))
|
||||
}
|
||||
}
|
||||
})
|
||||
engine.OnRegex(`^设置语音模式(.*)$`, ctxext.FirstValueInList(t)).SetBlock(true).
|
||||
@@ -96,7 +103,7 @@ func init() {
|
||||
}
|
||||
|
||||
// new 语音简单工厂
|
||||
func (t *ttsInstances) new(name string) (ts tts.TTS) {
|
||||
func (t *ttsInstances) new(name string) (ts tts.TTS, err error) {
|
||||
t.RLock()
|
||||
ts = t.m[name]
|
||||
t.RUnlock()
|
||||
@@ -104,11 +111,11 @@ func (t *ttsInstances) new(name string) (ts tts.TTS) {
|
||||
switch name {
|
||||
case "拟声鸟阿梓":
|
||||
t.Lock()
|
||||
ts, _ = mockingbird.NewMockingBirdTTS(0)
|
||||
ts, err = mockingbird.NewMockingBirdTTS(0)
|
||||
t.Unlock()
|
||||
case "拟声鸟药水哥":
|
||||
t.Lock()
|
||||
ts, _ = mockingbird.NewMockingBirdTTS(1)
|
||||
ts, err = mockingbird.NewMockingBirdTTS(1)
|
||||
t.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package bilibili
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
@@ -86,14 +85,14 @@ func followings(uid string) (s string, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
json := gjson.ParseBytes(body)
|
||||
s = json.Get("data.list.#.uname").Raw
|
||||
if json.Get("code").Int() == -101 {
|
||||
j := gjson.ParseBytes(body)
|
||||
s = j.Get("data.list.#.uname").Raw
|
||||
if j.Get("code").Int() == -101 {
|
||||
err = errNeedCookie
|
||||
return
|
||||
}
|
||||
if json.Get("code").Int() != 0 {
|
||||
err = errors.New(json.Get("message").String())
|
||||
if j.Get("code").Int() != 0 {
|
||||
err = errors.New(j.Get("message").String())
|
||||
return
|
||||
}
|
||||
return
|
||||
@@ -104,6 +103,7 @@ type userinfo struct {
|
||||
Mid string `json:"mid"`
|
||||
Face string `json:"face"`
|
||||
Fans int64 `json:"fans"`
|
||||
Regtime int64 `json:"regtime"`
|
||||
Attentions []int64 `json:"attentions"`
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ func medalwall(uid string) (result []medal, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
fmt.Println("medalwall:", binary.BytesToString(data))
|
||||
j := gjson.ParseBytes(data)
|
||||
if j.Get("code").Int() == -101 {
|
||||
err = errNeedCookie
|
||||
|
||||
@@ -4,8 +4,11 @@ package bilibili
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -33,6 +36,7 @@ var engine = control.Register("bilibili", &control.Options{
|
||||
"- 更新vup",
|
||||
PublicDataFolder: "Bilibili",
|
||||
})
|
||||
var re = regexp.MustCompile(`^\d+$`)
|
||||
|
||||
// 查成分的
|
||||
func init() {
|
||||
@@ -41,9 +45,8 @@ func init() {
|
||||
_ = os.MkdirAll(cachePath, 0755)
|
||||
var getdb = ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
var err error
|
||||
dbfile := engine.DataFolder() + "bilibili.db"
|
||||
_, _ = file.GetLazyData(dbfile, false, false)
|
||||
vdb, err = initialize(dbfile)
|
||||
_, _ = engine.GetLazyData("bilibili.db", false)
|
||||
vdb, err = initialize(engine.DataFolder() + "bilibili.db")
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -103,15 +106,9 @@ func init() {
|
||||
))
|
||||
})
|
||||
|
||||
engine.OnRegex(`^查成分\s?(.{1,25})$`, getdb).SetBlock(true).
|
||||
engine.OnRegex(`^查成分\s?(.{1,25})$`, getdb, getPara).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
keyword := ctx.State["regex_matched"].([]string)[1]
|
||||
searchRes, err := search(keyword)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
id := strconv.FormatInt(searchRes[0].Mid, 10)
|
||||
id := ctx.State["uid"].(string)
|
||||
today := time.Now().Format("20060102")
|
||||
drawedFile := cachePath + id + today + "vupLike.png"
|
||||
if file.IsExist(drawedFile) {
|
||||
@@ -153,35 +150,36 @@ func init() {
|
||||
i--
|
||||
}
|
||||
}
|
||||
facePath := cachePath + id + "vupFace.png"
|
||||
err = initFacePic(facePath, u.Face)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
facePath := cachePath + id + "vupFace" + path.Ext(u.Face)
|
||||
backX := 500
|
||||
backY := 500
|
||||
var back image.Image
|
||||
if path.Ext(u.Face) != ".webp" {
|
||||
err = initFacePic(facePath, u.Face)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
back, err = gg.LoadImage(facePath)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
back = img.Size(back, backX, backY).Im
|
||||
}
|
||||
var backX int
|
||||
var backY int
|
||||
back, err := gg.LoadImage(facePath)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
back = img.Limit(back, 500, 500)
|
||||
backX = back.Bounds().Size().X
|
||||
backY = back.Bounds().Size().Y
|
||||
if len(vups) > 50 {
|
||||
ctx.SendChain(message.Text(u.Name + "关注的up主太多了,只展示前50个up"))
|
||||
vups = vups[:50]
|
||||
}
|
||||
canvas := gg.NewContext(backX*3, int(float64(backY)*(1.1+float64(len(vups))/3)))
|
||||
fontSize := float64(backX) * 0.1
|
||||
canvas := gg.NewContext(1500, int(500*(1.1+float64(len(vups))/3)))
|
||||
fontSize := 50.0
|
||||
canvas.SetColor(color.White)
|
||||
canvas.Clear()
|
||||
if back != nil {
|
||||
canvas.DrawImage(back, 0, 0)
|
||||
}
|
||||
canvas.SetColor(color.Black)
|
||||
_, err = file.GetLazyData(text.BoldFontFile, false, true)
|
||||
_, err = file.GetLazyData(text.BoldFontFile, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
}
|
||||
@@ -192,16 +190,18 @@ func init() {
|
||||
sl, _ := canvas.MeasureString("好")
|
||||
length, h := canvas.MeasureString(u.Mid)
|
||||
n, _ := canvas.MeasureString(u.Name)
|
||||
canvas.DrawString(u.Name, float64(backX)*1.1, float64(backY)/3-h)
|
||||
canvas.DrawRoundedRectangle(float64(backX)*1.2+n-length*0.1, float64(backY)/3-h*2.5, length*1.2, h*2, fontSize*0.2)
|
||||
canvas.DrawString(u.Name, 550, 160-h)
|
||||
canvas.DrawRoundedRectangle(600+n-length*0.1, 160-h*2.5, length*1.2, h*2, fontSize*0.2)
|
||||
canvas.SetRGB255(221, 221, 221)
|
||||
canvas.Fill()
|
||||
canvas.SetColor(color.Black)
|
||||
canvas.DrawString(u.Mid, float64(backX)*1.2+n, float64(backY)/3-h)
|
||||
canvas.DrawString(fmt.Sprintf("粉丝:%d", u.Fans), float64(backX)*1.1, float64(backY)/3*2-2.5*h)
|
||||
canvas.DrawString(fmt.Sprintf("关注:%d", len(u.Attentions)), float64(backX)*2, float64(backY)/3*2-2.5*h)
|
||||
canvas.DrawString(fmt.Sprintf("管人痴成分:%.2f%%(%d/%d)", float64(vupLen)/float64(len(u.Attentions))*100, vupLen, len(u.Attentions)), float64(backX)*1.1, float64(backY)-4*h)
|
||||
canvas.DrawString("日期:"+time.Now().Format("2006-01-02"), float64(backX)*1.1, float64(backY)-h)
|
||||
canvas.DrawString(u.Mid, 600+n, 160-h)
|
||||
canvas.DrawString(fmt.Sprintf("粉丝:%d", u.Fans), 550, 240-h)
|
||||
canvas.DrawString(fmt.Sprintf("关注:%d", len(u.Attentions)), 1000, 240-h)
|
||||
canvas.DrawString(fmt.Sprintf("管人痴成分:%.2f%%(%d/%d)", float64(vupLen)/float64(len(u.Attentions))*100, vupLen, len(u.Attentions)), 550, 320-h)
|
||||
regtime := time.Unix(u.Regtime, 0).Format("2006-01-02 15:04:05")
|
||||
canvas.DrawString("注册日期:"+regtime, 550, 400-h)
|
||||
canvas.DrawString("查询日期:"+time.Now().Format("2006-01-02"), 550, 480-h)
|
||||
for i, v := range vups {
|
||||
if i%2 == 1 {
|
||||
canvas.SetRGB255(245, 245, 245)
|
||||
@@ -221,9 +221,9 @@ func init() {
|
||||
mnl, _ := canvas.MeasureString(m.MedalName)
|
||||
grad := gg.NewLinearGradient(nl+ml-sl/2+float64(backX)*0.4, float64(backY)*1.1+float64(i+1)*float64(backY)/3-3.5*h, nl+ml+mnl+sl/2+float64(backX)*0.4, float64(backY)*1.1+float64(i+1)*float64(backY)/3-1.5*h)
|
||||
r, g, b := int2rbg(m.MedalColorStart)
|
||||
grad.AddColorStop(0, color.RGBA{uint8(r), uint8(g), uint8(b), 255})
|
||||
grad.AddColorStop(0, color.RGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 255})
|
||||
r, g, b = int2rbg(m.MedalColorEnd)
|
||||
grad.AddColorStop(1, color.RGBA{uint8(r), uint8(g), uint8(b), 255})
|
||||
grad.AddColorStop(1, color.RGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 255})
|
||||
canvas.SetFillStyle(grad)
|
||||
canvas.SetLineWidth(4)
|
||||
canvas.MoveTo(nl+ml-sl/2+float64(backX)*0.4, float64(backY)*1.1+float64(i+1)*float64(backY)/3-3.5*h)
|
||||
@@ -307,3 +307,51 @@ func int2rbg(t int64) (int64, int64, int64) {
|
||||
b, g, r := int64(buf[0]), int64(buf[1]), int64(buf[2])
|
||||
return r, g, b
|
||||
}
|
||||
|
||||
func getPara(ctx *zero.Ctx) bool {
|
||||
keyword := ctx.State["regex_matched"].([]string)[1]
|
||||
if !re.MatchString(keyword) {
|
||||
searchRes, err := search(keyword)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
ctx.State["uid"] = strconv.FormatInt(searchRes[0].Mid, 10)
|
||||
return true
|
||||
}
|
||||
next := zero.NewFutureEvent("message", 999, false, ctx.CheckSession())
|
||||
recv, cancel := next.Repeat()
|
||||
defer cancel()
|
||||
ctx.SendChain(message.Text("输入为纯数字,请选择查询uid还是用户名,输入对应序号:\n0. 查询uid\n1. 查询用户名"))
|
||||
for {
|
||||
select {
|
||||
case <-time.After(time.Second * 10):
|
||||
ctx.SendChain(message.Text("时间太久啦!", zero.BotConfig.NickName[0], "帮你选择查询uid"))
|
||||
ctx.State["uid"] = keyword
|
||||
return true
|
||||
case c := <-recv:
|
||||
msg := c.Event.Message.ExtractPlainText()
|
||||
num, err := strconv.Atoi(msg)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("请输入数字!"))
|
||||
continue
|
||||
}
|
||||
if num < 0 || num > 1 {
|
||||
ctx.SendChain(message.Text("序号非法!"))
|
||||
continue
|
||||
}
|
||||
if num == 0 {
|
||||
ctx.State["uid"] = keyword
|
||||
return true
|
||||
} else if num == 1 {
|
||||
searchRes, err := search(keyword)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
ctx.State["uid"] = strconv.FormatInt(searchRes[0].Mid, 10)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,10 +94,7 @@ func updateVup() error {
|
||||
uname := value.Get("uname").String()
|
||||
roomid := value.Get("roomid").Int()
|
||||
err = vdb.insertVupByMid(mid, uname, roomid)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return err == nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package bilibiliparse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -51,9 +50,7 @@ func parseURL(bilibiliURL string) (m message.Message, err error) {
|
||||
title := htmlquery.FindOne(doc, "//*[@id='viewbox_report']/h1/span/text()").Data
|
||||
m = append(m, message.Text(title+"\n"))
|
||||
upName := strings.TrimSpace(htmlquery.FindOne(doc, "//*[@id='v_upinfo']/div[2]/div[1]/a[1]/text()").Data)
|
||||
fmt.Println(upName)
|
||||
fanNumber := htmlquery.InnerText(htmlquery.FindOne(doc, "//i[@class='van-icon-general_addto_s']").NextSibling.NextSibling)
|
||||
fmt.Println(fanNumber)
|
||||
m = append(m, message.Text("up:"+upName+",粉丝:"+fanNumber+"\n"))
|
||||
view := htmlquery.FindOne(doc, "//*[@id='viewbox_report']/div/span[@class='view']/text()").Data
|
||||
dm := htmlquery.FindOne(doc, "//*[@id='viewbox_report']/div/span[@class='dm']/text()").Data
|
||||
|
||||
@@ -205,12 +205,10 @@ func init() {
|
||||
gid = -ctx.Event.UserID
|
||||
}
|
||||
bpl := bdb.getAllPushByGroup(gid)
|
||||
fmt.Println(bpl)
|
||||
msg := "--------b站推送列表--------"
|
||||
for _, v := range bpl {
|
||||
if _, ok := upMap[v.BilibiliUID]; !ok {
|
||||
bdb.updateAllUp()
|
||||
fmt.Println(upMap)
|
||||
}
|
||||
msg += fmt.Sprintf("\nuid:%-12d 动态:", v.BilibiliUID)
|
||||
if v.DynamicDisable == 0 {
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/FloatTech/zbputils/binary"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img/text"
|
||||
)
|
||||
|
||||
@@ -21,10 +20,9 @@ func init() {
|
||||
})
|
||||
|
||||
getdb := ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
dbpath := engine.DataFolder()
|
||||
db.DBPath = dbpath + "bookreview.db"
|
||||
db.DBPath = engine.DataFolder() + "bookreview.db"
|
||||
// os.RemoveAll(dbpath)
|
||||
_, _ = file.GetLazyData(db.DBPath, false, true)
|
||||
_, _ = engine.GetLazyData("bookreview.db", true)
|
||||
err := db.Create("bookreview", &book{})
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -20,10 +19,9 @@ func init() {
|
||||
|
||||
en.OnRegex("^抽象翻译((\\s|[\\r\\n]|[\\p{Han}\\p{P}A-Za-z0-9])+)$",
|
||||
ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
dbpath := en.DataFolder()
|
||||
db.DBPath = dbpath + "cxh.db"
|
||||
db.DBPath = en.DataFolder() + "cxh.db"
|
||||
// os.RemoveAll(dbpath)
|
||||
_, _ = file.GetLazyData(db.DBPath, false, true)
|
||||
_, _ = en.GetLazyData("cxh.db", true)
|
||||
err := db.Create("pinyin", &pinyin{})
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/math"
|
||||
)
|
||||
|
||||
@@ -22,10 +21,9 @@ func init() {
|
||||
})
|
||||
|
||||
getdb := ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
dbpath := engine.DataFolder()
|
||||
db.DBPath = dbpath + "cp.db"
|
||||
db.DBPath = engine.DataFolder() + "cp.db"
|
||||
// os.RemoveAll(dbpath)
|
||||
_, _ = file.GetLazyData(db.DBPath, false, true)
|
||||
_, _ = engine.GetLazyData("cp.db", true)
|
||||
err := db.Create("cp_story", &cpstory{})
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
)
|
||||
|
||||
@@ -25,9 +24,8 @@ func init() {
|
||||
})
|
||||
|
||||
getdb := ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
dbpath := engine.DataFolder()
|
||||
db.DBPath = dbpath + "curse.db"
|
||||
_, err := file.GetLazyData(db.DBPath, false, true)
|
||||
db.DBPath = engine.DataFolder() + "curse.db"
|
||||
_, err := engine.GetLazyData("curse.db", true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/danbooru"
|
||||
"github.com/FloatTech/AnimeAPI/saucenao"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img/writer"
|
||||
@@ -30,14 +29,7 @@ func init() { // 插件主体
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text("少女祈祷中..."))
|
||||
for _, url := range ctx.State["image_url"].([]string) {
|
||||
name := ""
|
||||
r, err := saucenao.SauceNAO(url)
|
||||
if err != nil {
|
||||
name = "未知图片"
|
||||
} else {
|
||||
name = r[0].Title
|
||||
}
|
||||
t, err := danbooru.TagURL(name, url)
|
||||
t, err := danbooru.TagURL("", url)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
|
||||
@@ -20,7 +20,7 @@ type text struct {
|
||||
|
||||
// LoadText 加载小作文
|
||||
func LoadText(dbfile string) error {
|
||||
_, err := file.GetLazyData(dbfile, false, false)
|
||||
_, err := file.GetLazyData(dbfile, false)
|
||||
db.DBPath = dbfile
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
"github.com/FloatTech/zbputils/binary"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
@@ -15,12 +14,14 @@ import (
|
||||
|
||||
const (
|
||||
servicename = "epidemic"
|
||||
txurl = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"
|
||||
txurl = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf"
|
||||
)
|
||||
|
||||
// result 疫情查询结果
|
||||
type result struct {
|
||||
Data string `json:"data"`
|
||||
Data struct {
|
||||
Epidemic epidemic `json:"diseaseh5Shelf"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
// epidemic 疫情数据
|
||||
@@ -33,8 +34,8 @@ type epidemic struct {
|
||||
type area struct {
|
||||
Name string `json:"name"`
|
||||
Today struct {
|
||||
Confirm int `json:"confirm"`
|
||||
Wzzadd int `json:"wzz_add"`
|
||||
Confirm int `json:"confirm"`
|
||||
Wzzadd interface{} `json:"wzz_add"`
|
||||
} `json:"today"`
|
||||
Total struct {
|
||||
NowConfirm int `json:"nowConfirm"`
|
||||
@@ -116,11 +117,6 @@ func queryEpidemic(findCityName string) (citydata *area, times string, err error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var e epidemic
|
||||
err = json.Unmarshal(binary.StringToBytes(r.Data), &e)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
citydata = rcity(e.AreaTree[0], findCityName)
|
||||
return citydata, e.LastUpdateTime, nil
|
||||
citydata = rcity(r.Data.Epidemic.AreaTree[0], findCityName)
|
||||
return citydata, r.Data.Epidemic.LastUpdateTime, nil
|
||||
}
|
||||
|
||||
@@ -8,10 +8,8 @@ import (
|
||||
"encoding/json"
|
||||
"image"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/fogleman/gg" // 注册了 jpg png gif
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -40,7 +38,7 @@ const (
|
||||
|
||||
var (
|
||||
// 底图类型列表
|
||||
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹", "李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想", "战双", "阴阳师", "赛马娘", "东方归言录", "奇异恩典"}
|
||||
table = [...]string{"车万", "DC4", "爱因斯坦", "星空列车", "樱云之恋", "富婆妹", "李清歌", "公主连结", "原神", "明日方舟", "碧蓝航线", "碧蓝幻想", "战双", "阴阳师", "赛马娘", "东方归言录", "奇异恩典", "夏日口袋"}
|
||||
// 映射底图与 index
|
||||
index = make(map[string]uint8)
|
||||
// 签文
|
||||
@@ -53,7 +51,7 @@ func init() {
|
||||
DisableOnDefault: false,
|
||||
Help: "每日运势: \n" +
|
||||
"- 运势 | 抽签\n" +
|
||||
"- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘 | 东方归言录 | 奇异恩典]",
|
||||
"- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘 | 东方归言录 | 奇异恩典 | 夏日口袋]",
|
||||
PublicDataFolder: "Fortune",
|
||||
})
|
||||
_ = os.RemoveAll(cache)
|
||||
@@ -90,7 +88,7 @@ func init() {
|
||||
})
|
||||
en.OnFullMatchGroup([]string{"运势", "抽签"}, ctxext.DoOnceOnSuccess(
|
||||
func(ctx *zero.Ctx) bool {
|
||||
data, err := file.GetLazyData(omikujson, true, false)
|
||||
data, err := file.GetLazyData(omikujson, false)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -100,7 +98,7 @@ func init() {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
_, err = file.GetLazyData(font, false, true)
|
||||
_, err = file.GetLazyData(font, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -126,25 +124,22 @@ func init() {
|
||||
}
|
||||
// 检查背景图片是否存在
|
||||
zipfile := images + kind + ".zip"
|
||||
_, err := file.GetLazyData(zipfile, false, false)
|
||||
_, err := file.GetLazyData(zipfile, false)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
|
||||
// 生成种子
|
||||
t, _ := strconv.ParseInt(time.Now().Format("20060102"), 10, 64)
|
||||
seed := ctx.Event.UserID + t
|
||||
|
||||
// 随机获取背景
|
||||
background, index, err := randimage(zipfile, seed)
|
||||
background, index, err := randimage(zipfile, ctx)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
|
||||
// 随机获取签文
|
||||
title, text := randtext(seed)
|
||||
randtextindex := ctxext.RandSenderPerDayN(ctx, 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[:])
|
||||
|
||||
@@ -166,18 +161,16 @@ func init() {
|
||||
|
||||
// @function randimage 随机选取zip内的文件
|
||||
// @param path zip路径
|
||||
// @param seed 随机数种子
|
||||
// @param ctx *zero.Ctx
|
||||
// @return 文件路径 & 错误信息
|
||||
func randimage(path string, seed int64) (im image.Image, index int, err error) {
|
||||
func randimage(path string, ctx *zero.Ctx) (im image.Image, index int, err error) {
|
||||
reader, err := zip.OpenReader(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer reader.Close()
|
||||
|
||||
r := rand.New(rand.NewSource(seed))
|
||||
index = r.Intn(len(reader.File))
|
||||
file := reader.File[index]
|
||||
file := reader.File[ctxext.RandSenderPerDayN(ctx, len(reader.File))]
|
||||
f, err := file.Open()
|
||||
if err != nil {
|
||||
return
|
||||
@@ -188,16 +181,6 @@ func randimage(path string, seed int64) (im image.Image, index int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// @function randtext 随机选取签文
|
||||
// @param file 文件路径
|
||||
// @param seed 随机数种子
|
||||
// @return 签名 & 签文 & 错误信息
|
||||
func randtext(seed int64) (string, string) {
|
||||
r := rand.New(rand.NewSource(seed))
|
||||
i := r.Intn(len(omikujis))
|
||||
return omikujis[i]["title"], omikujis[i]["content"]
|
||||
}
|
||||
|
||||
// @function draw 绘制运势图
|
||||
// @param background 背景图片路径
|
||||
// @param seed 随机数种子
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
sql "github.com/FloatTech/sqlite"
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
)
|
||||
|
||||
type joke struct {
|
||||
@@ -25,14 +24,13 @@ func init() {
|
||||
en := control.Register("funny", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "讲个笑话\n" +
|
||||
"- 讲个笑话[@xxx] | 讲个笑话[qq号]",
|
||||
"- 讲个笑话[@xxx|qq号|人名] | 夸夸[@xxx|qq号|人名] ",
|
||||
PublicDataFolder: "Funny",
|
||||
})
|
||||
|
||||
en.OnPrefix("讲个笑话", ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
dbpath := en.DataFolder()
|
||||
db.DBPath = dbpath + "jokes.db"
|
||||
_, err := file.GetLazyData(db.DBPath, false, true)
|
||||
en.OnPrefixGroup([]string{"讲个笑话", "夸夸"}, ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
db.DBPath = en.DataFolder() + "jokes.db"
|
||||
_, err := en.GetLazyData("jokes.db", true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"math/rand"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img/writer"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/golang/freetype"
|
||||
@@ -29,6 +29,7 @@ var (
|
||||
totl uint64 // 累计抽奖次数
|
||||
filetree = make(zipfilestructure, 32)
|
||||
starN3, starN4, starN5 *zip.File
|
||||
namereg = regexp.MustCompile(`_(.*)\.png`)
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -67,7 +68,7 @@ func init() {
|
||||
engine.OnFullMatch("原神十连", ctxext.DoOnceOnSuccess(
|
||||
func(ctx *zero.Ctx) bool {
|
||||
zipfile := engine.DataFolder() + "Genshin.zip"
|
||||
_, err := file.GetLazyData(zipfile, false, false)
|
||||
_, err := engine.GetLazyData("Genshin.zip", false)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -91,18 +92,24 @@ func init() {
|
||||
gid = -ctx.Event.UserID
|
||||
}
|
||||
store := (storage)(c.GetData(gid))
|
||||
img, err := randnums(10, store)
|
||||
img, str, mode, err := randnums(10, store)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
b, cl := writer.ToBytes(img)
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.ImageBytes(b)))
|
||||
if mode {
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID,
|
||||
message.Text("恭喜你抽到了: \n", str), message.ImageBytes(b)))
|
||||
} else {
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID,
|
||||
message.Text("十连成功~"), message.ImageBytes(b)))
|
||||
}
|
||||
cl()
|
||||
})
|
||||
}
|
||||
|
||||
func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
func randnums(nums int, store storage) (rgba *image.RGBA, str string, replyMode bool, err error) {
|
||||
var (
|
||||
fours, fives = make([]*zip.File, 0, 10), make([]*zip.File, 0, 10) // 抽到 四, 五星角色
|
||||
threeArms, fourArms, fiveArms = make([]*zip.File, 0, 10), make([]*zip.File, 0, 10), make([]*zip.File, 0, 10) // 抽到 三 , 四, 五星武器
|
||||
@@ -145,18 +152,18 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
}
|
||||
} else { // 默认模式
|
||||
for i := 0; i < nums; i++ {
|
||||
a := rand.Intn(1000)
|
||||
switch { // 抽卡几率 三星75% 四星18% 五星7%
|
||||
case a >= 0 && a <= 750:
|
||||
a := rand.Intn(1000) // 抽卡几率 三星80% 四星17% 五星3%
|
||||
switch {
|
||||
case a >= 0 && a <= 800:
|
||||
threeN2++
|
||||
threeArms = append(threeArms, filetree["Three"][rand.Intn(threelen)])
|
||||
case a > 750 && a <= 840:
|
||||
case a > 800 && a <= 885:
|
||||
fourN++
|
||||
fours = append(fours, filetree["four"][rand.Intn(fourlen)]) // 随机角色
|
||||
case a > 840 && a <= 930:
|
||||
case a > 885 && a <= 970:
|
||||
fourN2++
|
||||
fourArms = append(fourArms, filetree["four2"][rand.Intn(four2len)]) // 随机武器
|
||||
case a > 930 && a <= 965:
|
||||
case a > 970 && a <= 985:
|
||||
fiveN++
|
||||
fives = append(fives, filetree["five"][rand.Intn(fivelen)])
|
||||
default:
|
||||
@@ -210,12 +217,16 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
|
||||
if fiveN > 0 { // 按顺序加入
|
||||
he(fiveN, 5, starN5, fivebg) // 五星角色
|
||||
str += reply(fives, 1, str)
|
||||
replyMode = true
|
||||
}
|
||||
if fourN > 0 {
|
||||
he(fourN, 3, starN4, fourbg) // 四星角色
|
||||
}
|
||||
if fiveN2 > 0 {
|
||||
he(fiveN2, 4, starN5, fivebg) // 五星武器
|
||||
str += reply(fiveArms, 2, str)
|
||||
replyMode = true
|
||||
}
|
||||
if fourN2 > 0 {
|
||||
he(fourN2, 2, starN4, fourbg) // 四星武器
|
||||
@@ -256,7 +267,7 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
|
||||
imgs, err := bgs[i].Open() // 取出背景图片
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", false, err
|
||||
}
|
||||
defer imgs.Close()
|
||||
|
||||
@@ -266,7 +277,7 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
|
||||
imgs1, err := hero[i].Open() // 取出图片名
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", false, err
|
||||
}
|
||||
defer imgs1.Close()
|
||||
|
||||
@@ -276,7 +287,7 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
|
||||
imgs2, err := stars[i].Open() // 取出星级图标
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", false, err
|
||||
}
|
||||
defer imgs2.Close()
|
||||
|
||||
@@ -286,7 +297,7 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
|
||||
imgs3, err := cicon[i].Open() // 取出类型图标
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", false, err
|
||||
}
|
||||
defer imgs3.Close()
|
||||
|
||||
@@ -296,12 +307,12 @@ func randnums(nums int, store storage) (rgba *image.RGBA, err error) {
|
||||
}
|
||||
imgs4, err := filetree["Reply.png"][0].Open() // "分享" 图标
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", false, err
|
||||
}
|
||||
defer imgs4.Close()
|
||||
img4, err := png.Decode(imgs4)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, "", false, err
|
||||
}
|
||||
offset4 := image.Pt(1270, 945) // 宽, 高
|
||||
draw.Draw(rgba, img4.Bounds().Add(offset4), img4, image.Point{}, draw.Over)
|
||||
@@ -343,3 +354,21 @@ func parsezip(zipFile string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 取出角色武器名
|
||||
func reply(z []*zip.File, num int, nameStr string) string {
|
||||
var tmp strings.Builder
|
||||
tmp.Grow(128)
|
||||
switch {
|
||||
case num == 1:
|
||||
tmp.WriteString("★五星角色★\n")
|
||||
case num == 2 && len(nameStr) > 0:
|
||||
tmp.WriteString("\n★五星武器★\n")
|
||||
default:
|
||||
tmp.WriteString("★五星武器★\n")
|
||||
}
|
||||
for i := range z {
|
||||
tmp.WriteString(namereg.FindStringSubmatch(z[i].Name)[1] + " * ")
|
||||
}
|
||||
return tmp.String()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# ZeroBot-Plugin-Gif
|
||||
[ZeroBot QQ机器人](https://github.com/wdvxdr1123/ZeroBot)插件,可以制作各种沙雕gif图
|
||||
> 素材包地址: https://codechina.csdn.net/u011570312/imagematerials
|
||||
> 素材包地址: https://gitcode.net/u011570312/imagematerials
|
||||
|
||||
## 触发方式
|
||||
1. [指令词]+[qq号] 如:爬123456
|
||||
|
||||
@@ -20,7 +20,7 @@ func dlchan(name string, s *string, wg *sync.WaitGroup, exit func(error)) {
|
||||
target := datapath + `materials/` + name
|
||||
var err error
|
||||
if file.IsNotExist(target) {
|
||||
err = file.DownloadTo(`https://codechina.csdn.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
|
||||
err = file.DownloadTo(`https://gitcode.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
|
||||
if err != nil {
|
||||
exit(err)
|
||||
return
|
||||
@@ -35,7 +35,7 @@ func dlchan(name string, s *string, wg *sync.WaitGroup, exit func(error)) {
|
||||
func dlblock(name string) (string, error) {
|
||||
target := datapath + `materials/` + name
|
||||
if file.IsNotExist(target) {
|
||||
err := file.DownloadTo(`https://codechina.csdn.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
|
||||
err := file.DownloadTo(`https://gitcode.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package hs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -87,7 +86,6 @@ func init() {
|
||||
// 卡组
|
||||
engine.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
|
||||
SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
fmt.Print("成功")
|
||||
List := ctx.State["regex_matched"].([]string)[1]
|
||||
ctx.SendChain(
|
||||
message.Image(kz(List)),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Package hyaku 百人一首
|
||||
package hyaku
|
||||
|
||||
import (
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/FloatTech/zbputils/binary"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/antchfx/htmlquery"
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
@@ -29,9 +28,8 @@ func init() {
|
||||
})
|
||||
|
||||
getdb := ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
dbpath := engine.DataFolder()
|
||||
db.DBPath = dbpath + "pics.db"
|
||||
_, _ = file.GetLazyData(db.DBPath, false, false)
|
||||
db.DBPath = engine.DataFolder() + "pics.db"
|
||||
_, _ = engine.GetLazyData("pics.db", false)
|
||||
err := db.Create("picture", &picture{})
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package lolicon
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -23,18 +24,30 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
queue = make(chan string, capacity)
|
||||
queue = make(chan string, capacity)
|
||||
custapi = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
control.Register("lolicon", &control.Options{
|
||||
en := control.Register("lolicon", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "lolicon\n" +
|
||||
"- 来份萝莉",
|
||||
}).ApplySingle(ctxext.DefaultSingle).OnFullMatch("来份萝莉").SetBlock(true).
|
||||
"- 来份萝莉\n" +
|
||||
"- 设置随机图片地址[http...]",
|
||||
}).ApplySingle(ctxext.DefaultSingle)
|
||||
en.OnFullMatch("来份萝莉").SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
go func() {
|
||||
for i := 0; i < math.Min(cap(queue)-len(queue), 2); i++ {
|
||||
if custapi != "" {
|
||||
data, err := web.GetData(custapi)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
continue
|
||||
}
|
||||
queue <- "base64://" + base64.StdEncoding.EncodeToString(data)
|
||||
continue
|
||||
}
|
||||
data, err := web.GetData(api)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
@@ -67,6 +80,7 @@ func init() {
|
||||
case img := <-queue:
|
||||
id := ctx.SendChain(message.Image(img))
|
||||
if id.ID() == 0 {
|
||||
process.SleepAbout1sTo2s()
|
||||
id = ctx.SendChain(message.Image(img).Add("cache", "0"))
|
||||
if id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:图片发送失败,可能被风控了~"))
|
||||
@@ -74,4 +88,13 @@ func init() {
|
||||
}
|
||||
}
|
||||
})
|
||||
en.OnPrefix("设置随机图片地址", zero.SuperUserPermission).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
u := strings.TrimSpace(ctx.State["args"].(string))
|
||||
if !strings.HasPrefix(u, "http") {
|
||||
ctx.SendChain(message.Text("ERROR:url非法!"))
|
||||
return
|
||||
}
|
||||
custapi = u
|
||||
})
|
||||
}
|
||||
|
||||
@@ -349,11 +349,7 @@ func init() { // 插件主体
|
||||
engine.OnFullMatchGroup([]string{"翻牌"}, zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
// 无缓存获取群员列表
|
||||
list := ctx.CallAction("get_group_member_list", zero.Params{
|
||||
"group_id": ctx.Event.GroupID,
|
||||
"no_cache": true,
|
||||
}).Data
|
||||
temp := list.Array()
|
||||
temp := ctx.GetThisGroupMemberListNoCache().Array()
|
||||
sort.SliceStable(temp, func(i, j int) bool {
|
||||
return temp[i].Get("last_sent_time").Int() < temp[j].Get("last_sent_time").Int()
|
||||
})
|
||||
|
||||
@@ -2,28 +2,12 @@
|
||||
package moyucalendar
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
xpath "github.com/antchfx/htmlquery"
|
||||
)
|
||||
|
||||
var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"
|
||||
var weixin = regexp.MustCompile(`url \+= '(.+)';`)
|
||||
|
||||
var client = &http.Client{}
|
||||
|
||||
func init() {
|
||||
control.Register("moyucalendar", &control.Options{
|
||||
DisableOnDefault: true,
|
||||
@@ -34,159 +18,11 @@ func init() {
|
||||
" - 摸鱼人日历",
|
||||
}).OnFullMatch("摸鱼人日历").SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
title := fmt.Sprintf("摸鱼人日历 %d月%d日", time.Now().Month(), time.Now().Day())
|
||||
sg, cookies, err := sougou(title, "摸鱼人日历", ua)
|
||||
data, err := web.GetData("https://api.vvhan.com/api/moyu")
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
wx, err := redirect(sg, cookies, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
image, err := calendar(wx, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Image(image))
|
||||
ctx.SendChain(message.ImageBytes(data))
|
||||
})
|
||||
}
|
||||
|
||||
func sougou(title, publisher, ua string) (string, []*http.Cookie, error) {
|
||||
u, _ := url.Parse("https://weixin.sogou.com/weixin")
|
||||
u.RawQuery = url.Values{
|
||||
"type": []string{"2"},
|
||||
"s_from": []string{"input"},
|
||||
"query": []string{title},
|
||||
}.Encode()
|
||||
req, err := http.NewRequest("GET", u.String(), nil)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
req.Header.Set("User-Agent", ua)
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", nil, errors.New("status not ok")
|
||||
}
|
||||
// 解析XPATH
|
||||
doc, err := xpath.Parse(resp.Body)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
// 取出每个返回的结果
|
||||
list := xpath.Find(doc, `//*[@class="news-list"]/li/div[@class="txt-box"]`)
|
||||
if len(list) == 0 {
|
||||
return "", nil, errors.New("sougou result not found")
|
||||
}
|
||||
var match string
|
||||
for i := range list {
|
||||
account := xpath.FindOne(list[i], `//div[@class="s-p"]/a[@class="account"]`)
|
||||
if account == nil {
|
||||
continue
|
||||
}
|
||||
if xpath.InnerText(account) != publisher {
|
||||
continue
|
||||
}
|
||||
target := xpath.FindOne(list[i], `//h3/a[@target="_blank"]`)
|
||||
if target == nil {
|
||||
continue
|
||||
}
|
||||
match = xpath.SelectAttr(target, "href")
|
||||
break
|
||||
}
|
||||
if match == "" {
|
||||
return "", nil, errors.New("sougou result not found")
|
||||
}
|
||||
return "https://weixin.sogou.com" + match, resp.Cookies(), nil
|
||||
}
|
||||
|
||||
func redirect(link string, cookies []*http.Cookie, ua string) (string, error) {
|
||||
req, err := http.NewRequest("GET", link, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
req.Header.Set("User-Agent", ua)
|
||||
var c = make([]string, 0, 4)
|
||||
for _, cookie := range cookies {
|
||||
if cookie.Name != "ABTEST" && cookie.Name != "SNUID" &&
|
||||
cookie.Name != "IPLOC" && cookie.Name != "SUID" {
|
||||
continue
|
||||
}
|
||||
c = append(c, cookie.Name+"="+cookie.Value)
|
||||
}
|
||||
req.Header.Set("Cookie", strings.Join(c, "; "))
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", errors.New("status not ok")
|
||||
}
|
||||
br := bufio.NewReader(resp.Body)
|
||||
var u = make([]string, 0)
|
||||
for {
|
||||
b, _, err := br.ReadLine()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
matcha := weixin.FindStringSubmatch(string(b))
|
||||
if len(matcha) < 2 {
|
||||
continue
|
||||
}
|
||||
u = append(u, strings.ReplaceAll(matcha[1], "@", ""))
|
||||
}
|
||||
if len(u) == 0 {
|
||||
return "", errors.New("weixin url not found")
|
||||
}
|
||||
return strings.Join(u, ""), nil
|
||||
}
|
||||
|
||||
func calendar(link, ua string) (string, error) {
|
||||
req, err := http.NewRequest("GET", link, nil)
|
||||
req.Header.Set("User-Agent", ua)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", errors.New("status not ok")
|
||||
}
|
||||
doc, err := xpath.Parse(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
html := xpath.OutputHTML(doc, false)
|
||||
if !strings.Contains(html, time.Now().Format("2006-01-02")) {
|
||||
return "", errors.New("calendar not today")
|
||||
}
|
||||
images := xpath.Find(doc, `//*[@id="js_content"]/p/img`)
|
||||
if images == nil {
|
||||
return "", errors.New("calendar not found")
|
||||
}
|
||||
var image string
|
||||
for i := range images {
|
||||
if xpath.SelectAttr(images[i], "data-w") != "540" {
|
||||
continue
|
||||
}
|
||||
image = xpath.SelectAttr(images[i], "data-src")
|
||||
break
|
||||
}
|
||||
if image == "" {
|
||||
return "", errors.New("image not found")
|
||||
}
|
||||
return image, nil
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/tidwall/gjson"
|
||||
@@ -134,81 +136,28 @@ func kugou(keyword string) message.MessageSegment {
|
||||
}
|
||||
|
||||
// cloud163 返回网易云音乐卡片
|
||||
func cloud163(keyword string) message.MessageSegment {
|
||||
headers := http.Header{
|
||||
"Content-Type": []string{"application/x-www-form-urlencoded"},
|
||||
"User-Agent": []string{"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"},
|
||||
func cloud163(keyword string) (msg message.MessageSegment) {
|
||||
requestURL := "https://autumnfish.cn/search?keywords=" + url.QueryEscape(keyword)
|
||||
data, err := web.GetData(requestURL)
|
||||
if err != nil {
|
||||
msg = message.Text("ERROR:", err)
|
||||
return
|
||||
}
|
||||
data := url.Values{
|
||||
"offset": []string{"0"},
|
||||
"total": []string{"true"},
|
||||
"limit": []string{"9"},
|
||||
"type": []string{"1"},
|
||||
"s": []string{keyword},
|
||||
}
|
||||
// 搜索音乐信息 第一首歌
|
||||
info := gjson.ParseBytes(netPost("http://music.163.com/api/search/pc", data, headers)).Get("result.songs.0")
|
||||
// 返回音乐卡片
|
||||
return message.CustomMusic(
|
||||
fmt.Sprintf("http://y.music.163.com/m/song?id=%d", info.Get("id").Int()),
|
||||
fmt.Sprintf("http://music.163.com/song/media/outer/url?id=%d.mp3", info.Get("id").Int()),
|
||||
info.Get("name").Str,
|
||||
).Add("content", info.Get("artists.0.name").Str).Add("image", info.Get("album.blurPicUrl").Str)
|
||||
msg = message.Music("163", gjson.ParseBytes(data).Get("result.songs.0.id").Int())
|
||||
return
|
||||
}
|
||||
|
||||
// qqmusic 返回QQ音乐卡片
|
||||
func qqmusic(keyword string) message.MessageSegment {
|
||||
// 搜索音乐信息 第一首歌
|
||||
h1 := http.Header{
|
||||
"User-Agent": []string{"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"},
|
||||
func qqmusic(keyword string) (msg message.MessageSegment) {
|
||||
requestURL := "https://c.y.qq.com/soso/fcgi-bin/client_search_cp?w=" + url.QueryEscape(keyword)
|
||||
data, err := web.RequestDataWith(web.NewDefaultClient(), requestURL, "GET", "", web.RandUA())
|
||||
if err != nil {
|
||||
msg = message.Text("ERROR:", err)
|
||||
return
|
||||
}
|
||||
search, _ := url.Parse("https://c.y.qq.com/soso/fcgi-bin/client_search_cp")
|
||||
search.RawQuery = url.Values{
|
||||
"w": []string{keyword},
|
||||
}.Encode()
|
||||
res := netGet(search.String(), h1)
|
||||
info := gjson.ParseBytes(res[9 : len(res)-1]).Get("data.song.list.0")
|
||||
// 获得音乐直链
|
||||
h2 := http.Header{
|
||||
"User-Agent": []string{"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"},
|
||||
"referer": []string{"http://y.qq.com"},
|
||||
}
|
||||
music, _ := url.Parse("https://u.y.qq.com/cgi-bin/musicu.fcg")
|
||||
music.RawQuery = url.Values{
|
||||
"data": []string{`{"req": {"module": "CDN.SrfCdnDispatchServer", "method": "GetCdnDispatch", "param": {"guid": "3982823384", "calltype": 0, "userip": ""}}, "req_0": {"module": "vkey.GetVkeyServer", "method": "CgiGetVkey", "param": {"guid": "3982823384", "songmid": ["` + info.Get("songmid").Str + `"], "songtype": [0], "uin": "0", "loginflag": 1, "platform": "20"}}, "comm": {"uin": 0, "format": "json", "ct": 24, "cv": 0}}`},
|
||||
}.Encode()
|
||||
audio := gjson.ParseBytes(netGet(music.String(), h2))
|
||||
// 获得音乐封面
|
||||
image := "https://y.gtimg.cn/music/photo_new/" +
|
||||
find(
|
||||
`photo_new\u002F`,
|
||||
"?max_age",
|
||||
string(
|
||||
netGet("https://y.qq.com/n/yqq/song/"+info.Get("songmid").Str+".html", nil),
|
||||
),
|
||||
)
|
||||
// 返回音乐卡片
|
||||
return message.CustomMusic(
|
||||
"https://y.qq.com/n/yqq/song/"+info.Get("songmid").Str+".html",
|
||||
"https://isure.stream.qqmusic.qq.com/"+audio.Get("req_0.data.midurlinfo.0.purl").Str,
|
||||
info.Get("songname").Str,
|
||||
).Add("content", info.Get("singer.0.name").Str).Add("image", image)
|
||||
}
|
||||
|
||||
// find 返回 pre 到 suf 之间的文本
|
||||
func find(pre string, suf string, str string) string {
|
||||
n := strings.Index(str, pre)
|
||||
if n == -1 {
|
||||
n = 0
|
||||
} else {
|
||||
n += len(pre)
|
||||
}
|
||||
str = str[n:]
|
||||
m := strings.Index(str, suf)
|
||||
if m == -1 {
|
||||
m = len(str)
|
||||
}
|
||||
return str[:m]
|
||||
info := gjson.ParseBytes(data[9 : len(data)-1]).Get("data.song.list.0")
|
||||
msg = message.Music("qq", info.Get("songid").Int())
|
||||
return
|
||||
}
|
||||
|
||||
// md5str 返回字符串 MD5
|
||||
@@ -232,17 +181,3 @@ func netGet(url string, header http.Header) []byte {
|
||||
result, _ := io.ReadAll(res.Body)
|
||||
return result
|
||||
}
|
||||
|
||||
// netPost 返回请求数据
|
||||
func netPost(url string, data url.Values, header http.Header) []byte {
|
||||
client := &http.Client{}
|
||||
request, _ := http.NewRequest("POST", url, strings.NewReader(data.Encode()))
|
||||
request.Header = header
|
||||
res, err := client.Do(request)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
defer res.Body.Close()
|
||||
result, _ := io.ReadAll(res.Body)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -3,18 +3,14 @@ package omikuji
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img/text"
|
||||
)
|
||||
|
||||
@@ -30,22 +26,17 @@ func init() { // 插件主体
|
||||
|
||||
engine.OnFullMatchGroup([]string{"求签", "占卜"}).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
miku, err := bangoToday(ctx.Event.UserID)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
i := ctxext.RandSenderPerDayN(ctx, 100) + 1
|
||||
ctx.SendChain(
|
||||
message.At(ctx.Event.UserID),
|
||||
message.Image(fmt.Sprintf(bed, miku, 0)),
|
||||
message.Image(fmt.Sprintf(bed, miku, 1)),
|
||||
message.Image(fmt.Sprintf(bed, i, 0)),
|
||||
message.Image(fmt.Sprintf(bed, i, 1)),
|
||||
)
|
||||
})
|
||||
engine.OnFullMatch("解签", ctxext.DoOnceOnSuccess(
|
||||
func(ctx *zero.Ctx) bool {
|
||||
dbpath := engine.DataFolder()
|
||||
db.DBPath = dbpath + "kuji.db"
|
||||
_, err := file.GetLazyData(db.DBPath, false, true)
|
||||
db.DBPath = engine.DataFolder() + "kuji.db"
|
||||
_, err := engine.GetLazyData("kuji.db", true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -60,17 +51,17 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
log.Printf("[kuji]读取%d条签文", n)
|
||||
logrus.Infof("[kuji]读取%d条签文", n)
|
||||
return true
|
||||
},
|
||||
)).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
bg, err := bangoToday(ctx.Event.UserID)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
kujiBytes, err := text.RenderToBase64(getKujiByBango(bg), text.FontFile, 400, 20)
|
||||
kujiBytes, err := text.RenderToBase64(
|
||||
getKujiByBango(
|
||||
uint8(ctxext.RandSenderPerDayN(ctx, 100)+1),
|
||||
),
|
||||
text.FontFile, 400, 20,
|
||||
)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
@@ -80,13 +71,3 @@ func init() { // 插件主体
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func bangoToday(uid int64) (uint8, error) {
|
||||
today, err := strconv.ParseInt(time.Now().Format("20060102"), 10, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
seed := uid + today
|
||||
r := rand.New(rand.NewSource(seed))
|
||||
return uint8(r.Intn(100) + 1), nil
|
||||
}
|
||||
|
||||
260
plugin/qqwife/qqmapwife.go
Normal file
260
plugin/qqwife/qqmapwife.go
Normal file
@@ -0,0 +1,260 @@
|
||||
// Package qqwife 娶群友 基于“翻牌”和江林大佬的“群老婆”插件魔改作品
|
||||
package qqwife
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/math"
|
||||
)
|
||||
|
||||
var (
|
||||
qqwifegroup = make(map[int64]map[int64]int64, 64) // 64个群的预算大小
|
||||
lastdate time.Time
|
||||
mu sync.Mutex
|
||||
sendtext = [...][]string{
|
||||
{
|
||||
"今天你向ta表白了,ta羞涩的点了点头同意了!\n",
|
||||
"你对ta说“以我之名,冠你指间,一天相伴,一天相随”.ta捂着嘴点了点头\n\n",
|
||||
},
|
||||
{
|
||||
"今天你向ta表白了,ta毫无感情的拒绝了你\n",
|
||||
"今天你向ta表白了,ta对你说“你是一个非常好的人”\n",
|
||||
"今天你向ta表白了,ta给了你一个拥抱后擦肩而过\n",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine := control.Register("qqwife", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "一群一天一夫一妻制群老婆\n" +
|
||||
"- 娶群友\n" +
|
||||
"- 娶[老婆QQ号|@老婆QQ]\n(注:单身专属技能,CD24H,不跨天刷新)\n" +
|
||||
"- 群老婆列表",
|
||||
})
|
||||
engine.OnFullMatch("娶群友", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
if time.Now().Day() != lastdate.Day() {
|
||||
qqwifegroup = make(map[int64]map[int64]int64, 64) // 跨天就重新初始化数据
|
||||
}
|
||||
// 看列表是为为空
|
||||
gid := ctx.Event.GroupID
|
||||
if qqwifegroup[gid] == nil {
|
||||
qqwifegroup[gid] = make(map[int64]int64, 32)
|
||||
}
|
||||
// 先判断是否已经娶过或者被娶
|
||||
uid := ctx.Event.UserID
|
||||
// 如果娶过
|
||||
wife, ok := qqwifegroup[gid][uid]
|
||||
if ok {
|
||||
ctx.SendChain(
|
||||
message.At(uid),
|
||||
message.Text("今天你的群老婆是"),
|
||||
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(wife, 10)+"&s=640").Add("cache", 0),
|
||||
message.Text(
|
||||
"\n",
|
||||
"[", ctx.CardOrNickName(wife), "]",
|
||||
"(", wife, ")哒",
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
// 如果被娶过
|
||||
husband, ok := qqwifegroup[gid][-uid]
|
||||
if ok {
|
||||
ctx.SendChain(
|
||||
message.At(uid),
|
||||
message.Text("今天你被娶了,群老公是"),
|
||||
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(husband, 10)+"&s=640").Add("cache", 0),
|
||||
message.Text(
|
||||
"\n",
|
||||
"[", ctx.CardOrNickName(husband), "]",
|
||||
"(", husband, ")哒",
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
// 无缓存获取群员列表
|
||||
temp := ctx.GetThisGroupMemberListNoCache().Array()
|
||||
sort.SliceStable(temp, func(i, j int) bool {
|
||||
return temp[i].Get("last_sent_time").Int() < temp[j].Get("last_sent_time").Int()
|
||||
})
|
||||
temp = temp[math.Max(0, len(temp)-30):]
|
||||
// 将已经娶过的人剔除
|
||||
qqgrouplist := make([]int64, 0, len(temp))
|
||||
if len(qqwifegroup) == 0 {
|
||||
for k := 0; k < len(temp); k++ {
|
||||
qqgrouplist = append(qqgrouplist, temp[k].Get("user_id").Int())
|
||||
}
|
||||
} else {
|
||||
for k := 0; k < len(temp); k++ {
|
||||
_, ok := qqwifegroup[gid][temp[k].Get("user_id").Int()]
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
_, ok = qqwifegroup[gid][-temp[k].Get("user_id").Int()]
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
qqgrouplist = append(qqgrouplist, temp[k].Get("user_id").Int())
|
||||
}
|
||||
}
|
||||
// 没有人(只剩自己)的时候
|
||||
if len(qqgrouplist) == 0 {
|
||||
ctx.SendChain(message.Text("噢,此时此刻你还是一只单身狗,等待下一次情缘吧"))
|
||||
return
|
||||
}
|
||||
// 随机抽娶
|
||||
wife = qqgrouplist[rand.Intn(len(qqgrouplist))]
|
||||
if wife == uid { // 如果是自己
|
||||
ctx.SendChain(message.Text("噢,此时此刻你还是一只单身狗,等待下一次情缘吧"))
|
||||
return
|
||||
}
|
||||
// 绑定CP
|
||||
qqwifegroup[gid][uid] = wife
|
||||
qqwifegroup[gid][-wife] = uid
|
||||
// 输出结果
|
||||
ctx.SendChain(
|
||||
message.At(uid),
|
||||
message.Text("今天你的群老婆是"),
|
||||
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(wife, 10)+"&s=640").Add("cache", 0),
|
||||
message.Text(
|
||||
"\n",
|
||||
"[", ctx.CardOrNickName(wife), "]",
|
||||
"(", wife, ")哒",
|
||||
),
|
||||
)
|
||||
// 更新时间
|
||||
lastdate = time.Now()
|
||||
})
|
||||
// 单生狗专属技能
|
||||
var singledogCD = ctxext.NewLimiterManager(time.Hour*24, 1)
|
||||
engine.OnRegex(`^娶(\d+|\[CQ:at,qq=(\d+)\])`, zero.OnlyGroup, checkdog).SetBlock(true).Limit(singledogCD.LimitByUser).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
fiancee, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||
if err != nil {
|
||||
fiancee, _ = strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||
}
|
||||
gid := ctx.Event.GroupID
|
||||
uid := ctx.Event.UserID
|
||||
if rand.Intn(2) == 1 {
|
||||
// 绑定CP
|
||||
if qqwifegroup[gid] == nil {
|
||||
qqwifegroup[gid] = make(map[int64]int64, 32)
|
||||
}
|
||||
qqwifegroup[gid][uid] = fiancee
|
||||
qqwifegroup[gid][-fiancee] = uid
|
||||
// 输出结果
|
||||
ctx.SendChain(
|
||||
message.Text(sendtext[0][rand.Intn(len(sendtext[0]))]),
|
||||
message.At(uid),
|
||||
message.Text("今天你的群老婆是"),
|
||||
message.Image("http://q4.qlogo.cn/g?b=qq&nk="+strconv.FormatInt(fiancee, 10)+"&s=640").Add("cache", 0),
|
||||
message.Text(
|
||||
"\n",
|
||||
"[", ctx.CardOrNickName(fiancee), "]",
|
||||
"(", fiancee, ")哒",
|
||||
),
|
||||
)
|
||||
} else {
|
||||
ctx.SendChain(message.Text(sendtext[1][rand.Intn(len(sendtext[1]))]))
|
||||
}
|
||||
})
|
||||
engine.OnFullMatch("群老婆列表", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByUser).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
group, ok := qqwifegroup[ctx.Event.GroupID]
|
||||
if !ok {
|
||||
ctx.SendChain(message.Text("你群并没有任何的CP额"))
|
||||
return
|
||||
}
|
||||
if len(group) == 0 {
|
||||
ctx.SendChain(message.Text("你群并没有任何的CP额"))
|
||||
return
|
||||
}
|
||||
cplist := make([]string, 1, len(group)+1)
|
||||
cplist[0] = "群老公←———→群老婆\n----------------------"
|
||||
for husband, wife := range group {
|
||||
if husband > 0 {
|
||||
cplist = append(cplist, ctx.CardOrNickName(husband)+" & "+ctx.CardOrNickName(wife))
|
||||
}
|
||||
}
|
||||
ctx.SendChain(message.Text(strings.Join(cplist, "\n")))
|
||||
})
|
||||
}
|
||||
|
||||
// 注入判断 是否为单身狗
|
||||
func checkdog(ctx *zero.Ctx) bool {
|
||||
fiancee, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||
// fmt.Println("1:", fiancee)
|
||||
if err != nil {
|
||||
fiancee, _ = strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||
// fmt.Println("2:", fiancee)
|
||||
}
|
||||
gid := ctx.Event.GroupID
|
||||
uid := ctx.Event.UserID
|
||||
if uid == fiancee {
|
||||
ctx.SendChain(message.Text("今日获得成就:自恋狂"))
|
||||
return false
|
||||
}
|
||||
// 如果用户娶过
|
||||
husband, ok := qqwifegroup[gid][uid]
|
||||
if ok {
|
||||
switch husband {
|
||||
case fiancee:
|
||||
ctx.SendChain(message.Text("笨蛋~你明明已经娶了啊w"))
|
||||
default:
|
||||
ctx.SendChain(message.Text("笨蛋~你家里还有个吃白饭的w"))
|
||||
}
|
||||
return false
|
||||
}
|
||||
// 如果用户被娶过
|
||||
wife, ok := qqwifegroup[gid][-uid]
|
||||
if ok {
|
||||
switch wife {
|
||||
case fiancee:
|
||||
ctx.SendChain(message.Text("笨蛋~你明明已经嫁给他了啊w"))
|
||||
default:
|
||||
ctx.SendChain(message.Text("该是0就是0,当0有什么不好"))
|
||||
}
|
||||
return false
|
||||
}
|
||||
// 如果未婚妻娶过
|
||||
wife, ok = qqwifegroup[gid][fiancee]
|
||||
if ok {
|
||||
switch wife {
|
||||
case uid:
|
||||
ctx.SendChain(message.Text("笨蛋~你明明已经嫁给他了啊w"))
|
||||
default:
|
||||
ctx.SendChain(message.Text("他有别的女人了,你该放下了"))
|
||||
}
|
||||
return false
|
||||
}
|
||||
// 如果未婚妻被娶过
|
||||
husband, ok = qqwifegroup[gid][-fiancee]
|
||||
if ok {
|
||||
switch husband {
|
||||
case uid:
|
||||
ctx.SendChain(message.Text("笨蛋~你明明已经娶了啊w"))
|
||||
default:
|
||||
ctx.SendChain(message.Text("这是一个纯爱的世界,拒绝NTR"))
|
||||
}
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
// load 加载rate数据
|
||||
func load(area *rate, jsonfile string) error {
|
||||
data, err := file.GetLazyData(jsonfile, true, true)
|
||||
data, err := file.GetLazyData(jsonfile, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package saucenao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -11,22 +12,41 @@ import (
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/ascii2d"
|
||||
"github.com/FloatTech/AnimeAPI/pixiv"
|
||||
"github.com/FloatTech/AnimeAPI/saucenao"
|
||||
"github.com/FloatTech/AnimeAPI/yandex"
|
||||
"github.com/jozsefsallai/gophersauce"
|
||||
|
||||
"github.com/FloatTech/zbputils/binary"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img/pool"
|
||||
)
|
||||
|
||||
var (
|
||||
saucenaocli *gophersauce.Client
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
engine := control.Register("saucenao", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "搜图\n" +
|
||||
"- 以图搜图 | 搜索图片 | 以图识图[图片]\n" +
|
||||
"- 搜图[P站图片ID]",
|
||||
PrivateDataFolder: "saucenao",
|
||||
})
|
||||
apikeyfile := engine.DataFolder() + "apikey.txt"
|
||||
if file.IsExist(apikeyfile) {
|
||||
key, err := os.ReadFile(apikeyfile)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
saucenaocli, err = gophersauce.NewClient(&gophersauce.Settings{
|
||||
MaxResults: 1,
|
||||
APIKey: binary.BytesToString(key),
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
// 根据 PID 搜图
|
||||
engine.OnRegex(`^搜图(\d+)$`).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
@@ -65,11 +85,11 @@ func init() { // 插件主体
|
||||
imgs = append(imgs, message.Image("file:///"+f))
|
||||
}
|
||||
txt := message.Text(
|
||||
"标题:", illust.Title, "\n",
|
||||
"插画ID:", illust.Pid, "\n",
|
||||
"画师:", illust.UserName, "\n",
|
||||
"画师ID:", illust.UserId, "\n",
|
||||
"直链:", "https://pixivel.moe/detail?id=", illust.Pid,
|
||||
"标题: ", illust.Title, "\n",
|
||||
"插画ID: ", illust.Pid, "\n",
|
||||
"画师: ", illust.UserName, "\n",
|
||||
"画师ID: ", illust.UserId, "\n",
|
||||
"直链: ", "https://pixivel.moe/detail?id=", illust.Pid,
|
||||
)
|
||||
if imgs != nil {
|
||||
// 发送搜索结果
|
||||
@@ -88,42 +108,83 @@ func init() { // 插件主体
|
||||
// 开始搜索图片
|
||||
ctx.SendChain(message.Text("少女祈祷中......"))
|
||||
for _, pic := range ctx.State["image_url"].([]string) {
|
||||
fmt.Println(pic)
|
||||
if result, err := saucenao.SauceNAO(pic); err != nil {
|
||||
if saucenaocli != nil {
|
||||
resp, err := saucenaocli.FromURL(pic)
|
||||
if err == nil && resp.Count() > 0 {
|
||||
result := resp.First()
|
||||
// 返回SauceNAO的结果
|
||||
picid := 0
|
||||
picidstr := ""
|
||||
source := ""
|
||||
switch {
|
||||
case result.IsPixiv():
|
||||
picid = result.Data.PixivID
|
||||
source = "Pixiv"
|
||||
case result.IsAniDB():
|
||||
picid = result.Data.AniDBAID
|
||||
source = "AniDB"
|
||||
case result.IsBcy():
|
||||
picid = result.Data.BcyID
|
||||
source = "Bcy"
|
||||
case result.IsDanbooru():
|
||||
picid = result.Data.DanbooruID
|
||||
source = "Danbooru"
|
||||
case result.IsDeviantArt():
|
||||
picid = result.Data.DeviantArtID
|
||||
source = "DeviantArt"
|
||||
case result.IsIMDb():
|
||||
picidstr = result.Data.IMDbID
|
||||
source = "IMDb"
|
||||
case result.IsPawoo():
|
||||
picid = result.Data.PawooID
|
||||
source = "Pawoo"
|
||||
case result.IsSankaku():
|
||||
picid = result.Data.SankakuID
|
||||
source = "Sankaku"
|
||||
case result.IsSeiga():
|
||||
picid = result.Data.SeigaID
|
||||
source = "Seiga"
|
||||
}
|
||||
if picid != 0 {
|
||||
ctx.SendChain(
|
||||
message.Text("我有把握是这个!"),
|
||||
message.Image(result.Header.Thumbnail),
|
||||
message.Text(
|
||||
"\n",
|
||||
"图源: ", source, "\n",
|
||||
"相似度: ", result.Header.Similarity, "\n",
|
||||
"标题: ", result.Data.Title, "\n",
|
||||
"插画ID: ", picid, "\n",
|
||||
"画师: ", result.Data.MemberName, "\n",
|
||||
"画师ID: ", result.Data.MemberID, "\n",
|
||||
"直链: ", "https://pixivel.moe/detail?id=", result.Data.PixivID,
|
||||
),
|
||||
)
|
||||
continue
|
||||
}
|
||||
if picidstr != "" {
|
||||
ctx.SendChain(
|
||||
message.Text("我有把握是这个!"),
|
||||
message.Image(result.Header.Thumbnail),
|
||||
message.Text(
|
||||
"\n",
|
||||
"图源: ", source, "\n",
|
||||
"相似度: ", result.Header.Similarity, "\n",
|
||||
"标题: ", result.Data.Title, "\n",
|
||||
"插画ID: ", picidstr, "\n",
|
||||
"画师: ", result.Data.MemberName, "\n",
|
||||
"画师ID: ", result.Data.MemberID, "\n",
|
||||
"直链: ", "https://pixivel.moe/detail?id=", result.Data.PixivID,
|
||||
),
|
||||
)
|
||||
continue
|
||||
}
|
||||
}
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
} else {
|
||||
// 返回SauceNAO的结果
|
||||
ctx.SendChain(
|
||||
message.Text("我有把握是这个!"),
|
||||
message.Image(result[0].Thumbnail),
|
||||
message.Text(
|
||||
"\n",
|
||||
"相似度:", result[0].Similarity, "\n",
|
||||
"标题:", result[0].Title, "\n",
|
||||
"插画ID:", result[0].PixivID, "\n",
|
||||
"画师:", result[0].MemberName, "\n",
|
||||
"画师ID:", result[0].MemberID, "\n",
|
||||
"直链:", "https://pixivel.moe/detail?id=", result[0].PixivID,
|
||||
),
|
||||
)
|
||||
continue
|
||||
ctx.SendChain(message.Text("请私聊发送 设置 saucenao api key [apikey] 以启用 saucenao 搜图, key 请前往 https://saucenao.com/user.php?page=search-api 获取"))
|
||||
}
|
||||
if result, err := yandex.Yandex(pic); err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
} else {
|
||||
ctx.SendChain(
|
||||
message.Text("也许是这个?"),
|
||||
message.Text(
|
||||
"\n",
|
||||
"标题:", result.Title, "\n",
|
||||
"插画ID:", result.Pid, "\n",
|
||||
"画师:", result.UserName, "\n",
|
||||
"画师ID:", result.UserId, "\n",
|
||||
"直链:", "https://pixivel.moe/detail?id=", result.Pid,
|
||||
),
|
||||
)
|
||||
}
|
||||
// 不论结果如何都执行 ascii2d 搜索
|
||||
// ascii2d 搜索
|
||||
if result, err := ascii2d.Ascii2d(pic); err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
continue
|
||||
@@ -133,7 +194,7 @@ func init() { // 插件主体
|
||||
msg = append(msg, ctxext.FakeSenderForwardNode(ctx,
|
||||
message.Image(result[i].Thumb),
|
||||
message.Text(fmt.Sprintf(
|
||||
"标题:%s\n图源:%s\n画师:%s\n画师链接:%s\n图片链接:%s",
|
||||
"标题: %s\n图源: %s\n画师: %s\n画师链接: %s\n图片链接: %s",
|
||||
result[i].Name,
|
||||
result[i].Type,
|
||||
result[i].AuthNm,
|
||||
@@ -151,4 +212,22 @@ func init() { // 插件主体
|
||||
}
|
||||
}
|
||||
})
|
||||
engine.OnRegex(`^设置\s?saucenao\s?api\s?key\s?([0-9a-f]{40})$`, zero.SuperUserPermission, zero.OnlyPrivate).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var err error
|
||||
saucenaocli, err = gophersauce.NewClient(&gophersauce.Settings{
|
||||
MaxResults: 1,
|
||||
APIKey: ctx.State["regex_matched"].([]string)[1],
|
||||
})
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
err = os.WriteFile(apikeyfile, binary.StringToBytes(saucenaocli.APIKey), 0644)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text("成功!"))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
backgroundURL = "https://iw233.cn/API/pc.php?type=json"
|
||||
backgroundURL = "https://iw233.cn/api.php?sort=pc&type=json"
|
||||
referer = "https://iw233.cn/main.html"
|
||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
|
||||
signinMax = 1
|
||||
@@ -42,7 +42,7 @@ func init() {
|
||||
})
|
||||
cachePath := engine.DataFolder() + "cache/"
|
||||
go func() {
|
||||
os.RemoveAll(cachePath)
|
||||
_ = os.RemoveAll(cachePath)
|
||||
err := os.MkdirAll(cachePath, 0755)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -94,7 +94,7 @@ func init() {
|
||||
|
||||
monthWord := now.Format("01/02")
|
||||
hourWord := getHourWord(now)
|
||||
_, err = file.GetLazyData(text.BoldFontFile, false, true)
|
||||
_, err = file.GetLazyData(text.BoldFontFile, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
@@ -107,7 +107,7 @@ func init() {
|
||||
canvas.DrawString(hourWord, float64(back.Bounds().Size().X)*0.1, float64(back.Bounds().Size().Y)*1.2)
|
||||
canvas.DrawString(monthWord, float64(back.Bounds().Size().X)*0.6, float64(back.Bounds().Size().Y)*1.2)
|
||||
nickName := ctx.CardOrNickName(uid)
|
||||
_, err = file.GetLazyData(text.FontFile, false, true)
|
||||
_, err = file.GetLazyData(text.FontFile, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
@@ -192,7 +192,7 @@ func init() {
|
||||
ctx.SendChain(message.Text("ERROR:目前还没有人签到过"))
|
||||
return
|
||||
}
|
||||
_, err = file.GetLazyData(text.FontFile, false, true)
|
||||
_, err = file.GetLazyData(text.FontFile, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
@@ -234,7 +234,7 @@ func init() {
|
||||
err = graph.Render(chart.PNG, f)
|
||||
_ = f.Close()
|
||||
if err != nil {
|
||||
os.Remove(drawedFile)
|
||||
_ = os.Remove(drawedFile)
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func init() { // 插件主体
|
||||
getdb := ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
// 如果数据库不存在则下载
|
||||
pool.db.DBPath = engine.DataFolder() + "SetuTime.db"
|
||||
_, _ = fileutil.GetLazyData(pool.db.DBPath, false, false)
|
||||
_, _ = engine.GetLazyData("SetuTime.db", false)
|
||||
err := pool.db.Open()
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
@@ -97,7 +97,7 @@ func init() { // 插件主体
|
||||
}
|
||||
})
|
||||
|
||||
engine.OnRegex(`^添加(.+)\s?(\d+)$`, zero.SuperUserPermission, getdb).SetBlock(true).
|
||||
engine.OnRegex(`^添加\s*([^0-9\s]+)\s*(\d+)$`, zero.SuperUserPermission, getdb).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var (
|
||||
imgtype = ctx.State["regex_matched"].([]string)[1]
|
||||
@@ -111,7 +111,7 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Text("成功向分类", imgtype, "添加图片", id))
|
||||
})
|
||||
|
||||
engine.OnRegex(`^删除(.+)\s?(\d+)$`, getdb, ctxext.FirstValueInList(pool), zero.SuperUserPermission).SetBlock(true).
|
||||
engine.OnRegex(`^删除\s*([^0-9\s]+)\s*(\d+)$`, getdb, ctxext.FirstValueInList(pool), zero.SuperUserPermission).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var (
|
||||
imgtype = ctx.State["regex_matched"].([]string)[1]
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package shadiao
|
||||
|
||||
import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine.OnFullMatch("哄我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
data, err := web.RequestDataWith(web.NewDefaultClient(), chpURL, "GET", chpReferer, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||
})
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package shadiao
|
||||
|
||||
import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
data, err := web.RequestDataWith(web.NewDefaultClient(), duURL, "GET", duReferer, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||
})
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package shadiao
|
||||
|
||||
import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine.OnFullMatch("发个朋友圈").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
data, err := web.RequestDataWith(web.NewDefaultClient(), pyqURL, "GET", pyqReferer, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||
})
|
||||
}
|
||||
@@ -3,19 +3,22 @@ package shadiao
|
||||
|
||||
import (
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
"github.com/tidwall/gjson"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
chpURL = "https://chp.shadiao.app/api.php"
|
||||
duURL = "https://du.shadiao.app/api.php"
|
||||
pyqURL = "https://pyq.shadiao.app/api.php"
|
||||
chpURL = "https://api.shadiao.app/chp"
|
||||
duURL = "https://api.shadiao.app/du"
|
||||
pyqURL = "https://api.shadiao.app/pyq"
|
||||
yduanziURL = "http://www.yduanzi.com/duanzi/getduanzi"
|
||||
chayiURL = "https://api.lovelive.tools/api/SweetNothings/Web/0"
|
||||
ganhaiURL = "https://api.lovelive.tools/api/SweetNothings/Web/1"
|
||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
|
||||
chpReferer = "https://chp.shadiao.app/"
|
||||
duReferer = "https://du.shadiao.app/"
|
||||
pyqReferer = "https://pyq.shadiao.app/"
|
||||
sdReferer = "https://api.shadiao.app/"
|
||||
yduanziReferer = "http://www.yduanzi.com/?utm_source=shadiao.app"
|
||||
loveliveReferer = "https://lovelive.tools/"
|
||||
)
|
||||
@@ -26,4 +29,17 @@ var (
|
||||
Help: "沙雕app\n" +
|
||||
"- 哄我\n- 渣我\n- 来碗绿茶\n- 发个朋友圈\n- 来碗毒鸡汤\n- 讲个段子",
|
||||
})
|
||||
sdMap = map[string]string{"哄我": chpURL, "来碗毒鸡汤": duURL, "发个朋友圈": pyqURL}
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine.OnFullMatchGroup([]string{"哄我", "来碗毒鸡汤", "发个朋友圈"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
requestURL := sdMap[ctx.State["matched"].(string)]
|
||||
data, err := web.RequestDataWith(web.NewDefaultClient(), requestURL, "GET", sdReferer, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(gjson.GetBytes(data, "data.text").String()))
|
||||
})
|
||||
}
|
||||
|
||||
164
plugin/tarot/tarot.go
Normal file
164
plugin/tarot/tarot.go
Normal file
@@ -0,0 +1,164 @@
|
||||
// Package tarot 塔罗牌
|
||||
package tarot
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const bed = "https://gitcode.net/shudorcl/zbp-tarot/-/raw/master/"
|
||||
|
||||
type cardInfo struct {
|
||||
Description string `json:"description"`
|
||||
ReverseDescription string `json:"reverseDescription"`
|
||||
ImgURL string `json:"imgUrl"`
|
||||
}
|
||||
type card struct {
|
||||
Name string `json:"name"`
|
||||
cardInfo `json:"info"`
|
||||
}
|
||||
type cardSet = map[string]card
|
||||
|
||||
var cardMap = make(cardSet, 30)
|
||||
var infoMap = make(map[string]cardInfo, 30)
|
||||
|
||||
// var cardName = make([]string, 22)
|
||||
|
||||
func init() {
|
||||
engine := control.Register("tarot", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "塔罗牌\n" +
|
||||
"- 抽塔罗牌\n" +
|
||||
"- 抽n张塔罗牌\n" +
|
||||
"- 解塔罗牌[牌名]",
|
||||
PublicDataFolder: "Tarot",
|
||||
}).ApplySingle(ctxext.DefaultSingle)
|
||||
|
||||
engine.OnRegex(`^抽(\d{1,2}张)?塔罗牌$`, ctxext.DoOnceOnSuccess(
|
||||
func(ctx *zero.Ctx) bool {
|
||||
data, err := engine.GetLazyData("tarots.json", true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
err = json.Unmarshal(data, &cardMap)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
logrus.Infof("[tarot]读取%d张塔罗牌", len(cardMap))
|
||||
return true
|
||||
},
|
||||
)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
match := ctx.State["regex_matched"].([]string)[1]
|
||||
n := 1
|
||||
reasons := [...]string{"您抽到的是~\n", "锵锵锵,塔罗牌的预言是~\n", "诶,让我看看您抽到了~\n"}
|
||||
position := [...]string{"正位", "逆位"}
|
||||
reverse := [...]string{"", "Reverse"}
|
||||
if match != "" {
|
||||
var err error
|
||||
n, err = strconv.Atoi(match[:len(match)-3])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if n <= 0 {
|
||||
ctx.SendChain(message.Text("ERROR:张数必须为正"))
|
||||
return
|
||||
}
|
||||
if n > 1 && !zero.OnlyGroup(ctx) {
|
||||
ctx.SendChain(message.Text("ERROR:抽取多张仅支持群聊"))
|
||||
return
|
||||
}
|
||||
if n > 20 {
|
||||
ctx.SendChain(message.Text("ERROR:抽取张数过多"))
|
||||
return
|
||||
}
|
||||
}
|
||||
if n == 1 {
|
||||
i := rand.Intn(22)
|
||||
p := rand.Intn(2)
|
||||
card := cardMap[(strconv.Itoa(i))]
|
||||
name := card.Name
|
||||
if id := ctx.SendChain(
|
||||
message.Text(reasons[rand.Intn(len(reasons))], position[p], " 的 ", name, "\n"),
|
||||
message.Image(fmt.Sprintf(bed+"MajorArcana%s/%d.png", reverse[p], i))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
return
|
||||
}
|
||||
msg := make([]message.MessageSegment, n)
|
||||
randomIntMap := make(map[int]int, 30)
|
||||
for i := range msg {
|
||||
j := rand.Intn(22)
|
||||
_, ok := randomIntMap[j]
|
||||
for ok {
|
||||
j = rand.Intn(22)
|
||||
_, ok = randomIntMap[j]
|
||||
}
|
||||
randomIntMap[j] = 0
|
||||
p := rand.Intn(2)
|
||||
card := cardMap[(strconv.Itoa(j))]
|
||||
name := card.Name
|
||||
tarotMsg := []message.MessageSegment{
|
||||
message.Text(reasons[rand.Intn(len(reasons))], position[p], " 的 ", name, "\n"),
|
||||
message.Image(fmt.Sprintf(bed+"MajorArcana%s/%d.png", reverse[p], j))}
|
||||
msg[i] = ctxext.FakeSenderForwardNode(ctx, tarotMsg...)
|
||||
}
|
||||
ctx.SendGroupForwardMessage(ctx.Event.GroupID, msg)
|
||||
})
|
||||
|
||||
engine.OnRegex(`^解塔罗牌\s?(.*)`, ctxext.DoOnceOnSuccess(
|
||||
func(ctx *zero.Ctx) bool {
|
||||
if len(cardMap) > 0 {
|
||||
for _, card := range cardMap {
|
||||
infoMapKey := strings.Split(card.Name, "(")[0]
|
||||
infoMap[infoMapKey] = card.cardInfo
|
||||
// 可以拿来显示大阿尔卡纳列表
|
||||
// cardName = append(cardName, infoMapKey)
|
||||
}
|
||||
return true
|
||||
}
|
||||
tempMap := make(cardSet, 30)
|
||||
data, err := engine.GetLazyData("tarots.json", true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
err = json.Unmarshal(data, &tempMap)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
|
||||
for _, card := range tempMap {
|
||||
infoMapKey := strings.Split(card.Name, "(")[0]
|
||||
infoMap[infoMapKey] = card.cardInfo
|
||||
// 可以拿来显示大阿尔卡纳列表
|
||||
// cardName = append(cardName, infoMapKey)
|
||||
}
|
||||
return true
|
||||
},
|
||||
)).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||
match := ctx.State["regex_matched"].([]string)[1]
|
||||
info, ok := infoMap[match]
|
||||
if ok {
|
||||
ctx.SendChain(
|
||||
message.Image(bed+info.ImgURL),
|
||||
message.Text("\n", match, "的含义是~"),
|
||||
message.Text("\n正位:", info.Description),
|
||||
message.Text("\n逆位:", info.ReverseDescription))
|
||||
} else {
|
||||
ctx.SendChain(message.Text("没有找到", match, "噢~"))
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"math/rand"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
@@ -21,7 +20,7 @@ func init() {
|
||||
PublicDataFolder: "Chat",
|
||||
})
|
||||
go func() {
|
||||
data, err := file.GetLazyData(engine.DataFolder()+"kimoi.json", true, false)
|
||||
data, err := engine.GetLazyData("kimoi.json", false)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
sql "github.com/FloatTech/sqlite"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
@@ -28,9 +27,8 @@ func init() {
|
||||
|
||||
en.OnFullMatch("舔狗日记", ctxext.DoOnceOnSuccess(
|
||||
func(ctx *zero.Ctx) bool {
|
||||
dbpath := en.DataFolder()
|
||||
db.DBPath = dbpath + "tiangou.db"
|
||||
_, err := file.GetLazyData(db.DBPath, false, true)
|
||||
db.DBPath = en.DataFolder() + "tiangou.db"
|
||||
_, err := en.GetLazyData("tiangou.db", true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
package tracemoe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
trmoe "github.com/fumiama/gotracemoe"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
@@ -25,7 +23,6 @@ func init() { // 插件主体
|
||||
// 开始搜索图片
|
||||
ctx.SendChain(message.Text("少女祈祷中......"))
|
||||
for _, pic := range ctx.State["image_url"].([]string) {
|
||||
fmt.Println(pic)
|
||||
if result, err := moe.Search(pic, true, true); err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
} else if len(result.Result) > 0 {
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -26,12 +27,7 @@ import (
|
||||
"github.com/FloatTech/ZeroBot-Plugin/plugin/vtb_quotation/model"
|
||||
)
|
||||
|
||||
const regStr = ".*/(.*)"
|
||||
const recordRe = "(\\.mp3|\\.wav|\\.wma|\\.mpa|\\.ram|\\.ra|\\.aac|\\.aif|\\.m4a|\\.tsa)"
|
||||
|
||||
var (
|
||||
re = regexp.MustCompile(recordRe)
|
||||
)
|
||||
var reg = regexp.MustCompile(".*/(.*)")
|
||||
|
||||
func init() {
|
||||
engine := control.Register("vtbquotation", &control.Options{
|
||||
@@ -47,7 +43,7 @@ func init() {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
_, err = file.GetLazyData(dbfile, false, false)
|
||||
_, err = engine.GetLazyData("vtb.db", false)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -57,9 +53,7 @@ func init() {
|
||||
|
||||
engine.OnFullMatch("vtb语录", getdb).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var firstIndex int
|
||||
var secondIndex int
|
||||
var thirdIndex int
|
||||
indexs := [3]int{}
|
||||
echo, cancel := ctx.FutureEvent("message",
|
||||
ctx.CheckSession()). // 只复读开启复读模式的人的消息
|
||||
Repeat() // 不断监听复读
|
||||
@@ -95,147 +89,122 @@ func init() {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("输入错误太多,请重新发指令"))
|
||||
return
|
||||
}
|
||||
msg := c.Event.Message.ExtractPlainText()
|
||||
num, err := strconv.Atoi(msg)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
|
||||
errorCount++
|
||||
continue
|
||||
}
|
||||
switch step {
|
||||
case 0:
|
||||
firstIndex, err = strconv.Atoi(c.Event.RawMessage)
|
||||
// log.Debugln(fmt.Sprintf("当前在第%d步", step))
|
||||
// log.Debugln(fmt.Sprintf("firstIndex:%d,secondIndex:%d,thirdIndex:%d", firstIndex, secondIndex, thirdIndex))
|
||||
indexs[0] = num
|
||||
secondStepMessage, err := db.GetAllSecondCategoryMessageByFirstIndex(indexs[0])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
|
||||
errorCount++
|
||||
} else {
|
||||
secondStepMessage, err := db.GetAllSecondCategoryMessageByFirstIndex(firstIndex)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
// log.Debugln(secondStepMessage)
|
||||
if secondStepMessage == "" {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
|
||||
r, err := db.GetAllFirstCategoryMessage()
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
errorCount++
|
||||
} else {
|
||||
secondStepMessageBytes, err := text.RenderToBase64(secondStepMessage, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
step++
|
||||
}
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
case 1:
|
||||
secondIndex, err = strconv.Atoi(c.Event.RawMessage)
|
||||
// log.Debugln(fmt.Sprintf("当前在第%d步", step))
|
||||
// log.Debugln(fmt.Sprintf("firstIndex:%d,secondIndex:%d,thirdIndex:%d", firstIndex, secondIndex, thirdIndex))
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
|
||||
errorCount++
|
||||
} else {
|
||||
thirdStepMessage, err := db.GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(firstIndex, secondIndex)
|
||||
if secondStepMessage == "" {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
|
||||
r, err := db.GetAllFirstCategoryMessage()
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
// log.Debugln(thirdStepMessage)
|
||||
if thirdStepMessage == "" {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
|
||||
r, err := db.GetAllSecondCategoryMessageByFirstIndex(firstIndex)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
secondStepMessageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
errorCount++
|
||||
} else {
|
||||
thirdStepMessageBytes, err := text.RenderToBase64(thirdStepMessage, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(thirdStepMessageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
step++
|
||||
firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
errorCount++
|
||||
} else {
|
||||
secondStepMessageBytes, err := text.RenderToBase64(secondStepMessage, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
step++
|
||||
}
|
||||
|
||||
case 1:
|
||||
indexs[1] = num
|
||||
thirdStepMessage, err := db.GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(indexs[0], indexs[1])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if thirdStepMessage == "" {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输"))
|
||||
r, err := db.GetAllSecondCategoryMessageByFirstIndex(indexs[0])
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
secondStepMessageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
errorCount++
|
||||
} else {
|
||||
thirdStepMessageBytes, err := text.RenderToBase64(thirdStepMessage, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(thirdStepMessageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
step++
|
||||
}
|
||||
case 2:
|
||||
thirdIndex, err = strconv.Atoi(c.Event.RawMessage)
|
||||
// log.Debugln(fmt.Sprintf("当前在第%d步", step))
|
||||
// log.Debugln(fmt.Sprintf("firstIndex:%d,secondIndex:%d,thirdIndex:%d", firstIndex, secondIndex, thirdIndex))
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请输入正确的序号,三次输入错误,指令可退出重输"))
|
||||
indexs[2] = num
|
||||
tc := db.GetThirdCategory(indexs[0], indexs[1], indexs[2])
|
||||
recURL := tc.ThirdCategoryPath
|
||||
if recURL == "" {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("没有内容请重新选择,三次输入错误,指令可退出重输"))
|
||||
r, err := db.GetAllFirstCategoryMessage()
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
errorCount++
|
||||
step = 1
|
||||
} else {
|
||||
tc := db.GetThirdCategory(firstIndex, secondIndex, thirdIndex)
|
||||
reg := regexp.MustCompile(regStr)
|
||||
recURL := tc.ThirdCategoryPath
|
||||
if recURL == "" {
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("没有内容请重新选择,三次输入错误,指令可退出重输"))
|
||||
r, err := db.GetAllFirstCategoryMessage()
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 {
|
||||
ctx.SendChain(message.Text("ERROR:可能被风控了"))
|
||||
}
|
||||
errorCount++
|
||||
step = 1
|
||||
} else {
|
||||
if reg.MatchString(recURL) {
|
||||
// log.Debugln(reg.FindStringSubmatch(recordUrl)[1])
|
||||
// log.Debugln(url.QueryEscape(reg.FindStringSubmatch(recordUrl)[1]))
|
||||
recURL = strings.ReplaceAll(recURL, reg.FindStringSubmatch(recURL)[1], url.QueryEscape(reg.FindStringSubmatch(recURL)[1]))
|
||||
recURL = strings.ReplaceAll(recURL, "+", "%20")
|
||||
// log.Debugln(recordUrl)
|
||||
}
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请欣赏《"+tc.ThirdCategoryName+"》"))
|
||||
|
||||
if !re.MatchString(recURL) {
|
||||
ctx.SendChain(message.Text("ERROR:文件格式不匹配"))
|
||||
return
|
||||
}
|
||||
format := re.FindStringSubmatch(recURL)[1]
|
||||
recordFile := storePath + fmt.Sprintf("%d-%d-%d", firstIndex, secondIndex, thirdIndex) + format
|
||||
if file.IsExist(recordFile) {
|
||||
ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
|
||||
return
|
||||
}
|
||||
err = initRecord(recordFile, recURL)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
if reg.MatchString(recURL) {
|
||||
recURL = strings.ReplaceAll(recURL, reg.FindStringSubmatch(recURL)[1], url.QueryEscape(reg.FindStringSubmatch(recURL)[1]))
|
||||
recURL = strings.ReplaceAll(recURL, "+", "%20")
|
||||
}
|
||||
ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("请欣赏《"+tc.ThirdCategoryName+"》"))
|
||||
recordFile := storePath + fmt.Sprintf("%d-%d-%d", indexs[0], indexs[1], indexs[2]) + path.Ext(recURL)
|
||||
if file.IsExist(recordFile) {
|
||||
ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
|
||||
return
|
||||
}
|
||||
err = initRecord(recordFile, recURL)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
|
||||
return
|
||||
}
|
||||
default:
|
||||
return
|
||||
@@ -257,19 +226,13 @@ func init() {
|
||||
tc := db.RandomVtb()
|
||||
fc := db.GetFirstCategoryByFirstUID(tc.FirstCategoryUID)
|
||||
if (tc != model.ThirdCategory{}) && (fc != model.FirstCategory{}) {
|
||||
reg := regexp.MustCompile(regStr)
|
||||
recURL := tc.ThirdCategoryPath
|
||||
if reg.MatchString(recURL) {
|
||||
recURL = strings.ReplaceAll(recURL, reg.FindStringSubmatch(recURL)[1], url.QueryEscape(reg.FindStringSubmatch(recURL)[1]))
|
||||
recURL = strings.ReplaceAll(recURL, "+", "%20")
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("请欣赏"+fc.FirstCategoryName+"的《"+tc.ThirdCategoryName+"》"))
|
||||
if !re.MatchString(recURL) {
|
||||
ctx.SendChain(message.Text("ERROR:文件格式不匹配"))
|
||||
return
|
||||
}
|
||||
format := re.FindStringSubmatch(recURL)[1]
|
||||
recordFile := storePath + fmt.Sprintf("%d-%d-%d", fc.FirstCategoryIndex, tc.SecondCategoryIndex, tc.ThirdCategoryIndex) + format
|
||||
recordFile := storePath + fmt.Sprintf("%d-%d-%d", fc.FirstCategoryIndex, tc.SecondCategoryIndex, tc.ThirdCategoryIndex) + path.Ext(recURL)
|
||||
if file.IsExist(recordFile) {
|
||||
ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile))
|
||||
return
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/zbputils/binary"
|
||||
@@ -17,6 +18,7 @@ import (
|
||||
"github.com/FloatTech/zbputils/img/text"
|
||||
"github.com/golang/freetype"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/wcharczuk/go-chart/v2"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
@@ -38,7 +40,7 @@ func init() {
|
||||
_ = os.RemoveAll(cachePath)
|
||||
_ = os.MkdirAll(cachePath, 0755)
|
||||
engine.OnRegex(`^热词\s?(\d*)\s?(\d*)$`, zero.OnlyGroup, ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
_, err := file.GetLazyData(engine.DataFolder()+"stopwords.txt", false, false)
|
||||
_, err := engine.GetLazyData("stopwords.txt", false)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
@@ -48,12 +50,28 @@ func init() {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
}
|
||||
stopwords = strings.Split(binary.BytesToString(data), "\r\n")
|
||||
stopwords = strings.Split(strings.ReplaceAll(binary.BytesToString(data), "\r", ""), "\n")
|
||||
sort.Strings(stopwords)
|
||||
logrus.Infoln("[wordcount]加载", len(stopwords), "条停用词")
|
||||
return true
|
||||
})).Limit(ctxext.LimitByUser).SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
_, err := file.GetLazyData(text.FontFile, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
b, err := os.ReadFile(text.FontFile)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
font, err := freetype.ParseFont(b)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx.SendChain(message.Text("少女祈祷中..."))
|
||||
gid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||
p, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[2], 10, 64)
|
||||
@@ -77,28 +95,44 @@ func init() {
|
||||
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile))
|
||||
return
|
||||
}
|
||||
messageMap := make(map[string]int)
|
||||
h := ctx.CallAction("get_group_msg_history", zero.Params{"group_id": gid}).Data
|
||||
messageSeq := h.Get("messages.0.message_seq").Int()
|
||||
for i := 0; i < int(p/20) && messageSeq != 0; i++ {
|
||||
if i != 0 {
|
||||
h = ctx.CallAction("get_group_msg_history", zero.Params{"group_id": gid, "message_seq": messageSeq}).Data
|
||||
messageMap := make(map[string]int, 256)
|
||||
msghists := make(chan *gjson.Result, 256)
|
||||
go func() {
|
||||
h := ctx.GetLatestGroupMessageHistory(gid)
|
||||
messageSeq := h.Get("messages.0.message_seq").Int()
|
||||
msghists <- &h
|
||||
for i := 1; i < int(p/20) && messageSeq != 0; i++ {
|
||||
h := ctx.GetGroupMessageHistory(gid, messageSeq)
|
||||
msghists <- &h
|
||||
messageSeq = h.Get("messages.0.message_seq").Int()
|
||||
}
|
||||
for _, v := range h.Get("messages.#.message").Array() {
|
||||
tex := strings.TrimSpace(message.ParseMessageFromString(v.Str).ExtractPlainText())
|
||||
if tex == "" {
|
||||
continue
|
||||
}
|
||||
for _, t := range ctx.GetWordSlices(tex).Get("slices").Array() {
|
||||
tex := strings.TrimSpace(t.Str)
|
||||
i := sort.SearchStrings(stopwords, tex)
|
||||
if re.MatchString(tex) && (i >= len(stopwords) || stopwords[i] != tex) {
|
||||
messageMap[tex]++
|
||||
close(msghists)
|
||||
}()
|
||||
var wg sync.WaitGroup
|
||||
var mapmu sync.Mutex
|
||||
for h := range msghists {
|
||||
wg.Add(1)
|
||||
go func(h *gjson.Result) {
|
||||
for _, v := range h.Get("messages.#.message").Array() {
|
||||
tex := strings.TrimSpace(message.ParseMessageFromString(v.Str).ExtractPlainText())
|
||||
if tex == "" {
|
||||
continue
|
||||
}
|
||||
for _, t := range ctx.GetWordSlices(tex).Get("slices").Array() {
|
||||
tex := strings.TrimSpace(t.Str)
|
||||
i := sort.SearchStrings(stopwords, tex)
|
||||
if re.MatchString(tex) && (i >= len(stopwords) || stopwords[i] != tex) {
|
||||
mapmu.Lock()
|
||||
messageMap[tex]++
|
||||
mapmu.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
messageSeq = h.Get("messages.0.message_seq").Int()
|
||||
wg.Done()
|
||||
}(h)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
wc := rankByWordCount(messageMap)
|
||||
if len(wc) > 20 {
|
||||
wc = wc[:20]
|
||||
@@ -108,21 +142,6 @@ func init() {
|
||||
ctx.SendChain(message.Text("ERROR:历史消息为空或者无法获得历史消息"))
|
||||
return
|
||||
}
|
||||
_, err := file.GetLazyData(text.FontFile, false, true)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
b, err := os.ReadFile(text.FontFile)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
font, err := freetype.ParseFont(b)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
bars := make([]chart.Value, len(wc))
|
||||
for i, v := range wc {
|
||||
bars[i] = chart.Value{
|
||||
|
||||
@@ -13,12 +13,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/tl"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/FloatTech/zbputils/binary"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/img/writer"
|
||||
"github.com/fogleman/gg"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
@@ -87,8 +85,7 @@ func init() {
|
||||
wg.Add(2)
|
||||
go func(i int) {
|
||||
defer wg.Done()
|
||||
dc, err := file.GetLazyData(fmt.Sprintf("%scet-4_%d.txt", en.DataFolder(), i), true, true)
|
||||
logrus.Debugln("[wordle] get", fmt.Sprintf("%scet-4_%d.txt", en.DataFolder(), i))
|
||||
dc, err := en.GetLazyData(fmt.Sprintf("cet-4_%d.txt", i), true)
|
||||
if err != nil {
|
||||
atomic.AddUint32(&errcnt, 1)
|
||||
return
|
||||
@@ -103,8 +100,7 @@ func init() {
|
||||
}(i)
|
||||
go func(i int) {
|
||||
defer wg.Done()
|
||||
dd, err := file.GetLazyData(fmt.Sprintf("%sdict_%d.txt", en.DataFolder(), i), true, true)
|
||||
logrus.Debugln("[wordle] get", fmt.Sprintf("%sdict_%d.txt", en.DataFolder(), i))
|
||||
dd, err := en.GetLazyData(fmt.Sprintf("dict_%d.txt", i), true)
|
||||
if err != nil {
|
||||
atomic.AddUint32(&errcnt, 1)
|
||||
return
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
@@ -17,9 +16,9 @@ func init() {
|
||||
Help: "月幕galgame\n- 随机galCG\n- 随机gal表情包\n- galCG[xxx]\n- gal表情包[xxx]\n- 更新gal\n",
|
||||
PublicDataFolder: "Ymgal",
|
||||
})
|
||||
dbfile := engine.DataFolder() + "ymgal.db"
|
||||
getdb := ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
||||
_, err := file.GetLazyData(dbfile, false, false)
|
||||
dbfile := engine.DataFolder() + "ymgal.db"
|
||||
_, err := engine.GetLazyData("ymgal.db", false)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return false
|
||||
|
||||
@@ -49,7 +49,7 @@ func init() { // 插件主体
|
||||
func getdata() error { // 获取图片链接并且下载
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
if picdata != nil && time.Since(pictime) <= time.Hour*20 {
|
||||
if picdata != nil && time.Since(pictime) <= time.Hour*8 && time.Now().Day() == pictime.Day() {
|
||||
return nil
|
||||
}
|
||||
data, err := web.RequestDataWith(web.NewDefaultClient(), api, "GET", "", ua)
|
||||
|
||||
Reference in New Issue
Block a user