mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-22 16:20:08 +08:00
🐛 fix curse over-widely matching
This commit is contained in:
parent
173fd250cb
commit
8ec4271419
@ -13,20 +13,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
prio = 10
|
prio = 300
|
||||||
minLevel = "min"
|
minLevel = "min"
|
||||||
maxLevel = "max"
|
maxLevel = "max"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
func init() {
|
||||||
engine = control.Register("curse", &control.Options{
|
limit := rate.NewManager(time.Minute, 30)
|
||||||
DisableOnDefault: false,
|
engine := control.Register("curse", &control.Options{
|
||||||
|
DisableOnDefault: true,
|
||||||
Help: "骂人(求骂,自卫)\n- 骂我\n- 大力骂我\n- @bot 他妈|公交车|你妈|操|屎|去死|快死|日|逼|尼玛|艾滋|癌症|有病|戴套|啊对对对|烦你|你爹|屮|tui|cnm",
|
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) {
|
engine.OnFullMatch("骂我").SetBlock(true).SetPriority(prio).Handle(func(ctx *zero.Ctx) {
|
||||||
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||||
return
|
return
|
||||||
@ -44,7 +42,8 @@ func init() {
|
|||||||
text := getRandomCurseByLevel(maxLevel).Text
|
text := getRandomCurseByLevel(maxLevel).Text
|
||||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(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).SetPriority(prio).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
text := getRandomCurseByLevel(maxLevel).Text
|
text := getRandomCurseByLevel(maxLevel).Text
|
||||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user