Fix: Move disable check to other disable checks

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-06-14 23:55:23 +02:00
parent 1b1c5daebf
commit 56e138724b
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -46,6 +46,10 @@ func (a *autoMessage) CanSend() bool {
} }
switch { switch {
case !str.StringInSlice(a.Channel, config.Channels):
// Not an observed channel, auto-message is not valid
return false
case a.MessageInterval > a.linesSinceLastMessage: case a.MessageInterval > a.linesSinceLastMessage:
// Not enough chatted lines // Not enough chatted lines
return false return false
@ -116,11 +120,6 @@ 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