Compare commits

..

12 Commits

Author SHA1 Message Date
fumiama
6dbc0b3891 💩👌 make lint happy 2022-01-15 20:25:07 +08:00
github-actions[bot]
db3cef9bb6 🎨 改进代码样式 2022-01-15 12:18:59 +00:00
fumiama
3de009727e 💩👌 make lint happy 2022-01-15 20:17:56 +08:00
github-actions[bot]
8d35515497 🎨 改进代码样式 2022-01-15 12:15:39 +00:00
fumiama
4519dd5eb8 💫 ♻️ 🎉 ️ 强制使用优先级 2022-01-15 20:14:34 +08:00
fumiama
925e6847f3 🎨 adjust prio 2022-01-15 17:06:50 +08:00
fumiama
9462cbc7e0 🔥 shrink README 2022-01-15 17:02:33 +08:00
fumiama
8ec4271419 🐛 fix curse over-widely matching 2022-01-15 17:00:07 +08:00
fumiama
173fd250cb 🐛 fix: manager timer panic 2022-01-15 15:41:27 +08:00
fumiama
89bdc1e496 🐛 fix gif panic 2022-01-15 15:18:25 +08:00
fumiama
48736d3f4a 💩👌 make lint happy 2022-01-15 11:02:34 +08:00
himawari
f8df60f06b fix:修复直播状态更新的bug (#107)
* feat:添加b站推送,写了一半

* feat:添加b站推送(后续看情况,替换掉chromepd)

* fix:修复一直推送直播的bug

* fix:添加缓存路径

* feat:添加推送列表,修复重复发消息的bug

* feat:发现禁用有用,删除多余指令

* fix:修改格式

* fix:sleep无效

* fix:修改直播card

* fix:增加长度

* fix:修改readme

* fix:修lint,并去掉cron

* fix:修lint

* fix:去掉日志

* fix:更新旧状态

* fix:删掉多余方法

* fix:优化判断语句

* fix:修lint

Co-authored-by: Guohuiyuan <haibaraguo@yeahka.com>
2022-01-15 11:01:33 +08:00
64 changed files with 434 additions and 261 deletions

View File

@@ -228,8 +228,6 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- **小说** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" `
- [x] 小说[xxx]
- **沙雕app插件** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shadiao"`
- [x] 骂他[@xxx]|骂他[qq号] (停用)
- [x] 骂我 (停用)
- [x] 哄我
- [x] 渣我
- [x] 来碗绿茶
@@ -254,7 +252,6 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- **骂人** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_curse"`
- [x] 骂我
- [x] 大力骂我
- [x] @bot 他妈|公交车|你妈|操|屎|去死|快死|日|逼|尼玛|艾滋|癌症|有病|戴套|啊对对对|烦你|你爹|屮|tui|cnm
- **b站推送** `_ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili_push"`
- [x] 添加订阅[uid]
- [x] 取消订阅[uid]

2
data

Submodule data updated: cf3c143aa9...522acbf5e3

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()))
})

105
order/prio.go Normal file
View File

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

View File

@@ -12,6 +12,8 @@ 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/web"
)
@@ -31,7 +33,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 +42,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 +53,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 +63,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 +80,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 +89,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 +98,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

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

View File

@@ -10,24 +10,25 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +45,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

