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 (
|
||||
prio = 10
|
||||
prio = 300
|
||||
minLevel = "min"
|
||||
maxLevel = "max"
|
||||
)
|
||||
|
||||
var (
|
||||
engine = control.Register("curse", &control.Options{
|
||||
DisableOnDefault: false,
|
||||
func init() {
|
||||
limit := rate.NewManager(time.Minute, 30)
|
||||
engine := control.Register("curse", &control.Options{
|
||||
DisableOnDefault: true,
|
||||
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) {
|
||||
if !limit.Load(ctx.Event.GroupID).Acquire() {
|
||||
return
|
||||
@ -44,7 +42,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).SetPriority(prio).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
text := getRandomCurseByLevel(maxLevel).Text
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user