mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
🎨 ⚡️ 🔥 modify wyy
This commit is contained in:
parent
6990819d5c
commit
7109e30d93
@ -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...**
|
||||
|
||||
## 使用方法
|
||||
|
||||
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站用户信息
|
||||
|
||||
@ -1,43 +1,40 @@
|
||||
// Package wangyiyun 网易云音乐热评
|
||||
package wangyiyun
|
||||
|
||||
import
|
||||
(
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
control "github.com/FloatTech/zbputils/control"
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
"github.com/FloatTech/ZeroBot-Plugin/order"
|
||||
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||
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"
|
||||
)
|
||||
|
||||
var(
|
||||
engine = control.Register("wangyiyun",order.PrioWangYiYun, &control.Options{
|
||||
|
||||
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- 来份网易云热评",
|
||||
})
|
||||
limit = rate.NewManager(time.Minute, 60)
|
||||
)
|
||||
func init() {
|
||||
engine.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
|
||||
}
|
||||
|
||||
})
|
||||
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)))
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user