mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-30 00:21:16 +00:00
Disable auto-messages in non-observed channels
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
b8737a4286
commit
1b1c5daebf
1 changed files with 6 additions and 0 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Luzifer/go_helpers/v2/str"
|
||||
"github.com/go-irc/irc"
|
||||
"github.com/mitchellh/hashstructure/v2"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -115,6 +116,11 @@ func (a *autoMessage) ID() string {
|
|||
}
|
||||
|
||||
func (a *autoMessage) IsValid() bool {
|
||||
if !str.StringInSlice(a.Channel, config.Channels) {
|
||||
// Not an observed channel, auto-message is not valid
|
||||
return false
|
||||
}
|
||||
|
||||
if a.Cron != "" {
|
||||
if _, err := cronParser.Parse(a.Cron); err != nil {
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue