mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
Feature zbpp bilibilipush 20230224 (#599)
* 🔥 删除小鸡词典 * ✨ 添加新插件和修改bilibilipush问题 * 🎨 去掉多余结构 * 🎨 简化语句
This commit is contained in:
31
plugin/kfccrazythursday/kfccrazythursday.go
Normal file
31
plugin/kfccrazythursday/kfccrazythursday.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Package kfccrazythursday 疯狂星期四
|
||||
package kfccrazythursday
|
||||
|
||||
import (
|
||||
"github.com/FloatTech/floatbox/web"
|
||||
ctrl "github.com/FloatTech/zbpctrl"
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
"github.com/tidwall/gjson"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
crazyURL = "https://www.iculture.cc/demo/CrazyThursday/api/kfc.php"
|
||||
)
|
||||
|
||||
func init() {
|
||||
engine := control.Register("kfccrazythursday", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "疯狂星期四",
|
||||
Help: "疯狂星期四\n",
|
||||
})
|
||||
engine.OnFullMatch("疯狂星期四").SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
data, err := web.GetData(crazyURL)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("Error:", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text(gjson.ParseBytes(data).Get("@this.0.content").String()))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user