fix splitting messages not working

This commit is contained in:
lyx0 2021-10-21 01:46:25 +02:00
parent 340afc9e4d
commit 8e9d634df8

View file

@ -27,6 +27,18 @@ func (b *Bot) Send(target, text string) {
// text = ". " + text // text = ". " + text
// } // }
// If a message is too long for a single twitch
// message, split it into two messages.
if len(text) > 500 {
firstMessage := text[0:499]
secondMessage := text[499:]
b.TwitchClient.Say(target, firstMessage)
b.TwitchClient.Say(target, secondMessage)
return
}
// check the message for bad words before we say it // check the message for bad words before we say it
messageBanned, banReason := CheckMessage(text) messageBanned, banReason := CheckMessage(text)
if messageBanned { if messageBanned {
@ -40,16 +52,4 @@ func (b *Bot) Send(target, text string) {
return return
} }
// If a message is too long for a single twitch
// message, split it into two messages.
if len(text) > 500 {
firstMessage := text[0:499]
secondMessage := text[499:]
b.TwitchClient.Say(target, firstMessage)
b.TwitchClient.Say(target, secondMessage)
return
}
} }