Skip to content

Commit

Permalink
ignore empty message
Browse files Browse the repository at this point in the history
  • Loading branch information
RikaCelery committed Oct 12, 2024
1 parent d501a63 commit 07a5fcb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 07a5fcb

Please sign in to comment.