mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-07 23:50:25 +00:00
Compare commits
6 Commits
v1.2.4-bet
...
v1.2.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0212ec51cc | ||
|
|
7109e30d93 | ||
|
|
6990819d5c | ||
|
|
b4ff754934 | ||
|
|
6ece644a7b | ||
|
|
f826b4d0bc |
@@ -252,12 +252,14 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
|
||||
- **骂人** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_curse"`
|
||||
- [x] 骂我
|
||||
- [x] 大力骂我
|
||||
- **b站推送** `_ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili_push"`
|
||||
- **b站推送** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili_push"`
|
||||
- [x] 添加订阅[uid]
|
||||
- [x] 取消订阅[uid]
|
||||
- [x] 取消动态订阅[uid]
|
||||
- [x] 取消直播订阅[uid]
|
||||
- [x] 推送列表
|
||||
- **网易云音乐热评** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_wangyiyun"`
|
||||
- [x] 来份网易云热评
|
||||
- **TODO...**
|
||||
|
||||
## 使用方法
|
||||
|
||||
4
go.mod
4
go.mod
@@ -3,8 +3,8 @@ module github.com/FloatTech/ZeroBot-Plugin
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v1.2.4-beta21
|
||||
github.com/FloatTech/zbputils v1.2.4-beta7
|
||||
github.com/FloatTech/AnimeAPI v1.2.4
|
||||
github.com/FloatTech/zbputils v1.2.4
|
||||
github.com/antchfx/htmlquery v1.2.4
|
||||
github.com/corona10/goimagehash v1.0.3
|
||||
github.com/fogleman/gg v1.3.0
|
||||
|
||||
8
go.sum
8
go.sum
@@ -1,8 +1,8 @@
|
||||
github.com/FloatTech/AnimeAPI v1.2.4-beta21 h1:C0CoX6mrEAOEWl1sLUhGBTasvwnwMkEMEGcDI4fps1I=
|
||||
github.com/FloatTech/AnimeAPI v1.2.4-beta21/go.mod h1:rhYvzqLH2YTKBOk7DfJsXsdZlnxhpBP3HvctwqlLykM=
|
||||
github.com/FloatTech/AnimeAPI v1.2.4 h1:lo5c8s/nj3ZdpFkWrjnyEv3b79b5mAGTPQmMiaGVKo0=
|
||||
github.com/FloatTech/AnimeAPI v1.2.4/go.mod h1:Ys5P/MadG6TT/5rWuPgxWgt+dDoDPKEBKCkLg4jn5uc=
|
||||
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
|
||||
github.com/FloatTech/zbputils v1.2.4-beta7 h1:DofQTSVEBU1BQnLb4GahNZqsqVqoj4Lu5GDJa2rJW9o=
|
||||
github.com/FloatTech/zbputils v1.2.4-beta7/go.mod h1:mPVpKu2scTyBiitNmzCrxGc9aIKs9rwfb6iqz/+heck=
|
||||
github.com/FloatTech/zbputils v1.2.4 h1:8wTqL0LwY++LdIakQ1cvCfYqQdTvlCGaL6RRTy6UMnA=
|
||||
github.com/FloatTech/zbputils v1.2.4/go.mod h1:mPVpKu2scTyBiitNmzCrxGc9aIKs9rwfb6iqz/+heck=
|
||||
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=
|
||||
|
||||
1
main.go
1
main.go
@@ -52,6 +52,7 @@ import (
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_score" // 分数
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shadiao" // 沙雕app
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_wangyiyun" // 网易云音乐热评
|
||||
|
||||
// b站相关
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili" // 查询b站用户信息
|
||||
|
||||
@@ -53,4 +53,5 @@ const (
|
||||
PrioCurse
|
||||
PrioMockingBird
|
||||
PrioAIReply
|
||||
PrioWangYiYun
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/file"
|
||||
"github.com/FloatTech/zbputils/math"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
"github.com/FloatTech/zbputils/txt2img"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
@@ -146,7 +147,7 @@ func init() {
|
||||
digest := md5.Sum(helper.StringToBytes(zipfile + strconv.Itoa(index) + title + text))
|
||||
cachefile := cache + hex.EncodeToString(digest[:])
|
||||
|
||||
m, err := imgpool.NewImage(ctx, cachefile, file.BOTPATH+"/"+cachefile)
|
||||
m, err := imgpool.GetImage(ctx, cachefile)
|
||||
if err != nil {
|
||||
logrus.Debugln("[fortune]", err)
|
||||
if file.IsNotExist(cachefile) {
|
||||
@@ -163,6 +164,11 @@ func init() {
|
||||
}
|
||||
}
|
||||
m, err = imgpool.NewImage(ctx, cachefile, file.BOTPATH+"/"+cachefile)
|
||||
process.SleepAbout1sTo2s() // 防止风控
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + cachefile))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/AnimeAPI/imgpool"
|
||||
@@ -76,7 +76,7 @@ func init() {
|
||||
rannum := randintn(len(soutujson.Illusts))
|
||||
pom2 := soutujson.Illusts[rannum].ImageUrls.Medium[19:]
|
||||
u := pom1 + pom2
|
||||
m, err := imgpool.NewImage(ctx, strconv.Itoa(soutujson.Illusts[rannum].ID), u)
|
||||
m, err := imgpool.NewImage(ctx, u[strings.LastIndex(u, "/")+1:], u)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Image(u))
|
||||
return
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/FloatTech/AnimeAPI/imgpool"
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/math"
|
||||
"github.com/FloatTech/zbputils/process"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
@@ -54,7 +55,12 @@ func init() {
|
||||
}
|
||||
url := json.Get("data.0.urls.original").Str
|
||||
url = strings.ReplaceAll(url, "i.pixiv.cat", "i.pixiv.re")
|
||||
m, err := imgpool.NewImage(ctx, url[:strings.LastIndex(url, "/")+1], url)
|
||||
name := url[strings.LastIndex(url, "/")+1 : len(url)-4]
|
||||
m, err := imgpool.GetImage(ctx, name)
|
||||
if err != nil {
|
||||
m, err = imgpool.NewImage(ctx, name, url)
|
||||
process.SleepAbout1sTo2s()
|
||||
}
|
||||
if err == nil {
|
||||
queue <- m.String()
|
||||
} else {
|
||||
|
||||
40
plugin_wangyiyun/main.go
Normal file
40
plugin_wangyiyun/main.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// Package wangyiyun 网易云音乐热评
|
||||
package wangyiyun
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
)
|
||||
|
||||
const (
|
||||
wangyiyunURL = "http://ovooa.com/API/wyrp/api.php?type=text"
|
||||
wangyiyunReferer = "http://ovooa.com/"
|
||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
|
||||
)
|
||||
|
||||
func init() {
|
||||
limit := rate.NewManager(time.Minute, 60)
|
||||
control.Register("wangyiyun", order.PrioWangYiYun, &control.Options{
|
||||
DisableOnDefault: false,
|
||||
Help: "wangyiyun \n- 来份网易云热评",
|
||||
}).OnFullMatch("来份网易云热评").SetBlock(true).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||
return
|
||||
}
|
||||
data, err := web.ReqWith(wangyiyunURL, "GET", wangyiyunReferer, ua)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text(helper.BytesToString(data)))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user