💫 ♻️ 🎉 ️ 强制使用优先级

This commit is contained in:
fumiama 2022-01-15 20:14:34 +08:00
parent 925e6847f3
commit 4519dd5eb8
58 changed files with 303 additions and 215 deletions

4
go.mod
View File

@ -3,8 +3,8 @@ module github.com/FloatTech/ZeroBot-Plugin
go 1.17
require (
github.com/FloatTech/AnimeAPI v1.2.4-beta1
github.com/FloatTech/zbputils v1.2.4-beta1
github.com/FloatTech/AnimeAPI v1.2.4-beta2
github.com/FloatTech/zbputils v1.2.4-beta2
github.com/antchfx/htmlquery v1.2.4
github.com/chromedp/chromedp v0.7.6
github.com/corona10/goimagehash v1.0.3

8
go.sum
View File

@ -1,8 +1,8 @@
github.com/FloatTech/AnimeAPI v1.2.4-beta1 h1:Ff+721UgTSXCRiod83wlUCY0C1nE4wWa7+NCgYjF/Ew=
github.com/FloatTech/AnimeAPI v1.2.4-beta1/go.mod h1:tQNIP/1fbQzEi3U9v9PsdPOr2OURMx9S8WH+w1oco4I=
github.com/FloatTech/AnimeAPI v1.2.4-beta2 h1:bpWv2QwIgommXblBTro+OtxfUWfSv86dSLMA2M1jjog=
github.com/FloatTech/AnimeAPI v1.2.4-beta2/go.mod h1:q2WwEhalrhjGdI/woUwWMryUXwIWKgJybQA2t2B+hB4=
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
github.com/FloatTech/zbputils v1.2.4-beta1 h1:WT85o9Y6MAJtmQaMD5h0l1mJ/7qBcjRQdNlCsB5pAPY=
github.com/FloatTech/zbputils v1.2.4-beta1/go.mod h1:ZIuQP4tuhn7jiowEy+PALiHmr4zzPQBj4VdjEyd5/Es=
github.com/FloatTech/zbputils v1.2.4-beta2 h1:9y8BZR5Rr4NgDz/818r8sCBjitIPrHY+Hd6tl3lINn4=
github.com/FloatTech/zbputils v1.2.4-beta2/go.mod h1:ZIuQP4tuhn7jiowEy+PALiHmr4zzPQBj4VdjEyd5/Es=
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb h1:Rkj28fqIwGx/EgBzRYtpmJRfH6wqVn7cNdc7aJ0QE4M=
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb/go.mod h1:imVKbfKqqeit+C/eaWGb4MKQ3z3gN6pRpBU5RMtp5so=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=

View File

@ -153,11 +153,11 @@ func getKanban() string {
func main() {
printBanner()
// 帮助
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).FirstPriority().
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(banner, "\n可发送\"/服务列表\"查看 bot 功能"))
})
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).FirstPriority().
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(getKanban()))
})

56
order/prio.go Normal file
View File

@ -0,0 +1,56 @@
// Package order 各个插件的优先级
package order
const (
PrioChat = iota * 10
PrioSleepManage
PrioAtri
PrioManager
PrioACGImage
PrioAIFalse
PrioAIWife
PrioBase14
PrioBilibili
PrioBilibiliPush
PrioBookReview
PrioCangTouShi
PrioChoose
PrioChouXiangHua
PrioCoser
PrioCPStory
PrioDanbooru
PrioDiana
PrioFansDaily
PrioFortune
PrioFunny
PrioGIF
PrioGithub
PrioHS
PrioImageFinder
PrioJueJueZi
PrioLolicon
PrioMinecraft
PrioMoyu
PrioMusic
PrioNativeSetu
PrioNativeWife
PrioNBNHHSH
PrioNovel
PrioOmikuji
PrioReborn
PrioRuncode
PrioSauceNao
PrioScore
PrioSetuTime
PrioShaDiao
PrioShinDan
PrioTraceMoe
PrioTranslation
PrioVtbQuotation
PrioWtf
PrioCurse
PrioMockingBird
PrioAIReply
)

View File

