From 5aa1cc07b653f48a9d53d87f0788f6ac279cb249 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 7 Jul 2023 13:10:41 +0200 Subject: [PATCH] do the real matching: message <-> pattern --- lib/action/action.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/action/action.go b/lib/action/action.go index 776e65c..00baeca 100644 --- a/lib/action/action.go +++ b/lib/action/action.go @@ -44,8 +44,17 @@ func Select(ctx lib.Context, msg lib.Message) []lib.Action { } func match(ac lib.ActionConfig, msg lib.Message) bool { - return ac.Pattern().Slice()[0] == msg.Action() - //return false + pat := ac.Pattern().Slice() + if len(pat) == 1 { + return pat[0] == msg.Action() + } + mh := msg.Slice() + for idx, p := range pat { + if p != "" && mh[idx] != p { + return false + } + } + return true } // action handling