mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 08:40:01 +00:00
Add users matching
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3a3959c79c
commit
433b84fcb7
2 changed files with 11 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue