From a8d60b0b057127b29931578aa2d00725e3489320 Mon Sep 17 00:00:00 2001 From: nerix Date: Fri, 18 Oct 2024 15:41:57 +0200 Subject: [PATCH 1/5] refactor: move MessageBuilder snapshot test to IrcMessageHandler (#5654) --- CHANGELOG.md | 2 +- src/providers/twitch/TwitchChannel.hpp | 4 ++-- tests/CMakeLists.txt | 2 +- .../IRC => IrcMessageHandler}/action.json | 0 .../all-usernames.json | 0 .../IRC => IrcMessageHandler}/bad-emotes.json | 0 .../IRC => IrcMessageHandler}/bad-emotes2.json | 0 .../IRC => IrcMessageHandler}/bad-emotes3.json | 0 .../IRC => IrcMessageHandler}/bad-emotes4.json | 0 .../badges-invalid.json | 0 .../IRC => IrcMessageHandler}/badges.json | 0 .../IRC => IrcMessageHandler}/blocked-user.json | 0 .../IRC => IrcMessageHandler}/cheer1.json | 0 .../IRC => IrcMessageHandler}/cheer2.json | 0 .../IRC => IrcMessageHandler}/cheer3.json | 0 .../IRC => IrcMessageHandler}/cheer4.json | 0 .../IRC => IrcMessageHandler}/custom-mod.json | 0 .../IRC => IrcMessageHandler}/custom-vip.json | 0 .../IRC => IrcMessageHandler}/emote-emoji.json | 0 .../IRC => IrcMessageHandler}/emote.json | 0 .../IRC => IrcMessageHandler}/emotes.json | 0 .../IRC => IrcMessageHandler}/emotes2.json | 0 .../IRC => IrcMessageHandler}/emotes3.json | 0 .../IRC => IrcMessageHandler}/emotes4.json | 0 .../IRC => IrcMessageHandler}/emotes5.json | 0 .../IRC => IrcMessageHandler}/first-msg.json | 0 .../IRC => IrcMessageHandler}/highlight1.json | 0 .../IRC => IrcMessageHandler}/highlight2.json | 0 .../IRC => IrcMessageHandler}/highlight3.json | 0 .../hype-chat-invalid.json | 0 .../IRC => IrcMessageHandler}/hype-chat0.json | 0 .../IRC => IrcMessageHandler}/hype-chat1.json | 0 .../IRC => IrcMessageHandler}/hype-chat2.json | 0 .../ignore-block1.json | 0 .../ignore-block2.json | 0 .../ignore-infinite.json | 0 .../ignore-replace.json | 0 .../IRC => IrcMessageHandler}/justinfan.json | 0 .../IRC => IrcMessageHandler}/links.json | 0 .../IRC => IrcMessageHandler}/mentions.json | 0 .../IRC => IrcMessageHandler}/mod.json | 0 .../IRC => IrcMessageHandler}/nickname.json | 0 .../IRC => IrcMessageHandler}/no-nick.json | 0 .../IRC => IrcMessageHandler}/no-tags.json | 0 .../redeemed-highlight.json | 0 .../IRC => IrcMessageHandler}/reply-action.json | 0 .../IRC => IrcMessageHandler}/reply-block.json | 0 .../reply-blocked-user.json | 0 .../IRC => IrcMessageHandler}/reply-child.json | 0 .../IRC => IrcMessageHandler}/reply-ignore.json | 0 .../reply-no-prev.json | 0 .../IRC => IrcMessageHandler}/reply-root.json | 0 .../IRC => IrcMessageHandler}/reply-single.json | 0 .../IRC => IrcMessageHandler}/reward-bits.json | 0 .../reward-blocked-user.json | 0 .../IRC => IrcMessageHandler}/reward-empty.json | 0 .../IRC => IrcMessageHandler}/reward-known.json | 0 .../reward-unknown.json | 0 .../IRC => IrcMessageHandler}/rm-deleted.json | 0 .../shared-chat-emotes.json | 0 .../shared-chat-known.json | 0 .../shared-chat-same-channel.json | 0 .../shared-chat-unknown.json | 0 .../IRC => IrcMessageHandler}/simple.json | 0 .../username-localized.json | 0 .../username-localized2.json | 0 .../IRC => IrcMessageHandler}/username.json | 0 .../IRC => IrcMessageHandler}/vip.json | 0 ...MessageBuilder.cpp => IrcMessageHandler.cpp} | 17 ++++++++--------- 69 files changed, 12 insertions(+), 13 deletions(-) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/action.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/all-usernames.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes4.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/badges-invalid.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/badges.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/blocked-user.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer4.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/custom-mod.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/custom-vip.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emote-emoji.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emote.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes4.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes5.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/first-msg.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/highlight1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/highlight2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/highlight3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat-invalid.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat0.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-block1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-block2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-infinite.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-replace.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/justinfan.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/links.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/mentions.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/mod.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/nickname.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/no-nick.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/no-tags.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/redeemed-highlight.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-action.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-block.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-blocked-user.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-child.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-ignore.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-no-prev.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-root.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-single.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-bits.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-blocked-user.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-empty.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-known.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-unknown.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/rm-deleted.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-emotes.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-known.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-same-channel.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-unknown.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/simple.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/username-localized.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/username-localized2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/username.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/vip.json (100%) rename tests/src/{MessageBuilder.cpp => IrcMessageHandler.cpp} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54544119b3c..fc73acb323a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,7 +103,7 @@ - Dev: Added more tests for input completion. (#5604) - Dev: Refactored legacy Unicode zero-width-joiner replacement. (#5594) - Dev: The JSON output when copying a message (SHIFT + right-click) is now more extensive. (#5600) -- Dev: Added more tests for message building. (#5598) +- Dev: Added more tests for message building. (#5598, #5654) - Dev: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607) - Dev: `GIFTimer` is no longer initialized in tests. (#5608) - Dev: Emojis now use flags instead of a set of strings for capabilities. (#5616) diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index 802da811240..41eb53de89d 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -25,7 +25,7 @@ #include #include -class TestMessageBuilderP; +class TestIrcMessageHandlerP; namespace chatterino { @@ -464,7 +464,7 @@ class TwitchChannel final : public Channel, public ChannelChatters friend class MessageBuilder; friend class IrcMessageHandler; friend class Commands_E2E_Test; - friend class ::TestMessageBuilderP; + friend class ::TestIrcMessageHandlerP; }; } // namespace chatterino diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8a6647fee9e..5a2cb5f1b55 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,7 +22,7 @@ set(test_SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/UtilTwitch.cpp ${CMAKE_CURRENT_LIST_DIR}/src/IrcHelpers.cpp ${CMAKE_CURRENT_LIST_DIR}/src/TwitchPubSubClient.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/MessageBuilder.cpp + ${CMAKE_CURRENT_LIST_DIR}/src/IrcMessageHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/src/HighlightController.cpp ${CMAKE_CURRENT_LIST_DIR}/src/FormatTime.cpp ${CMAKE_CURRENT_LIST_DIR}/src/LimitedQueue.cpp diff --git a/tests/snapshots/MessageBuilder/IRC/action.json b/tests/snapshots/IrcMessageHandler/action.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/action.json rename to tests/snapshots/IrcMessageHandler/action.json diff --git a/tests/snapshots/MessageBuilder/IRC/all-usernames.json b/tests/snapshots/IrcMessageHandler/all-usernames.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/all-usernames.json rename to tests/snapshots/IrcMessageHandler/all-usernames.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes.json b/tests/snapshots/IrcMessageHandler/bad-emotes.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes.json rename to tests/snapshots/IrcMessageHandler/bad-emotes.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes2.json b/tests/snapshots/IrcMessageHandler/bad-emotes2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes2.json rename to tests/snapshots/IrcMessageHandler/bad-emotes2.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes3.json b/tests/snapshots/IrcMessageHandler/bad-emotes3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes3.json rename to tests/snapshots/IrcMessageHandler/bad-emotes3.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes4.json b/tests/snapshots/IrcMessageHandler/bad-emotes4.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes4.json rename to tests/snapshots/IrcMessageHandler/bad-emotes4.json diff --git a/tests/snapshots/MessageBuilder/IRC/badges-invalid.json b/tests/snapshots/IrcMessageHandler/badges-invalid.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/badges-invalid.json rename to tests/snapshots/IrcMessageHandler/badges-invalid.json diff --git a/tests/snapshots/MessageBuilder/IRC/badges.json b/tests/snapshots/IrcMessageHandler/badges.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/badges.json rename to tests/snapshots/IrcMessageHandler/badges.json diff --git a/tests/snapshots/MessageBuilder/IRC/blocked-user.json b/tests/snapshots/IrcMessageHandler/blocked-user.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/blocked-user.json rename to tests/snapshots/IrcMessageHandler/blocked-user.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer1.json b/tests/snapshots/IrcMessageHandler/cheer1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer1.json rename to tests/snapshots/IrcMessageHandler/cheer1.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer2.json b/tests/snapshots/IrcMessageHandler/cheer2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer2.json rename to tests/snapshots/IrcMessageHandler/cheer2.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer3.json b/tests/snapshots/IrcMessageHandler/cheer3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer3.json rename to tests/snapshots/IrcMessageHandler/cheer3.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer4.json b/tests/snapshots/IrcMessageHandler/cheer4.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer4.json rename to tests/snapshots/IrcMessageHandler/cheer4.json diff --git a/tests/snapshots/MessageBuilder/IRC/custom-mod.json b/tests/snapshots/IrcMessageHandler/custom-mod.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/custom-mod.json rename to tests/snapshots/IrcMessageHandler/custom-mod.json diff --git a/tests/snapshots/MessageBuilder/IRC/custom-vip.json b/tests/snapshots/IrcMessageHandler/custom-vip.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/custom-vip.json rename to tests/snapshots/IrcMessageHandler/custom-vip.json diff --git a/tests/snapshots/MessageBuilder/IRC/emote-emoji.json b/tests/snapshots/IrcMessageHandler/emote-emoji.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emote-emoji.json rename to tests/snapshots/IrcMessageHandler/emote-emoji.json diff --git a/tests/snapshots/MessageBuilder/IRC/emote.json b/tests/snapshots/IrcMessageHandler/emote.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emote.json rename to tests/snapshots/IrcMessageHandler/emote.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes.json b/tests/snapshots/IrcMessageHandler/emotes.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes.json rename to tests/snapshots/IrcMessageHandler/emotes.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes2.json b/tests/snapshots/IrcMessageHandler/emotes2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes2.json rename to tests/snapshots/IrcMessageHandler/emotes2.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes3.json b/tests/snapshots/IrcMessageHandler/emotes3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes3.json rename to tests/snapshots/IrcMessageHandler/emotes3.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes4.json b/tests/snapshots/IrcMessageHandler/emotes4.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes4.json rename to tests/snapshots/IrcMessageHandler/emotes4.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes5.json b/tests/snapshots/IrcMessageHandler/emotes5.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes5.json rename to tests/snapshots/IrcMessageHandler/emotes5.json diff --git a/tests/snapshots/MessageBuilder/IRC/first-msg.json b/tests/snapshots/IrcMessageHandler/first-msg.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/first-msg.json rename to tests/snapshots/IrcMessageHandler/first-msg.json diff --git a/tests/snapshots/MessageBuilder/IRC/highlight1.json b/tests/snapshots/IrcMessageHandler/highlight1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/highlight1.json rename to tests/snapshots/IrcMessageHandler/highlight1.json diff --git a/tests/snapshots/MessageBuilder/IRC/highlight2.json b/tests/snapshots/IrcMessageHandler/highlight2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/highlight2.json rename to tests/snapshots/IrcMessageHandler/highlight2.json diff --git a/tests/snapshots/MessageBuilder/IRC/highlight3.json b/tests/snapshots/IrcMessageHandler/highlight3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/highlight3.json rename to tests/snapshots/IrcMessageHandler/highlight3.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat-invalid.json b/tests/snapshots/IrcMessageHandler/hype-chat-invalid.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat-invalid.json rename to tests/snapshots/IrcMessageHandler/hype-chat-invalid.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat0.json b/tests/snapshots/IrcMessageHandler/hype-chat0.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat0.json rename to tests/snapshots/IrcMessageHandler/hype-chat0.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat1.json b/tests/snapshots/IrcMessageHandler/hype-chat1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat1.json rename to tests/snapshots/IrcMessageHandler/hype-chat1.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat2.json b/tests/snapshots/IrcMessageHandler/hype-chat2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat2.json rename to tests/snapshots/IrcMessageHandler/hype-chat2.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-block1.json b/tests/snapshots/IrcMessageHandler/ignore-block1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-block1.json rename to tests/snapshots/IrcMessageHandler/ignore-block1.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-block2.json b/tests/snapshots/IrcMessageHandler/ignore-block2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-block2.json rename to tests/snapshots/IrcMessageHandler/ignore-block2.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-infinite.json b/tests/snapshots/IrcMessageHandler/ignore-infinite.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-infinite.json rename to tests/snapshots/IrcMessageHandler/ignore-infinite.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-replace.json b/tests/snapshots/IrcMessageHandler/ignore-replace.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-replace.json rename to tests/snapshots/IrcMessageHandler/ignore-replace.json diff --git a/tests/snapshots/MessageBuilder/IRC/justinfan.json b/tests/snapshots/IrcMessageHandler/justinfan.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/justinfan.json rename to tests/snapshots/IrcMessageHandler/justinfan.json diff --git a/tests/snapshots/MessageBuilder/IRC/links.json b/tests/snapshots/IrcMessageHandler/links.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/links.json rename to tests/snapshots/IrcMessageHandler/links.json diff --git a/tests/snapshots/MessageBuilder/IRC/mentions.json b/tests/snapshots/IrcMessageHandler/mentions.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/mentions.json rename to tests/snapshots/IrcMessageHandler/mentions.json diff --git a/tests/snapshots/MessageBuilder/IRC/mod.json b/tests/snapshots/IrcMessageHandler/mod.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/mod.json rename to tests/snapshots/IrcMessageHandler/mod.json diff --git a/tests/snapshots/MessageBuilder/IRC/nickname.json b/tests/snapshots/IrcMessageHandler/nickname.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/nickname.json rename to tests/snapshots/IrcMessageHandler/nickname.json diff --git a/tests/snapshots/MessageBuilder/IRC/no-nick.json b/tests/snapshots/IrcMessageHandler/no-nick.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/no-nick.json rename to tests/snapshots/IrcMessageHandler/no-nick.json diff --git a/tests/snapshots/MessageBuilder/IRC/no-tags.json b/tests/snapshots/IrcMessageHandler/no-tags.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/no-tags.json rename to tests/snapshots/IrcMessageHandler/no-tags.json diff --git a/tests/snapshots/MessageBuilder/IRC/redeemed-highlight.json b/tests/snapshots/IrcMessageHandler/redeemed-highlight.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/redeemed-highlight.json rename to tests/snapshots/IrcMessageHandler/redeemed-highlight.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-action.json b/tests/snapshots/IrcMessageHandler/reply-action.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-action.json rename to tests/snapshots/IrcMessageHandler/reply-action.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-block.json b/tests/snapshots/IrcMessageHandler/reply-block.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-block.json rename to tests/snapshots/IrcMessageHandler/reply-block.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-blocked-user.json b/tests/snapshots/IrcMessageHandler/reply-blocked-user.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-blocked-user.json rename to tests/snapshots/IrcMessageHandler/reply-blocked-user.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-child.json b/tests/snapshots/IrcMessageHandler/reply-child.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-child.json rename to tests/snapshots/IrcMessageHandler/reply-child.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-ignore.json b/tests/snapshots/IrcMessageHandler/reply-ignore.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-ignore.json rename to tests/snapshots/IrcMessageHandler/reply-ignore.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-no-prev.json b/tests/snapshots/IrcMessageHandler/reply-no-prev.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-no-prev.json rename to tests/snapshots/IrcMessageHandler/reply-no-prev.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-root.json b/tests/snapshots/IrcMessageHandler/reply-root.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-root.json rename to tests/snapshots/IrcMessageHandler/reply-root.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-single.json b/tests/snapshots/IrcMessageHandler/reply-single.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-single.json rename to tests/snapshots/IrcMessageHandler/reply-single.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-bits.json b/tests/snapshots/IrcMessageHandler/reward-bits.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-bits.json rename to tests/snapshots/IrcMessageHandler/reward-bits.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-blocked-user.json b/tests/snapshots/IrcMessageHandler/reward-blocked-user.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-blocked-user.json rename to tests/snapshots/IrcMessageHandler/reward-blocked-user.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-empty.json b/tests/snapshots/IrcMessageHandler/reward-empty.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-empty.json rename to tests/snapshots/IrcMessageHandler/reward-empty.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-known.json b/tests/snapshots/IrcMessageHandler/reward-known.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-known.json rename to tests/snapshots/IrcMessageHandler/reward-known.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-unknown.json b/tests/snapshots/IrcMessageHandler/reward-unknown.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-unknown.json rename to tests/snapshots/IrcMessageHandler/reward-unknown.json diff --git a/tests/snapshots/MessageBuilder/IRC/rm-deleted.json b/tests/snapshots/IrcMessageHandler/rm-deleted.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/rm-deleted.json rename to tests/snapshots/IrcMessageHandler/rm-deleted.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-emotes.json b/tests/snapshots/IrcMessageHandler/shared-chat-emotes.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-emotes.json rename to tests/snapshots/IrcMessageHandler/shared-chat-emotes.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-known.json b/tests/snapshots/IrcMessageHandler/shared-chat-known.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-known.json rename to tests/snapshots/IrcMessageHandler/shared-chat-known.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-same-channel.json b/tests/snapshots/IrcMessageHandler/shared-chat-same-channel.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-same-channel.json rename to tests/snapshots/IrcMessageHandler/shared-chat-same-channel.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-unknown.json b/tests/snapshots/IrcMessageHandler/shared-chat-unknown.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-unknown.json rename to tests/snapshots/IrcMessageHandler/shared-chat-unknown.json diff --git a/tests/snapshots/MessageBuilder/IRC/simple.json b/tests/snapshots/IrcMessageHandler/simple.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/simple.json rename to tests/snapshots/IrcMessageHandler/simple.json diff --git a/tests/snapshots/MessageBuilder/IRC/username-localized.json b/tests/snapshots/IrcMessageHandler/username-localized.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/username-localized.json rename to tests/snapshots/IrcMessageHandler/username-localized.json diff --git a/tests/snapshots/MessageBuilder/IRC/username-localized2.json b/tests/snapshots/IrcMessageHandler/username-localized2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/username-localized2.json rename to tests/snapshots/IrcMessageHandler/username-localized2.json diff --git a/tests/snapshots/MessageBuilder/IRC/username.json b/tests/snapshots/IrcMessageHandler/username.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/username.json rename to tests/snapshots/IrcMessageHandler/username.json diff --git a/tests/snapshots/MessageBuilder/IRC/vip.json b/tests/snapshots/IrcMessageHandler/vip.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/vip.json rename to tests/snapshots/IrcMessageHandler/vip.json diff --git a/tests/src/MessageBuilder.cpp b/tests/src/IrcMessageHandler.cpp similarity index 97% rename from tests/src/MessageBuilder.cpp rename to tests/src/IrcMessageHandler.cpp index 107d4023c18..a80e928ef85 100644 --- a/tests/src/MessageBuilder.cpp +++ b/tests/src/IrcMessageHandler.cpp @@ -1,4 +1,4 @@ -#include "messages/MessageBuilder.hpp" +#include "providers/twitch/IrcMessageHandler.hpp" #include "common/Literals.hpp" #include "controllers/accounts/AccountController.hpp" @@ -20,7 +20,6 @@ #include "providers/seventv/SeventvBadges.hpp" #include "providers/twitch/api/Helix.hpp" #include "providers/twitch/ChannelPointReward.hpp" -#include "providers/twitch/IrcMessageHandler.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchBadge.hpp" #include "providers/twitch/TwitchBadges.hpp" @@ -56,7 +55,7 @@ namespace { /// to generate an initial snapshot. Make sure to verify the output! constexpr bool UPDATE_SNAPSHOTS = false; -const QString IRC_CATEGORY = u"MessageBuilder/IRC"_s; +const QString IRC_CATEGORY = u"IrcMessageHandler"_s; class MockApplication : public mock::BaseApplication { @@ -447,12 +446,12 @@ QT_WARNING_POP } // namespace -class TestMessageBuilderP : public ::testing::TestWithParam +class TestIrcMessageHandlerP : public ::testing::TestWithParam { public: void SetUp() override { - auto param = TestMessageBuilderP::GetParam(); + auto param = TestIrcMessageHandlerP::GetParam(); this->snapshot = testlib::Snapshot::read(IRC_CATEGORY, param); this->mockApplication = @@ -558,7 +557,7 @@ class TestMessageBuilderP : public ::testing::TestWithParam /// `IrcMesssageHandler` to ensure the correct (or: "real") arguments to build /// messages. /// -/// Tests are contained in `tests/snapshots/MessageBuilder/IRC`. Fixtures +/// Tests are contained in `tests/snapshots/IrcMessageHandler`. Fixtures /// consist of an object with the keys `input`, `output`, `settings` (optional), /// and `params` (optional). /// @@ -569,7 +568,7 @@ class TestMessageBuilderP : public ::testing::TestWithParam /// - `prevMessages`: An array of past messages (used for replies) /// - `findAllUsernames`: A boolean controlling the equally named setting /// (default: false) -TEST_P(TestMessageBuilderP, Run) +TEST_P(TestIrcMessageHandlerP, Run) { auto channel = makeMockTwitchChannel(u"pajlada"_s, *snapshot); @@ -608,10 +607,10 @@ TEST_P(TestMessageBuilderP, Run) } INSTANTIATE_TEST_SUITE_P( - IrcMessage, TestMessageBuilderP, + IrcMessage, TestIrcMessageHandlerP, testing::ValuesIn(testlib::Snapshot::discover(IRC_CATEGORY))); -TEST(TestMessageBuilderP, Integrity) +TEST(TestIrcMessageHandlerP, Integrity) { ASSERT_FALSE(UPDATE_SNAPSHOTS); // make sure fixtures are actually tested } From 85d34c8ff068b53c5031349757c6b3475d0014cf Mon Sep 17 00:00:00 2001 From: pajlada Date: Fri, 18 Oct 2024 21:23:13 +0200 Subject: [PATCH 2/5] test: use httpbox fork release (#5655) --- .github/workflows/test-macos.yml | 12 ++++++++---- .github/workflows/test-windows.yml | 14 +++++++++----- tests/README.md | 13 +++++-------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 00e0bf10e38..b35e7aea523 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -8,6 +8,7 @@ on: env: TWITCH_PUBSUB_SERVER_TAG: v1.0.7 + HTTPBOX_TAG: v0.2.1 QT_QPA_PLATFORM: minimal HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 @@ -58,6 +59,13 @@ jobs: run: | brew install boost openssl rapidjson p7zip create-dmg cmake + - name: Install httpbox + run: | + curl -L -o httpbox.tar.xz "/~https://github.com/Chatterino/httpbox/releases/download/${{ env.HTTPBOX_TAG }}/httpbox-x86_64-apple-darwin.tar.xz" + tar -xJf httpbox.tar.xz + mv ./httpbox-x86_64-apple-darwin/httpbox /usr/local/bin + working-directory: /tmp + - name: Build run: | mkdir build-test @@ -83,10 +91,6 @@ jobs: curl -L -o server.key "/~https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key" cd .. - - name: Cargo Install httpbox - run: | - cargo install --git /~https://github.com/kevinastone/httpbox --rev 89b971f - - name: Test timeout-minutes: 30 run: | diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index a81c69891a7..926d5f90701 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -8,6 +8,7 @@ on: env: TWITCH_PUBSUB_SERVER_TAG: v1.0.7 + HTTPBOX_TAG: v0.2.1 QT_QPA_PLATFORM: minimal # Last known good conan version # 2.0.3 has a bug on Windows (conan-io/conan#13606) @@ -111,6 +112,13 @@ jobs: mkdir -Force build-test/bin cp "$((ls $Env:VCToolsRedistDir/onecore/x64 -Filter '*.CRT')[0].FullName)/*" build-test/bin + - name: Install httpbox + run: | + mkdir httpbox + Invoke-WebRequest -Uri "/~https://github.com/Chatterino/httpbox/releases/download/${{ env.HTTPBOX_TAG }}/httpbox-x86_64-pc-windows-msvc.zip" -outfile "httpbox.zip" + Expand-Archive httpbox.zip -DestinationPath httpbox + rm httpbox.zip + - name: Build run: | cmake ` @@ -139,14 +147,10 @@ jobs: Invoke-WebRequest -Uri "/~https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key" -outfile "server.key" cd .. - - name: Cargo Install httpbox - run: | - cargo install --git /~https://github.com/kevinastone/httpbox --rev 89b971f - - name: Test timeout-minutes: 30 run: | - httpbox --port 9051 & + ..\httpbox\httpbox.exe --port 9051 & cd ..\pubsub-server-test .\server.exe 127.0.0.1:9050 & cd ..\build-test diff --git a/tests/README.md b/tests/README.md index 47ac1b202ae..e5d73c1ad1a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,10 +1,7 @@ -To run all tests you will need to run the `kennethreitz/httpbin` and `ghcr.io/chatterino/twitch-pubsub-server-test:latest` docker images. +# Pre-requisites to running tests -For example: +- Download & run [httpbox](/~https://github.com/Chatterino/httpbox/releases/latest) + `httpbox --port 9051` -```bash -docker run --network=host --detach ghcr.io/chatterino/twitch-pubsub-server-test:latest -docker run -p 9051:80 --detach kennethreitz/httpbin -``` - -If you're unable to use docker, you can use [httpbox](/~https://github.com/kevinastone/httpbox) (`httpbox --port 9051`) and [Chatterino/twitch-pubsub-server-test](/~https://github.com/Chatterino/twitch-pubsub-server-test/releases/latest) manually. +- Download & run [twitch-pubsub-server-test](/~https://github.com/Chatterino/twitch-pubsub-server-test/releases/latest) + `twitch-pubsub-server-test` From d0b9fd0dc3796403fc5539f83f6192a41146edbe Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 19 Oct 2024 11:56:46 +0200 Subject: [PATCH 3/5] fix: animate emotes when overlay is open (#5659) --- CHANGELOG.md | 2 +- src/singletons/helper/GifTimer.cpp | 1 + src/singletons/helper/GifTimer.hpp | 12 ++++++++++++ src/widgets/OverlayWindow.cpp | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc73acb323a..52be2a8953f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - Major: Add option to show pronouns in user card. (#5442, #5583) - Major: Release plugins alpha. (#5288) - Major: Improve high-DPI support on Windows. (#4868, #5391) -- Major: Added transparent overlay window (default keybind: CTRL + ALT + N). (#4746, #5643) +- Major: Added transparent overlay window (default keybind: CTRL + ALT + N). (#4746, #5643, #5659) - Minor: Removed the Ctrl+Shift+L hotkey for toggling the "live only" tab visibility state. (#5530) - Minor: Add support for Shared Chat messages. Shared chat messages can be filtered with the `flags.shared` filter variable, or with search using `is:shared`. Some messages like subscriptions are filtered on purpose to avoid confusion for the broadcaster. If you have both channels participating in Shared Chat open, only one of the message triggering your highlight will trigger. (#5606, #5625) - Minor: Moved tab visibility control to a submenu, without any toggle actions. (#5530) diff --git a/src/singletons/helper/GifTimer.cpp b/src/singletons/helper/GifTimer.cpp index 07e255381c3..42f1d326aed 100644 --- a/src/singletons/helper/GifTimer.cpp +++ b/src/singletons/helper/GifTimer.cpp @@ -26,6 +26,7 @@ void GIFTimer::initialize() QObject::connect(&this->timer, &QTimer::timeout, [this] { if (getSettings()->animationsWhenFocused && + this->openOverlayWindows_ == 0 && QApplication::activeWindow() == nullptr) { return; diff --git a/src/singletons/helper/GifTimer.hpp b/src/singletons/helper/GifTimer.hpp index ecb741be76e..a8004c8c00d 100644 --- a/src/singletons/helper/GifTimer.hpp +++ b/src/singletons/helper/GifTimer.hpp @@ -18,9 +18,21 @@ class GIFTimer return this->position_; } + void registerOpenOverlayWindow() + { + this->openOverlayWindows_++; + } + + void unregisterOpenOverlayWindow() + { + assert(this->openOverlayWindows_ >= 1); + this->openOverlayWindows_--; + } + private: QTimer timer; long unsigned position_{}; + size_t openOverlayWindows_ = 0; }; } // namespace chatterino diff --git a/src/widgets/OverlayWindow.cpp b/src/widgets/OverlayWindow.cpp index 94811fa8719..b6cff796e1a 100644 --- a/src/widgets/OverlayWindow.cpp +++ b/src/widgets/OverlayWindow.cpp @@ -4,6 +4,7 @@ #include "common/FlagsEnum.hpp" #include "common/Literals.hpp" #include "controllers/hotkeys/HotkeyController.hpp" +#include "singletons/Emotes.hpp" #include "singletons/Settings.hpp" #include "singletons/WindowManager.hpp" #include "widgets/BaseWidget.hpp" @@ -166,6 +167,7 @@ OverlayWindow::OverlayWindow(IndirectChannel channel, this->addShortcuts(); this->triggerFirstActivation(); + getApp()->getEmotes()->getGIFTimer().registerOpenOverlayWindow(); } OverlayWindow::~OverlayWindow() @@ -173,6 +175,7 @@ OverlayWindow::~OverlayWindow() #ifdef Q_OS_WIN ::DestroyCursor(this->sizeAllCursor_); #endif + getApp()->getEmotes()->getGIFTimer().unregisterOpenOverlayWindow(); } void OverlayWindow::applyTheme() From dab97b3235528dd2c8059a68a410953b57a330d8 Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 19 Oct 2024 12:25:21 +0200 Subject: [PATCH 4/5] test: `USERNOTICE` snapshot tests (#5656) --- CHANGELOG.md | 2 +- .../IrcMessageHandler/announcement.json | 255 ++++++++++++ .../IrcMessageHandler/bitsbadge.json | 172 ++++++++ .../shared-chat-announcement.json | 313 ++++++++++++++ .../IrcMessageHandler/sub-blocked-phrase.json | 32 ++ .../IrcMessageHandler/sub-blocked-user.json | 5 + .../IrcMessageHandler/sub-first-gift.json | 307 ++++++++++++++ .../IrcMessageHandler/sub-first-time.json | 142 +++++++ .../snapshots/IrcMessageHandler/sub-gift.json | 172 ++++++++ .../IrcMessageHandler/sub-message.json | 393 ++++++++++++++++++ .../sub-multi-month-anon-gift.json | 247 +++++++++++ .../sub-multi-month-gift-count.json | 322 ++++++++++++++ .../sub-multi-month-gift.json | 217 ++++++++++ .../sub-multi-month-resub.json | 292 +++++++++++++ .../IrcMessageHandler/sub-multi-month.json | 202 +++++++++ .../IrcMessageHandler/sub-no-message.json | 292 +++++++++++++ .../IrcMessageHandler/sub-shared-chat.json | 5 + 17 files changed, 3369 insertions(+), 1 deletion(-) create mode 100644 tests/snapshots/IrcMessageHandler/announcement.json create mode 100644 tests/snapshots/IrcMessageHandler/bitsbadge.json create mode 100644 tests/snapshots/IrcMessageHandler/shared-chat-announcement.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-blocked-phrase.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-blocked-user.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-first-gift.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-first-time.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-gift.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-message.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-multi-month-anon-gift.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-multi-month-gift-count.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-multi-month-gift.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-multi-month-resub.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-multi-month.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-no-message.json create mode 100644 tests/snapshots/IrcMessageHandler/sub-shared-chat.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 52be2a8953f..1aa0e5a5a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,7 +103,7 @@ - Dev: Added more tests for input completion. (#5604) - Dev: Refactored legacy Unicode zero-width-joiner replacement. (#5594) - Dev: The JSON output when copying a message (SHIFT + right-click) is now more extensive. (#5600) -- Dev: Added more tests for message building. (#5598, #5654) +- Dev: Added more tests for message building. (#5598, #5654, #5656) - Dev: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607) - Dev: `GIFTimer` is no longer initialized in tests. (#5608) - Dev: Emojis now use flags instead of a set of strings for capabilities. (#5616) diff --git a/tests/snapshots/IrcMessageHandler/announcement.json b/tests/snapshots/IrcMessageHandler/announcement.json new file mode 100644 index 00000000000..b3ddfd2e6af --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/announcement.json @@ -0,0 +1,255 @@ +{ + "input": "@badge-info=subscriber/47;badges=broadcaster/1,subscriber/3012,twitchconAmsterdam2020/1;color=#FF0000;display-name=Supinic;emotes=;flags=;id=8c26e1ab-b50c-4d9d-bc11-3fd57a941d90;login=supinic;mod=0;msg-id=announcement;msg-param-color=PRIMARY;room-id=11148817;subscriber=1;system-msg=;tmi-sent-ts=1648762219962;user-id=31400525;user-type= :tmi.twitch.tv USERNOTICE #pajlada :mm test lol", + "output": [ + { + "badgeInfos": { + "subscriber": "47" + }, + "badges": [ + "broadcaster", + "subscriber", + "twitchconAmsterdam2020" + ], + "channelName": "pajlada", + "count": 1, + "displayName": "Supinic", + "elements": [ + { + "color": "System", + "flags": "ChannelName", + "link": { + "type": "JumpToChannel", + "value": "pajlada" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "#pajlada" + ] + }, + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "21:30" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "21:30:19", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "flags": "ModeratorTools", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "", + "trailingSpace": true, + "type": "TwitchModerationElement" + }, + { + "emote": { + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/3" + }, + "name": "", + "tooltip": "Broadcaster" + }, + "flags": "BadgeChannelAuthority", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "Broadcaster", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "emote": { + "homePage": "https://www.twitchcon.com/amsterdam/?utm_source=twitch-chat&utm_medium=badge&utm_campaign=tcamsterdam20", + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/ed917c9a-1a45-4340-9c64-ca8be4348c51/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/ed917c9a-1a45-4340-9c64-ca8be4348c51/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/ed917c9a-1a45-4340-9c64-ca8be4348c51/3" + }, + "name": "", + "tooltip": "TwitchCon 2020 - Amsterdam" + }, + "flags": "BadgeVanity", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "TwitchCon 2020 - Amsterdam", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "color": "#ffff0000", + "flags": "Username", + "link": { + "type": "UserInfo", + "value": "Supinic" + }, + "style": "ChatMediumBold", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Supinic:" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "mm" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "test" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "lol" + ] + }, + { + "background": "#ffa0a0a4", + "flags": "ReplyButton", + "link": { + "type": "ReplyToMessage", + "value": "8c26e1ab-b50c-4d9d-bc11-3fd57a941d90" + }, + "padding": 2, + "tooltip": "", + "trailingSpace": true, + "type": "CircularImageElement", + "url": "" + } + ], + "flags": "Collapsed|Subscription", + "id": "8c26e1ab-b50c-4d9d-bc11-3fd57a941d90", + "localizedName": "", + "loginName": "supinic", + "messageText": "mm test lol", + "searchText": "supinic supinic: mm test lol ", + "serverReceivedTime": "2022-03-31T21:30:19Z", + "timeoutUser": "", + "usernameColor": "#ffff0000" + }, + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "21:30" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "21:30:19", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Announcement" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "Announcement", + "searchText": "Announcement", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/bitsbadge.json b/tests/snapshots/IrcMessageHandler/bitsbadge.json new file mode 100644 index 00000000000..bd2b353246e --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/bitsbadge.json @@ -0,0 +1,172 @@ +{ + "input": "@badge-info=subscriber/2;badges=subscriber/2,bits/1000;color=#FF4500;display-name=whoopiix;emotes=;flags=;id=d2b32a02-3071-4c52-b2ce-bc3716acdc44;login=whoopiix;mod=0;msg-id=bitsbadgetier;msg-param-threshold=1000;room-id=11148817;subscriber=1;system-msg=bits\\sbadge\\stier\\snotification;tmi-sent-ts=1594520403813;user-id=104252055;user-type= :tmi.twitch.tv USERNOTICE #pajlada", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "2:20" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "02:20:03", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "whoopiix" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "just" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "earned" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "new" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1K" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Bits" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "badge!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "whoopiix just earned a new 1K Bits badge!", + "searchText": "whoopiix just earned a new 1K Bits badge!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/shared-chat-announcement.json b/tests/snapshots/IrcMessageHandler/shared-chat-announcement.json new file mode 100644 index 00000000000..9c6fa2f6511 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/shared-chat-announcement.json @@ -0,0 +1,313 @@ +{ + "input": "@badge-info=;badges=staff/1,raging-wolf-helm/1;color=#DAA520;display-name=lahoooo;emotes=;flags=;id=01cd601f-bc3f-49d5-ab4b-136fa9d6ec22;login=lahoooo;mod=0;msg-id=sharedchatnotice;msg-param-color=PRIMARY;room-id=11148817;source-badge-info=;source-badges=staff/1,moderator/1,bits-leader/1;source-id=4083dadc-9f20-40f9-ba92-949ebf6bc294;source-msg-id=announcement;source-room-id=1025594235;subscriber=0;system-msg=;tmi-sent-ts=1726118378465;user-id=612865661;user-type=staff;vip=0 :tmi.twitch.tv USERNOTICE #pajlada :hi this is an announcement from 1", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + "staff", + "raging-wolf-helm" + ], + "channelName": "pajlada", + "count": 1, + "displayName": "lahoooo", + "elements": [ + { + "color": "System", + "flags": "ChannelName", + "link": { + "type": "JumpToChannel", + "value": "pajlada" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "#pajlada" + ] + }, + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "5:19" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "05:19:38", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "flags": "ModeratorTools", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "", + "trailingSpace": true, + "type": "TwitchModerationElement" + }, + { + "emote": { + "homePage": "https://www.twitch.tv/jobs?ref=chat_badge", + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/d97c37bd-a6f5-4c38-8f57-4e4bef88af34/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/d97c37bd-a6f5-4c38-8f57-4e4bef88af34/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/d97c37bd-a6f5-4c38-8f57-4e4bef88af34/3" + }, + "name": "", + "tooltip": "Staff" + }, + "flags": "BadgeGlobalAuthority", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "Staff", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "emote": { + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/3ff668be-59a3-4e3e-96af-e6b2908b3171/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/3ff668be-59a3-4e3e-96af-e6b2908b3171/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/3ff668be-59a3-4e3e-96af-e6b2908b3171/3" + }, + "name": "", + "tooltip": "Raging Wolf Helm" + }, + "flags": "BadgeVanity", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "Raging Wolf Helm", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "color": "#ffdaa520", + "flags": "Username", + "link": { + "type": "UserInfo", + "value": "lahoooo" + }, + "style": "ChatMediumBold", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "lahoooo:" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "hi" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "this" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "is" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "an" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "announcement" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "from" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "background": "#ffa0a0a4", + "flags": "ReplyButton", + "link": { + "type": "ReplyToMessage", + "value": "01cd601f-bc3f-49d5-ab4b-136fa9d6ec22" + }, + "padding": 2, + "tooltip": "", + "trailingSpace": true, + "type": "CircularImageElement", + "url": "" + } + ], + "flags": "Collapsed|Subscription|SharedMessage", + "id": "01cd601f-bc3f-49d5-ab4b-136fa9d6ec22", + "localizedName": "", + "loginName": "lahoooo", + "messageText": "hi this is an announcement from 1", + "searchText": "lahoooo lahoooo: hi this is an announcement from 1 ", + "serverReceivedTime": "2024-09-12T05:19:38Z", + "timeoutUser": "", + "usernameColor": "#ffdaa520" + }, + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "5:19" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "05:19:38", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Announcement" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription|SharedMessage", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "Announcement", + "searchText": "Announcement", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-blocked-phrase.json b/tests/snapshots/IrcMessageHandler/sub-blocked-phrase.json new file mode 100644 index 00000000000..c8c92b59c21 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-blocked-phrase.json @@ -0,0 +1,32 @@ +{ + "input": "@badges=staff/1,broadcaster/1,turbo/1;color=#008000;display-name=ronni;emotes=;id=db25007f-7a18-43eb-9379-80131e44d633;login=ronni;mod=0;msg-id=resub;msg-param-months=6;msg-param-sub-plan=Prime;msg-param-sub-plan-name=Prime;room-id=11148817;subscriber=1;system-msg=ronni\\shas\\ssubscribed\\sfor\\s6\\smonths!;tmi-sent-ts=1507246572675;turbo=1;user-id=1337;user-type=staff :tmi.twitch.tv USERNOTICE #pajlada :somethingblock!!something", + "output": [ + ], + "settings": { + "ignore": { + "phrases": [ + { + "caseSensitive": false, + "isBlock": false, + "pattern": "ignore", + "regex": false, + "replaceWith": "replace" + }, + { + "caseSensitive": true, + "isBlock": true, + "pattern": "block!{2,}", + "regex": true, + "replaceWith": "?" + }, + { + "caseSensitive": true, + "isBlock": true, + "pattern": "", + "regex": false, + "replaceWith": "empty" + } + ] + } + } +} diff --git a/tests/snapshots/IrcMessageHandler/sub-blocked-user.json b/tests/snapshots/IrcMessageHandler/sub-blocked-user.json new file mode 100644 index 00000000000..e444b0139ce --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-blocked-user.json @@ -0,0 +1,5 @@ +{ + "input": "@badges=subscriber/0,premium/1;color=#0000FF;display-name=blocked;emotes=;id=fe390424-ab89-4c33-bb5a-53c6e5214b9f;login=blocked;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=12345;user-type= :tmi.twitch.tv USERNOTICE #pajlada", + "output": [ + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-first-gift.json b/tests/snapshots/IrcMessageHandler/sub-first-gift.json new file mode 100644 index 00000000000..25ed044e1f9 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-first-gift.json @@ -0,0 +1,307 @@ +{ + "input": "@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", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "9:28" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "09:28:58", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "hyperbolicxd" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "gifted" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "sub" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "to" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "quote_if_nam!" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "This" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "is" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "their" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "first" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Gift" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Sub" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "in" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "the" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "channel!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "hyperbolicxd gifted a Tier 1 sub to quote_if_nam! This is their first Gift Sub in the channel!", + "searchText": "hyperbolicxd gifted a Tier 1 sub to quote_if_nam! This is their first Gift Sub in the channel!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-first-time.json b/tests/snapshots/IrcMessageHandler/sub-first-time.json new file mode 100644 index 00000000000..e1427a8b009 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-first-time.json @@ -0,0 +1,142 @@ +{ + "input": "@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", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "9:29" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "09:29:23", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "byebyeheart" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "just" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "subscribed" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "with" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Twitch" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Prime!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "byebyeheart just subscribed with Twitch Prime!", + "searchText": "byebyeheart just subscribed with Twitch Prime!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-gift.json b/tests/snapshots/IrcMessageHandler/sub-gift.json new file mode 100644 index 00000000000..738fe14e4e7 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-gift.json @@ -0,0 +1,172 @@ +{ + "input": "@badges=staff/1,premium/1;color=#0000FF;display-name=TWW2;emotes=;id=e9176cd8-5e22-4684-ad40-ce53c2561c5e;login=tww2;mod=0;msg-id=subgift;msg-param-months=1;msg-param-recipient-display-name=Mr_Woodchuck;msg-param-recipient-id=89614178;msg-param-recipient-name=mr_woodchuck;msg-param-sub-plan-name=House\\sof\\sNyoro~n;msg-param-sub-plan=1000;room-id=19571752;subscriber=0;system-msg=TWW2\\sgifted\\sa\\sTier\\s1\\ssub\\sto\\sMr_Woodchuck!;tmi-sent-ts=1521159445153;turbo=0;user-id=13405587;user-type=staff :tmi.twitch.tv USERNOTICE #pajlada", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "0:17" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "00:17:25", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "TWW2" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "gifted" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "sub" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "to" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Mr_Woodchuck!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "TWW2 gifted a Tier 1 sub to Mr_Woodchuck!", + "searchText": "TWW2 gifted a Tier 1 sub to Mr_Woodchuck!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-message.json b/tests/snapshots/IrcMessageHandler/sub-message.json new file mode 100644 index 00000000000..fd74777c55f --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-message.json @@ -0,0 +1,393 @@ +{ + "input": "@badges=staff/1,broadcaster/1,turbo/1;color=#008000;display-name=ronni;emotes=;id=db25007f-7a18-43eb-9379-80131e44d633;login=ronni;mod=0;msg-id=resub;msg-param-months=6;msg-param-sub-plan=Prime;msg-param-sub-plan-name=Prime;room-id=11148817;subscriber=1;system-msg=ronni\\shas\\ssubscribed\\sfor\\s6\\smonths!;tmi-sent-ts=1507246572675;turbo=1;user-id=1337;user-type=staff :tmi.twitch.tv USERNOTICE #pajlada :Great stream -- keep it up!", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + "staff", + "broadcaster", + "turbo" + ], + "channelName": "pajlada", + "count": 1, + "displayName": "ronni", + "elements": [ + { + "color": "System", + "flags": "ChannelName", + "link": { + "type": "JumpToChannel", + "value": "pajlada" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "#pajlada" + ] + }, + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "23:36" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "23:36:12", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "flags": "ModeratorTools", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "", + "trailingSpace": true, + "type": "TwitchModerationElement" + }, + { + "emote": { + "homePage": "https://www.twitch.tv/jobs?ref=chat_badge", + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/d97c37bd-a6f5-4c38-8f57-4e4bef88af34/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/d97c37bd-a6f5-4c38-8f57-4e4bef88af34/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/d97c37bd-a6f5-4c38-8f57-4e4bef88af34/3" + }, + "name": "", + "tooltip": "Staff" + }, + "flags": "BadgeGlobalAuthority", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "Staff", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "emote": { + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/3" + }, + "name": "", + "tooltip": "Broadcaster" + }, + "flags": "BadgeChannelAuthority", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "Broadcaster", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "emote": { + "images": { + "1x": "https://static-cdn.jtvnw.net/badges/v1/bd444ec6-8f34-4bf9-91f4-af1e3428d80f/1", + "2x": "https://static-cdn.jtvnw.net/badges/v1/bd444ec6-8f34-4bf9-91f4-af1e3428d80f/2", + "3x": "https://static-cdn.jtvnw.net/badges/v1/bd444ec6-8f34-4bf9-91f4-af1e3428d80f/3" + }, + "name": "", + "tooltip": "Turbo" + }, + "flags": "BadgeVanity", + "link": { + "type": "None", + "value": "" + }, + "tooltip": "Turbo", + "trailingSpace": true, + "type": "BadgeElement" + }, + { + "color": "#ff008000", + "flags": "Username", + "link": { + "type": "UserInfo", + "value": "ronni" + }, + "style": "ChatMediumBold", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "ronni:" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Great" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "stream" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "--" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "keep" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "it" + ] + }, + { + "color": "Text", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "up!" + ] + }, + { + "background": "#ffa0a0a4", + "flags": "ReplyButton", + "link": { + "type": "ReplyToMessage", + "value": "db25007f-7a18-43eb-9379-80131e44d633" + }, + "padding": 2, + "tooltip": "", + "trailingSpace": true, + "type": "CircularImageElement", + "url": "" + } + ], + "flags": "Collapsed|Subscription", + "id": "db25007f-7a18-43eb-9379-80131e44d633", + "localizedName": "", + "loginName": "ronni", + "messageText": "Great stream -- keep it up!", + "searchText": "ronni ronni: Great stream -- keep it up! ", + "serverReceivedTime": "2017-10-05T23:36:12Z", + "timeoutUser": "", + "usernameColor": "#ff008000" + }, + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "23:36" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "23:36:12", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "ronni" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "has" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "subscribed" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "for" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "6" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "ronni has subscribed for 6 months!", + "searchText": "ronni has subscribed for 6 months!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-multi-month-anon-gift.json b/tests/snapshots/IrcMessageHandler/sub-multi-month-anon-gift.json new file mode 100644 index 00000000000..a9857556559 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-multi-month-anon-gift.json @@ -0,0 +1,247 @@ +{ + "input": "@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 #pajlada", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "20:07" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "20:07:17", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "An" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "anonymous" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "user" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "gifted" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "6" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "of" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "sub" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "to" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "MohammadrezaDH!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "An anonymous user gifted 6 months of a Tier 1 sub to MohammadrezaDH!", + "searchText": "An anonymous user gifted 6 months of a Tier 1 sub to MohammadrezaDH!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-multi-month-gift-count.json b/tests/snapshots/IrcMessageHandler/sub-multi-month-gift-count.json new file mode 100644 index 00000000000..3b9d3b106c0 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-multi-month-gift-count.json @@ -0,0 +1,322 @@ +{ + "input": "@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 #pajlada", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "5:08" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "05:08:17", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "iNatsuFN" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "gifted" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "6" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "of" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "sub" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "to" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "kimmi_tm!" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "They've" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "gifted" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "334" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "in" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "the" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "channel." + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "iNatsuFN gifted 6 months of a Tier 1 sub to kimmi_tm! They've gifted 334 months in the channel.", + "searchText": "iNatsuFN gifted 6 months of a Tier 1 sub to kimmi_tm! They've gifted 334 months in the channel.", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-multi-month-gift.json b/tests/snapshots/IrcMessageHandler/sub-multi-month-gift.json new file mode 100644 index 00000000000..65246a879c6 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-multi-month-gift.json @@ -0,0 +1,217 @@ +{ + "input": "@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", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "2:52" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "02:52:27", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Lucidfoxx" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "gifted" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "12" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "of" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "sub" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "to" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "OGprodigy!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "Lucidfoxx gifted 12 months of a Tier 1 sub to OGprodigy!", + "searchText": "Lucidfoxx gifted 12 months of a Tier 1 sub to OGprodigy!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-multi-month-resub.json b/tests/snapshots/IrcMessageHandler/sub-multi-month-resub.json new file mode 100644 index 00000000000..4878d3f4ea6 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-multi-month-resub.json @@ -0,0 +1,292 @@ +{ + "input": "@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", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "3:13" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "03:13:31", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "calm__like_a_tom" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "subscribed" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "at" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "3" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "for" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "6" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "in" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "advance," + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "reaching" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "9" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "cumulatively" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "so" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "far!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "calm__like_a_tom subscribed at Tier 3 for 6 months in advance, reaching 9 months cumulatively so far!", + "searchText": "calm__like_a_tom subscribed at Tier 3 for 6 months in advance, reaching 9 months cumulatively so far!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-multi-month.json b/tests/snapshots/IrcMessageHandler/sub-multi-month.json new file mode 100644 index 00000000000..98f7e34a462 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-multi-month.json @@ -0,0 +1,202 @@ +{ + "input": "@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", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "5:29" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "05:29:22", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "foly__" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "subscribed" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "at" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "1" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "for" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "6" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "in" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "advance!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "foly__ subscribed at Tier 1 for 6 months in advance!", + "searchText": "foly__ subscribed at Tier 1 for 6 months in advance!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-no-message.json b/tests/snapshots/IrcMessageHandler/sub-no-message.json new file mode 100644 index 00000000000..01d589b9077 --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-no-message.json @@ -0,0 +1,292 @@ +{ + "input": "@badges=subscriber/12;color=#CC00C2;display-name=cspice;emotes=;id=6fc4c3e0-ca61-454a-84b8-5669dee69fc9;login=cspice;mod=0;msg-id=resub;msg-param-months=12;msg-param-sub-plan-name=Channel\\sSubscription\\s(forsenlol):\\s$9.99\\sSub;msg-param-sub-plan=2000;room-id=22484632;subscriber=1;system-msg=cspice\\sjust\\ssubscribed\\swith\\sa\\sTier\\s2\\ssub.\\scspice\\ssubscribed\\sfor\\s12\\smonths\\sin\\sa\\srow!;tmi-sent-ts=1528192510808;turbo=0;user-id=47894662;user-type= :tmi.twitch.tv USERNOTICE #pajlada", + "output": [ + { + "badgeInfos": { + }, + "badges": [ + ], + "channelName": "", + "count": 1, + "displayName": "", + "elements": [ + { + "element": { + "color": "System", + "flags": "Timestamp", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "9:55" + ] + }, + "flags": "Timestamp", + "format": "", + "link": { + "type": "None", + "value": "" + }, + "time": "09:55:10", + "tooltip": "", + "trailingSpace": true, + "type": "TimestampElement" + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "cspice" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "just" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "subscribed" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "with" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "Tier" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "2" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "sub." + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "cspice" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "subscribed" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "for" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "12" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "months" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "in" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "a" + ] + }, + { + "color": "System", + "flags": "Text", + "link": { + "type": "None", + "value": "" + }, + "style": "ChatMedium", + "tooltip": "", + "trailingSpace": true, + "type": "TextElement", + "words": [ + "row!" + ] + } + ], + "flags": "System|DoNotTriggerNotification|Subscription", + "id": "", + "localizedName": "", + "loginName": "", + "messageText": "cspice just subscribed with a Tier 2 sub. cspice subscribed for 12 months in a row!", + "searchText": "cspice just subscribed with a Tier 2 sub. cspice subscribed for 12 months in a row!", + "serverReceivedTime": "", + "timeoutUser": "", + "usernameColor": "#ff000000" + } + ] +} diff --git a/tests/snapshots/IrcMessageHandler/sub-shared-chat.json b/tests/snapshots/IrcMessageHandler/sub-shared-chat.json new file mode 100644 index 00000000000..e5bfc22233e --- /dev/null +++ b/tests/snapshots/IrcMessageHandler/sub-shared-chat.json @@ -0,0 +1,5 @@ +{ + "input": "@user-id=818265505;source-room-id=39317849;mod=0;subscriber=1;msg-param-was-gifted=false;vip=0;msg-param-months=0;tmi-sent-ts=1729257926126;msg-param-streak-months=4;msg-param-cumulative-months=6;badge-info=subscriber/6;flags=;id=5fca3f42-9eb6-46c2-a321-57ad9508b976;source-msg-id=resub;badges=subscriber/6;login=gulgarius;system-msg=Gulgarius\\ssubscribed\\sat\\sTier\\s1.\\sThey've\\ssubscribed\\sfor\\s6\\smonths,\\scurrently\\son\\sa\\s4\\smonth\\sstreak!;display-name=Gulgarius;msg-param-sub-plan-name=Join\\sthe\\sLowkoTV\\sfamily!\\s;rm-received-ts=1729257926266;source-id=5fca3f42-9eb6-46c2-a321-57ad9508b976;msg-param-sub-plan=1000;user-type=;msg-param-multimonth-duration=4;room-id=11148817;msg-param-should-share-streak=1;msg-param-multimonth-tenure=3;source-badge-info=subscriber/6;source-badges=subscriber/6;msg-id=resub;emotes=;color=;historical=1 :tmi.twitch.tv USERNOTICE #pajlada", + "output": [ + ] +} From fb787b522645787478b79ed7021a935d0400e749 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Sat, 19 Oct 2024 11:01:22 +0000 Subject: [PATCH 5/5] feat: make raid entry username clickable (#5651) --- CHANGELOG.md | 1 + src/messages/MessageBuilder.cpp | 29 ++++++++ src/messages/MessageBuilder.hpp | 6 ++ src/providers/twitch/IrcMessageHandler.cpp | 78 +++++++++++++++++++++- 4 files changed, 113 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa0e5a5a9a..3c7212d43b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - Minor: Added `--login ` CLI argument to specify which account to start logged in as. (#5626) - Minor: Indicate when subscriptions and resubscriptions are for multiple months. (#5642) - Minor: Proxy URL information is now included in the `/debug-env` command. (#5648) +- Minor: Make raid entry message usernames clickable. (#5651) - 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) diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index e470b01cec3..fca5753a802 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -461,6 +461,35 @@ MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text, this->message().searchText = text; } +MessageBuilder::MessageBuilder(RaidEntryMessageTag, const QString &text, + const QString &loginName, + const QString &displayName, + const MessageColor &userColor, const QTime &time) + : MessageBuilder() +{ + this->emplace(time); + + const QStringList textFragments = + text.split(QRegularExpression("\\s"), Qt::SkipEmptyParts); + for (const auto &word : textFragments) + { + if (word == displayName) + { + this->emplace(displayName, loginName, + MessageColor::System, userColor); + continue; + } + + this->emplace(word, MessageElementFlag::Text, + MessageColor::System); + } + + this->message().flags.set(MessageFlag::System); + this->message().flags.set(MessageFlag::DoNotTriggerNotification); + this->message().messageText = text; + this->message().searchText = text; +} + MessageBuilder::MessageBuilder(TimeoutMessageTag, const QString &timeoutUser, const QString &sourceUser, const QString &systemMessageText, int times, diff --git a/src/messages/MessageBuilder.hpp b/src/messages/MessageBuilder.hpp index aa2933b640e..b353a8bdec0 100644 --- a/src/messages/MessageBuilder.hpp +++ b/src/messages/MessageBuilder.hpp @@ -53,6 +53,8 @@ namespace linkparser { struct SystemMessageTag { }; +struct RaidEntryMessageTag { +}; struct TimeoutMessageTag { }; struct LiveUpdatesUpdateEmoteMessageTag { @@ -67,6 +69,7 @@ struct ImageUploaderResultTag { }; const SystemMessageTag systemMessage{}; +const RaidEntryMessageTag raidEntryMessage{}; const TimeoutMessageTag timeoutMessage{}; const LiveUpdatesUpdateEmoteMessageTag liveUpdatesUpdateEmoteMessage{}; const LiveUpdatesRemoveEmoteMessageTag liveUpdatesRemoveEmoteMessage{}; @@ -109,6 +112,9 @@ class MessageBuilder MessageBuilder(SystemMessageTag, const QString &text, const QTime &time = QTime::currentTime()); + MessageBuilder(RaidEntryMessageTag, const QString &text, + const QString &loginName, const QString &displayName, + const MessageColor &userColor, const QTime &time); MessageBuilder(TimeoutMessageTag, const QString &timeoutUser, const QString &sourceUser, const QString &systemMessageText, int times, const QTime &time = QTime::currentTime()); diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 8bac0d9fe97..9724ec21352 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -531,6 +531,35 @@ std::vector parseUserNoticeMessage(Channel *channel, { messageText = "Announcement"; } + else if (msgType == "raid") + { + auto login = tags.value("login").toString(); + auto displayName = tags.value("msg-param-displayName").toString(); + + if (!login.isEmpty() && !displayName.isEmpty()) + { + MessageColor color = MessageColor::System; + if (auto colorTag = tags.value("color").value(); + colorTag.isValid()) + { + color = MessageColor(colorTag); + } + + auto b = MessageBuilder( + raidEntryMessage, parseTagString(messageText), login, + displayName, color, calculateMessageTime(message).time()); + + b->flags.set(MessageFlag::Subscription); + if (mirrored) + { + b->flags.set(MessageFlag::SharedMessage); + } + + auto newMessage = b.release(); + builtMessages.emplace_back(newMessage); + return builtMessages; + } + } else if (msgType == "subgift") { if (auto monthsIt = tags.find("msg-param-gift-months"); @@ -600,12 +629,12 @@ std::vector parseUserNoticeMessage(Channel *channel, auto b = MessageBuilder(systemMessage, parseTagString(messageText), calculateMessageTime(message).time()); - b->flags.set(MessageFlag::Subscription); if (mirrored) { b->flags.set(MessageFlag::SharedMessage); } + auto newMessage = b.release(); builtMessages.emplace_back(newMessage); } @@ -1085,6 +1114,53 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message, { messageText = "Announcement"; } + else if (msgType == "raid") + { + auto login = tags.value("login").toString(); + auto displayName = tags.value("msg-param-displayName").toString(); + + if (!login.isEmpty() && !displayName.isEmpty()) + { + MessageColor color = MessageColor::System; + if (auto colorTag = tags.value("color").value(); + colorTag.isValid()) + { + color = MessageColor(colorTag); + } + + auto b = MessageBuilder( + raidEntryMessage, parseTagString(messageText), login, + displayName, color, calculateMessageTime(message).time()); + + b->flags.set(MessageFlag::Subscription); + if (mirrored) + { + b->flags.set(MessageFlag::SharedMessage); + } + auto newMessage = b.release(); + + QString channelName; + + if (message->parameters().size() < 1) + { + return; + } + + if (!trimChannelName(message->parameter(0), channelName)) + { + return; + } + + auto chan = twitchServer.getChannelOrEmpty(channelName); + + if (!chan->isEmpty()) + { + chan->addMessage(newMessage, MessageContext::Original); + } + + return; + } + } else if (msgType == "subgift") { if (auto monthsIt = tags.find("msg-param-gift-months");