From 07a5fcb552469f3a70a0dfab35f118dcb64c65f5 Mon Sep 17 00:00:00 2001 From: RikaCelery Date: Sat, 12 Oct 2024 10:29:06 +0800 Subject: [PATCH] ignore empty message --- rules.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules.go b/rules.go index f54d31e..b501c1e 100644 --- a/rules.go +++ b/rules.go @@ -129,6 +129,9 @@ func RegexRule(regexPattern string) Rule { // PatternRule check if the message can be matched by the pattern func PatternRule(pattern *Pattern) Rule { return func(ctx *Ctx) bool { + if len(ctx.Event.Message) == 0 { + return false + } // copy messages msgs := make([]message.MessageSegment, 0, len(ctx.Event.Message)) msgs = append(msgs, ctx.Event.Message[0])