diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index d0880bf75..be48c918e 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -502,17 +502,27 @@ void TwitchMessageBuilder::appendChannelName() ->setLink(link); } -void TwitchMessageBuilder::parseUsername() +void TwitchMessageBuilder::parseUsernameColor() { const auto iterator = this->tags.find("color"); - if (const auto color = iterator.value().toString(); !color.isEmpty()) + if (iterator != this->tags.end()) { - this->usernameColor_ = QColor(color); + if (const auto color = iterator.value().toString(); !color.isEmpty()) + { + this->usernameColor_ = QColor(color); + return; + } } - else if (getSettings()->colorizeNicknames && this->tags.contains("user-id")) + + if (getSettings()->colorizeNicknames && this->tags.contains("user-id")) { this->usernameColor_ = getRandomColor(this->tags.value("user-id")); } +} + +void TwitchMessageBuilder::parseUsername() +{ + this->parseUsernameColor(); // username this->userName = this->ircMessage->nick(); diff --git a/src/providers/twitch/TwitchMessageBuilder.hpp b/src/providers/twitch/TwitchMessageBuilder.hpp index 0bf7ae55d..664176b0b 100644 --- a/src/providers/twitch/TwitchMessageBuilder.hpp +++ b/src/providers/twitch/TwitchMessageBuilder.hpp @@ -52,6 +52,7 @@ private: void parseMessageID(); void parseRoomID(); void appendChannelName(); + void parseUsernameColor(); void parseUsername(); void appendUsername(); void runIgnoreReplaces(