From 390880f3e7cc280db7a360a6f6efc0a854ef84d8 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Thu, 26 Dec 2024 00:01:03 -0500 Subject: [PATCH 1/2] Add Valorant account ID to bonus gift sub detection --- TwitchDownloaderCore/Tools/HighlightIcons.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TwitchDownloaderCore/Tools/HighlightIcons.cs b/TwitchDownloaderCore/Tools/HighlightIcons.cs index b9b501ae..6fb611a4 100644 --- a/TwitchDownloaderCore/Tools/HighlightIcons.cs +++ b/TwitchDownloaderCore/Tools/HighlightIcons.cs @@ -160,10 +160,11 @@ public static HighlightType GetHighlightType(Comment comment) if (comment.commenter._id is ANONYMOUS_GIFT_ACCOUNT_ID or TWITCH_ACCOUNT_ID && GiftAnonymousRegex.IsMatch(comment.message.body)) return HighlightType.GiftedAnonymous; - if (comment.commenter._id is TWITCH_ACCOUNT_ID && comment.message.body.EndsWith("'s gift! ") && + const string VALORANT_ACCOUNT_ID = "490592527"; + if (comment.commenter._id is TWITCH_ACCOUNT_ID or VALORANT_ACCOUNT_ID && comment.message.body.EndsWith("'s gift! ") && Regex.IsMatch(comment.message.body, @"^We added \d+ Gift Subs (?:AND \d+ Bonus Gift Subs )?to ")) { - // TODO: Make a dedicated enum value for Subtember? + // TODO: Make a dedicated enum value for bonus gift subs? return HighlightType.GiftedMany; } From 2b8f5e664a03cf08de47161bbb0c96bca528d1d5 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Thu, 26 Dec 2024 00:01:26 -0500 Subject: [PATCH 2/2] Update tests --- TwitchDownloaderCore.Tests/ToolTests/HighlightIconsTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TwitchDownloaderCore.Tests/ToolTests/HighlightIconsTests.cs b/TwitchDownloaderCore.Tests/ToolTests/HighlightIconsTests.cs index 95ddaf9b..71d6eba8 100644 --- a/TwitchDownloaderCore.Tests/ToolTests/HighlightIconsTests.cs +++ b/TwitchDownloaderCore.Tests/ToolTests/HighlightIconsTests.cs @@ -159,7 +159,11 @@ public void CorrectlyIdentifiesHighlightTypes(string messageString, HighlightTyp "{\"body\":\"We added 13 Gift Subs AND 10 Bonus Gift Subs to viewer8's gift! \",\"bits_spent\":0,\"fragments\":[{\"text\":\"We added 13 Gift Subs AND 10 Bonus Gift Subs to viewer8's gift! \",\"emoticon\":null}],\"user_badges\":[],\"user_color\":null,\"emoticons\":[]}")] [InlineData("{\"display_name\":\"Twitch\",\"_id\":\"12826\",\"name\":\"twitch\",\"bio\":\"Twitch is where thousands of communities come together for whatever, every day. \",\"created_at\":\"2007-05-22T10:39:54.238271Z\",\"updated_at\":\"2024-09-22T22:28:39.594659Z\",\"logo\":\"https://static-cdn.jtvnw.net/jtv_user_pictures/aa88230d-7af5-4053-a7cd-889e626d3382-profile_image-300x300.png\"}", "{\"body\":\"We added 1 Gift Subs to viewer8's gift! \",\"bits_spent\":0,\"fragments\":[{\"text\":\"We added 1 Gift Subs to viewer8's gift! \",\"emoticon\":null}],\"user_badges\":[],\"user_color\":null,\"emoticons\":[]}")] - public void CorrectlyIdentifiesSubtemberGiftedMany(string commenterString, string messageString) + [InlineData("{\"display_name\": \"VALORANT\",\"_id\": \"490592527\",\"name\": \"valorant\",\"bio\": \"VALORANT is a 5v5 character based tactical shooter video game from Riot Games. \",\"created_at\": \"2007-05-22T10:39:54.238271Z\",\"updated_at\": \"2024-09-22T22:28:39.594659Z\",\"logo\": \"https://static-cdn.jtvnw.net/jtv_user_pictures/34c5c8da-19b6-47b2-85ba-cc7ae87f1413-profile_image-300x300.png\"}", + "{\"body\":\"We added 13 Gift Subs AND 10 Bonus Gift Subs to viewer8's gift! \",\"bits_spent\":0,\"fragments\":[{\"text\":\"We added 13 Gift Subs AND 10 Bonus Gift Subs to viewer8's gift! \",\"emoticon\":null}],\"user_badges\":[],\"user_color\":null,\"emoticons\":[]}")] + [InlineData("{\"display_name\": \"VALORANT\",\"_id\": \"490592527\",\"name\": \"valorant\",\"bio\": \"VALORANT is a 5v5 character based tactical shooter video game from Riot Games. \",\"created_at\": \"2007-05-22T10:39:54.238271Z\",\"updated_at\": \"2024-09-22T22:28:39.594659Z\",\"logo\": \"https://static-cdn.jtvnw.net/jtv_user_pictures/34c5c8da-19b6-47b2-85ba-cc7ae87f1413-profile_image-300x300.png\"}", + "{\"body\":\"We added 1 Gift Subs to viewer8's gift! \",\"bits_spent\":0,\"fragments\":[{\"text\":\"We added 1 Gift Subs to viewer8's gift! \",\"emoticon\":null}],\"user_badges\":[],\"user_color\":null,\"emoticons\":[]}")] + public void CorrectlyIdentifiesBonusSubsGiftedMany(string commenterString, string messageString) { const HighlightType EXPECTED_TYPE = HighlightType.GiftedMany;