mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2025-01-04 10:46:02 +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"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Luzifer/go_helpers/v2/str"
|
||||||
"github.com/go-irc/irc"
|
"github.com/go-irc/irc"
|
||||||
"github.com/mitchellh/hashstructure/v2"
|
"github.com/mitchellh/hashstructure/v2"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -115,6 +116,11 @@ func (a *autoMessage) ID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *autoMessage) IsValid() bool {
|
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 a.Cron != "" {
|
||||||
if _, err := cronParser.Parse(a.Cron); err != nil {
|
if _, err := cronParser.Parse(a.Cron); err != nil {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue