mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
♻️ 🔥 优化青云客结构
This commit is contained in:
parent
577b5b108f
commit
42f761d44d
14
go.mod
14
go.mod
@ -3,10 +3,10 @@ module github.com/FloatTech/ZeroBot-Plugin
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v1.1.12
|
||||
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.5
|
||||
github.com/FloatTech/zbpctrl v1.2.3
|
||||
github.com/FloatTech/zbputils v1.2.3
|
||||
github.com/FloatTech/AnimeAPI v1.2.0
|
||||
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.6
|
||||
github.com/FloatTech/zbpctrl v1.2.3-add1
|
||||
github.com/FloatTech/zbputils v1.2.3-add1
|
||||
github.com/antchfx/htmlquery v1.2.4
|
||||
github.com/corona10/goimagehash v1.0.3
|
||||
github.com/fogleman/gg v1.3.0
|
||||
@ -51,8 +51,8 @@ require (
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
|
||||
golang.org/x/mod v0.5.1 // indirect
|
||||
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
|
||||
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d // indirect
|
||||
golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/tools v0.1.8 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||
@ -64,7 +64,7 @@ require (
|
||||
modernc.org/mathutil v1.4.1 // indirect
|
||||
modernc.org/memory v1.0.5 // indirect
|
||||
modernc.org/opt v0.1.1 // indirect
|
||||
modernc.org/sqlite v1.14.3 // indirect
|
||||
modernc.org/sqlite v1.14.4 // indirect
|
||||
modernc.org/strutil v1.1.1 // indirect
|
||||
modernc.org/token v1.0.0 // indirect
|
||||
)
|
||||
|
||||
44
go.sum
44
go.sum
@ -1,14 +1,14 @@
|
||||
github.com/FloatTech/AnimeAPI v1.1.12 h1:tEIAYumjti+FXYw5dhANU9lpoHY7i/sLm96Ly6kPeLE=
|
||||
github.com/FloatTech/AnimeAPI v1.1.12/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.5 h1:9Xn0DI81OjCsKCvknmKB/hXyPXX0l9xj5vdlD9wppBw=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.5/go.mod h1:rECiTB88W5hMYggb6zMKNLcHBEMWT7TFvlwJRQfWnhM=
|
||||
github.com/FloatTech/AnimeAPI v1.2.0 h1:1P6hOEqNOB8EeC7PD5LuIRL9aWRKNVjKF6kP8X1ZYmI=
|
||||
github.com/FloatTech/AnimeAPI v1.2.0/go.mod h1:P2pJSBhflFXJsJPUwhHt13obMVBRc9WJxEKx4bJ+11Q=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.6 h1:canagsXdWdQWTRwNq5U80dAc22hMARTICBxssUtOxhI=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Gif v0.2.6/go.mod h1:umANZgKejUlyBT7c6OfaF8pmnf24QHgqhja94iSpQW4=
|
||||
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
|
||||
github.com/FloatTech/imgfactory v0.1.1 h1:ooL2+fV8yrMhv1ShGGKsN0Rm/flWoKnvqXaUD+dC3DQ=
|
||||
github.com/FloatTech/imgfactory v0.1.1/go.mod h1:ThDALab8aOuU6KVYESVWFqmjcqtm03e0SvGlTw6s+aw=
|
||||
github.com/FloatTech/zbpctrl v1.2.3 h1:/QZoakrgZupmWONed+kyEOoC+UKXu7actKSb2GHHW/Y=
|
||||
github.com/FloatTech/zbpctrl v1.2.3/go.mod h1:uHZ5i0/CUqYLuqza9uDUUc5tCyX+Rn3wtmLdRo6tdhA=
|
||||
github.com/FloatTech/zbputils v1.2.3 h1:c6CkfeFN2gFyHtK4kZnVH6ATOtIcuVbtNK7/l37Std4=
|
||||
github.com/FloatTech/zbputils v1.2.3/go.mod h1:+NZ6tqt9lR2ilyiIh/+90tZlSW2pXx0IyOFlpOiqadE=
|
||||
github.com/FloatTech/zbpctrl v1.2.3-add1 h1:YkLR95p4SOCv6E2EnQ0qFO1O0mcBi+9n0gRhPUVJddA=
|
||||
github.com/FloatTech/zbpctrl v1.2.3-add1/go.mod h1:70cC4XawE8bpbYz/OFA6d6uecK8jTc61pUCY5eXMaC0=
|
||||
github.com/FloatTech/zbputils v1.2.3-add1 h1:gzLw4aa7HhVB7cRUIcJUdFoM/fqxy6yEOXwtt5nw+40=
|
||||
github.com/FloatTech/zbputils v1.2.3-add1/go.mod h1:+NZ6tqt9lR2ilyiIh/+90tZlSW2pXx0IyOFlpOiqadE=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb h1:Rkj28fqIwGx/EgBzRYtpmJRfH6wqVn7cNdc7aJ0QE4M=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb/go.mod h1:imVKbfKqqeit+C/eaWGb4MKQ3z3gN6pRpBU5RMtp5so=
|
||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||
@ -85,7 +85,6 @@ github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkr
|
||||
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/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
@ -104,11 +103,10 @@ github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
||||
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA=
|
||||
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.10 h1:MLn+5bFRlWMGoSRmJour3CL1w/qL96mvipqpwQW/Sfk=
|
||||
github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2-0.20210109003243-333559e1834b/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
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=
|
||||
@ -156,7 +154,6 @@ github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2bi
|
||||
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/wdvxdr1123/ZeroBot v1.2.2/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc=
|
||||
github.com/wdvxdr1123/ZeroBot v1.3.2/go.mod h1:i2DIqQjtjE+3gvVi9r9sc+QpNaUuyTXx/HNXXayIpwI=
|
||||
github.com/wdvxdr1123/ZeroBot v1.4.1 h1:fk/8RH2D1gB3YeC1eI/SZi/kG31Rh7Z8lAiDc60VZFM=
|
||||
github.com/wdvxdr1123/ZeroBot v1.4.1/go.mod h1:7t9m4vDZPwWAmzKlhP6IvUoisOIiqNdm/3AJgiY3+ew=
|
||||
@ -188,8 +185,8 @@ golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 h1:+6WJMRLHlD7X7frgp7TUZ36RnQzSf9wVVTNakEp+nqY=
|
||||
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d h1:62NvYBuaanGXR2ZOfwDFkhhl6X1DUgf8qg3GuQvxZsE=
|
||||
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
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=
|
||||
@ -214,8 +211,8 @@ golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe h1:W8vbETX/n8S6EmY0Pu4Ix7VvpsJUESTwl0oCK8MJOgk=
|
||||
golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
@ -299,10 +296,8 @@ modernc.org/ccgo/v3 v3.12.73/go.mod h1:hngkB+nUUqzOf3iqsM48Gf1FZhY599qzVg1iX+BT3
|
||||
modernc.org/ccgo/v3 v3.12.81/go.mod h1:p2A1duHoBBg1mFtYvnhAnQyI6vL0uw5PGYLSIgF6rYY=
|
||||
modernc.org/ccgo/v3 v3.12.84/go.mod h1:ApbflUfa5BKadjHynCficldU1ghjen84tuM5jRynB7w=
|
||||
modernc.org/ccgo/v3 v3.12.86/go.mod h1:dN7S26DLTgVSni1PVA3KxxHTcykyDurf3OgUzNqTSrU=
|
||||
modernc.org/ccgo/v3 v3.12.88/go.mod h1:0MFzUHIuSIthpVZyMWiFYMwjiFnhrN5MkvBrUwON+ZM=
|
||||
modernc.org/ccgo/v3 v3.12.90/go.mod h1:obhSc3CdivCRpYZmrvO88TXlW0NvoSVvdh/ccRjJYko=
|
||||
modernc.org/ccgo/v3 v3.12.92/go.mod h1:5yDdN7ti9KWPi5bRVWPl8UNhpEAtCjuEE7ayQnzzqHA=
|
||||
modernc.org/ccgo/v3 v3.12.95/go.mod h1:ZcLyvtocXYi8uF+9Ebm3G8EF8HNY5hGomBqthDp4eC8=
|
||||
modernc.org/ccgo/v3 v3.13.1/go.mod h1:aBYVOUfIlcSnrsRVU8VRS35y2DIfpgkmVkYZ0tpIXi4=
|
||||
modernc.org/ccgo/v3 v3.14.0 h1:Zr1Ny9+7r5yAiXpBdgp8XiXqkNA4ARrRphHGHVXeAp0=
|
||||
modernc.org/ccgo/v3 v3.14.0/go.mod h1:hBrkiBlUwvr5vV/ZH9YzXIp982jKE8Ek8tR1ytoAL6Q=
|
||||
@ -346,11 +341,8 @@ modernc.org/libc v1.11.82/go.mod h1:NF+Ek1BOl2jeC7lw3a7Jj5PWyHPwWD4aq3wVKxqV1fI=
|
||||
modernc.org/libc v1.11.86/go.mod h1:ePuYgoQLmvxdNT06RpGnaDKJmDNEkV7ZPKI2jnsvZoE=
|
||||
modernc.org/libc v1.11.87/go.mod h1:Qvd5iXTeLhI5PS0XSyqMY99282y+3euapQFxM7jYnpY=
|
||||
modernc.org/libc v1.11.88/go.mod h1:h3oIVe8dxmTcchcFuCcJ4nAWaoiwzKCdv82MM0oiIdQ=
|
||||
modernc.org/libc v1.11.90/go.mod h1:ynK5sbjsU77AP+nn61+k+wxUGRx9rOFcIqWYYMaDZ4c=
|
||||
modernc.org/libc v1.11.98/go.mod h1:ynK5sbjsU77AP+nn61+k+wxUGRx9rOFcIqWYYMaDZ4c=
|
||||
modernc.org/libc v1.11.99/go.mod h1:wLLYgEiY2D17NbBOEp+mIJJJBGSiy7fLL4ZrGGZ+8jI=
|
||||
modernc.org/libc v1.11.101/go.mod h1:wLLYgEiY2D17NbBOEp+mIJJJBGSiy7fLL4ZrGGZ+8jI=
|
||||
modernc.org/libc v1.11.104/go.mod h1:2MH3DaF/gCU8i/UBiVE1VFRos4o523M7zipmwH8SIgQ=
|
||||
modernc.org/libc v1.12.0/go.mod h1:2MH3DaF/gCU8i/UBiVE1VFRos4o523M7zipmwH8SIgQ=
|
||||
modernc.org/libc v1.13.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk=
|
||||
modernc.org/libc v1.13.2 h1:GCFjY9bmwDZ/TJC4OZOUWaNgxIxwb104C/QZrqpcVEA=
|
||||
@ -366,13 +358,13 @@ modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM=
|
||||
modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
|
||||
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/sqlite v1.13.0/go.mod h1:2qO/6jZJrcQaxFUHxOwa6Q6WfiGSsiVj6GXX0Ker+Jg=
|
||||
modernc.org/sqlite v1.14.3 h1:psrTwgpEujgWEP3FNdsC9yNh5tSeA77U0GeWhHH4XmQ=
|
||||
modernc.org/sqlite v1.14.3/go.mod h1:xMpicS1i2MJ4C8+Ap0vYBqTwYfpFvdnPE6brbFOtV2Y=
|
||||
modernc.org/sqlite v1.14.4 h1:F3DRiVZKnCLqIQ0LhEGqBLnw9LcdADciCwCIHQ8bD5g=
|
||||
modernc.org/sqlite v1.14.4/go.mod h1:LWtcO8JtBrt29KKmTqNNXDjAn36vHa/3nHvOYoVIAjc=
|
||||
modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
|
||||
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
|
||||
modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE=
|
||||
modernc.org/tcl v1.9.2/go.mod h1:aw7OnlIoiuJgu1gwbTZtrKnGpDqH9wyH++jZcxdqNsg=
|
||||
modernc.org/tcl v1.10.0/go.mod h1:WzWapmP/7dHVhFoyPpEaNSVTL8xtewhouN/cqSJ5A2s=
|
||||
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
|
||||
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js=
|
||||
modernc.org/z v1.2.20/go.mod h1:zU9FiF4PbHdOTUxw+IF8j7ArBMRPsHgq10uVPt6xTzo=
|
||||
modernc.org/z v1.2.21/go.mod h1:uXrObx4pGqXWIMliC5MiKuwAyMrltzwpteOFUP1PWCc=
|
||||
|
||||
1
main.go
1
main.go
@ -42,7 +42,6 @@ import (
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_juejuezi" // 绝绝子生成器
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_mocking_bird" // 拟声鸟
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_moyu" // 摸鱼
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" // 铅笔小说网搜索
|
||||
|
||||
@ -1,148 +0,0 @@
|
||||
// Package aireply 人工智能回复
|
||||
package aireply
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
control "github.com/FloatTech/zbpctrl"
|
||||
log "github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
var (
|
||||
bucket = rate.NewManager(time.Minute, 20) // 青云客接口回复
|
||||
engine = control.Register(serviceName, &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "人工智能回复\n" +
|
||||
"- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱]\n- ",
|
||||
})
|
||||
modeMap = map[string]int64{"青云客": 1, "小爱": 2}
|
||||
)
|
||||
|
||||
const (
|
||||
serviceName = "aireply"
|
||||
qykURL = "http://api.qingyunke.com/api.php?key=free&appid=0&msg=%s"
|
||||
qykBotName = "菲菲"
|
||||
xiaoaiURL = "http://81.70.100.130/api/xiaoai.php?msg=%s&n=text"
|
||||
xiaoaiBotName = "小爱"
|
||||
prio = 256
|
||||
)
|
||||
|
||||
// AIReply 公用智能回复类
|
||||
type AIReply interface {
|
||||
// DealQuestion 把椛椛替换为各api接口的bot名字
|
||||
DealQuestion(preMsg string) (msg string)
|
||||
// GetReply 取得回复消息
|
||||
GetReply(msg string) (reply string)
|
||||
// DealReply 处理回复消息
|
||||
DealReply(reply string) (textReply string, faceReply int)
|
||||
}
|
||||
|
||||
// NewAIReply 智能回复简单工厂
|
||||
func NewAIReply(mode int64) AIReply {
|
||||
if mode == 1 {
|
||||
return &QYKReply{}
|
||||
} else if mode == 2 {
|
||||
return &XiaoAiReply{}
|
||||
}
|
||||
return &QYKReply{}
|
||||
}
|
||||
|
||||
func init() { // 插件主体
|
||||
// 回复 @和包括名字
|
||||
engine.OnMessage(zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
aireply := NewAIReply(GetReplyMode(ctx))
|
||||
if !bucket.Load(ctx.Event.UserID).Acquire() {
|
||||
// 频繁触发,不回复
|
||||
return
|
||||
}
|
||||
msg := ctx.ExtractPlainText()
|
||||
// 把消息里的椛椛替换成对应接口机器人的名字
|
||||
msg = aireply.DealQuestion(msg)
|
||||
reply := aireply.GetReply(msg)
|
||||
// 挑出 face 表情
|
||||
textReply, faceReply := aireply.DealReply(reply)
|
||||
// 回复
|
||||
time.Sleep(time.Second * 1)
|
||||
if ctx.Event.MessageType == "group" {
|
||||
if faceReply != -1 {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(textReply), message.Face(faceReply))
|
||||
} else {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(textReply))
|
||||
}
|
||||
}
|
||||
if ctx.Event.MessageType == "private" {
|
||||
if faceReply != -1 {
|
||||
ctx.SendChain(message.Text(textReply), message.Face(faceReply))
|
||||
} else {
|
||||
ctx.SendChain(message.Text(textReply))
|
||||
}
|
||||
}
|
||||
})
|
||||
engine.OnPrefix(`设置回复模式`).SetBlock(true).SetPriority(20).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
param := ctx.State["args"].(string)
|
||||
switch param {
|
||||
case "青云客":
|
||||
if err := setReplyMode(ctx, modeMap["青云客"]); err != nil {
|
||||
log.Errorln("[aireply]:", err)
|
||||
}
|
||||
ctx.SendChain(message.Text("设置为青云客回复"))
|
||||
case "小爱":
|
||||
if err := setReplyMode(ctx, modeMap["小爱"]); err != nil {
|
||||
log.Errorln("[aireply]:", err)
|
||||
}
|
||||
ctx.SendChain(message.Text("设置为小爱回复"))
|
||||
default:
|
||||
ctx.SendChain(message.Text("设置失败"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func setReplyMode(ctx *zero.Ctx, mode int64) error {
|
||||
gid := ctx.Event.GroupID
|
||||
if gid == 0 {
|
||||
gid = -ctx.Event.UserID
|
||||
}
|
||||
m, ok := control.Lookup(serviceName)
|
||||
if ok {
|
||||
return m.SetData(gid, mode)
|
||||
}
|
||||
return errors.New("no such plugin")
|
||||
}
|
||||
|
||||
// GetReplyMode 取得回复模式
|
||||
func GetReplyMode(ctx *zero.Ctx) (mode int64) {
|
||||
gid := ctx.Event.GroupID
|
||||
if gid == 0 {
|
||||
gid = -ctx.Event.UserID
|
||||
}
|
||||
m, ok := control.Lookup(serviceName)
|
||||
if ok {
|
||||
mode = m.GetData(gid)
|
||||
}
|
||||
return mode
|
||||
}
|
||||
|
||||
func getAgent() string {
|
||||
agent := [...]string{
|
||||
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0",
|
||||
"Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11",
|
||||
"Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11",
|
||||
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)",
|
||||
"Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
|
||||
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; The World)",
|
||||
"User-Agent,Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
|
||||
"User-Agent, Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)",
|
||||
"User-Agent,Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
|
||||
}
|
||||
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
len1 := len(agent)
|
||||
return agent[r.Intn(len1)]
|
||||
}
|
||||
95
plugin_ai_reply/main.go
Normal file
95
plugin_ai_reply/main.go
Normal file
@ -0,0 +1,95 @@
|
||||
package aireply
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/aireply"
|
||||
control "github.com/FloatTech/zbpctrl"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
serviceName = "aireply"
|
||||
prio = 256
|
||||
)
|
||||
|
||||
var modes = [...]string{"青云客", "小爱"}
|
||||
|
||||
func init() { // 插件主体
|
||||
bucket := rate.NewManager(time.Minute, 20) // 接口回复限速器
|
||||
engine := control.Register(serviceName, &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "人工智能回复\n" +
|
||||
"- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱]\n- ",
|
||||
})
|
||||
// 回复 @和包括名字
|
||||
engine.OnMessage(zero.OnlyToMe).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
aireply := aireply.NewAIReply(getReplyMode(ctx))
|
||||
if !bucket.Load(ctx.Event.UserID).Acquire() {
|
||||
// 频繁触发,不回复
|
||||
return
|
||||
}
|
||||
reply := aireply.Talk(ctx.ExtractPlainText())
|
||||
// 回复
|
||||
time.Sleep(time.Second * 1)
|
||||
if ctx.Event.MessageType == "group" {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), reply)
|
||||
return
|
||||
}
|
||||
ctx.SendChain(reply)
|
||||
})
|
||||
engine.OnPrefix(`设置回复模式`).SetBlock(true).SetPriority(20).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
param := ctx.State["args"].(string)
|
||||
err := setReplyMode(ctx, param)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("成功"))
|
||||
})
|
||||
}
|
||||
|
||||
func setReplyMode(ctx *zero.Ctx, name string) error {
|
||||
gid := ctx.Event.GroupID
|
||||
if gid == 0 {
|
||||
gid = -ctx.Event.UserID
|
||||
}
|
||||
var ok bool
|
||||
var index int64
|
||||
for i, s := range modes {
|
||||
if s == name {
|
||||
ok = true
|
||||
index = int64(i)
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
return errors.New("no such mode")
|
||||
}
|
||||
m, ok := control.Lookup(serviceName)
|
||||
if !ok {
|
||||
return errors.New("no such plugin")
|
||||
}
|
||||
return m.SetData(gid, index)
|
||||
}
|
||||
|
||||
func getReplyMode(ctx *zero.Ctx) (name string) {
|
||||
gid := ctx.Event.GroupID
|
||||
if gid == 0 {
|
||||
gid = -ctx.Event.UserID
|
||||
}
|
||||
m, ok := control.Lookup(serviceName)
|
||||
if ok {
|
||||
index := m.GetData(gid)
|
||||
if int(index) < len(modes) {
|
||||
return modes[index]
|
||||
}
|
||||
|
||||
}
|
||||
return "青云客"
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
package aireply
|
||||
|
||||
// TODO: 待优化
|
||||
|
||||
/*
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var (
|
||||
reImg = `https?://[^"]+?(\.((jpg)|(png)|(jpeg)|(gif)|(bmp)))`
|
||||
)
|
||||
|
||||
//取图片
|
||||
func getPicture() string {
|
||||
prefix := "https://fabiaoqing.com/tag/detail/id/5682/page"
|
||||
url := fmt.Sprintf("%d.html", rand.Intn(11)+1)
|
||||
url = prefix + url
|
||||
log.Println("正在" + url + "寻找图片")
|
||||
urls := getImgs(url)
|
||||
fmt.Println(urls)
|
||||
imageURL := urls[rand.Intn(len(urls))]
|
||||
log.Println("取到" + imageURL)
|
||||
return imageURL
|
||||
}
|
||||
|
||||
func HandleError(err error, why string) {
|
||||
if err != nil {
|
||||
fmt.Println(why, err)
|
||||
}
|
||||
}
|
||||
|
||||
func getImgs(url string) (urls []string) {
|
||||
pageStr := GetPageStr(url)
|
||||
re := regexp.MustCompile(reImg)
|
||||
results := re.FindAllStringSubmatch(pageStr, -1)
|
||||
fmt.Printf("共找到%d条结果\n", len(results))
|
||||
for _, result := range results {
|
||||
url := result[0]
|
||||
urls = append(urls, url)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetPageStr(url string) (pageStr string) {
|
||||
resp, err := http.Get(url)
|
||||
HandleError(err, "http.Get url")
|
||||
defer resp.Body.Close()
|
||||
// 2.读取页面内容
|
||||
pageBytes, err := ioutil.ReadAll(resp.Body)
|
||||
HandleError(err, "ioutil.ReadAll")
|
||||
// 字节转字符串
|
||||
pageStr = string(pageBytes)
|
||||
return pageStr
|
||||
}
|
||||
*/
|
||||
@ -1,69 +0,0 @@
|
||||
package aireply
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
)
|
||||
|
||||
// QYKReply 青云客回复类
|
||||
type QYKReply struct{}
|
||||
|
||||
// DealQuestion 把椛椛替换为菲菲
|
||||
func (*QYKReply) DealQuestion(preMsg string) (msg string) {
|
||||
msg = strings.ReplaceAll(preMsg, zero.BotConfig.NickName[0], qykBotName)
|
||||
return msg
|
||||
}
|
||||
|
||||
// GetReply 取得回复消息
|
||||
func (*QYKReply) GetReply(msg string) (reply string) {
|
||||
u := fmt.Sprintf(qykURL, url.QueryEscape(msg))
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
log.Errorln("[aireply-qingyunke]:", err)
|
||||
return ""
|
||||
}
|
||||
// 自定义Header
|
||||
req.Header.Set("User-Agent", getAgent())
|
||||
req.Header.Set("Connection", "keep-alive")
|
||||
req.Header.Set("Host", "api.qingyunke.com")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln("[aireply-qingyunke]:", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
bytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Errorln("[aireply-qingyunke]:", err)
|
||||
return
|
||||
}
|
||||
reply = gjson.Get(helper.BytesToString(bytes), "content").String()
|
||||
log.Println("reply:", reply)
|
||||
return
|
||||
}
|
||||
|
||||
// DealReply 处理回复消息
|
||||
func (*QYKReply) DealReply(reply string) (textReply string, faceReply int) {
|
||||
reg := regexp.MustCompile(`\{face:(\d+)\}(.*)`)
|
||||
faceReply = -1
|
||||
if reg.MatchString(reply) {
|
||||
faceReply, _ = strconv.Atoi(reg.FindStringSubmatch(reply)[1])
|
||||
textReply = reg.FindStringSubmatch(reply)[2]
|
||||
} else {
|
||||
textReply = reply
|
||||
}
|
||||
textReply = strings.ReplaceAll(textReply, qykBotName, zero.BotConfig.NickName[0])
|
||||
textReply = strings.ReplaceAll(textReply, "{br}", "\n")
|
||||
return
|
||||
}
|
||||
32
plugin_ai_reply/tts.go
Normal file
32
plugin_ai_reply/tts.go
Normal file
@ -0,0 +1,32 @@
|
||||
package aireply
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/aireply"
|
||||
"github.com/FloatTech/AnimeAPI/mockingbird"
|
||||
control "github.com/FloatTech/zbpctrl"
|
||||
)
|
||||
|
||||
const ttsprio = 250
|
||||
|
||||
func init() {
|
||||
limit := rate.NewManager(time.Second*10, 1)
|
||||
|
||||
control.Register("mockingbird", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "拟声鸟\n- @Bot 任意文本(任意一句话回复)",
|
||||
}).OnMessage(zero.OnlyToMe, func(ctx *zero.Ctx) bool {
|
||||
return limit.Load(ctx.Event.UserID).Acquire()
|
||||
}).SetBlock(true).SetPriority(ttsprio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
msg := ctx.ExtractPlainText()
|
||||
r := aireply.NewAIReply(getReplyMode(ctx))
|
||||
ctx.SendChain(mockingbird.Speak(ctx.Event.UserID, func() string {
|
||||
return r.TalkPlain(msg)
|
||||
}))
|
||||
})
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
package aireply
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
)
|
||||
|
||||
// XiaoAiReply 小爱回复类
|
||||
type XiaoAiReply struct{}
|
||||
|
||||
// DealQuestion 把椛椛替换为小爱
|
||||
func (*XiaoAiReply) DealQuestion(preMsg string) (msg string) {
|
||||
msg = strings.ReplaceAll(preMsg, zero.BotConfig.NickName[0], xiaoaiBotName)
|
||||
return msg
|
||||
}
|
||||
|
||||
// GetReply 取得回复消息
|
||||
func (*XiaoAiReply) GetReply(msg string) (reply string) {
|
||||
u := fmt.Sprintf(xiaoaiURL, url.QueryEscape(msg))
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
log.Errorln("[aireply-xiaoai]:", err)
|
||||
return ""
|
||||
}
|
||||
// 自定义Header
|
||||
req.Header.Set("User-Agent", getAgent())
|
||||
req.Header.Set("Connection", "keep-alive")
|
||||
req.Header.Set("Host", "81.70.100.130")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln("[aireply-xiaoai]:", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
bytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Errorln("[aireply-xiaoai]:", err)
|
||||
return
|
||||
}
|
||||
reply = helper.BytesToString(bytes)
|
||||
log.Println("reply:", reply)
|
||||
return
|
||||
}
|
||||
|
||||
// DealReply 处理回复消息
|
||||
func (*XiaoAiReply) DealReply(reply string) (textReply string, faceReply int) {
|
||||
textReply = strings.ReplaceAll(reply, xiaoaiBotName, zero.BotConfig.NickName[0])
|
||||
if textReply == "" {
|
||||
textReply = zero.BotConfig.NickName[0] + "听不懂你的话了,能再说一遍吗"
|
||||
}
|
||||
textReply = strings.ReplaceAll(textReply, "小米智能助理", "电子宠物")
|
||||
faceReply = -1
|
||||
return
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
package mockingbird
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
)
|
||||
|
||||
// 加载数据库
|
||||
func init() {
|
||||
go func() {
|
||||
process.SleepAbout1sTo2s()
|
||||
_ = os.MkdirAll(dbpath, 0755)
|
||||
os.RemoveAll(cachePath)
|
||||
_ = os.MkdirAll(cachePath, 0755)
|
||||
_, err := file.GetLazyData(dbfile, false, true)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
logrus.Infoln("[mockingbird]加载实例音频")
|
||||
}()
|
||||
}
|
||||
@ -1,139 +0,0 @@
|
||||
// Package mockingbird 拟声鸟
|
||||
package mockingbird
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
control "github.com/FloatTech/zbpctrl"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
|
||||
aireply "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_reply"
|
||||
)
|
||||
|
||||
const (
|
||||
prio = 250
|
||||
dbpath = "data/MockingBird/"
|
||||
cachePath = dbpath + "cache/"
|
||||
dbfile = dbpath + "降噪3.wav"
|
||||
baseURL = "http://aaquatri.com/sound/"
|
||||
synthesizersURL = baseURL + "api/synthesizers/"
|
||||
synthesizeURL = baseURL + "api/synthesize"
|
||||
)
|
||||
|
||||
var (
|
||||
engine = control.Register("mockingbird", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "拟声鸟\n- @Bot 任意文本(任意一句话回复)",
|
||||
})
|
||||
limit = rate.NewManager(time.Second*10, 1)
|
||||
vocoderList = []string{"WaveRNN", "HifiGAN"}
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine.OnMessage(zero.OnlyToMe, getAcquire).SetBlock(true).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
msg := ctx.ExtractPlainText()
|
||||
AIReply := aireply.NewAIReply(aireply.GetReplyMode(ctx))
|
||||
// 把消息里的椛椛替换成对应接口机器人的名字
|
||||
msg = AIReply.DealQuestion(msg)
|
||||
reply := AIReply.GetReply(msg)
|
||||
// 挑出 face 表情
|
||||
textReply, _ := AIReply.DealReply(reply)
|
||||
// 拟声器生成音频
|
||||
syntPath := getSyntPath()
|
||||
fileName := getWav(textReply, syntPath, vocoderList[1], ctx.Event.UserID)
|
||||
// 回复
|
||||
ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + cachePath + fileName))
|
||||
})
|
||||
}
|
||||
|
||||
func getSyntPath() (syntPath string) {
|
||||
data, err := web.ReqWith(synthesizersURL, "GET", "", "")
|
||||
if err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
syntPath = gjson.Get(helper.BytesToString(data), "0.path").String()
|
||||
return
|
||||
}
|
||||
|
||||
func getWav(text, syntPath, vocoder string, uid int64) (fileName string) {
|
||||
fileName = strconv.FormatInt(uid, 10) + time.Now().Format("20060102150405") + ".wav"
|
||||
var b bytes.Buffer
|
||||
w := multipart.NewWriter(&b)
|
||||
// Add your file
|
||||
f, err := os.Open(dbfile)
|
||||
if err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
defer f.Close()
|
||||
fw, err := w.CreateFormFile("file", dbfile)
|
||||
if err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if _, err = io.Copy(fw, f); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if fw, err = w.CreateFormField("text"); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if _, err = fw.Write([]byte(text)); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if fw, err = w.CreateFormField("synt_path"); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if _, err = fw.Write([]byte(syntPath)); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if fw, err = w.CreateFormField("vocoder"); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
if _, err = fw.Write([]byte(vocoder)); err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
w.Close()
|
||||
// Now that you have a form, you can submit it to your handler.
|
||||
req, err := http.NewRequest("POST", synthesizeURL, &b)
|
||||
if err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
// Don't forget to set the content type, this will contain the boundary.
|
||||
req.Header.Set("Content-Type", w.FormDataContentType())
|
||||
|
||||
// Submit the request
|
||||
client := &http.Client{}
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
// Check the response
|
||||
if res.StatusCode != http.StatusOK {
|
||||
log.Errorf("[mockingbird]bad status: %s", res.Status)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
data, _ := ioutil.ReadAll(res.Body)
|
||||
err = os.WriteFile(cachePath+fileName, data, 0666)
|
||||
if err != nil {
|
||||
log.Errorln("[mockingbird]:", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getAcquire(ctx *zero.Ctx) bool {
|
||||
return limit.Load(ctx.Event.UserID).Acquire()
|
||||
}
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "github.com/logoove/sqlite" // import sql
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -192,7 +193,7 @@ func (vdb *VtbDB) GetVtbList() (uidList []string) {
|
||||
return
|
||||
}
|
||||
// 自定义Header
|
||||
req.Header.Set("User-Agent", randua())
|
||||
req.Header.Set("User-Agent", web.RandUA())
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
@ -255,7 +256,7 @@ func (vdb *VtbDB) StoreVtb(uid string) {
|
||||
return
|
||||
}
|
||||
// 自定义Header
|
||||
req.Header.Set("User-Agent", randua())
|
||||
req.Header.Set("User-Agent", web.RandUA())
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
@ -335,19 +336,3 @@ func (vdb *VtbDB) StoreVtb(uid string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var agent = [...]string{
|
||||
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0",
|
||||
"Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11",
|
||||
"Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11",
|
||||
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)",
|
||||
"Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
|
||||
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; The World)",
|
||||
"User-Agent,Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
|
||||
"User-Agent, Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)",
|
||||
"User-Agent,Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
|
||||
}
|
||||
|
||||
func randua() string {
|
||||
return agent[rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(agent))]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user