mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
fix: fix banphrased messages still being sent
This commit is contained in:
parent
d05ef09c39
commit
afd6488135
|
@ -94,17 +94,7 @@ func (app *application) Send(target, message string) {
|
||||||
|
|
||||||
// check the message for bad words before we say it
|
// check the message for bad words before we say it
|
||||||
messageBanned, banReason := app.checkMessage(message)
|
messageBanned, banReason := app.checkMessage(message)
|
||||||
if messageBanned {
|
if !messageBanned {
|
||||||
// Bad message, replace message and log it.
|
|
||||||
app.TwitchClient.Say(target, "[BANPHRASED] monkaS")
|
|
||||||
app.Log.Infow("banned message detected",
|
|
||||||
"target channel", target,
|
|
||||||
"message", message,
|
|
||||||
"ban reason", banReason,
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
// In case the message we are trying to send is longer than the
|
// In case the message we are trying to send is longer than the
|
||||||
// maximum allowed message length on twitch we split the message in two parts.
|
// maximum allowed message length on twitch we split the message in two parts.
|
||||||
// Twitch has a maximum length for messages of 510 characters so to be safe
|
// Twitch has a maximum length for messages of 510 characters so to be safe
|
||||||
|
@ -118,10 +108,21 @@ func (app *application) Send(target, message string) {
|
||||||
app.TwitchClient.Say(target, firstMessage)
|
app.TwitchClient.Say(target, firstMessage)
|
||||||
app.TwitchClient.Say(target, secondMessage)
|
app.TwitchClient.Say(target, secondMessage)
|
||||||
|
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
// Message was fine.
|
||||||
|
app.TwitchClient.Say(target, message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Message was fine.
|
} else {
|
||||||
app.TwitchClient.Say(target, message)
|
// Bad message, replace message and log it.
|
||||||
|
app.TwitchClient.Say(target, "[BANPHRASED] monkaS")
|
||||||
|
app.Log.Infow("banned message detected",
|
||||||
|
"target channel", target,
|
||||||
|
"message", message,
|
||||||
|
"ban reason", banReason,
|
||||||
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue