diff --git a/config.go b/config.go index 604a95c..5469517 100644 --- a/config.go +++ b/config.go @@ -37,6 +37,7 @@ type rule struct { MatchChannels []string `yaml:"match_channels"` MatchEvent *string `yaml:"match_event"` MatchMessage *string `yaml:"match_message"` + MatchUsers []string `yaml:"match_users"` DisableOnMatchMessages []string `yaml:"disable_on_match_messages"` @@ -83,6 +84,13 @@ func (r *rule) Matches(m *irc.Message, event *string) bool { } } + if len(r.MatchUsers) > 0 { + if !str.StringInSlice(strings.ToLower(m.User), r.MatchUsers) { + logger.Trace("Non-Match: Users") + return false + } + } + // Check Event match if r.MatchEvent != nil { if event == nil || *r.MatchEvent != *event { diff --git a/wiki/Home.md b/wiki/Home.md index 0a0d855..237a244 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -47,6 +47,9 @@ rules: # See below for examples # Require the chat message to be sent in this channel match_channels: ['#mychannel'] + # Require the chat message to be sent by one of these users + match_users: ['mychannel'] # List of users, all names MUST be all lower-case + # Execute actions when this event occurs match_event: 'permit'