do the real matching: message <-> pattern

This commit is contained in:
Helmut Merz 2023-07-07 13:10:41 +02:00
parent a2a47293a8
commit 5aa1cc07b6

View file

@ -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