mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
feat: report duration for multi-month anon sub gifts (#5293)
This commit is contained in:
parent
2a447d3c95
commit
92e75784fc
|
@ -53,6 +53,7 @@
|
|||
- Minor: Add `reward.cost` `reward.id`, `reward.title` filter variables. (#5275)
|
||||
- Minor: Change Lua `CompletionRequested` handler to use an event table. (#5280)
|
||||
- Minor: Changed the layout of the about page. (#5287)
|
||||
- Minor: Add duration to multi-month anon sub gift messages. (#5293)
|
||||
- Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840)
|
||||
- Bugfix: Fixed the `/shoutout` command not working with usernames starting with @'s (e.g. `/shoutout @forsen`). (#4800)
|
||||
- Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848)
|
||||
|
|
|
@ -53,6 +53,8 @@ const QSet<QString> SPECIAL_MESSAGE_TYPES{
|
|||
"viewermilestone", // watch streak, but other categories possible in future
|
||||
};
|
||||
|
||||
const QString ANONYMOUS_GIFTER_ID = "274598607";
|
||||
|
||||
MessagePtr generateBannedMessage(bool confirmedBan)
|
||||
{
|
||||
const auto linkColor = MessageColor(MessageColor::Link);
|
||||
|
@ -516,6 +518,26 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
|||
{
|
||||
messageText = "Announcement";
|
||||
}
|
||||
else if (msgType == "subgift" &&
|
||||
ANONYMOUS_GIFTER_ID == tags.value("user-id").toString())
|
||||
{
|
||||
if (auto monthsIt = tags.find("msg-param-gift-months");
|
||||
monthsIt != tags.end())
|
||||
{
|
||||
int months = monthsIt.value().toInt();
|
||||
if (months > 1)
|
||||
{
|
||||
auto plan = tags.value("msg-param-sub-plan").toString();
|
||||
messageText =
|
||||
QString("An anonymous user gifted %1 months of a Tier "
|
||||
"%2 sub to %3!")
|
||||
.arg(QString::number(months),
|
||||
plan.isEmpty() ? '1' : plan.at(0),
|
||||
tags.value("msg-param-recipient-display-name")
|
||||
.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
||||
calculateMessageTime(message).time());
|
||||
|
@ -1010,6 +1032,26 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
|||
{
|
||||
messageText = "Announcement";
|
||||
}
|
||||
else if (msgType == "subgift" &&
|
||||
ANONYMOUS_GIFTER_ID == tags.value("user-id").toString())
|
||||
{
|
||||
if (auto monthsIt = tags.find("msg-param-gift-months");
|
||||
monthsIt != tags.end())
|
||||
{
|
||||
int months = monthsIt.value().toInt();
|
||||
if (months > 1)
|
||||
{
|
||||
auto plan = tags.value("msg-param-sub-plan").toString();
|
||||
messageText =
|
||||
QString("An anonymous user gifted %1 months of a Tier "
|
||||
"%2 sub to %3!")
|
||||
.arg(QString::number(months),
|
||||
plan.isEmpty() ? '1' : plan.at(0),
|
||||
tags.value("msg-param-recipient-display-name")
|
||||
.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
||||
calculateMessageTime(message).time());
|
||||
|
|
|
@ -70,6 +70,12 @@ const QStringList &getSampleSubMessages()
|
|||
// hyperbolicxd gifted a sub to quote_if_nam
|
||||
R"(@badges=subscriber/0,premium/1;color=#00FF7F;display-name=hyperbolicxd;emotes=;id=b20ef4fe-cba8-41d0-a371-6327651dc9cc;login=hyperbolicxd;mod=0;msg-id=subgift;msg-param-months=1;msg-param-recipient-display-name=quote_if_nam;msg-param-recipient-id=217259245;msg-param-recipient-user-name=quote_if_nam;msg-param-sender-count=1;msg-param-sub-plan-name=Channel\sSubscription\s(nymn_hs);msg-param-sub-plan=1000;room-id=62300805;subscriber=1;system-msg=hyperbolicxd\sgifted\sa\sTier\s1\ssub\sto\squote_if_nam!\sThis\sis\stheir\sfirst\sGift\sSub\sin\sthe\schannel!;tmi-sent-ts=1528190938558;turbo=0;user-id=111534250;user-type= :tmi.twitch.tv USERNOTICE #pajlada)",
|
||||
|
||||
// multi-month sub gift
|
||||
R"(@badge-info=subscriber/32;badges=subscriber/3030,sub-gift-leader/2;color=#FF8EA3;display-name=iNatsuFN;emotes=;flags=;id=0d0decbd-b8f4-4e83-9e18-eca9cab69153;login=inatsufn;mod=0;msg-id=subgift;msg-param-gift-months=6;msg-param-goal-contribution-type=SUBS;msg-param-goal-current-contributions=881;msg-param-goal-target-contributions=900;msg-param-goal-user-contributions=1;msg-param-months=16;msg-param-origin-id=2524053421157386961;msg-param-recipient-display-name=kimmi_tm;msg-param-recipient-id=225806893;msg-param-recipient-user-name=kimmi_tm;msg-param-sender-count=334;msg-param-sub-plan-name=Channel\sSubscription\s(mxddy);msg-param-sub-plan=1000;room-id=210915729;subscriber=1;system-msg=iNatsuFN\sgifted\s6\smonths\sof\sTier\s1\sto\skimmi_tm.\sThey've\sgifted\s334\smonths\sin\sthe\schannel!;tmi-sent-ts=1712034497332;user-id=218205938;user-type=;vip=0 :tmi.twitch.tv USERNOTICE #mxddy)",
|
||||
|
||||
// multi-month anon sub gift
|
||||
R"(@msg-param-goal-user-contributions=1;system-msg=An\sanonymous\suser\sgifted\sa\sTier\s1\ssub\sto\sMohammadrezaDH!\s;msg-param-goal-current-contributions=2;vip=0;color=;user-id=274598607;mod=0;flags=;msg-param-months=2;historical=1;id=afa2155b-f563-4973-a5c2-e4075882bbfb;msg-param-gift-months=6;msg-id=subgift;badge-info=;msg-param-recipient-user-name=mohammadrezadh;login=ananonymousgifter;room-id=441388138;msg-param-goal-target-contributions=25;rm-received-ts=1712002037736;msg-param-recipient-id=204174899;emotes=;display-name=AnAnonymousGifter;badges=;msg-param-fun-string=FunStringFive;msg-param-goal-contribution-type=NEW_SUB_POINTS;msg-param-origin-id=8862142563198473546;msg-param-recipient-display-name=MohammadrezaDH;msg-param-sub-plan-name=jmarxists;user-type=;subscriber=0;tmi-sent-ts=1712002037615;msg-param-sub-plan=1000;msg-param-goal-description=day\slee\sgoal\s:-) :tmi.twitch.tv USERNOTICE #jmarianne)",
|
||||
|
||||
// first time sub
|
||||
R"(@badges=subscriber/0,premium/1;color=#0000FF;display-name=byebyeheart;emotes=;id=fe390424-ab89-4c33-bb5a-53c6e5214b9f;login=byebyeheart;mod=0;msg-id=sub;msg-param-months=0;msg-param-sub-plan-name=Dakotaz;msg-param-sub-plan=Prime;room-id=39298218;subscriber=0;system-msg=byebyeheart\sjust\ssubscribed\swith\sTwitch\sPrime!;tmi-sent-ts=1528190963670;turbo=0;user-id=131956000;user-type= :tmi.twitch.tv USERNOTICE #pajlada)",
|
||||
|
||||
|
|
Loading…
Reference in a new issue