@ -8,6 +8,7 @@ import (
"github.com/FloatTech/AnimeAPI/classify"
"github.com/FloatTech/AnimeAPI/picture"
"github.com/FloatTech/ZeroBot-Plugin/order"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
@ -31,7 +32,7 @@ var (
)
func init() { // 插件主体
engine := control.Register("acgimage", &control.Options{
engine := control.Register("acgimage", order.PrioACGImage, &control.Options{
DisableOnDefault: false,
Help: "随机图片与AI点评\n" +
"- 随机图片(评级大于6的图将私发)\n" +
@ -40,7 +41,7 @@ func init() { // 插件主体
"- 太涩了(撤回最近发的图)\n" +
"- 评价图片(发送一张图片让bot评分)",
})
engine.OnRegex(`^设置随机图片网址(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).SetPriority(20).
engine.OnRegex(`^设置随机图片网址(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["regex_matched"].([]string)[1]
if !strings.HasPrefix(url, "http") {
@ -51,7 +52,7 @@ func init() { // 插件主体
}
})
// 有保护的随机图片
engine.OnFullMatch("随机图片", zero.OnlyGroup).SetBlock(true).SetPriority(24).
engine.OnFullMatch("随机图片", zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if limit.Load(ctx.Event.UserID).Acquire() {
class, dhash, comment, _ := classify.Classify(randapi, true)
@ -61,7 +62,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("你太快啦!"))
})
// 直接随机图片无r18保护后果自负。如果出r18图可尽快通过发送"太涩了"撤回
engine.OnFullMatch("直接随机", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(24).
engine.OnFullMatch("直接随机", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if block {
ctx.SendChain(message.Text("请稍后再试哦"))
@ -78,7 +79,7 @@ func init() { // 插件主体
}
})
// 撤回最后的直接随机图片
engine.OnFullMatch("太涩了").SetBlock(true).SetPriority(24).
engine.OnFullMatch("太涩了").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
msg, ok := msgof[ctx.Event.GroupID]
if ok {
@ -87,7 +88,7 @@ func init() { // 插件主体
}
})
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).SetPriority(24).
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中..."))
for _, url := range ctx.State["image_url"].([]string) {
@ -96,7 +97,7 @@ func init() { // 插件主体
break
}
})
engine.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).SetPriority(20).
engine.OnRegex(`^给你点提示哦:(.*)$`, zero.OnlyPrivate).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
dhash := ctx.State["regex_matched"].([]string)[1]
if len(dhash) == 5*3 {

View File

@ -7,6 +7,7 @@ import (
"os"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/disk"
@ -17,7 +18,7 @@ import (
)
func init() { // 插件主体
engine := control.Register("aifalse", &control.Options{
engine := control.Register("aifalse", order.PrioAIFalse, &control.Options{
DisableOnDefault: false,
Help: "AIfalse\n" +
"- 查询计算机当前活跃度: [检查身体|自检|启动自检|系统状态]",

View File

@ -6,6 +6,7 @@ import (
"time"
"github.com/FloatTech/AnimeAPI/aireply"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
@ -14,20 +15,19 @@ import (
const (
serviceName = "aireply"
prio = 256
)
var modes = [...]string{"青云客", "小爱"}
func init() { // 插件主体
bucket := rate.NewManager(time.Minute, 20) // 接口回复限速器
engine := control.Register(serviceName, &control.Options{
engine := control.Register(serviceName, order.PrioAIReply, &control.Options{
DisableOnDefault: false,
Help: "人工智能回复\n" +
"- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱]\n- ",
})
// 回复 @和包括名字
engine.OnMessage(zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnMessage(zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
aireply := aireply.NewAIReply(getReplyMode(ctx))
if !bucket.Load(ctx.Event.UserID).Acquire() {
@ -44,7 +44,7 @@ func init() { // 插件主体
}
ctx.Send(reply)
})
engine.OnPrefix(`设置回复模式`).SetBlock(true).SetPriority(20).
engine.OnPrefix(`设置回复模式`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
param := ctx.State["args"].(string)
err := setReplyMode(ctx, param)

View File

@ -8,20 +8,19 @@ import (
"github.com/FloatTech/AnimeAPI/aireply"
"github.com/FloatTech/AnimeAPI/mockingbird"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
)
const ttsprio = 250
func init() {
limit := rate.NewManager(time.Second*10, 1)
control.Register("mockingbird", &control.Options{
control.Register("mockingbird", order.PrioMockingBird, &control.Options{
DisableOnDefault: false,
Help: "拟声鸟\n- @Bot 任意文本(任意一句话回复)",
}).OnMessage(zero.OnlyToMe, func(ctx *zero.Ctx) bool {
return limit.Load(ctx.Event.UserID).Acquire()
}).SetBlock(true).SetPriority(ttsprio).
}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
msg := ctx.ExtractPlainText()
r := aireply.NewAIReply(getReplyMode(ctx))

View File

@ -6,6 +6,7 @@ import (
"math/rand"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -19,11 +20,11 @@ func init() { // 插件主体
// TODO: 1.17 特性暂不增加
// rand.Seed(time.Now().UnixMicro())
rand.Seed(time.Now().UnixNano())
control.Register("aiwife", &control.Options{
control.Register("aiwife", order.PrioAIWife, &control.Options{
DisableOnDefault: false,
Help: "AIWife\n" +
"- waifu|随机waifu",
}).OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetPriority(10).SetBlock(true).
}).OnFullMatchGroup([]string{"waifu", "随机waifu"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
miku := rand.Intn(100000) + 1
ctx.SendChain(message.At(ctx.Event.UserID), message.Image(fmt.Sprintf(bed, miku)))

View File

@ -12,6 +12,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
)
@ -19,14 +20,12 @@ import (
const (
// 服务名
servicename = "atri"
// ATRI 所有命令的优先级
prio = 15
// ATRI 表情的 codechina 镜像
res = "https://gitcode.net/u011570312/zbpdata/-/raw/main/Atri/"
)
func init() { // 插件主体
engine := control.Register(servicename, &control.Options{
engine := control.Register(servicename, order.PrioAtri, &control.Options{
DisableOnDefault: false,
Help: "本插件基于 ATRI ,为 Golang 移植版\n" +
"- ATRI醒醒\n- ATRI睡吧\n- 萝卜子\n- 喜欢|爱你|爱|suki|daisuki|すき|好き|贴贴|老婆|亲一个|mua\n" +
@ -35,7 +34,7 @@ func init() { // 插件主体
"- 没事|没关系|大丈夫|还好|不要紧|没出大问题|没伤到哪\n- 好吗|是吗|行不行|能不能|可不可以\n- 啊这\n- 我好了\n- |?|¿\n" +
"- 离谱\n- 答应我",
})
zero.OnFullMatch("ATRI醒醒", zero.AdminPermission).SetBlock(true).SetPriority(prio).
zero.OnFullMatch("ATRI醒醒", zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
c, ok := control.Lookup(servicename)
if ok && !c.IsEnabledIn(ctx.Event.GroupID) {
@ -44,7 +43,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("嗯呜呜……夏生先生……?"))
}
})
engine.OnFullMatch("ATRI睡吧", zero.AdminPermission).SetBlock(true).SetPriority(prio).
engine.OnFullMatch("ATRI睡吧", zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
c, ok := control.Lookup(servicename)
if ok && c.IsEnabledIn(ctx.Event.GroupID) {
@ -53,7 +52,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("Zzz……Zzz……"))
}
})
engine.OnFullMatch("萝卜子", atriSleep).SetBlock(true).SetPriority(prio).
engine.OnFullMatch("萝卜子", atriSleep).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
switch rand.Intn(2) {
@ -63,17 +62,17 @@ func init() { // 插件主体
ctx.SendChain(randRecord("RocketPunch.amr"))
}
})
engine.OnFullMatchGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSleep, zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnFullMatchGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSleep, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
})
engine.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, atriSleep, zero.OnlyToMe).SetBlock(true).SetPriority(prio - 1).
engine.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, atriSleep, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
ctx.SendChain(randImage("FN.jpg", "WQ.jpg", "WQ1.jpg"))
})
engine.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早", "早早早"}).SetBlock(true).SetPriority(prio).
engine.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早", "早早早"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
process.SleepAbout1sTo2s()
@ -113,7 +112,7 @@ func init() { // 插件主体
))
}
})
engine.OnFullMatchGroup([]string{"中午好", "午安", "午好"}).SetBlock(true).SetPriority(prio).
engine.OnFullMatchGroup([]string{"中午好", "午安", "午好"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
if now > 11 && now < 15 { // 中午
@ -126,7 +125,7 @@ func init() { // 插件主体
))
}
})
engine.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好", "晚上好"}).SetBlock(true).SetPriority(prio).
engine.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好", "晚上好"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour()
process.SleepAbout1sTo2s()
@ -169,7 +168,7 @@ func init() { // 插件主体
))
}
})
engine.OnKeywordGroup([]string{"高性能", "太棒了", "すごい", "sugoi", "斯国一", "よかった"}, atriSleep, zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnKeywordGroup([]string{"高性能", "太棒了", "すごい", "sugoi", "斯国一", "よかった"}, atriSleep, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
ctx.SendChain(randText(
@ -190,7 +189,7 @@ func init() { // 插件主体
"呣......我的高性能,毫无遗憾地施展出来了......",
))
})
engine.OnKeywordGroup([]string{"没事", "没关系", "大丈夫", "还好", "不要紧", "没出大问题", "没伤到哪"}, atriSleep, zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnKeywordGroup([]string{"没事", "没关系", "大丈夫", "还好", "不要紧", "没出大问题", "没伤到哪"}, atriSleep, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
ctx.SendChain(randText(
@ -205,26 +204,26 @@ func init() { // 插件主体
))
})
engine.OnKeywordGroup([]string{"好吗", "是吗", "行不行", "能不能", "可不可以"}, atriSleep).SetBlock(true).SetPriority(prio).
engine.OnKeywordGroup([]string{"好吗", "是吗", "行不行", "能不能", "可不可以"}, atriSleep).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
if rand.Intn(2) == 0 {
ctx.SendChain(randImage("YES.png", "NO.jpg"))
}
})
engine.OnKeywordGroup([]string{"啊这"}, atriSleep).SetBlock(true).SetPriority(prio).
engine.OnKeywordGroup([]string{"啊这"}, atriSleep).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
if rand.Intn(2) == 0 {
ctx.SendChain(randImage("AZ.jpg", "AZ1.jpg"))
}
})
engine.OnKeywordGroup([]string{"我好了"}, atriSleep).SetBlock(true).SetPriority(prio).
engine.OnKeywordGroup([]string{"我好了"}, atriSleep).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
ctx.SendChain(message.Reply(ctx.Event.MessageID), randText("不许好!", "憋回去!"))
})
engine.OnFullMatchGroup([]string{"", "?", "¿"}, atriSleep).SetBlock(true).SetPriority(prio).
engine.OnFullMatchGroup([]string{"", "?", "¿"}, atriSleep).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
switch rand.Intn(5) {
@ -234,7 +233,7 @@ func init() { // 插件主体
ctx.SendChain(randImage("WH.jpg", "WH1.jpg", "WH2.jpg", "WH3.jpg"))
}
})
engine.OnKeyword("离谱", atriSleep).SetBlock(true).SetPriority(prio).
engine.OnKeyword("离谱", atriSleep).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
switch rand.Intn(5) {
case 0:
@ -243,7 +242,7 @@ func init() { // 插件主体
ctx.SendChain(randImage("WH.jpg"))
}
})
engine.OnKeyword("答应我", atriSleep, zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnKeyword("答应我", atriSleep, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
process.SleepAbout1sTo2s()
ctx.SendChain(randText("我无法回应你的请求"))

View File

@ -4,6 +4,7 @@ package b14coder
import (
"unsafe"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
base14 "github.com/fumiama/go-base16384"
tea "github.com/fumiama/gofastTEA"
@ -13,12 +14,12 @@ import (
)
func init() {
en := control.Register("base16384", &control.Options{
en := control.Register("base16384", order.PrioBase14, &control.Options{
DisableOnDefault: false,
Help: "base16384加解密\n" +
"- 加密xxx\n- 解密xxx\n- 用yyy加密xxx\n- 用yyy解密xxx",
})
en.OnRegex(`^加密(.*)`).SetBlock(true).ThirdPriority().
en.OnRegex(`^加密(.*)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es, err := base14.UTF16be2utf8(base14.EncodeString(str))
@ -28,7 +29,7 @@ func init() {
ctx.SendChain(message.Text("加密失败!"))
}
})
en.OnRegex("^解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).ThirdPriority().
en.OnRegex("^解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[1]
es, err := base14.UTF82utf16be(helper.StringToBytes(str))
@ -38,7 +39,7 @@ func init() {
ctx.SendChain(message.Text("解密失败!"))
}
})
en.OnRegex(`^用(.*)加密(.*)`).SetBlock(true).ThirdPriority().
en.OnRegex(`^用(.*)加密(.*)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)
@ -49,7 +50,7 @@ func init() {
ctx.SendChain(message.Text("加密失败!"))
}
})
en.OnRegex("^用(.*)解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).ThirdPriority().
en.OnRegex("^用(.*)解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
t := getea(key)

View File

@ -5,6 +5,7 @@ import (
"net/http"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/fumiama/cron"
zero "github.com/wdvxdr1123/ZeroBot"
@ -25,7 +26,7 @@ type follower struct {
// 开启日报推送
func init() {
fansDaily()
en := control.Register("fansdaily", &control.Options{
en := control.Register("fansdaily", order.PrioFansDaily, &control.Options{
DisableOnDefault: true,
Help: "fansdaily\n- /开启粉丝日报\n- /关闭粉丝日报",
})

View File

@ -5,13 +5,14 @@ import (
"io/ioutil"
"net/http"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
var engine = control.Register("bilibili", &control.Options{
var engine = control.Register("bilibili", order.PrioBilibili, &control.Options{
DisableOnDefault: false,
Help: "bilibili\n" +
"- >vup info [名字|uid]\n" +

View File

@ -12,6 +12,7 @@ import (
"strconv"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
@ -33,7 +34,6 @@ const (
liveListURL = "https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids"
tURL = "https://t.bilibili.com/"
liveURL = "https://live.bilibili.com/"
prio = 10
serviceName = "bilibilipush"
)
@ -61,7 +61,7 @@ var (
func init() {
go bilibiliPushDaily()
en := control.Register(serviceName, &control.Options{
en := control.Register(serviceName, order.PrioBilibiliPush, &control.Options{
DisableOnDefault: false,
Help: "bilibilipush\n" +
"- 添加订阅[uid]\n" +
@ -71,7 +71,7 @@ func init() {
"- 推送列表",
})
en.OnRegex(`^添加订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^添加订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@ -97,7 +97,7 @@ func init() {
ctx.SendChain(message.Text("已添加" + name + "的订阅"))
}
})
en.OnRegex(`^取消订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^取消订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@ -123,7 +123,7 @@ func init() {
ctx.SendChain(message.Text("已取消" + name + "的订阅"))
}
})
en.OnRegex(`^取消动态订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^取消动态订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@ -149,7 +149,7 @@ func init() {
ctx.SendChain(message.Text("已取消" + name + "的动态订阅"))
}
})
en.OnRegex(`^取消直播订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
en.OnRegex(`^取消直播订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
var name string
var ok bool
@ -175,7 +175,7 @@ func init() {
ctx.SendChain(message.Text("已取消" + name + "的直播订阅"))
}
})
en.OnFullMatch("推送列表", ctxext.UserOrGrpAdmin).SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
en.OnFullMatch("推送列表", ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID

View File

@ -7,12 +7,13 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/txt2img"
)
func init() {
engine := control.Register("bookreview", &control.Options{
engine := control.Register("bookreview", order.PrioBookReview, &control.Options{
DisableOnDefault: false,
Help: "哀伤雪刃推书记录\n- 书评[xxx]\n- 随机书评",
})

View File

@ -9,6 +9,7 @@ import (
"net/url"
"strings"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/antchfx/htmlquery"
log "github.com/sirupsen/logrus"
@ -22,7 +23,6 @@ const (
searchURL = "https://www.shicimingju.com/cangtoushi/index.html"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
referer = "https://www.shicimingju.com/cangtoushi/index.html"
prio = 20
)
var (
@ -31,12 +31,12 @@ var (
)
func init() {
engine := control.Register("cangtoushi", &control.Options{
engine := control.Register("cangtoushi", order.PrioCangTouShi, &control.Options{
DisableOnDefault: false,
Help: "藏头诗\n" +
"- 藏头诗[xxx]\n- 藏尾诗[xxx]",
})
engine.OnRegex("藏头诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnRegex("藏头诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).Handle(func(ctx *zero.Ctx) {
kw := ctx.State["regex_matched"].([]string)[1]
login()
data, err := search(kw, "7", "0")
@ -47,7 +47,7 @@ func init() {
ctx.SendChain(message.Text(text))
})
engine.OnRegex("藏尾诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnRegex("藏尾诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).Handle(func(ctx *zero.Ctx) {
kw := ctx.State["regex_matched"].([]string)[1]
login()
data, err := search(kw, "7", "2")

View File

@ -6,6 +6,7 @@ import (
"strconv"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
@ -15,12 +16,11 @@ import (
const (
dbpath = "data/Chat/"
dbfile = dbpath + "kimoi.json"
prio = 10
)
var (
poke = rate.NewManager(time.Minute*5, 8) // 戳一戳
engine = control.Register("chat", &control.Options{
engine = control.Register("chat", order.PrioChat, &control.Options{
DisableOnDefault: false,
Help: "chat\n- [BOT名字]\n- [戳一戳BOT]\n- 空调开\n- 空调关\n- 群温度\n- 设置温度[正整数]\n- mua|啾咪|摸|上你|傻|裸|贴|老婆|抱|亲|一下|咬|操|123|进去|调教|搓|让|捏|挤|略|呐|原味|胖次|内裤|内衣|衣服|ghs|批|憨批|kkp|咕|骚|喜欢|suki|好き|看|不能|砸了|透|口我|草我|自慰|onani|オナニー|炸了|色图|涩图|告白|对不起|回来|吻|软|壁咚|掰开|女友|是|喵|嗷呜|叫|拜|佬|awsl|臭|香|腿|张开|脚|脸|头发|手|pr|舔|小穴|腰|诶嘿嘿|可爱|扭蛋|鼻|眼|色气|推|床|举|手冲|饿|变|敲|爬|怕|冲|射|不穿|迫害|猫粮|揪尾巴|薄荷|早|晚安|揉|榨|掐|胸|奶子|欧派|嫩|蹭|牵手|握手|拍照|w|睡不着|欧尼酱|哥|爱你|过来|自闭|打不过|么么哒|很懂|膝枕|累了|安慰|洗澡|一起睡觉|一起|多大|姐姐|糖|嗦|牛子|🐂子|🐮子|嫌弃|紧|baka|笨蛋|插|插进来|屁股|翘|翘起来|抬|抬起|爸|傲娇|rua|咕噜咕噜|咕噜|上床|做爱|吃掉|吃|揪|种草莓|种草|掀|妹|病娇|嘻",
})
@ -30,7 +30,7 @@ var (
func init() { // 插件主体
// 被喊名字
engine.OnFullMatch("", zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnFullMatch("", zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var nickname = zero.BotConfig.NickName[0]
time.Sleep(time.Second * 1)
@ -44,7 +44,7 @@ func init() { // 插件主体
))
})
// 戳一戳
engine.On("notice/notify/poke", zero.OnlyToMe).SetBlock(false).SetPriority(prio).
engine.On("notice/notify/poke", zero.OnlyToMe).SetBlock(false).
Handle(func(ctx *zero.Ctx) {
var nickname = zero.BotConfig.NickName[0]
switch {
@ -63,18 +63,18 @@ func init() { // 插件主体
// 群空调
var AirConditTemp = map[int64]int{}
var AirConditSwitch = map[int64]bool{}
engine.OnFullMatch("空调开").SetBlock(true).SetPriority(prio).
engine.OnFullMatch("空调开").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
AirConditSwitch[ctx.Event.GroupID] = true
ctx.SendChain(message.Text("❄️哔~"))
})
engine.OnFullMatch("空调关").SetBlock(true).SetPriority(prio).
engine.OnFullMatch("空调关").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
AirConditSwitch[ctx.Event.GroupID] = false
delete(AirConditTemp, ctx.Event.GroupID)
ctx.SendChain(message.Text("💤哔~"))
})
engine.OnRegex(`设置温度(\d+)`).SetBlock(true).SetPriority(prio).
engine.OnRegex(`设置温度(\d+)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if _, exist := AirConditTemp[ctx.Event.GroupID]; !exist {
AirConditTemp[ctx.Event.GroupID] = 26
@ -93,7 +93,7 @@ func init() { // 插件主体
))
}
})
engine.OnFullMatch(`群温度`).SetBlock(true).SetPriority(prio).
engine.OnFullMatch(`群温度`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if _, exist := AirConditTemp[ctx.Event.GroupID]; !exist {
AirConditTemp[ctx.Event.GroupID] = 26
@ -111,7 +111,7 @@ func init() { // 插件主体
}
})
initChatList(func() {
engine.OnFullMatchGroup(chatList, zero.OnlyToMe).SetBlock(true).SetPriority(prio).Handle(
engine.OnFullMatchGroup(chatList, zero.OnlyToMe).SetBlock(true).Handle(
func(ctx *zero.Ctx) {
key := ctx.MessageString()
val := *kimomap[key]

View File

@ -6,19 +6,20 @@ import (
"strconv"
"strings"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() {
engine := control.Register("choose", &control.Options{
engine := control.Register("choose", order.PrioChoose, &control.Options{
DisableOnDefault: false,
Help: "choose\n" +
"- 选择可口可乐还是百事可乐\n" +
"- 选择肯德基还是麦当劳还是必胜客",
})
engine.OnPrefix("选择").SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("选择").SetBlock(true).Handle(handle)
}
func handle(ctx *zero.Ctx) {
rawOptions := strings.Split(ctx.State["args"].(string), "还是")

View File

@ -2,18 +2,17 @@
package chouxianghua
import (
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
const prio = 10
func init() {
control.Register("chouxianghua", &control.Options{
control.Register("chouxianghua", order.PrioChouXiangHua, &control.Options{
DisableOnDefault: false,
Help: "抽象话\n- 抽象翻译xxx",
}).OnRegex("^抽象翻译((\\s|[\\r\\n]|[\\p{Han}\\p{P}A-Za-z0-9])+)$").SetBlock(true).SetPriority(prio).
}).OnRegex("^抽象翻译((\\s|[\\r\\n]|[\\p{Han}\\p{P}A-Za-z0-9])+)$").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
r := cx(ctx.State["regex_matched"].([]string)[1])
ctx.SendChain(message.Text(r))

View File

@ -12,23 +12,22 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/web"
)
var (
engine = control.Register("coser", &control.Options{
DisableOnDefault: false,
Help: "三次元小姐姐\n- coser",
})
prio = 20
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
coserURL = "http://ovooa.com/API/cosplay/api.php"
limit = rate.NewManager(time.Minute, 5)
)
func init() {
engine.OnFullMatch("coser", zero.OnlyGroup).SetBlock(true).SetPriority(prio).
control.Register("coser", order.PrioCoser, &control.Options{
DisableOnDefault: false,
Help: "三次元小姐姐\n- coser",
}).OnFullMatch("coser", zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0..."))

View File

@ -7,21 +7,18 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/math"
)
const (
prio = 20
)
func init() {
engine := control.Register("cpstory", &control.Options{
engine := control.Register("cpstory", order.PrioCPStory, &control.Options{
DisableOnDefault: false,
Help: "cp短打\n- 组cp[@xxx][@xxx]\n- 组cp大老师 雪乃",
})
engine.OnRegex("^组cp.*?(\\d+).*?(\\d+)", zero.OnlyGroup).SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnRegex("^组cp.*?(\\d+).*?(\\d+)", zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) {
cs := getRandomCpStory()
gong := ctxext.CardOrNickName(ctx, math.Str2Int64(ctx.State["regex_matched"].([]string)[1]))
shou := ctxext.CardOrNickName(ctx, math.Str2Int64(ctx.State["regex_matched"].([]string)[2]))
@ -31,7 +28,7 @@ func init() {
text = strings.ReplaceAll(text, cs.Shou, gong)
ctx.SendChain(message.Text(text))
})
engine.OnPrefix("组cp").SetBlock(true).SetPriority(prio + 1).Handle(func(ctx *zero.Ctx) {
engine.OnPrefix("组cp").SetBlock(true).Handle(func(ctx *zero.Ctx) {
cs := getRandomCpStory()
params := strings.Split(ctx.State["args"].(string), " ")
if len(params) < 2 {

View File

@ -8,6 +8,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
)
@ -20,12 +21,12 @@ const (
func init() {
limit := rate.NewManager(time.Minute, 30)
engine := control.Register("curse", &control.Options{
engine := control.Register("curse", order.PrioCurse, &control.Options{
DisableOnDefault: true,
Help: "骂人(求骂,自卫)\n- 骂我\n- 大力骂我",
})
engine.OnFullMatch("骂我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("骂我").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}
@ -34,7 +35,7 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
})
engine.OnFullMatch("大力骂我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("大力骂我").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}
@ -43,7 +44,7 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
})
engine.OnKeywordGroup([]string{"他妈", "公交车", "你妈", "操", "屎", "去死", "快死", "我日", "逼", "尼玛", "艾滋", "癌症", "有病", "烦你", "你爹", "屮", "cnm"}, zero.OnlyToMe).SetBlock(true).SetPriority(prio).
engine.OnKeywordGroup([]string{"他妈", "公交车", "你妈", "操", "屎", "去死", "快死", "我日", "逼", "尼玛", "艾滋", "癌症", "有病", "烦你", "你爹", "屮", "cnm"}, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
text := getRandomCurseByLevel(maxLevel).Text
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))

View File

@ -9,6 +9,7 @@ import (
"github.com/FloatTech/AnimeAPI/danbooru"
"github.com/FloatTech/AnimeAPI/picture"
"github.com/FloatTech/AnimeAPI/saucenao"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/file"
zero "github.com/wdvxdr1123/ZeroBot"
@ -24,13 +25,13 @@ func init() { // 插件主体
if err != nil {
panic(err)
}
engine := control.Register("danbooru", &control.Options{
engine := control.Register("danbooru", order.PrioDanbooru, &control.Options{
DisableOnDefault: false,
Help: "二次元图片标签识别\n" +
"- 鉴赏图片[图片]",
})
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).SetPriority(23).
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, picture.CmdMatch, picture.MustGiven).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中..."))
for _, url := range ctx.State["image_url"].([]string) {

View File

@ -10,20 +10,21 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
)
var engine *zero.Engine
func init() {
engine = control.Register("diana", &control.Options{
var engine = control.Register("diana", order.PrioDiana, &control.Options{
DisableOnDefault: false,
Help: "嘉然\n" +
"- 小作文\n" +
"- 发大病\n" +
"- 教你一篇小作文[作文]\n" +
"- [回复]查重",
})
})
func init() {
// 随机发送一篇上面的小作文
engine.OnFullMatch("小作文").SetBlock(true).
Handle(func(ctx *zero.Ctx) {

View File

@ -18,6 +18,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/math"
@ -69,13 +70,13 @@ func init() {
panic(err)
}
// 插件主体
en := control.Register("fortune", &control.Options{
en := control.Register("fortune", order.PrioFortune, &control.Options{
DisableOnDefault: false,
Help: "每日运势: \n" +
"- 运势|抽签\n" +
"- 设置底图[车万 DC4 爱因斯坦 星空列车 樱云之恋 富婆妹 李清歌 公主连结 原神 明日方舟 碧蓝航线 碧蓝幻想 战双 阴阳师]",
})
en.OnRegex(`^设置底图(.*)`).SetBlock(true).SecondPriority().
en.OnRegex(`^设置底图(.*)`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
gid := ctx.Event.GroupID
if gid <= 0 {
@ -99,7 +100,7 @@ func init() {
}
ctx.SendChain(message.Text("没有这个底图哦~"))
})
en.OnFullMatchGroup([]string{"运势", "抽签"}).SetBlock(true).SecondPriority().
en.OnFullMatchGroup([]string{"运势", "抽签"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 获取该群背景类型,默认车万
kind := "车万"

View File

@ -9,13 +9,14 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/sql"
)
var (
engine = control.Register("funny", &control.Options{
engine = control.Register("funny", order.PrioFunny, &control.Options{
DisableOnDefault: false,
Help: "讲个笑话\n" +
"- 讲个笑话[@xxx]|讲个笑话[qq号]",
@ -25,7 +26,7 @@ var (
)
func init() {
engine.OnPrefix("讲个笑话").SetBlock(true).FirstPriority().Handle(func(ctx *zero.Ctx) {
engine.OnPrefix("讲个笑话").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -8,6 +8,7 @@ import (
"strings"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -27,11 +28,11 @@ func init() { // 插件主体
panic(err)
}
rand.Seed(time.Now().UnixNano()) // 设置种子
control.Register("gif", &control.Options{
control.Register("gif", order.PrioGIF, &control.Options{
DisableOnDefault: false,
Help: "制图\n- " + strings.Join(cmds, "\n- "),
}).OnRegex(`^(` + strings.Join(cmds, "|") + `)\D*?(\[CQ:(image\,file=([0-9a-zA-Z]{32}).*|at.+?(\d{5,11}))\].*|(\d+))$`).
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
SetBlock(true).Handle(func(ctx *zero.Ctx) {
c := newContext(ctx.Event.UserID)
list := ctx.State["regex_matched"].([]string)
c.prepareLogos(list[4]+list[5]+list[6], strconv.FormatInt(ctx.Event.UserID, 10))

View File

@ -9,6 +9,7 @@ import (
"net/url"
"strings"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -17,12 +18,12 @@ import (
)
func init() { // 插件主体
control.Register("github", &control.Options{
control.Register("github", order.PrioGithub, &control.Options{
DisableOnDefault: false,
Help: "GitHub仓库搜索\n" +
"- >github [xxx]\n" +
"- >github -p [xxx]",
}).OnRegex(`^>github\s(-.{1,10}? )?(.*)$`).SetBlock(true).FirstPriority().
}).OnRegex(`^>github\s(-.{1,10}? )?(.*)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 发送请求
header := http.Header{

View File

@ -12,6 +12,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/web"
@ -49,7 +50,7 @@ func init() {
panic(err)
}
engine := control.Register("hs", &control.Options{
engine := control.Register("hs", order.PrioHS, &control.Options{
DisableOnDefault: false,
Help: "炉石\n" +
"- 搜卡[xxxx]\n" +
@ -57,7 +58,7 @@ func init() {
"- 更多搜卡指令参数https://hs.fbigame.com/misc/searchhelp",
})
engine.OnRegex(`^搜卡(.+)$`).
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
SetBlock(true).Handle(func(ctx *zero.Ctx) {
List := ctx.State["regex_matched"].([]string)[1]
g := sh(List)
t := int(gjson.Get(g, `list.#`).Int())
@ -100,7 +101,7 @@ func init() {
})
// 卡组
engine.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
SetBlock(true).Handle(func(ctx *zero.Ctx) {
fmt.Print("成功")
List := ctx.State["regex_matched"].([]string)[1]
ctx.SendChain(

View File

@ -8,6 +8,7 @@ import (
"net/http"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -60,7 +61,7 @@ type resultjson struct {
}
func init() {
control.Register("imgfinder", &control.Options{
control.Register("imgfinder", order.PrioImageFinder, &control.Options{
DisableOnDefault: false,
Help: "关键字搜图\n" +
"- 来张 [xxx]",

View File

@ -8,6 +8,7 @@ import (
"strings"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
@ -19,7 +20,6 @@ import (
const (
juejueziURL = "https://www.offjuan.com/api/juejuezi/text"
prio = 15
referer = "https://juejuezi.offjuan.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"
)
@ -29,11 +29,11 @@ var (
)
func init() {
control.Register("juejuezi", &control.Options{
control.Register("juejuezi", order.PrioJueJueZi, &control.Options{
DisableOnDefault: false,
Help: "绝绝子生成器\n" +
"- 喝奶茶绝绝子|绝绝子吃饭",
}).OnRegex("[\u4E00-\u9FA5]{0,10}绝绝子[\u4E00-\u9FA5]{0,10}").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
}).OnRegex("[\u4E00-\u9FA5]{0,10}绝绝子[\u4E00-\u9FA5]{0,10}").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -11,6 +11,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/math"
)
@ -25,7 +26,7 @@ var (
)
func init() {
control.Register("lolicon", &control.Options{
control.Register("lolicon", order.PrioLolicon, &control.Options{
DisableOnDefault: false,
Help: "lolicon\n" +
"- 来份萝莉",

View File

@ -21,6 +21,7 @@ import (
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/zbputils/sql"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_manager/timer"
)
@ -60,7 +61,7 @@ var (
clock timer.Clock
)
var engine = control.Register("manager", &control.Options{
var engine = control.Register("manager", order.PrioManager, &control.Options{
DisableOnDefault: false,
Help: hint,
})
@ -80,7 +81,7 @@ func init() { // 插件主体
}
}()
// 升为管理
engine.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupAdmin(
ctx.Event.GroupID,
@ -95,7 +96,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text(nickname + " 升为了管理~"))
})
// 取消管理
engine.OnRegex(`^取消管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^取消管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupAdmin(
ctx.Event.GroupID,
@ -110,7 +111,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("残念~ " + nickname + " 暂时失去了管理员的资格"))
})
// 踢出群聊
engine.OnRegex(`^踢出群聊.*?(\d+)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^踢出群聊.*?(\d+)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupKick(
ctx.Event.GroupID,
@ -125,7 +126,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("残念~ " + nickname + " 被放逐"))
})
// 退出群聊
engine.OnRegex(`^退出群聊.*?(\d+)`, zero.OnlyToMe, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^退出群聊.*?(\d+)`, zero.OnlyToMe, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupLeave(
math.Str2Int64(ctx.State["regex_matched"].([]string)[1]), // 要退出的群的群号
@ -133,7 +134,7 @@ func init() { // 插件主体
)
})
// 开启全体禁言
engine.OnRegex(`^开启全员禁言$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^开启全员禁言$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupWholeBan(
ctx.Event.GroupID,
@ -142,7 +143,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("全员自闭开始~"))
})
// 解除全员禁言
engine.OnRegex(`^解除全员禁言$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^解除全员禁言$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupWholeBan(
ctx.Event.GroupID,
@ -151,7 +152,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("全员自闭结束~"))
})
// 禁言
engine.OnRegex(`^禁言.*?(\d+).*?\s(\d+)(.*)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^禁言.*?(\d+).*?\s(\d+)(.*)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
duration := math.Str2Int64(ctx.State["regex_matched"].([]string)[2])
switch ctx.State["regex_matched"].([]string)[3] {
@ -175,7 +176,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("小黑屋收留成功~"))
})
// 解除禁言
engine.OnRegex(`^解除禁言.*?(\d+)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^解除禁言.*?(\d+)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupBan(
ctx.Event.GroupID,
@ -185,7 +186,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("小黑屋释放成功~"))
})
// 自闭禁言
engine.OnRegex(`^(我要自闭|禅定).*?(\d+)(.*)`, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnRegex(`^(我要自闭|禅定).*?(\d+)(.*)`, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
duration := math.Str2Int64(ctx.State["regex_matched"].([]string)[2])
switch ctx.State["regex_matched"].([]string)[3] {
@ -209,7 +210,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("那我就不手下留情了~"))
})
// 修改名片
engine.OnRegex(`^修改名片.*?(\d+).*?\s(.*)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^修改名片.*?(\d+).*?\s(.*)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupCard(
ctx.Event.GroupID,
@ -219,7 +220,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("嗯!已经修改了"))
})
// 修改头衔
engine.OnRegex(`^修改头衔.*?(\d+).*?\s(.*)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^修改头衔.*?(\d+).*?\s(.*)`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupSpecialTitle(
ctx.Event.GroupID,
@ -229,7 +230,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("嗯!已经修改了"))
})
// 申请头衔
engine.OnRegex(`^申请头衔(.*)`, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnRegex(`^申请头衔(.*)`, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SetGroupSpecialTitle(
ctx.Event.GroupID,
@ -239,7 +240,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("嗯!不错的头衔呢~"))
})
// 群聊转发
engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 对CQ码进行反转义
content := ctx.State["regex_matched"].([]string)[2]
@ -252,7 +253,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("📧 --> " + ctx.State["regex_matched"].([]string)[1]))
})
// 私聊转发
engine.OnRegex(`^私聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^私聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 对CQ码进行反转义
content := ctx.State["regex_matched"].([]string)[2]
@ -265,7 +266,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("📧 --> " + ctx.State["regex_matched"].([]string)[1]))
})
// 定时提醒
engine.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
dateStrs := ctx.State["regex_matched"].([]string)
ts := timer.GetFilledTimer(dateStrs, ctx.Event.SelfID, ctx.Event.GroupID, false)
@ -277,7 +278,7 @@ func init() { // 插件主体
}
})
// 定时 cron 提醒
engine.OnRegex(`^在"(.*)"时(用.+)?提醒大家(.*)`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnRegex(`^在"(.*)"时(用.+)?提醒大家(.*)`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
dateStrs := ctx.State["regex_matched"].([]string)
var url, alert string
@ -300,7 +301,7 @@ func init() { // 插件主体
}
})
// 取消定时
engine.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
dateStrs := ctx.State["regex_matched"].([]string)
ts := timer.GetFilledTimer(dateStrs, ctx.Event.SelfID, ctx.Event.GroupID, true)
@ -313,7 +314,7 @@ func init() { // 插件主体
}
})
// 取消 cron 定时
engine.OnRegex(`^取消在"(.*)"的提醒`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnRegex(`^取消在"(.*)"的提醒`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
dateStrs := ctx.State["regex_matched"].([]string)
ts := timer.Timer{Cron: dateStrs[1], GrpID: ctx.Event.GroupID}
@ -326,12 +327,12 @@ func init() { // 插件主体
}
})
// 列出本群所有定时
engine.OnFullMatch("列出所有提醒", zero.AdminPermission, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnFullMatch("列出所有提醒", zero.AdminPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(clock.ListTimers(ctx.Event.GroupID)))
})
// 随机点名
engine.OnFullMatchGroup([]string{"翻牌"}, zero.OnlyGroup).SetBlock(true).SetPriority(40).
engine.OnFullMatchGroup([]string{"翻牌"}, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("少女祈祷中......"))
@ -369,7 +370,7 @@ func init() { // 插件主体
)
})
// 入群欢迎
engine.OnNotice().SetBlock(false).FirstPriority().
engine.OnNotice().SetBlock(false).
Handle(func(ctx *zero.Ctx) {
if ctx.Event.NoticeType == "group_increase" && ctx.Event.SelfID != ctx.Event.UserID {
var w welcome
@ -421,7 +422,7 @@ func init() { // 插件主体
}
})
// 退群提醒
engine.OnNotice().SetBlock(false).SetPriority(40).
engine.OnNotice().SetBlock(false).
Handle(func(ctx *zero.Ctx) {
if ctx.Event.NoticeType == "group_decrease" {
userid := ctx.Event.UserID
@ -429,7 +430,7 @@ func init() { // 插件主体
}
})
// 设置欢迎语
engine.OnRegex(`^设置欢迎语([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^设置欢迎语([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
w := &welcome{
GrpID: ctx.Event.GroupID,
@ -443,7 +444,7 @@ func init() { // 插件主体
}
})
// 入群后验证开关
engine.OnRegex(`^(.*)入群验证$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^(.*)入群验证$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
option := ctx.State["regex_matched"].([]string)[1]
c, ok := control.Lookup("manager")
@ -468,7 +469,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("找不到服务!"))
})
// 加群 gist 验证开关
engine.OnRegex(`^(.*)gist加群自动审批$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
engine.OnRegex(`^(.*)gist加群自动审批$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
option := ctx.State["regex_matched"].([]string)[1]
c, ok := control.Lookup("manager")
@ -493,7 +494,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("找不到服务!"))
})
// 运行 CQ 码
engine.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(0).
engine.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var cmd = ctx.State["regex_matched"].([]string)[1]
cmd = strings.ReplaceAll(cmd, "&#91;", "[")
@ -504,7 +505,7 @@ func init() { // 插件主体
// 根据 gist 自动同意加群
// 加群请在github新建一个gist其文件名为本群群号的字符串的md5(小写)内容为一行是当前unix时间戳(10分钟内有效)。
// 然后请将您的用户名和gist哈希(小写)按照username/gisthash的格式填写到回答即可。
engine.OnRequest().SetBlock(false).FirstPriority().Handle(func(ctx *zero.Ctx) {
engine.OnRequest().SetBlock(false).Handle(func(ctx *zero.Ctx) {
/*if ctx.Event.RequestType == "friend" {
ctx.SetFriendAddRequest(ctx.Event.Flag, true, "")
}*/

View File

@ -6,6 +6,7 @@ import (
"io/ioutil"
"net/http"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
@ -18,7 +19,7 @@ import (
const api = "http://your.addr:23333/api/start_server/%s/?apikey=apikey"
var engine = control.Register("minecraft", &control.Options{
var engine = control.Register("minecraft", order.PrioMinecraft, &control.Options{
DisableOnDefault: false,
Help: "minecraft\n" +
"- /mcstart xxx\n" +

View File

@ -4,6 +4,7 @@ package moyu
import (
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/fumiama/cron"
zero "github.com/wdvxdr1123/ZeroBot"
@ -18,12 +19,12 @@ func init() { // 插件主体
c.Start()
}
control.Register("moyu", &control.Options{
control.Register("moyu", order.PrioMoyu, &control.Options{
DisableOnDefault: true,
Help: "moyu\n" +
"- 添加摸鱼提醒\n" +
"- 删除摸鱼提醒",
}).OnFullMatch("删除摸鱼提醒", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(20).
}).OnFullMatch("删除摸鱼提醒", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
m, ok := control.Lookup("moyu")
if ok {
@ -38,7 +39,7 @@ func init() { // 插件主体
}
})
zero.OnFullMatch("添加摸鱼提醒", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(20).
zero.OnFullMatch("添加摸鱼提醒", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
m, ok := control.Lookup("moyu")
if ok {

View File

@ -11,6 +11,7 @@ import (
"strings"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
@ -21,14 +22,14 @@ import (
var limit = rate.NewManager(time.Minute*3, 5)
func init() {
control.Register("music", &control.Options{
control.Register("music", order.PrioMusic, &control.Options{
DisableOnDefault: false,
Help: "点歌\n" +
"- 点歌[xxx]\n" +
"- 网易点歌[xxx]\n" +
"- 酷我点歌[xxx]\n" +
"- 酷狗点歌[xxx]",
}).OnRegex("^(.{0,2})点歌(.{1,25})$").SetBlock(true).FirstPriority().
}).OnRegex("^(.{0,2})点歌(.{1,25})$").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0..."))

View File

@ -10,6 +10,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/rule"
)
@ -25,7 +26,7 @@ var (
)
func init() {
engine := control.Register("nativesetu", &control.Options{
engine := control.Register("nativesetu", order.PrioNativeSetu, &control.Options{
DisableOnDefault: false,
Help: "本地涩图\n" +
"- 本地[xxx]\n" +
@ -34,7 +35,7 @@ func init() {
"- 刷新所有本地setu\n" +
"- 所有本地setu分类",
})
engine.OnRegex(`^本地(.*)$`, func(ctx *zero.Ctx) bool { return rule.FirstValueInList(setuclasses)(ctx) }).SetBlock(true).SetPriority(36).
engine.OnRegex(`^本地(.*)$`, func(ctx *zero.Ctx) bool { return rule.FirstValueInList(setuclasses)(ctx) }).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
imgtype := ctx.State["regex_matched"].([]string)[1]
sc := new(setuclass)
@ -48,7 +49,7 @@ func init() {
ctx.SendChain(message.Text(imgtype, ": ", sc.Name, "\n"), message.Image(p))
}
})
engine.OnRegex(`^刷新本地(.*)$`, func(ctx *zero.Ctx) bool { return rule.FirstValueInList(setuclasses)(ctx) }, zero.SuperUserPermission).SetBlock(true).SetPriority(36).
engine.OnRegex(`^刷新本地(.*)$`, func(ctx *zero.Ctx) bool { return rule.FirstValueInList(setuclasses)(ctx) }, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
imgtype := ctx.State["regex_matched"].([]string)[1]
err := scanclass(os.DirFS(setupath), imgtype, imgtype)
@ -58,7 +59,7 @@ func init() {
ctx.SendChain(message.Text("ERROR: ", err))
}
})
engine.OnRegex(`^设置本地setu绝对路径(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(36).
engine.OnRegex(`^设置本地setu绝对路径(.*)$`, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
setupath = ctx.State["regex_matched"].([]string)[1]
err := os.WriteFile(cfgfile, helper.StringToBytes(setupath), 0644)
@ -68,7 +69,7 @@ func init() {
ctx.SendChain(message.Text("ERROR: ", err))
}
})
engine.OnFullMatch("刷新所有本地setu", zero.SuperUserPermission).SetBlock(true).SetPriority(36).
engine.OnFullMatch("刷新所有本地setu", zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
err := scanall(setupath)
if err == nil {
@ -77,7 +78,7 @@ func init() {
ctx.SendChain(message.Text("ERROR: ", err))
}
})
engine.OnFullMatch("所有本地setu分类").SetBlock(true).SetPriority(36).
engine.OnFullMatch("所有本地setu分类").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
msg := "所有本地setu分类"
mu.RLock()

View File

@ -13,6 +13,7 @@ import (
"time"
"github.com/FloatTech/AnimeAPI/picture"
"github.com/FloatTech/ZeroBot-Plugin/order"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
@ -31,11 +32,11 @@ func init() {
if err != nil {
panic(err)
}
engine := control.Register("nwife", &control.Options{
engine := control.Register("nwife", order.PrioNativeWife, &control.Options{
DisableOnDefault: false,
Help: "nativewife\n- 抽wife[@xxx]\n- 添加wife[名字][图片]\n- 删除wife[名字]\n- [让|不让]所有人均可添加wife",
})
engine.OnPrefix("抽wife", zero.OnlyGroup).SetBlock(true).SetPriority(20).
engine.OnPrefix("抽wife", zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
grpf := strconv.FormatInt(ctx.Event.GroupID, 36)
wifes, err := os.ReadDir(base + "/" + grpf)
@ -61,7 +62,7 @@ func init() {
}
})
// 上传一张图
engine.OnPrefix("添加wife", zero.OnlyGroup, chkAddWifePermission, picture.MustGiven).SetBlock(true).SetPriority(20).
engine.OnPrefix("添加wife", zero.OnlyGroup, chkAddWifePermission, picture.MustGiven).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
name := ""
for _, elem := range ctx.Event.Message {
@ -93,7 +94,7 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("没有找到wife的名字"))
}
})
engine.OnPrefix("删除wife", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(20).
engine.OnPrefix("删除wife", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
name := ""
for _, elem := range ctx.Event.Message {
@ -117,7 +118,7 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("没有找到wife的名字"))
}
})
engine.OnSuffix("所有人均可添加wife", zero.SuperUserPermission, zero.OnlyGroup).SetBlock(true).SetPriority(20).
engine.OnSuffix("所有人均可添加wife", zero.SuperUserPermission, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
text := ""
for _, elem := range ctx.Event.Message {

View File

@ -7,13 +7,18 @@ import (
"net/url"
"strings"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() {
zero.OnRegex(`^[?]{1,2} ?([a-z0-9]+)$`).SetBlock(false).
control.Register("nbnhhsh", order.PrioNBNHHSH, &control.Options{
DisableOnDefault: false,
Help: "拼音首字母释义工具\n- ?? [缩写]",
}).OnRegex(`^[?]{1,2} ?([a-z0-9]+)$`).SetBlock(false).
Handle(func(ctx *zero.Ctx) {
keyword := ctx.State["regex_matched"].([]string)[1]
ctx.SendChain(message.Text(keyword + ": " + strings.Join(getValue(keyword), ", ")))

View File

@ -18,6 +18,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
ub "github.com/FloatTech/zbputils/binary"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/txt2img"
@ -38,7 +39,7 @@ const (
var (
gCurCookieJar *cookiejar.Jar
engine = control.Register("novel", &control.Options{
engine = control.Register("novel", order.PrioNovel, &control.Options{
DisableOnDefault: false,
Help: "铅笔小说网搜索\n- 小说[xxx]",
})

View File

@ -12,6 +12,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/txt2img"
)
@ -21,7 +22,7 @@ const (
)
var (
engine = control.Register("omikuji", &control.Options{
engine = control.Register("omikuji", order.PrioOmikuji, &control.Options{
DisableOnDefault: false,
Help: "浅草寺求签\n" +
"- 求签|占卜\n- 解签",
@ -29,7 +30,7 @@ var (
)
func init() { // 插件主体
engine.OnFullMatchGroup([]string{"求签", "占卜"}).SetPriority(10).SetBlock(true).
engine.OnFullMatchGroup([]string{"求签", "占卜"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
miku := bangoToday(ctx.Event.UserID)
ctx.SendChain(
@ -38,7 +39,7 @@ func init() { // 插件主体
message.Image(fmt.Sprintf(bed, miku, 1)),
)
})
engine.OnFullMatchGroup([]string{"解签"}).SetPriority(10).SetBlock(true).
engine.OnFullMatchGroup([]string{"解签"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
kujiBytes, err := txt2img.RenderToBase64(getKujiByBango(bangoToday(ctx.Event.UserID)), txt2img.FontFile, 400, 20)
if err != nil {

View File

@ -6,6 +6,7 @@ import (
"math/rand"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -13,7 +14,7 @@ import (
func init() {
rand.Seed(time.Now().UnixNano())
control.Register("reborn", &control.Options{
control.Register("reborn", order.PrioReborn, &control.Options{
DisableOnDefault: false,
Help: "投胎\n- reborn",
}).OnFullMatch("reborn").SetBlock(true).

View File

@ -9,6 +9,7 @@ import (
"strings"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
@ -92,7 +93,7 @@ var (
)
func init() {
control.Register("runcode", &control.Options{
control.Register("runcode", order.PrioRuncode, &control.Options{
DisableOnDefault: false,
Help: "在线代码运行: \n" +
">runcode [language] [code block]\n" +
@ -103,7 +104,7 @@ func init() {
"JavaScript || TypeScript || PHP || Shell \n" +
"Kotlin || Rust || Erlang || Ruby || Swift \n" +
"R || VB || Py2 || Perl || Pascal || Scala",
}).OnRegex(`^>runcode\s(.+?)\s([\s\S]+)$`).SetBlock(true).SecondPriority().
}).OnRegex(`^>runcode\s(.+?)\s([\s\S]+)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0..."))

View File

@ -10,6 +10,7 @@ import (
"github.com/FloatTech/AnimeAPI/picture"
"github.com/FloatTech/AnimeAPI/pixiv"
"github.com/FloatTech/AnimeAPI/saucenao"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
@ -28,14 +29,14 @@ func init() { // 插件主体
if err != nil {
panic(err)
}
engine := control.Register("saucenao", &control.Options{
engine := control.Register("saucenao", order.PrioSauceNao, &control.Options{
DisableOnDefault: false,
Help: "搜图\n" +
"- 以图搜图|搜索图片|以图识图[图片]\n" +
"- 搜图[P站图片ID]",
})
// 根据 PID 搜图
engine.OnRegex(`^搜图(\d+)$`).SetBlock(true).FirstPriority().
engine.OnRegex(`^搜图(\d+)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
id, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
ctx.SendChain(message.Text("少女祈祷中......"))
@ -84,7 +85,7 @@ func init() { // 插件主体
}
})
// 以图搜图
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).FirstPriority().
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.SendChain(message.Text("少女祈祷中......"))

View File

@ -14,6 +14,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
@ -22,7 +23,6 @@ import (
)
const (
prio = 5
backgroundURL = "https://iw233.cn/API/pc.php?type=json"
referer = "https://iw233.cn/main.html"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
@ -32,7 +32,7 @@ const (
)
var (
engine = control.Register("score", &control.Options{
engine = control.Register("score", order.PrioScore, &control.Options{
DisableOnDefault: false,
Help: "签到得分\n- 签到\n- 获得签到背景[@xxx]|获得签到背景",
})
@ -40,7 +40,7 @@ var (
)
func init() {
engine.OnFullMatch("签到").SetBlock(true).SetPriority(prio).
engine.OnFullMatch("签到").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
uid := ctx.Event.UserID
now := time.Now()
@ -136,7 +136,7 @@ func init() {
}
ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile))
})
engine.OnPrefix("获得签到背景", zero.OnlyGroup).SetBlock(true).SetPriority(20).
engine.OnPrefix("获得签到背景", zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
param := ctx.State["args"].(string)
var uidStr string

View File

@ -10,6 +10,7 @@ import (
"time"
"github.com/FloatTech/AnimeAPI/pixiv"
"github.com/FloatTech/ZeroBot-Plugin/order"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
@ -67,7 +68,7 @@ var (
)
func init() { // 插件主体
engine := control.Register("setutime", &control.Options{
engine := control.Register("setutime", order.PrioSetuTime, &control.Options{
DisableOnDefault: false,
Help: "涩图\n" +
"- 来份[涩图/二次元/风景/车万]\n" +
@ -78,7 +79,7 @@ func init() { // 插件主体
go func() {
process.SleepAbout1sTo2s()
pool = newPools()
engine.OnRegex(`^来份(.*)$`, rule.FirstValueInList(pool.List)).SetBlock(true).SetPriority(20).
engine.OnRegex(`^来份(.*)$`, rule.FirstValueInList(pool.List)).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0..."))
@ -121,7 +122,7 @@ func init() { // 插件主体
}
})
engine.OnRegex(`^添加(.*?)(\d+)$`, rule.FirstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).SetPriority(21).
engine.OnRegex(`^添加(.*?)(\d+)$`, rule.FirstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var (
imgtype = ctx.State["regex_matched"].([]string)[1]
@ -152,7 +153,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("添加成功"))
})
engine.OnRegex(`^删除(.*?)(\d+)$`, rule.FirstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).SetPriority(22).
engine.OnRegex(`^删除(.*?)(\d+)$`, rule.FirstValueInList(pool.List), zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var (
imgtype = ctx.State["regex_matched"].([]string)[1]
@ -167,7 +168,7 @@ func init() { // 插件主体
})
// 查询数据库涩图数量
engine.OnFullMatchGroup([]string{">setu status"}).SetBlock(true).SetPriority(23).
engine.OnFullMatchGroup([]string{">setu status"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
state := []string{"[SetuTime]"}
for i := range pool.List {

View File

@ -9,7 +9,7 @@ import (
)
func init() {
engine.OnFullMatch("哄我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("哄我").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -9,7 +9,7 @@ import (
)
func init() {
engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -9,7 +9,7 @@ import (
)
func init() {
engine.OnFullMatch("发个朋友圈").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("发个朋友圈").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -4,6 +4,7 @@ package shadiao
import (
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
)
@ -21,11 +22,10 @@ const (
pyqReferer = "https://pyq.shadiao.app/"
yduanziReferer = "http://www.yduanzi.com/?utm_source=shadiao.app"
loveliveReferer = "https://lovelive.tools/"
prio = 10
)
var (
engine = control.Register("shadiao", &control.Options{
engine = control.Register("shadiao", order.PrioShaDiao, &control.Options{
DisableOnDefault: false,
Help: "沙雕app\n" +
"- 哄我\n- 渣我\n- 来碗绿茶\n- 发个朋友圈\n- 来碗毒鸡汤\n- 讲个段子",

View File

@ -10,7 +10,7 @@ import (
)
func init() {
engine.OnFullMatch("来碗绿茶").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("来碗绿茶").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}
@ -23,7 +23,7 @@ func init() {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
})
engine.OnFullMatch("渣我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("渣我").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -12,7 +12,7 @@ import (
)
func init() {
engine.OnFullMatch("讲个段子").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
engine.OnFullMatch("讲个段子").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}

View File

@ -5,6 +5,7 @@ import (
"time"
"github.com/FloatTech/AnimeAPI/shindanmaker"
"github.com/FloatTech/ZeroBot-Plugin/order"
log "github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
@ -22,7 +23,7 @@ var (
)
func init() {
engine := control.Register("shindan", &control.Options{
engine := control.Register("shindan", order.PrioShinDan, &control.Options{
DisableOnDefault: false,
Help: "shindan\n" +
"- 今天是什么少女[@xxx]\n" +
@ -30,10 +31,10 @@ func init() {
"- 卖萌[@xxx]\n" +
"- 抽老婆[@xxx]",
})
engine.OnPrefix("异世界转生", number(587874)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("卖萌", number(360578)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("抽老婆", number(1075116)).SetBlock(true).FirstPriority().Handle(handle)
engine.OnPrefix("异世界转生", number(587874)).SetBlock(true).Handle(handle)
engine.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).Handle(handle)
engine.OnPrefix("卖萌", number(360578)).SetBlock(true).Handle(handle)
engine.OnPrefix("抽老婆", number(1075116)).SetBlock(true).Handle(handle)
}
// shindanmaker 处理函数

View File

@ -11,20 +11,20 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage/model"
)
const dbpath = "data/sleep/"
const dbfile = dbpath + "manage.db"
const prio = 4
var engine = control.Register("sleepmanage", &control.Options{
var engine = control.Register("sleepmanage", order.PrioSleepManage, &control.Options{
DisableOnDefault: false,
Help: "sleepmanage\n- 早安\n- 晚安",
})
func init() {
engine.OnFullMatch("早安", isMorning, zero.OnlyGroup).SetBlock(true).SetPriority(prio).
engine.OnFullMatch("早安", isMorning, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
db, err := model.Open(dbfile)
if err != nil {
@ -41,7 +41,7 @@ func init() {
}
db.Close()
})
engine.OnFullMatch("晚安", isEvening, zero.OnlyGroup).SetBlock(true).SetPriority(prio).
engine.OnFullMatch("晚安", isEvening, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
db, err := model.Open(dbfile)
if err != nil {

View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/FloatTech/AnimeAPI/picture"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
trmoe "github.com/fumiama/gotracemoe"
zero "github.com/wdvxdr1123/ZeroBot"
@ -16,12 +17,12 @@ var (
)
func init() { // 插件主体
engine := control.Register("tracemoe", &control.Options{
engine := control.Register("tracemoe", order.PrioTraceMoe, &control.Options{
DisableOnDefault: false,
Help: "tracemoe\n- 搜番|搜索番剧[图片]",
})
// 以图搜图
engine.OnKeywordGroup([]string{"搜番", "搜索番剧"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).ThirdPriority().
engine.OnKeywordGroup([]string{"搜番", "搜索番剧"}, picture.CmdMatch, picture.MustGiven).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.SendChain(message.Text("少女祈祷中......"))

View File

@ -13,12 +13,12 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
)
var (
prio = 100
bucket = rate.NewManager(time.Minute, 20) // 接口回复
)
@ -42,11 +42,11 @@ func tl(d string) ([]byte, error) {
}
func init() {
control.Register("translation", &control.Options{
control.Register("translation", order.PrioTranslation, &control.Options{
DisableOnDefault: false,
Help: "翻译\n" +
">TL 你好",
}).OnRegex(`^>TL\s(-.{1,10}? )?(.*)$`).SetBlock(true).SetPriority(prio).
}).OnRegex(`^>TL\s(-.{1,10}? )?(.*)$`).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !bucket.Load(ctx.Event.UserID).Acquire() {
// 频繁触发,不回复

View File

@ -17,6 +17,7 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/txt2img"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation/model"
)
@ -26,7 +27,7 @@ const (
dbfile = dbpath + "vtb.db"
)
var engine = control.Register("vtbquotation", &control.Options{
var engine = control.Register("vtbquotation", order.PrioVtbQuotation, &control.Options{
DisableOnDefault: false,
Help: "vtbkeyboard.moe\n- vtb语录\n- 随机vtb",
})

View File

@ -6,6 +6,7 @@ import (
"strconv"
"time"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
@ -18,11 +19,11 @@ var (
)
func init() {
en := control.Register("wtf", &control.Options{
en := control.Register("wtf", order.PrioWtf, &control.Options{
DisableOnDefault: false,
Help: "鬼东西\n- 鬼东西列表\n- 查询鬼东西[序号][@xxx]",
})
en.OnFullMatch("鬼东西列表").SetBlock(true).SetPriority(30).
en.OnFullMatch("鬼东西列表").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
s := ""
for i, w := range table {
@ -30,7 +31,7 @@ func init() {
}
ctx.SendChain(message.Text(s))
})
en.OnRegex(`^查询鬼东西(\d*)`, zero.OnlyGroup).SetBlock(true).SetPriority(30).
en.OnRegex(`^查询鬼东西(\d*)`, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.UserID).Acquire() {
ctx.SendChain(message.Text("请稍后重试0x0..."))