feat: include duration in more multi month gifts (#5319)
* feat: include duration in more multi month gifts * chore: update sample data * chore: update changelog * push more sample data events to my channel * feat: use nicer display name for anon gifters --------- Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -518,8 +518,7 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
||||
{
|
||||
messageText = "Announcement";
|
||||
}
|
||||
else if (msgType == "subgift" &&
|
||||
ANONYMOUS_GIFTER_ID == tags.value("user-id").toString())
|
||||
else if (msgType == "subgift")
|
||||
{
|
||||
if (auto monthsIt = tags.find("msg-param-gift-months");
|
||||
monthsIt != tags.end())
|
||||
@@ -528,13 +527,29 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
||||
if (months > 1)
|
||||
{
|
||||
auto plan = tags.value("msg-param-sub-plan").toString();
|
||||
QString name =
|
||||
ANONYMOUS_GIFTER_ID == tags.value("user-id").toString()
|
||||
? "An anonymous user"
|
||||
: tags.value("display-name").toString();
|
||||
messageText =
|
||||
QString("An anonymous user gifted %1 months of a Tier "
|
||||
"%2 sub to %3!")
|
||||
.arg(QString::number(months),
|
||||
QString("%1 gifted %2 months of a Tier %3 sub to %4!")
|
||||
.arg(name, QString::number(months),
|
||||
plan.isEmpty() ? '1' : plan.at(0),
|
||||
tags.value("msg-param-recipient-display-name")
|
||||
.toString());
|
||||
|
||||
if (auto countIt = tags.find("msg-param-sender-count");
|
||||
countIt != tags.end())
|
||||
{
|
||||
int count = countIt.value().toInt();
|
||||
if (count > months)
|
||||
{
|
||||
messageText +=
|
||||
QString(
|
||||
" They've gifted %1 months in the channel.")
|
||||
.arg(QString::number(count));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1032,8 +1047,7 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
||||
{
|
||||
messageText = "Announcement";
|
||||
}
|
||||
else if (msgType == "subgift" &&
|
||||
ANONYMOUS_GIFTER_ID == tags.value("user-id").toString())
|
||||
else if (msgType == "subgift")
|
||||
{
|
||||
if (auto monthsIt = tags.find("msg-param-gift-months");
|
||||
monthsIt != tags.end())
|
||||
@@ -1042,13 +1056,29 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
||||
if (months > 1)
|
||||
{
|
||||
auto plan = tags.value("msg-param-sub-plan").toString();
|
||||
QString name =
|
||||
ANONYMOUS_GIFTER_ID == tags.value("user-id").toString()
|
||||
? "An anonymous user"
|
||||
: tags.value("display-name").toString();
|
||||
messageText =
|
||||
QString("An anonymous user gifted %1 months of a Tier "
|
||||
"%2 sub to %3!")
|
||||
.arg(QString::number(months),
|
||||
QString("%1 gifted %2 months of a Tier %3 sub to %4!")
|
||||
.arg(name, QString::number(months),
|
||||
plan.isEmpty() ? '1' : plan.at(0),
|
||||
tags.value("msg-param-recipient-display-name")
|
||||
.toString());
|
||||
|
||||
if (auto countIt = tags.find("msg-param-sender-count");
|
||||
countIt != tags.end())
|
||||
{
|
||||
int count = countIt.value().toInt();
|
||||
if (count > months)
|
||||
{
|
||||
messageText +=
|
||||
QString(
|
||||
" They've gifted %1 months in the channel.")
|
||||
.arg(QString::number(count));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user