From 84b1efcd242565283c03d8f67f11983f4fb5f1e6 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sun, 15 Sep 2019 19:05:04 +0200 Subject: [PATCH] fixes #1304 emote.name eating the .name --- src/providers/twitch/TwitchMessageBuilder.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 102d570e0..a79cdbd63 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -355,7 +355,7 @@ void TwitchMessageBuilder::addWords( auto i = int(); auto currentTwitchEmote = twitchEmotes.begin(); - for (const auto &word : words) + for (auto word : words) { // check if it's a twitch emote twitch emote while (currentTwitchEmote != twitchEmotes.end() && @@ -376,9 +376,19 @@ void TwitchMessageBuilder::addWords( MessageElementFlag::TwitchEmote); i += word.length() + 1; + + int len = std::get<2>(*currentTwitchEmote).string.length(); currentTwitchEmote++; - continue; + if (len < word.length()) + { + word = word.mid(len); + this->message().elements.back()->setTrailingSpace(false); + } + else + { + continue; + } } // split words