mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
增加沙雕app一系列接口 (#91)
* feat:添加沙雕app一系列api * fix: 修个文案 * fix:修改等级 * fix:好孩子不能骂人 Co-authored-by: Guohuiyuan <haibaraguo@yeahka.com>
This commit is contained in:
parent
f56cee9ec1
commit
a3b5a226ac
11
README.md
11
README.md
@ -220,8 +220,15 @@ zerobot -h -t token -u url [-d|w] [-g 监听地址:端口] qq1 qq2 qq3 ...
|
|||||||
- [x] coser
|
- [x] coser
|
||||||
- **小说** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" `
|
- **小说** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" `
|
||||||
- [x] 小说[xxx]
|
- [x] 小说[xxx]
|
||||||
- **骂人** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_curse"`
|
- **沙雕app插件** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shadiao"`
|
||||||
- [x] 骂他[@xxx]|骂他[qq号]
|
- [x] 骂他[@xxx]|骂他[qq号] (停用)
|
||||||
|
- [x] 骂我 (停用)
|
||||||
|
- [x] 哄我
|
||||||
|
- [x] 渣我
|
||||||
|
- [x] 来碗绿茶
|
||||||
|
- [x] 发个朋友圈
|
||||||
|
- [x] 来碗毒鸡汤
|
||||||
|
- [x] 讲个段子
|
||||||
- **笑话** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny"`
|
- **笑话** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny"`
|
||||||
- [x] 讲个笑话[@xxx]|讲个笑话[qq号]
|
- [x] 讲个笑话[@xxx]|讲个笑话[qq号]
|
||||||
- **TODO...**
|
- **TODO...**
|
||||||
|
|||||||
2
main.go
2
main.go
@ -33,7 +33,6 @@ import (
|
|||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_book_review" // 哀伤雪刃吧推书记录
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_book_review" // 哀伤雪刃吧推书记录
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_choose" // 选择困难症帮手
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_choose" // 选择困难症帮手
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_coser" // 三次元小姐姐
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_coser" // 三次元小姐姐
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_curse" // 骂人
|
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_fortune" // 运势
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_fortune" // 运势
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny" // 笑话
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny" // 笑话
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
|
||||||
@ -43,6 +42,7 @@ import (
|
|||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" // 铅笔小说网搜索
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" // 铅笔小说网搜索
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_reborn" // 投胎
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_reborn" // 投胎
|
||||||
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shadiao" // 沙雕app
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
|
||||||
|
|
||||||
// b站相关
|
// b站相关
|
||||||
|
|||||||
@ -117,7 +117,7 @@ func init() { // 插件主体
|
|||||||
key := ctx.MessageString()
|
key := ctx.MessageString()
|
||||||
val := *kimomap[key]
|
val := *kimomap[key]
|
||||||
text := val[rand.Intn(len(val))]
|
text := val[rand.Intn(len(val))]
|
||||||
ctx.SendChain(message.At(ctx.Event.UserID), message.Text(text))
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,16 +43,16 @@ func init() {
|
|||||||
text := gjson.Get(helper.BytesToString(data), "data.Title").String()
|
text := gjson.Get(helper.BytesToString(data), "data.Title").String()
|
||||||
m = append(m,
|
m = append(m,
|
||||||
message.CustomNode(
|
message.CustomNode(
|
||||||
zero.BotConfig.NickName[0],
|
ctx.Event.Sender.NickName,
|
||||||
ctx.Event.SelfID,
|
ctx.Event.UserID,
|
||||||
text,
|
text,
|
||||||
))
|
))
|
||||||
gjson.Get(helper.BytesToString(data), "data.data").ForEach(func(_, value gjson.Result) bool {
|
gjson.Get(helper.BytesToString(data), "data.data").ForEach(func(_, value gjson.Result) bool {
|
||||||
imgcq := `[CQ:image,file=` + value.String() + `]`
|
imgcq := `[CQ:image,file=` + value.String() + `]`
|
||||||
m = append(m,
|
m = append(m,
|
||||||
message.CustomNode(
|
message.CustomNode(
|
||||||
zero.BotConfig.NickName[0],
|
ctx.Event.Sender.NickName,
|
||||||
ctx.Event.SelfID,
|
ctx.Event.UserID,
|
||||||
imgcq),
|
imgcq),
|
||||||
)
|
)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@ -1,54 +0,0 @@
|
|||||||
package curse
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
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/control"
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/utils/math"
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
|
|
||||||
curseURL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
engine = control.Register("curse", &control.Options{
|
|
||||||
DisableOnDefault: false,
|
|
||||||
Help: "骂人\n" +
|
|
||||||
"- 骂他[@xxx]|骂他[qq号]\n",
|
|
||||||
})
|
|
||||||
limit = rate.NewManager(time.Minute, 20)
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
engine.OnPrefix("骂我").SetBlock(true).FirstPriority().Handle(func(ctx *zero.Ctx) {
|
|
||||||
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := web.ReqWith(curseURL, "GET", "", ua)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR:", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.SendChain(message.At(ctx.Event.UserID), message.Text(helper.BytesToString(data)))
|
|
||||||
})
|
|
||||||
engine.OnRegex(`^骂他.*?(\d+)`, zero.OnlyGroup).SetBlock(true).SetPriority(40).
|
|
||||||
Handle(func(ctx *zero.Ctx) {
|
|
||||||
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := web.ReqWith(curseURL, "GET", "", ua)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR:", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.SendChain(message.At(math.Str2Int64(ctx.State["regex_matched"].([]string)[1])), message.Text(helper.BytesToString(data)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
22
plugin_shadiao/caihongpi.go
Normal file
22
plugin_shadiao/caihongpi.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package shadiao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
||||||
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
engine.OnFullMatch("哄我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(chpURL, "GET", chpReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||||
|
})
|
||||||
|
}
|
||||||
22
plugin_shadiao/dujitang.go
Normal file
22
plugin_shadiao/dujitang.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package shadiao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
||||||
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(duURL, "GET", duReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||||
|
})
|
||||||
|
}
|
||||||
22
plugin_shadiao/pengyouquan.go
Normal file
22
plugin_shadiao/pengyouquan.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package shadiao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
||||||
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
engine.OnFullMatch("发个朋友圈").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(pyqURL, "GET", pyqReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||||
|
})
|
||||||
|
}
|
||||||
35
plugin_shadiao/shadiao.go
Normal file
35
plugin_shadiao/shadiao.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Package shadiao 来源于 https://shadiao.app/# 的接口
|
||||||
|
package shadiao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/control"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/extension/rate"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
chpURL = "https://chp.shadiao.app/api.php"
|
||||||
|
duURL = "https://du.shadiao.app/api.php"
|
||||||
|
pyqURL = "https://pyq.shadiao.app/api.php"
|
||||||
|
yduanziURL = "http://www.yduanzi.com/duanzi/getduanzi"
|
||||||
|
chayiURL = "https://api.lovelive.tools/api/SweetNothings/Web/0"
|
||||||
|
ganhaiURL = "https://api.lovelive.tools/api/SweetNothings/Web/1"
|
||||||
|
zuanURL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
|
||||||
|
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
|
||||||
|
chpReferer = "https://chp.shadiao.app/"
|
||||||
|
duReferer = "https://du.shadiao.app/"
|
||||||
|
pyqReferer = "https://pyq.shadiao.app/"
|
||||||
|
yduanziReferer = "http://www.yduanzi.com/?utm_source=shadiao.app"
|
||||||
|
loveliveReferer = "https://lovelive.tools/"
|
||||||
|
zuanReferer = "https://zuanbot.com/"
|
||||||
|
prio = 10
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
engine = control.Register("curse", &control.Options{
|
||||||
|
DisableOnDefault: false,
|
||||||
|
Help: "沙雕app\n" +
|
||||||
|
"- 骂他[@xxx]|骂他[qq号](停用)\n- 骂我(停用)\n- 哄我\n- 渣我\n- 来碗绿茶\n- 发个朋友圈\n- 来碗毒鸡汤\n- 讲个段子",
|
||||||
|
})
|
||||||
|
limit = rate.NewManager(time.Minute, 60)
|
||||||
|
)
|
||||||
37
plugin_shadiao/sweetnothings.go
Normal file
37
plugin_shadiao/sweetnothings.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package shadiao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
engine.OnFullMatch("来碗绿茶").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(chayiURL, "GET", loveliveReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
text := gjson.Get(helper.BytesToString(data), "returnObj.content").String()
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
||||||
|
})
|
||||||
|
|
||||||
|
engine.OnFullMatch("渣我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(ganhaiURL, "GET", loveliveReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
text := gjson.Get(helper.BytesToString(data), "returnObj.content").String()
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
||||||
|
})
|
||||||
|
}
|
||||||
26
plugin_shadiao/yduanzi.go
Normal file
26
plugin_shadiao/yduanzi.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package shadiao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/utils/web"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
engine.OnFullMatch("讲个段子").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(yduanziURL, "POST", yduanziReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
text := gjson.Get(helper.BytesToString(data), "duanzi").String()
|
||||||
|
text = strings.Replace(text, "<br>", "\n", -1)
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
||||||
|
})
|
||||||
|
}
|
||||||
29
plugin_shadiao/zuan.go
Normal file
29
plugin_shadiao/zuan.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package shadiao
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
/*
|
||||||
|
engine.OnFullMatch("骂我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(zuanURL, "GET", zuanReferer, ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(helper.BytesToString(data)))
|
||||||
|
})
|
||||||
|
engine.OnRegex(`^骂他.*?(\d+)`, zero.OnlyGroup).SetBlock(true).SetPriority(40).
|
||||||
|
Handle(func(ctx *zero.Ctx) {
|
||||||
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := web.ReqWith(zuanURL, "GET", "", ua)
|
||||||
|
if err != nil {
|
||||||
|
ctx.SendChain(message.Text("ERROR:", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.SendChain(message.At(math.Str2Int64(ctx.State["regex_matched"].([]string)[1])), message.Text(helper.BytesToString(data)))
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user