Improve sub/resub message parsing
Instead of regexping out the username, use the existing ircv3 login-tag
This commit is contained in:
@@ -288,19 +288,10 @@ void TwitchMessageBuilder::parseUsername()
|
||||
// username
|
||||
this->userName = this->ircMessage->nick();
|
||||
|
||||
if (this->userName.isEmpty()) {
|
||||
if (this->userName.isEmpty() || this->args.trimSubscriberUsername) {
|
||||
this->userName = this->tags.value(QLatin1String("login")).toString();
|
||||
}
|
||||
|
||||
if (this->args.trimSubscriberUsername) {
|
||||
static QRegularExpression fixName("^tmi.twitch.tv\\((\\w+)\\)$");
|
||||
|
||||
auto match = fixName.match(this->userName);
|
||||
if (match.hasMatch()) {
|
||||
this->userName = match.captured(1);
|
||||
}
|
||||
}
|
||||
|
||||
// display name
|
||||
// auto displayNameVariant = this->tags.value("display-name");
|
||||
// if (displayNameVariant.isValid()) {
|
||||
|
||||
Reference in New Issue
Block a user