From 8ecee0070d57f2cac0b2f69cdb540b8bddd91258 Mon Sep 17 00:00:00 2001 From: Przemek Pawlas <3606072+Destroy666x@users.noreply.github.com> Date: Sat, 5 Oct 2024 01:26:38 +0200 Subject: [PATCH] Add more Twitch chat tag temp vars and properties --- data/locale/en-US.ini | 88 +++++++++++++++++------ plugins/twitch/chat-connection.cpp | 38 +++++++++- plugins/twitch/chat-connection.hpp | 21 +++++- plugins/twitch/chat-message-pattern.cpp | 16 +++++ plugins/twitch/macro-condition-twitch.cpp | 59 ++++++++++++++- 5 files changed, 194 insertions(+), 28 deletions(-) diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 847f70c5..9011dae3 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -708,6 +708,8 @@ AdvSceneSwitcher.condition.twitch.type.chat.properties.emoteOnly="Is only using AdvSceneSwitcher.condition.twitch.type.chat.properties.mod="Is moderator" AdvSceneSwitcher.condition.twitch.type.chat.properties.subscriber="Is subscriber" AdvSceneSwitcher.condition.twitch.type.chat.properties.turbo="Is Turbo user" +AdvSceneSwitcher.condition.twitch.type.chat.properties.vip="Is VIP" +AdvSceneSwitcher.condition.twitch.type.chat.properties.color="Color matches" AdvSceneSwitcher.condition.twitch.type.chat.properties.displayName="Display name matches" AdvSceneSwitcher.condition.twitch.type.chat.properties.loginName="User name matches" AdvSceneSwitcher.condition.twitch.type.chat.properties.badge="User has badge" @@ -1397,14 +1399,14 @@ AdvSceneSwitcher.twitch.selection.points.reward.tooltip.error="Can't select poin AdvSceneSwitcher.tempVar.select="--select value--" AdvSceneSwitcher.tempVar.selectionInfo.lastValues="Last values:" -AdvSceneSwitcher.tempVar.twitch.broadcaster_user_id="Twitch broadcaster user id" +AdvSceneSwitcher.tempVar.twitch.broadcaster_user_id="Twitch broadcaster user ID" AdvSceneSwitcher.tempVar.twitch.broadcaster_user_id.description="The numerical Twitch user ID of the broadcaster." AdvSceneSwitcher.tempVar.twitch.broadcaster_user_login="Twitch broadcaster user login" AdvSceneSwitcher.tempVar.twitch.broadcaster_user_login.description="The Twitch user login of the broadcaster" AdvSceneSwitcher.tempVar.twitch.broadcaster_user_name="Twitch broadcaster user name" AdvSceneSwitcher.tempVar.twitch.broadcaster_user_name.description="The Twitch user name of the broadcaster" -AdvSceneSwitcher.tempVar.twitch.user_id.follow="Follower Twitch user id" +AdvSceneSwitcher.tempVar.twitch.user_id.follow="Follower Twitch user ID" AdvSceneSwitcher.tempVar.twitch.user_id.follow.description="The user ID for the user now following the specified channel." AdvSceneSwitcher.tempVar.twitch.user_login.follow="Follower Twitch user login" AdvSceneSwitcher.tempVar.twitch.user_login.follow.description="The user login for the user now following the specified channel." @@ -1413,7 +1415,7 @@ AdvSceneSwitcher.tempVar.twitch.user_name.follow.description="The user display n AdvSceneSwitcher.tempVar.twitch.followed_at="Twitch follow timestamp" AdvSceneSwitcher.tempVar.twitch.followed_at.description="The timestamp of when the Twitch follow event occurred" -AdvSceneSwitcher.tempVar.twitch.id.stream.online="Twitch stream id" +AdvSceneSwitcher.tempVar.twitch.id.stream.online="Twitch stream ID" AdvSceneSwitcher.tempVar.twitch.type.stream.online="Twitch stream type" AdvSceneSwitcher.tempVar.twitch.type.stream.online.description="The stream type. Valid values are: live, playlist, watch_party, premiere, rerun." AdvSceneSwitcher.tempVar.twitch.started_at.stream.online="Twitch stream start timestamp" @@ -1422,12 +1424,12 @@ AdvSceneSwitcher.tempVar.twitch.started_at.stream.online.description="The timest AdvSceneSwitcher.tempVar.twitch.title="Twitch stream title" AdvSceneSwitcher.tempVar.twitch.language="Twitch stream language code" AdvSceneSwitcher.tempVar.twitch.language.description="The broadcaster’s preferred language. The value is an ISO 639-1 two-letter language code (for example, en for English). The value is set to “other” if the language is not a Twitch supported language." -AdvSceneSwitcher.tempVar.twitch.category_id="Twitch stream category id" -AdvSceneSwitcher.tempVar.twitch.category_id.description="Numerical id identifying each Twitch streaming category" +AdvSceneSwitcher.tempVar.twitch.category_id="Twitch stream category ID" +AdvSceneSwitcher.tempVar.twitch.category_id.description="Numerical ID identifying each Twitch streaming category" AdvSceneSwitcher.tempVar.twitch.category_name="Twitch stream category name" AdvSceneSwitcher.tempVar.twitch.content_classification_labels="Twitch stream classification labels" -AdvSceneSwitcher.tempVar.twitch.user_id.subscribe="Subscriber Twitch user id" +AdvSceneSwitcher.tempVar.twitch.user_id.subscribe="Subscriber Twitch user ID" AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.description="The user ID for the user now subscribed to the specified channel." AdvSceneSwitcher.tempVar.twitch.user_login.subscribe="Subscriber Twitch user login" AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.description="The user login for the user now subscribed to the specified channel." @@ -1438,7 +1440,7 @@ AdvSceneSwitcher.tempVar.twitch.tier.subscribe.description="The tier of the subs AdvSceneSwitcher.tempVar.twitch.is_gift.subscribe="Is gifted Twitch subscription" AdvSceneSwitcher.tempVar.twitch.is_gift.subscribe.description="Valid values are true and false." -AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.end="Subscriber Twitch user id" +AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.end="Subscriber Twitch user ID" AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.end.description="The user ID for the user no longer subscribed to the specified channel." AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.end="Subscriber Twitch user login" AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.end.description="The user login for the user no longer subscribed to the specified channel." @@ -1447,7 +1449,7 @@ AdvSceneSwitcher.tempVar.twitch.user_name.subscribe.end.description="The user di AdvSceneSwitcher.tempVar.twitch.is_gift.subscribe="Was gifted Twitch subscription" AdvSceneSwitcher.tempVar.twitch.is_gift.subscribe.description="Valid values are true and false." -AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.gift="Subscriber Twitch user id" +AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.gift="Subscriber Twitch user ID" AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.gift.description="The user ID of the user who sent the subscription gift. Set to null if it was an anonymous subscription gift." AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.gift="Subscriber Twitch user login" AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.gift.description="The user login of the user who sent the gift. Set to null if it was an anonymous subscription gift." @@ -1460,7 +1462,7 @@ AdvSceneSwitcher.tempVar.twitch.cumulative_total.subscribe.description="The numb AdvSceneSwitcher.tempVar.twitch.is_anonymous.subscribe="Was anonymous Twitch subscription gift" AdvSceneSwitcher.tempVar.twitch.is_anonymous.subscribe.description="Valid values are true and false." -AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.message="Subscriber Twitch user id" +AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.message="Subscriber Twitch user ID" AdvSceneSwitcher.tempVar.twitch.user_id.subscribe.message.description="The user ID of the user who sent a resubscription chat message." AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.message="Subscriber Twitch user login" AdvSceneSwitcher.tempVar.twitch.user_login.subscribe.message.description="The user login of the user who sent a resubscription chat message." @@ -1475,7 +1477,7 @@ AdvSceneSwitcher.tempVar.twitch.streak_months.subscribe.description="The number AdvSceneSwitcher.tempVar.twitch.duration_months.subscribe="Subscription duration" AdvSceneSwitcher.tempVar.twitch.duration_months.subscribe.description="The month duration of the subscription." -AdvSceneSwitcher.tempVar.twitch.user_id.cheer="Cheerer Twitch user id" +AdvSceneSwitcher.tempVar.twitch.user_id.cheer="Cheerer Twitch user ID" AdvSceneSwitcher.tempVar.twitch.user_id.cheer.description="The user ID for the user who cheered on the specified channel. This is null if is_anonymous is true." AdvSceneSwitcher.tempVar.twitch.user_login.cheer="Cheerer Twitch user login" AdvSceneSwitcher.tempVar.twitch.user_login.cheer.description="The user login for the user who cheered on the specified channel. This is null if is_anonymous is true." @@ -1579,8 +1581,8 @@ AdvSceneSwitcher.tempVar.twitch.viewer_count.shoutoutReceived.description="The n AdvSceneSwitcher.tempVar.twitch.started_at.shoutoutReceived="Shoutout time" AdvSceneSwitcher.tempVar.twitch.started_at.shoutoutReceived.description="The UTC timestamp (in RFC3339 format) of when the moderator sent the Shoutout." -AdvSceneSwitcher.tempVar.twitch.id.reward="Reward id" -AdvSceneSwitcher.tempVar.twitch.user_id.reward="User id redeeming the reward" +AdvSceneSwitcher.tempVar.twitch.id.reward="Reward ID" +AdvSceneSwitcher.tempVar.twitch.user_id.reward="User ID redeeming the reward" AdvSceneSwitcher.tempVar.twitch.user_login.reward="User login redeeming the reward" AdvSceneSwitcher.tempVar.twitch.user_name.reward="User name redeeming the reward" AdvSceneSwitcher.tempVar.twitch.user_input.reward="User input for reward" @@ -1621,9 +1623,9 @@ AdvSceneSwitcher.tempVar.twitch.charity_name="Charity name" AdvSceneSwitcher.tempVar.twitch.charity_description="Charity description" AdvSceneSwitcher.tempVar.twitch.charity_logo="Charity logo" AdvSceneSwitcher.tempVar.twitch.charity_logo.description="A URL to an image of the charity’s logo. The image’s type is PNG and its size is 100px X 100px." -AdvSceneSwitcher.tempVar.twitch.id.charity="Charity id" +AdvSceneSwitcher.tempVar.twitch.id.charity="Charity ID" AdvSceneSwitcher.tempVar.twitch.id.charity.description="An ID that identifies the donation. The ID is unique across campaigns." -AdvSceneSwitcher.tempVar.twitch.user_id.charity="Donor user id" +AdvSceneSwitcher.tempVar.twitch.user_id.charity="Donor user ID" AdvSceneSwitcher.tempVar.twitch.user_id.charity.description="An ID that identifies the user that donated to the campaign." AdvSceneSwitcher.tempVar.twitch.user_login.charity="Donor login name" AdvSceneSwitcher.tempVar.twitch.user_login.charity.description="The user login that identifies the user that donated to the campaign." @@ -1668,13 +1670,13 @@ AdvSceneSwitcher.tempVar.twitch.thumbnail_url.description="A URL to an image of AdvSceneSwitcher.tempVar.twitch.viewer_count.live="Viewer count" AdvSceneSwitcher.tempVar.twitch.viewer_count.live.description="The number of users watching the stream." -AdvSceneSwitcher.tempVar.twitch.user_id.ban="Banned user id" +AdvSceneSwitcher.tempVar.twitch.user_id.ban="Banned user ID" AdvSceneSwitcher.tempVar.twitch.user_id.ban.description="The user ID for the user who was banned on the specified channel." AdvSceneSwitcher.tempVar.twitch.user_login.ban="Banned login name" AdvSceneSwitcher.tempVar.twitch.user_login.ban.description="The user login for the user who was banned on the specified channel." AdvSceneSwitcher.tempVar.twitch.user_name.ban="Banned user name" AdvSceneSwitcher.tempVar.twitch.user_name.ban.description="The user display name for the user who was banned on the specified channel." -AdvSceneSwitcher.tempVar.twitch.moderator_user_id.ban="Moderator user id" +AdvSceneSwitcher.tempVar.twitch.moderator_user_id.ban="Moderator user ID" AdvSceneSwitcher.tempVar.twitch.moderator_user_id.ban.description="The user ID of the issuer of the ban." AdvSceneSwitcher.tempVar.twitch.moderator_user_login.ban="Moderator login name" AdvSceneSwitcher.tempVar.twitch.moderator_user_login.ban.description="The user login of the issuer of the ban." @@ -1686,40 +1688,80 @@ AdvSceneSwitcher.tempVar.twitch.ends_at.ban.description="The UTC date and time ( AdvSceneSwitcher.tempVar.twitch.is_permanent.ban="Is permanent ban" AdvSceneSwitcher.tempVar.twitch.is_permanent.ban.description="Indicates whether the ban is permanent (true) or a timeout (false). If true, ends_at will be null." -AdvSceneSwitcher.tempVar.twitch.user_id.unban="Banned user id" +AdvSceneSwitcher.tempVar.twitch.user_id.unban="Banned user ID" AdvSceneSwitcher.tempVar.twitch.user_id.unban.description="The user ID for the user who was unbanned on the specified channel." AdvSceneSwitcher.tempVar.twitch.user_login.unban="Banned login name" AdvSceneSwitcher.tempVar.twitch.user_login.unban.description="The user login for the user who was unbanned on the specified channel." AdvSceneSwitcher.tempVar.twitch.user_name.unban="Banned user name" AdvSceneSwitcher.tempVar.twitch.user_name.unban.description="The user display name for the user who was unbanned on the specified channel." -AdvSceneSwitcher.tempVar.twitch.moderator_user_id.unban="Moderator user id" +AdvSceneSwitcher.tempVar.twitch.moderator_user_id.unban="Moderator user ID" AdvSceneSwitcher.tempVar.twitch.moderator_user_id.unban.description="The user ID of the issuer of the unban." AdvSceneSwitcher.tempVar.twitch.moderator_user_login.unban="Moderator login name" AdvSceneSwitcher.tempVar.twitch.moderator_user_login.unban.description="The user login of the issuer of the unban." AdvSceneSwitcher.tempVar.twitch.moderator_user_name.unban="Moderator user name" AdvSceneSwitcher.tempVar.twitch.moderator_user_name.unban.description="The user name of the issuer of the unban." -AdvSceneSwitcher.tempVar.twitch.user_id.addMod="User id" +AdvSceneSwitcher.tempVar.twitch.user_id.addMod="User ID" AdvSceneSwitcher.tempVar.twitch.user_id.addMod.description="The user ID of the new moderator." AdvSceneSwitcher.tempVar.twitch.user_login.addMod="Login name" AdvSceneSwitcher.tempVar.twitch.user_login.addMod.description="The user login of the new moderator." AdvSceneSwitcher.tempVar.twitch.user_name.addMod="User name" AdvSceneSwitcher.tempVar.twitch.user_name.addMod.description="The display name of the new moderator." -AdvSceneSwitcher.tempVar.twitch.user_id.removeMod="User id" +AdvSceneSwitcher.tempVar.twitch.user_id.removeMod="User ID" AdvSceneSwitcher.tempVar.twitch.user_id.removeMod.description="The user ID of the removed moderator." AdvSceneSwitcher.tempVar.twitch.user_login.removeMod="Login name" AdvSceneSwitcher.tempVar.twitch.user_login.removeMod.description="The user login of the removed moderator." AdvSceneSwitcher.tempVar.twitch.user_name.removeMod="User name" AdvSceneSwitcher.tempVar.twitch.user_name.removeMod.description="The display name of the removed moderator." +AdvSceneSwitcher.tempVar.twitch.id.chatReceive="Chat message ID" +AdvSceneSwitcher.tempVar.twitch.id.chatReceive.description="The ID of the message, formatted as UUID." +AdvSceneSwitcher.tempVar.twitch.chat_message.chatReceive="Chat message body" +AdvSceneSwitcher.tempVar.twitch.user_id.chatReceive="User ID" +AdvSceneSwitcher.tempVar.twitch.user_id.chatReceive.description="The user ID of the person who sent the chat message." AdvSceneSwitcher.tempVar.twitch.user_login.chatReceive="User login" AdvSceneSwitcher.tempVar.twitch.user_login.chatReceive.description="The user login of the person who sent the chat message." AdvSceneSwitcher.tempVar.twitch.user_name.chatReceive="User name" AdvSceneSwitcher.tempVar.twitch.user_name.chatReceive.description="The display name of the person who sent the chat message." -AdvSceneSwitcher.tempVar.twitch.chat_message.chatReceive="Chat message" -AdvSceneSwitcher.tempVar.twitch.badges.chatReceive="Chatter Badges" -AdvSceneSwitcher.tempVar.twitch.badges.chatReceive.description="A string describing the badges available to this user and their state.\nFor example: vip/1,subscriber/42,hype-train/1" +AdvSceneSwitcher.tempVar.twitch.user_type.chatReceive="User type" +AdvSceneSwitcher.tempVar.twitch.user_type.chatReceive.description="The type of the Twitch user - e.g. 'admin' for Twitch administrator, 'global_mod' for global moderator and 'staff' for Twitch staff." +AdvSceneSwitcher.tempVar.twitch.reply_parent_id.chatReceive="Reply parent message ID" +AdvSceneSwitcher.tempVar.twitch.reply_parent_id.chatReceive.description="The ID of the closest parent message, formatted as UUID, if one exists." +AdvSceneSwitcher.tempVar.twitch.reply_parent_message.chatReceive="Reply parent message body" +AdvSceneSwitcher.tempVar.twitch.reply_parent_message.chatReceive.description="The body of the closest parent message, if one exists." +AdvSceneSwitcher.tempVar.twitch.reply_parent_user_id.chatReceive="Reply parent user ID" +AdvSceneSwitcher.tempVar.twitch.reply_parent_user_id.chatReceive.description="The ID of the author of the closest parent message, if one exists." +AdvSceneSwitcher.tempVar.twitch.reply_parent_user_login.chatReceive="Reply parent user login" +AdvSceneSwitcher.tempVar.twitch.reply_parent_user_login.chatReceive.description="The login of the author of the closest parent message, if one exists." +AdvSceneSwitcher.tempVar.twitch.reply_parent_user_name.chatReceive="Reply parent user name" +AdvSceneSwitcher.tempVar.twitch.reply_parent_user_name.chatReceive.description="The display name of the author of the closest parent message, if one exists." +AdvSceneSwitcher.tempVar.twitch.root_parent_id.chatReceive="Root parent message ID" +AdvSceneSwitcher.tempVar.twitch.root_parent_id.chatReceive.description="The ID of the furthest parent message that started a discussion, formatted as UUID, if one exists." +AdvSceneSwitcher.tempVar.twitch.root_parent_user_login.chatReceive="Root parent user login" +AdvSceneSwitcher.tempVar.twitch.root_parent_user_login.chatReceive.description="The login of the author of the furthest parent message, if one exists." +AdvSceneSwitcher.tempVar.twitch.badge_info.chatReceive="Chatter badges' info" +AdvSceneSwitcher.tempVar.twitch.badge_info.chatReceive.description="A string describing the metadata of some of the badges available to this user.\nFor example, this means user has been subscribed for 8 months: subscriber/8" +AdvSceneSwitcher.tempVar.twitch.badges.chatReceive="Chatter badges" +AdvSceneSwitcher.tempVar.twitch.badges.chatReceive.description="A string describing all the badges of the user and their version.\nFor example: vip/1,subscriber/42,hype-train/1" +AdvSceneSwitcher.tempVar.twitch.bits.chatReceive="Chat message bits" +AdvSceneSwitcher.tempVar.twitch.bits.chatReceive.description="Number of bits that the user cheered along with the message." +AdvSceneSwitcher.tempVar.twitch.color.chatReceive="Chatter color" +AdvSceneSwitcher.tempVar.twitch.color.chatReceive.description="Hexadecimal color of user's display name, if they set one, otherwise empty string. Starts with #.\nFor example: #123456" +AdvSceneSwitcher.tempVar.twitch.emotes.chatReceive="Chatter badges" +AdvSceneSwitcher.tempVar.twitch.emotes.chatReceive.description="A string describing all the emotes in the message - the emote ID and comma-separated all positions of emotes with that ID.\nFor example: 25:0-4,12-16/1902:6-10" +AdvSceneSwitcher.tempVar.twitch.timestamp.chatReceive="Chat message timestamp" +AdvSceneSwitcher.tempVar.twitch.timestamp.chatReceive.description="The Unix timestamp representing when the chat message was sent, in milliseconds." +AdvSceneSwitcher.tempVar.twitch.is_first_message.chatReceive="Is chatter's first message" +AdvSceneSwitcher.tempVar.twitch.is_first_message.chatReceive.description="'true' if the chatter has never sent messages in the channel before, 'false' otherwise." +AdvSceneSwitcher.tempVar.twitch.is_mod.chatReceive="Is chatter a moderator" +AdvSceneSwitcher.tempVar.twitch.is_mod.chatReceive.description="'true' if the chatter is a moderator of the channel, 'false' otherwise." +AdvSceneSwitcher.tempVar.twitch.is_subscriber.chatReceive="Is chatter a subscriber" +AdvSceneSwitcher.tempVar.twitch.is_subscriber.chatReceive.description="'true' if the chatter is a subscriber of the channel, 'false' otherwise." +AdvSceneSwitcher.tempVar.twitch.is_turbo.chatReceive="Is chatter a Turbo user" +AdvSceneSwitcher.tempVar.twitch.is_turbo.chatReceive.description="'true' if the chatter is a Twitch Turbo user, 'false' otherwise." +AdvSceneSwitcher.tempVar.twitch.is_vip.chatReceive="Is chatter a VIP" +AdvSceneSwitcher.tempVar.twitch.is_vip.chatReceive.description="'true' if the chatter is a VIP in the channel, 'false' otherwise." AdvSceneSwitcher.tempVar.twitch.from_broadcaster_user_id.raid="Raid creator user ID" AdvSceneSwitcher.tempVar.twitch.from_broadcaster_user_id.raid.description="The broadcaster ID that created the raid." diff --git a/plugins/twitch/chat-connection.cpp b/plugins/twitch/chat-connection.cpp index 978a047d..f2149484 100644 --- a/plugins/twitch/chat-connection.cpp +++ b/plugins/twitch/chat-connection.cpp @@ -77,21 +77,53 @@ static void parseTags(const std::string &tags, IRCMessage &message) continue; } - if (tagName == "badges" || tagName == "badge-info") { + if (tagName == "badge-info") { + message.properties.badgeInfoString = tagValue; + } else if (tagName == "badges") { message.properties.badges = parseBadgeTag(tagValue); message.properties.badgesString = tagValue; + } else if (tagName == "bits") { + message.properties.bits = std::stoi(tagValue); + } else if (tagName == "color") { + message.properties.color = tagValue; } else if (tagName == "display-name") { message.properties.displayName = tagValue; - } else if (tagName == "first-msg") { - message.properties.isFirstMessage = tagValue == "1"; } else if (tagName == "emote-only") { message.properties.isUsingOnlyEmotes = tagValue == "1"; + } else if (tagName == "emotes") { + message.properties.emotesString = tagValue; + } else if (tagName == "first-msg") { + message.properties.isFirstMessage = tagValue == "1"; + } else if (tagName == "id") { + message.properties.id = tagValue; } else if (tagName == "mod") { message.properties.isMod = tagValue == "1"; + } else if (tagName == "reply-parent-msg-body") { + message.properties.replyParentBody = tagValue; + } else if (tagName == "reply-parent-display-name") { + message.properties.replyParentDisplayName = tagValue; + } else if (tagName == "reply-parent-msg-id") { + message.properties.replyParentId = tagValue; + } else if (tagName == "reply-parent-user-id") { + message.properties.replyParentUserId = tagValue; + } else if (tagName == "reply-parent-user-login") { + message.properties.replyParentUserLogin = tagValue; + } else if (tagName == "reply-thread-parent-msg-id") { + message.properties.rootParentId = tagValue; + } else if (tagName == "reply-thread-parent-user-login") { + message.properties.rootParentUserLogin = tagValue; } else if (tagName == "subscriber") { message.properties.isSubscriber = tagValue == "1"; + } else if (tagName == "tmi-sent-ts") { + message.properties.timestamp = std::stoull(tagValue); } else if (tagName == "turbo") { message.properties.isTurbo = tagValue == "1"; + } else if (tagName == "user-id") { + message.properties.userId = tagValue; + } else if (tagName == "user-type") { + message.properties.userType = tagValue; + } else if (tagName == "vip") { + message.properties.isVIP = tagValue == "1"; } } } diff --git a/plugins/twitch/chat-connection.hpp b/plugins/twitch/chat-connection.hpp index 3a34c0d3..6e2e0f8a 100644 --- a/plugins/twitch/chat-connection.hpp +++ b/plugins/twitch/chat-connection.hpp @@ -20,24 +20,43 @@ struct IRCMessage { bool enabled; }; struct { + std::string badgeInfoString; std::string badgesString; std::vector badges; + int bits = 0; + std::string color; std::string displayName; - bool isFirstMessage = false; bool isUsingOnlyEmotes = false; + std::string emotesString; + bool isFirstMessage = false; + std::string id; bool isMod = false; + std::string replyParentBody; + std::string replyParentDisplayName; + std::string replyParentId; + std::string replyParentUserId; + std::string replyParentUserLogin; + std::string rootParentId; + std::string rootParentUserLogin; bool isSubscriber = false; + unsigned long long timestamp; bool isTurbo = false; + std::string userId; + std::string userType; + bool isVIP = false; } properties; + struct { std::string nick; std::string host; } source; + struct { std::string command; std::variant> parameters; } command; + std::string message; }; diff --git a/plugins/twitch/chat-message-pattern.cpp b/plugins/twitch/chat-message-pattern.cpp index 1c446079..44ef388a 100644 --- a/plugins/twitch/chat-message-pattern.cpp +++ b/plugins/twitch/chat-message-pattern.cpp @@ -41,6 +41,22 @@ const std::vector ChatMessageProperty::_suppo return message.properties.isTurbo == std::get(property._value); }}, + {"vip", "AdvSceneSwitcher.condition.twitch.type.chat.properties.vip", + true, + [](const IRCMessage &message, const ChatMessageProperty &property) { + return message.properties.isVIP == + std::get(property._value); + }}, + {"color", + "AdvSceneSwitcher.condition.twitch.type.chat.properties.color", + std::string(), + [](const IRCMessage &message, const ChatMessageProperty &property) { + auto value = std::get(property._value); + return !property._regex.Enabled() + ? message.properties.color == std::string(value) + : property._regex.Matches( + message.properties.color, value); + }}, {"displayName", "AdvSceneSwitcher.condition.twitch.type.chat.properties.displayName", std::string(), diff --git a/plugins/twitch/macro-condition-twitch.cpp b/plugins/twitch/macro-condition-twitch.cpp index 861c0fd9..b391139c 100644 --- a/plugins/twitch/macro-condition-twitch.cpp +++ b/plugins/twitch/macro-condition-twitch.cpp @@ -389,10 +389,47 @@ bool MacroConditionTwitch::CheckChatMessages(TwitchToken &token) continue; } + SetTempVarValue("id", message->properties.id); + SetTempVarValue("chat_message", message->message); + SetTempVarValue("user_id", message->properties.userId); SetTempVarValue("user_login", message->source.nick); SetTempVarValue("user_name", message->properties.displayName); - SetTempVarValue("chat_message", message->message); + SetTempVarValue("user_type", message->properties.userType); + SetTempVarValue("reply_parent_id", + message->properties.replyParentId); + SetTempVarValue("reply_parent_message", + message->properties.replyParentBody); + SetTempVarValue("reply_parent_user_id", + message->properties.replyParentUserId); + SetTempVarValue("reply_parent_user_login", + message->properties.replyParentUserLogin); + SetTempVarValue("reply_parent_user_name", + message->properties.replyParentDisplayName); + SetTempVarValue("root_parent_id", + message->properties.rootParentId); + SetTempVarValue("root_parent_user_login", + message->properties.rootParentUserLogin); + SetTempVarValue("badge_info", + message->properties.badgeInfoString); SetTempVarValue("badges", message->properties.badgesString); + SetTempVarValue("bits", + std::to_string(message->properties.bits)); + SetTempVarValue("color", message->properties.color); + SetTempVarValue("emotes", message->properties.emotesString); + SetTempVarValue("timestamp", + std::to_string(message->properties.timestamp)); + SetTempVarValue("is_first_message", + message->properties.isFirstMessage ? "true" + : "false"); + SetTempVarValue("is_mod", + message->properties.isMod ? "true" : "false"); + SetTempVarValue("is_subscriber", + message->properties.isSubscriber ? "true" + : "false"); + SetTempVarValue("is_turbo", + message->properties.isTurbo ? "true" : "false"); + SetTempVarValue("is_vip", + message->properties.isVIP ? "true" : "false"); if (_clearBufferOnMatch) { _eventBuffer->Clear(); @@ -1236,10 +1273,30 @@ void MacroConditionTwitch::SetupTempVars() setupTempVarHelper("is_branded_content"); break; case Condition::CHAT_MESSAGE_RECEIVED: + setupTempVarHelper("id", ".chatReceive"); setupTempVarHelper("chat_message", ".chatReceive"); + setupTempVarHelper("user_id", ".chatReceive"); setupTempVarHelper("user_login", ".chatReceive"); setupTempVarHelper("user_name", ".chatReceive"); + setupTempVarHelper("user_type", ".chatReceive"); + setupTempVarHelper("reply_parent_id", ".chatReceive"); + setupTempVarHelper("reply_parent_message", ".chatReceive"); + setupTempVarHelper("reply_parent_user_id", ".chatReceive"); + setupTempVarHelper("reply_parent_user_login", ".chatReceive"); + setupTempVarHelper("reply_parent_user_name", ".chatReceive"); + setupTempVarHelper("root_parent_id", ".chatReceive"); + setupTempVarHelper("root_parent_user_login", ".chatReceive"); + setupTempVarHelper("badge_info", ".chatReceive"); setupTempVarHelper("badges", ".chatReceive"); + setupTempVarHelper("bits", ".chatReceive"); + setupTempVarHelper("color", ".chatReceive"); + setupTempVarHelper("emotes", ".chatReceive"); + setupTempVarHelper("timestamp", ".chatReceive"); + setupTempVarHelper("is_first_message", ".chatReceive"); + setupTempVarHelper("is_mod", ".chatReceive"); + setupTempVarHelper("is_subscriber", ".chatReceive"); + setupTempVarHelper("is_turbo", ".chatReceive"); + setupTempVarHelper("is_vip", ".chatReceive"); break; default: break;