diff --git a/config.go b/config.go index 5ae4068..9d7a7fd 100644 --- a/config.go +++ b/config.go @@ -32,7 +32,8 @@ func newConfigFile() configFile { type rule struct { Actions []*ruleAction `yaml:"actions"` - Cooldown *time.Duration `yaml:"cooldown"` + Cooldown *time.Duration `yaml:"cooldown"` + SkipCooldownFor []string `yaml:"skip_cooldown_for"` MatchChannels []string `yaml:"match_channels"` MatchEvent *string `yaml:"match_event"` @@ -169,8 +170,16 @@ func (r *rule) Matches(m *irc.Message, event *string) bool { // Check whether rule is in cooldown if r.Cooldown != nil && timerStore.InCooldown(r.MatcherID(), *r.Cooldown) { - logger.Trace("Non-Match: On cooldown") - return false + var userHasSkipBadge bool + for _, b := range r.SkipCooldownFor { + if badges.Has(b) { + userHasSkipBadge = true + } + } + if !userHasSkipBadge { + logger.Trace("Non-Match: On cooldown") + return false + } } if r.DisableOnOffline { @@ -180,6 +189,7 @@ func (r *rule) Matches(m *irc.Message, event *string) bool { return false } if !streamLive { + logger.Trace("Non-Match: Stream offline") return false } } diff --git a/wiki/Home.md b/wiki/Home.md index 6c4e73b..b3cc67c 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -42,6 +42,9 @@ rules: # See below for examples # Add a cooldown to the command (not to trigger counters twice, ...) cooldown: 1s # Duration value: 1s / 1m / 1h + # Do not apply cooldown for these badges + skip_cooldown_for: [broadcaster, moderator] + # Disable actions when the matched channel has no active stream disable_on_offline: false