change banphrase api

This commit is contained in:
lyx0 2021-10-20 22:35:36 +02:00
parent 61fc2fb652
commit a842cc012e
2 changed files with 9 additions and 8 deletions

View file

@ -42,7 +42,7 @@ func CheckMessage(text string) (bool, string) {
log.Info(reqBody) log.Info(reqBody)
resp, err := http.Post("https://forsen.tv/api/v1/banphrases/test", "application/json", bytes.NewBuffer(reqBody)) resp, err := http.Post("https://pajlada.pajbot.com/api/v1/banphrases/test", "application/json", bytes.NewBuffer(reqBody))
if err != nil { if err != nil {
log.Error(err) log.Error(err)
} }

View file

@ -23,6 +23,14 @@ func (b *Bot) Send(target, text string) {
// if text[0] == '.' || text[0] == '/' { // if text[0] == '.' || text[0] == '/' {
// text = ". " + text // text = ". " + text
// } // }
banned, reason := CheckMessage(text)
if banned {
b.TwitchClient.Say(target, reason)
return
} else {
b.TwitchClient.Say(target, text)
return
}
if len(text) > 500 { if len(text) > 500 {
firstMessage := text[0:499] firstMessage := text[0:499]
@ -32,11 +40,4 @@ func (b *Bot) Send(target, text string) {
return return
} }
banned, reason := CheckMessage(text)
if banned {
b.TwitchClient.Say(target, reason)
} else {
b.TwitchClient.Say(target, text)
}
} }