@@ -9,19 +9,19 @@ import (
"github.com/FloatTech/AnimeAPI/aireply"
"github.com/FloatTech/AnimeAPI/mockingbird"
control "github.com/FloatTech/zbputils/control"
)
const ttsprio = 250
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -9,6 +9,8 @@ import (
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -19,11 +21,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

@@ -14,19 +14,19 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +35,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 +44,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 +53,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 +63,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 +113,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 +126,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 +169,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 +190,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 +205,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 +234,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 +243,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

@@ -10,15 +10,17 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +30,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 +40,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 +51,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

@@ -9,6 +9,8 @@ import (
"github.com/fumiama/cron"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
type follower struct {
@@ -25,7 +27,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

@@ -9,9 +9,11 @@ import (
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -23,18 +23,19 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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"
referer = "https://www.bilibili.com/"
infoURL = "https://api.bilibili.com/x/space/acc/info?mid=%d"
userDynamicsURL = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history?host_uid=%d&offset_dynamic_id=0&need_top=0"
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"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
referer = "https://www.bilibili.com/"
infoURL = "https://api.bilibili.com/x/space/acc/info?mid=%d"
userDynamicURL = "https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history?host_uid=%d&offset_dynamic_id=0&need_top=0"
liveListURL = "https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids"
tURL = "https://t.bilibili.com/"
liveURL = "https://live.bilibili.com/"
serviceName = "bilibilipush"
)
var (
@@ -61,7 +62,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 +72,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 +98,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 +124,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 +150,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 +176,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
@@ -281,7 +282,7 @@ func unsubscribeLive(buid, groupid int64) (err error) {
}
func getUserDynamicCard(buid int64) (cardList []gjson.Result) {
data, err := web.ReqWith(fmt.Sprintf(userDynamicsURL, buid), "GET", referer, ua)
data, err := web.ReqWith(fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua)
if err != nil {
log.Errorln("[bilibilipush]:", err)
}
@@ -345,11 +346,12 @@ func sendDynamic() {
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, gid := range groupList {
if m.IsEnabledIn(gid) {
if gid > 0 {
switch {
case gid > 0:
ctx.SendGroupMessage(gid, msg)
} else if gid < 0 {
case gid < 0:
ctx.SendPrivateMessage(-gid, msg)
} else {
default:
log.Errorln("[bilibilipush]:gid为0")
}
}
@@ -398,11 +400,12 @@ func sendLive() {
zero.RangeBot(func(id int64, ctx *zero.Ctx) bool {
for _, gid := range groupList {
if m.IsEnabledIn(gid) {
if gid > 0 {
switch {
case gid > 0:
ctx.SendGroupMessage(gid, msg)
} else if gid < 0 {
case gid < 0:
ctx.SendPrivateMessage(-gid, msg)
} else {
default:
log.Errorln("[bilibilipush]:gid为0")
}
}
@@ -410,6 +413,8 @@ func sendLive() {
return true
})
}
} else if newStatus != oldStatus {
liveStatus[key.Int()] = newStatus
}
return true
})

View File

@@ -53,21 +53,6 @@ func initialize(dbpath string) *bilibilipushdb {
return (*bilibilipushdb)(gdb)
}
// open ...
func open(dbpath string) (*bilibilipushdb, error) {
db, err := gorm.Open("sqlite3", dbpath)
if err != nil {
return nil, err
}
return (*bilibilipushdb)(db), nil
}
// close ...
func (bdb *bilibilipushdb) close() error {
db := (*gorm.DB)(bdb)
return db.Close()
}
// insertOrUpdateLiveAndDynamic 插入或更新数据库
func (bdb *bilibilipushdb) insertOrUpdateLiveAndDynamic(bpMap map[string]interface{}) (err error) {
db := (*gorm.DB)(bdb)

View File

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

View File

@@ -15,6 +15,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -22,7 +24,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 +32,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 +48,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

@@ -10,17 +10,18 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +31,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 +45,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 +64,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 +94,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 +112,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

@@ -9,16 +9,18 @@ import (
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -5,15 +5,15 @@ import (
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -14,21 +14,21 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -10,18 +10,16 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/math"
)
const (
prio = 20
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +29,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

@@ -10,24 +10,24 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
prio = 10
prio = 250
minLevel = "min"
maxLevel = "max"
)
var (
engine = control.Register("curse", &control.Options{
DisableOnDefault: false,
Help: "骂人(求骂,自卫)\n- 骂我\n- 大力骂我\n- @bot 他妈|公交车|你妈|操|屎|去死|快死|日|逼|尼玛|艾滋|癌症|有病|戴套|啊对对对|烦你|你爹|屮|tui|cnm",
})
limit = rate.NewManager(time.Minute, 30)
)
func init() {
engine.OnFullMatch("骂我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
limit := rate.NewManager(time.Minute, 30)
engine := control.Register("curse", order.PrioCurse, &control.Options{
DisableOnDefault: true,
Help: "骂人(求骂,自卫)\n- 骂我\n- 大力骂我",
})
engine.OnFullMatch("骂我").SetBlock(true).Handle(func(ctx *zero.Ctx) {
if !limit.Load(ctx.Event.GroupID).Acquire() {
return
}
@@ -36,7 +36,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
}
@@ -44,7 +44,8 @@ func init() {
text := getRandomCurseByLevel(maxLevel).Text
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
})
engine.OnKeywordGroup([]string{"他妈", "公交车", "你妈", "操", "屎", "去死", "快死", "日", "逼", "尼玛", "艾滋", "癌症", "有病", "戴套", "啊对对对", "烦你", "你爹", "屮", "tui", "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

@@ -14,6 +14,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const cachefile = "data/danbooru/"
@@ -24,13 +26,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,20 @@ 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
var engine = control.Register("diana", order.PrioDiana, &control.Options{
DisableOnDefault: false,
Help: "嘉然\n" +
"- 小作文\n" +
"- 发大病\n" +
"- 教你一篇小作文[作文]\n" +
"- [回复]查重",
})
func init() {
engine = control.Register("diana", &control.Options{
DisableOnDefault: false,
Help: "嘉然\n" +
"- 小作文\n" +
"- 发大病\n" +
"- 教你一篇小作文[作文]\n" +
"- [回复]查重",
})
// 随机发送一篇上面的小作文
engine.OnFullMatch("小作文").SetBlock(true).
Handle(func(ctx *zero.Ctx) {

View File

@@ -23,6 +23,8 @@ import (
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/zbputils/txt2img"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
@@ -69,13 +71,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 +101,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

@@ -12,10 +12,12 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/sql"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
engine = control.Register("funny", &control.Options{
engine = control.Register("funny", order.PrioFunny, &control.Options{
DisableOnDefault: false,
Help: "讲个笑话\n" +
"- 讲个笑话[@xxx]|讲个笑话[qq号]",
@@ -25,7 +27,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

@@ -34,6 +34,9 @@ func dlblock(name string) string {
}
func dlrange(prefix string, end int) *[]chan *string {
if file.IsNotExist(datapath + `materials/` + prefix) {
_ = os.MkdirAll(datapath+`materials/`+prefix, 0755)
}
c := make([]chan *string, end)
for i := range c {
c[i] = make(chan *string)

View File

@@ -7,13 +7,13 @@ import (
"github.com/FloatTech/zbputils/file"
)
func (c *context) prepareLogos(s ...string) {
func (cc *context) prepareLogos(s ...string) {
for i, v := range s {
_, err := strconv.Atoi(v)
if err != nil {
_ = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", c.usrdir+strconv.Itoa(i)+".gif", true)
_ = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif", true)
} else {
_ = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", c.usrdir+strconv.Itoa(i)+".gif", true)
_ = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif", true)
}
}
}

View File

@@ -11,6 +11,8 @@ import (
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
@@ -21,13 +23,17 @@ var (
)
func init() { // 插件主体
os.RemoveAll(datapath) // 清除缓存图片
_ = os.RemoveAll(datapath) // 清除缓存图片
err := os.MkdirAll(datapath, 0755)
if err != nil {
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

@@ -13,16 +13,18 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/tidwall/gjson"
)
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

@@ -15,6 +15,8 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
@@ -49,7 +51,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 +59,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 +102,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

@@ -11,6 +11,8 @@ import (
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
type resultjson struct {
@@ -60,7 +62,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

@@ -15,11 +15,12 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +30,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

@@ -13,6 +13,8 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -25,7 +27,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

@@ -39,10 +39,10 @@ var (
// NewClock 添加一个新时钟
func NewClock(db *sql.Sqlite) (c Clock) {
c.loadTimers(db)
c.cron = cron.New()
c.entries = make(map[uint32]cron.EntryID)
c.timers = &map[uint32]*Timer{}
c.loadTimers(db)
c.cron.Start()
return
}

View File

@@ -10,6 +10,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
// 此功能实现依赖MCSManager项目对服务器的管理apimc服务器如果没有在该管理平台部署此功能无效
@@ -18,7 +20,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

@@ -8,6 +8,8 @@ import (
"github.com/fumiama/cron"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
func init() { // 插件主体
@@ -18,12 +20,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 +40,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

@@ -16,19 +16,21 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -12,6 +12,8 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/rule"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -25,7 +27,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 +36,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 +50,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 +60,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 +70,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 +79,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

@@ -17,6 +17,8 @@ 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"
@@ -31,11 +33,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 +63,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 +95,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 +119,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,19 @@ import (
"net/url"
"strings"
"github.com/FloatTech/zbputils/control"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -21,6 +21,8 @@ import (
ub "github.com/FloatTech/zbputils/binary"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/txt2img"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -38,7 +40,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

@@ -14,6 +14,8 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/txt2img"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -21,7 +23,7 @@ const (
)
var (
engine = control.Register("omikuji", &control.Options{
engine = control.Register("omikuji", order.PrioOmikuji, &control.Options{
DisableOnDefault: false,
Help: "浅草寺求签\n" +
"- 求签|占卜\n- 解签",
@@ -29,7 +31,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 +40,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

@@ -9,11 +9,13 @@ import (
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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

@@ -14,6 +14,8 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/tidwall/gjson"
)
@@ -92,7 +94,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 +105,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

@@ -14,6 +14,8 @@ 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/file"
)
@@ -28,14 +30,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 +86,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

@@ -19,10 +19,11 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/txt2img"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
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 +33,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 +41,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 +137,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

@@ -14,6 +14,8 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
control "github.com/FloatTech/zbputils/control"
fileutil "github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/math"
@@ -67,7 +69,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 +80,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 +123,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 +154,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 +169,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

@@ -6,6 +6,8 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
@@ -21,11 +23,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

@@ -11,6 +11,8 @@ 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/txt2img"
@@ -22,7 +24,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 +32,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

@@ -9,6 +9,8 @@ import (
trmoe "github.com/fumiama/gotracemoe"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
@@ -16,12 +18,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

@@ -15,10 +15,11 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
prio = 100
bucket = rate.NewManager(time.Minute, 20) // 接口回复
)
@@ -42,11 +43,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

@@ -10,6 +10,8 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
var (
@@ -18,11 +20,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 +32,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..."))