Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: report duration for multi-month anon sub gifts #5293

Merged

Conversation

iProdigy
Copy link
Contributor

@iProdigy iProdigy commented Apr 2, 2024

Similar to #2026 but for subgift (and these irc tags are actually documented)

Before
Screenshot_20240401_163359

After
image

@Felanbird
Copy link
Collaborator

can you put one of these in src/util/SampleData.cpp so it can be tested with the respective fake-sub-messages button (or the command)

@iProdigy
Copy link
Contributor Author

iProdigy commented Apr 2, 2024

actually the system message is good when the gift is not anonymous, will adjust my patch

@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

@iProdigy iProdigy changed the title feat: report duration for multi month sub gift feat: report duration for multi-month anon sub gifts Apr 2, 2024
.arg(QString::number(months),
tags.value("msg-param-sub-plan")
.toString()
.at(0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can throw if msg-param-sub-plan is set, but is an empty string.
See how SubtierPredicate.cpp does it https://github.com/Chatterino/chatterino2/blob/master/src/messages/search/SubtierPredicate.cpp#L25-L26

.arg(QString::number(months),
tags.value("msg-param-sub-plan")
.toString()
.at(0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can throw if msg-param-sub-plan is set, but is an empty string.
See how SubtierPredicate.cpp does it https://github.com/Chatterino/chatterino2/blob/master/src/messages/search/SubtierPredicate.cpp#L25-L26

@iProdigy iProdigy requested a review from pajlada April 2, 2024 09:13
@pajlada pajlada merged commit 92e7578 into Chatterino:master Apr 2, 2024
17 checks passed
@iProdigy iProdigy deleted the feature/subgift-multi-month-message branch April 2, 2024 10:53
@iProdigy
Copy link
Contributor Author

actually the system message is good when the gift is not anonymous, will adjust my patch

hm, not quite; observed a broadcaster gift a 12 month sub and the system-msg didn't include the number of months. may be related to msg-param-sender-count=0 (twitch doesn't appear to count the total number of subs gifted by the broadcaster) so They've gifted X months in the channel can't be populated (see quoted example above) => could adjust patch again to workaround this (or we can ignore this edge case)

 

@user-id=broadcasterId;msg-param-origin-id=2862055070165643340;display-name=broadcasterLogin;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=broadcasterId;msg-param-recipient-display-name=OGprodigy;msg-param-sub-plan-name=Silver\sPackage;subscriber=1;system-msg=broadcasterLogin\sgifted\sa\sTier\s1\ssub\sto\sOGprodigy!;login=broadcasterLogin;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 #broadcasterLogin

(removed broadcaster info)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants