feat: indicate multi-month subs and resubs (#5642)
This commit is contained in:
@@ -566,6 +566,37 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (msgType == "sub" || msgType == "resub")
|
||||
{
|
||||
if (auto tenure = tags.find("msg-param-multimonth-tenure");
|
||||
tenure != tags.end() && tenure.value().toInt() == 0)
|
||||
{
|
||||
int months =
|
||||
tags.value("msg-param-multimonth-duration").toInt();
|
||||
if (months > 1)
|
||||
{
|
||||
int tier = tags.value("msg-param-sub-plan").toInt() / 1000;
|
||||
messageText =
|
||||
QString(
|
||||
"%1 subscribed at Tier %2 for %3 months in advance")
|
||||
.arg(tags.value("display-name").toString(),
|
||||
QString::number(tier),
|
||||
QString::number(months));
|
||||
if (msgType == "resub")
|
||||
{
|
||||
int cumulative =
|
||||
tags.value("msg-param-cumulative-months").toInt();
|
||||
messageText +=
|
||||
QString(", reaching %1 months cumulatively so far!")
|
||||
.arg(QString::number(cumulative));
|
||||
}
|
||||
else
|
||||
{
|
||||
messageText += "!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
||||
calculateMessageTime(message).time());
|
||||
@@ -1084,6 +1115,37 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (msgType == "sub" || msgType == "resub")
|
||||
{
|
||||
if (auto tenure = tags.find("msg-param-multimonth-tenure");
|
||||
tenure != tags.end() && tenure.value().toInt() == 0)
|
||||
{
|
||||
int months =
|
||||
tags.value("msg-param-multimonth-duration").toInt();
|
||||
if (months > 1)
|
||||
{
|
||||
int tier = tags.value("msg-param-sub-plan").toInt() / 1000;
|
||||
messageText =
|
||||
QString(
|
||||
"%1 subscribed at Tier %2 for %3 months in advance")
|
||||
.arg(tags.value("display-name").toString(),
|
||||
QString::number(tier),
|
||||
QString::number(months));
|
||||
if (msgType == "resub")
|
||||
{
|
||||
int cumulative =
|
||||
tags.value("msg-param-cumulative-months").toInt();
|
||||
messageText +=
|
||||
QString(", reaching %1 months cumulatively so far!")
|
||||
.arg(QString::number(cumulative));
|
||||
}
|
||||
else
|
||||
{
|
||||
messageText += "!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
||||
calculateMessageTime(message).time());
|
||||
|
||||
Reference in New Issue
Block a user