Skip to content

feat:添加来自ovooa的网易云热评API #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 24, 2022
1 change: 1 addition & 0 deletions order/prio.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ const (
PrioCurse
PrioMockingBird
PrioAIReply
PrioWangYiYun
)
43 changes: 43 additions & 0 deletions plugin_wangyiyun/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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"
"time"
)

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{

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
}

})
}