mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
feat: indicate multi-month subs and resubs (#5642)
This commit is contained in:
parent
9f196c67ea
commit
bdc12ffb3f
|
@ -33,6 +33,7 @@
|
|||
- Minor: Moderators can now see which mods start and cancel raids. (#5563)
|
||||
- Minor: The emote popup now reloads when Twitch emotes are reloaded. (#5580)
|
||||
- Minor: Added `--login <username>` CLI argument to specify which account to start logged in as. (#5626)
|
||||
- Minor: Indicate when subscriptions and resubscriptions are for multiple months. (#5642)
|
||||
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
||||
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
||||
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -81,6 +81,12 @@ const QStringList &getSampleSubMessages()
|
|||
// multi-month sub gift by broadcaster
|
||||
R"(@user-id=35759863;msg-param-origin-id=2862055070165643340;display-name=Lucidfoxx;id=eeb3cdb8-337c-413a-9521-3a884ff78754;msg-param-gift-months=12;msg-param-sub-plan=1000;vip=0;emotes=;badges=broadcaster/1,subscriber/3042,partner/1;msg-param-recipient-user-name=ogprodigy;msg-param-recipient-id=53888434;badge-info=subscriber/71;room-id=35759863;msg-param-recipient-display-name=OGprodigy;msg-param-sub-plan-name=Silver\sPackage;subscriber=1;system-msg=Lucidfoxx\sgifted\sa\sTier\s1\ssub\sto\sOGprodigy!;login=lucidfoxx;msg-param-sender-count=0;user-type=;mod=0;flags=;rm-received-ts=1712803947891;color=#EB078D;msg-param-months=15;tmi-sent-ts=1712803947773;msg-id=subgift :tmi.twitch.tv USERNOTICE #pajlada)",
|
||||
|
||||
// multi-month sub
|
||||
R"(@badge-info=subscriber/1;badges=subscriber/0;emotes=;msg-param-sub-plan=1000;msg-param-months=0;mod=0;login=foly__;room-id=11148817;flags=;user-id=441166175;msg-param-multimonth-tenure=0;msg-param-should-share-streak=0;system-msg=foly__\ssubscribed\sat\sTier\s1.;msg-id=sub;display-name=foly__;msg-param-sub-plan-name=Channel\sSubscription\s(k4sen);user-type=;id=327249bb-81bc-4f87-8b43-c05720a2dd64;msg-param-was-gifted=false;tmi-sent-ts=1728710962985;msg-param-cumulative-months=1;vip=0;color=;subscriber=1;msg-param-multimonth-duration=6 :tmi.twitch.tv USERNOTICE #pajlada)",
|
||||
|
||||
// multi-month resub at tier 3
|
||||
R"(@system-msg=calm__like_a_tom\ssubscribed\sat\sTier\s3.\sThey've\ssubscribed\sfor\s9\smonths!;msg-param-cumulative-months=9;mod=0;msg-param-should-share-streak=0;msg-param-sub-plan-name=Executive\sProducer;color=#0000FF;msg-param-months=0;msg-param-multimonth-duration=6;user-type=;flags=;msg-id=resub;user-id=609242230;room-id=11148817;msg-param-multimonth-tenure=0;msg-param-sub-plan=3000;emotes=;badge-info=subscriber/9;msg-param-was-gifted=false;id=4a6e270c-8cdb-46e9-b602-f8177a79d472;badges=subscriber/3009;display-name=calm__like_a_tom;tmi-sent-ts=1725938011176;login=calm__like_a_tom;vip=0;subscriber=1 :tmi.twitch.tv USERNOTICE #pajlada)",
|
||||
|
||||
// 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