优化atri.go匹配逻辑

This commit is contained in:
haibaraguo 2021-09-05 12:04:18 +08:00
parent f790165358
commit 9665f6cb3f
4 changed files with 7 additions and 79524 deletions

79510
nohup.out

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ func init() { // 插件主体
ctx.SendChain(randRecord("RocketPunch.amr")) ctx.SendChain(randRecord("RocketPunch.amr"))
} }
}) })
zero.OnKeywordGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio). zero.OnFullMatchGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
time.Sleep(time.Second * 1) time.Sleep(time.Second * 1)
ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png")) ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
@ -57,7 +57,7 @@ func init() { // 插件主体
time.Sleep(time.Second * 1) time.Sleep(time.Second * 1)
ctx.SendChain(randImage("FN.jpg", "WQ.jpg", "WQ1.jpg")) ctx.SendChain(randImage("FN.jpg", "WQ.jpg", "WQ1.jpg"))
}) })
zero.OnKeywordGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早"}, atriSwitch()).SetBlock(true).SetPriority(prio). zero.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早"}, atriSwitch()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour() now := time.Now().Hour()
switch { switch {
@ -100,7 +100,7 @@ func init() { // 插件主体
)) ))
} }
}) })
zero.OnKeywordGroup([]string{"中午好", "午安", "午好"}, atriSwitch()).SetBlock(true).SetPriority(prio). zero.OnFullMatchGroup([]string{"中午好", "午安", "午好"}, atriSwitch()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour() now := time.Now().Hour()
if now > 11 && now < 15 { // 中午 if now > 11 && now < 15 { // 中午
@ -113,7 +113,7 @@ func init() { // 插件主体
)) ))
} }
}) })
zero.OnKeywordGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好"}, atriSwitch()).SetBlock(true).SetPriority(prio). zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好"}, atriSwitch()).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
now := time.Now().Hour() now := time.Now().Hour()
switch { switch {

View File

@ -13,14 +13,7 @@ import (
func init() { func init() {
//所有群添加定时早安 //所有群添加定时早安
//zero.RangeBot(func(id int64, ctx *zero.Ctx) bool { // test the range bot function
// result := ctx.GetGroupList()
// log.Println(result)
// for _, v := range result.Array() {
// Daily(v.Get("group_id").Int())
// }
// return true
//})
zero.OnCommand("daily").SetBlock(false).FirstPriority().Handle(func(ctx *zero.Ctx) { zero.OnCommand("daily").SetBlock(false).FirstPriority().Handle(func(ctx *zero.Ctx) {
log.Println(ctx.GetGroupList()) log.Println(ctx.GetGroupList())
result := ctx.GetGroupList() result := ctx.GetGroupList()

View File

@ -75,11 +75,11 @@ func init() { // 插件主体
}) })
zero.OnFullMatch("自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio). zero.OnFullMatch("启自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
enable = true enable = true
ctx.SendChain(message.Text("自动回复")) ctx.SendChain(message.Text("自动回复启"))
}) })
zero.OnFullMatch("关闭自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio). zero.OnFullMatch("关闭自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio).