Fix /me not going through upon sending an identical message (#3166)

This commit is contained in:
Paweł
2021-08-15 11:52:32 +02:00
committed by GitHub
parent d46589ca26
commit 9a1e405563
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -377,6 +377,16 @@ void TwitchChannel::sendMessage(const QString &message)
if (parsedMessage == this->lastSentMessage_)
{
auto spaceIndex = parsedMessage.indexOf(' ');
// If the message starts with either '/' or '.' Twitch will treat it as a command, omitting
// first space and only rest of the arguments treated as actual message content
// In cases when user sends a message like ". .a b" first character and first space are omitted as well
bool ignoreFirstSpace =
parsedMessage.at(0) == '/' || parsedMessage.at(0) == '.';
if (ignoreFirstSpace)
{
spaceIndex = parsedMessage.indexOf(' ', spaceIndex + 1);
}
if (spaceIndex == -1)
{
// no spaces found, fall back to old magic character