mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-21 15:30:09 +08:00
feat:添加来自ovooa的网易云热评API (#111)
* Create readme.md * 调用网易云热评API * Update main.go * Delete readme.md * Delete main.go * Create main.go * Add files via upload * Update prio.go * Add files via upload * Add files via upload * Update prio.go * Add files via upload * Update prio.go * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * revert main Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
This commit is contained in:
parent
b4ff754934
commit
6990819d5c
@ -53,4 +53,5 @@ const (
|
|||||||
PrioCurse
|
PrioCurse
|
||||||
PrioMockingBird
|
PrioMockingBird
|
||||||
PrioAIReply
|
PrioAIReply
|
||||||
|
PrioWangYiYun
|
||||||
)
|
)
|
||||||
|
|||||||
43
plugin_wangyiyun/main.go
Normal file
43
plugin_wangyiyun/main.go
Normal file
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user