diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 7d4d7c7e..41b19da1 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -702,6 +702,7 @@ AdvSceneSwitcher.condition.twitch.type.event.channel.raid.outbound="Raided someo AdvSceneSwitcher.condition.twitch.type.event.channel.raid.inbound="Raid to your channel occured" AdvSceneSwitcher.condition.twitch.type.event.channel.shoutout.outbound="Shoutout to someone's channel given" AdvSceneSwitcher.condition.twitch.type.event.channel.shoutout.inbound="Shoutout to your channel received" +AdvSceneSwitcher.condition.twitch.type.event.channel.commercial.start="Commercial break started" AdvSceneSwitcher.condition.twitch.type.event.channel.poll.start="Poll started" AdvSceneSwitcher.condition.twitch.type.event.channel.poll.progress="Poll votes changed (progress)" AdvSceneSwitcher.condition.twitch.type.event.channel.poll.end="Poll ended" @@ -1491,6 +1492,7 @@ AdvSceneSwitcher.twitchToken.bits.read="Read channel's Bits information." AdvSceneSwitcher.twitchToken.channel.raids.manage="Manage channel's raids." AdvSceneSwitcher.twitchToken.moderator.shoutouts.read="Read channel's shoutouts." AdvSceneSwitcher.twitchToken.moderator.shoutouts.manage="Manage channel's shoutouts." +AdvSceneSwitcher.twitchToken.channel.ads.read="Read the ads schedule and details on your channel." AdvSceneSwitcher.twitchToken.channel.polls.read="Read channel's polls' state." AdvSceneSwitcher.twitchToken.channel.polls.manage="Manage channel's polls." AdvSceneSwitcher.twitchToken.channel.predictions.read="Read channel's predictions' state." @@ -2006,6 +2008,18 @@ AdvSceneSwitcher.tempVar.twitch.offline_image_url.user.getInfo="Offline image UR AdvSceneSwitcher.tempVar.twitch.created_at.user.getInfo="Account creation date" AdvSceneSwitcher.tempVar.twitch.created_at.user.getInfo.description="The UTC date and time that the user's account was created. The timestamp is in RFC3339 format." +AdvSceneSwitcher.tempVar.twitch.duration_seconds.commercial="Duration" +AdvSceneSwitcher.tempVar.twitch.duration_seconds.commercial.description="Length in seconds of the mid-roll ad break requested." +AdvSceneSwitcher.tempVar.twitch.started_at.commercial="Started at" +AdvSceneSwitcher.tempVar.twitch.started_at.commercial.description="The UTC timestamp of when the ad break began, in RFC3339 format. Note that there is potential delay between this event, when the streamer requested the ad break, and when the viewers will see ads." +AdvSceneSwitcher.tempVar.twitch.is_automatic.commercial="Was automatic" +AdvSceneSwitcher.tempVar.twitch.is_automatic.commercial.description="Indicates if the ad was automatically scheduled via Ads Manager" +AdvSceneSwitcher.tempVar.twitch.requester_user_id.commercial="Requester user ID" +AdvSceneSwitcher.tempVar.twitch.requester_user_id.commercial.description="The ID of the user that requested the ad. For automatic ads, this will be the ID of the broadcaster." +AdvSceneSwitcher.tempVar.twitch.requester_user_login.commercial="Requester user login" +AdvSceneSwitcher.tempVar.twitch.requester_user_login.commercial.description="The login of the user that requested the ad." +AdvSceneSwitcher.tempVar.twitch.requester_user_name.commercial="Requester user name" +AdvSceneSwitcher.tempVar.twitch.requester_user_name.commercial.description="The display name of the user that requested the ad." AdvSceneSwitcher.tempVar.audio.output_volume="Output volume" AdvSceneSwitcher.tempVar.audio.output_volume.description="The volume the audio source is outputting." diff --git a/plugins/twitch/macro-condition-twitch.cpp b/plugins/twitch/macro-condition-twitch.cpp index 5827afa4..13df1d8d 100644 --- a/plugins/twitch/macro-condition-twitch.cpp +++ b/plugins/twitch/macro-condition-twitch.cpp @@ -113,6 +113,8 @@ const static std::map conditionTyp "AdvSceneSwitcher.condition.twitch.type.event.channel.stream.online.premiere"}, {MacroConditionTwitch::Condition::STREAM_ONLINE_RERUN_EVENT, "AdvSceneSwitcher.condition.twitch.type.event.channel.stream.online.rerun"}, + {MacroConditionTwitch::Condition::COMMERCIAL_START, + "AdvSceneSwitcher.condition.twitch.type.event.channel.commercial.start"}, {MacroConditionTwitch::Condition::LIVE_POLLING, "AdvSceneSwitcher.condition.twitch.type.polling.channel.live"}, {MacroConditionTwitch::Condition::TITLE_POLLING, @@ -153,6 +155,8 @@ const static std::map eventIdentif "channel.shoutout.create"}, {MacroConditionTwitch::Condition::SHOUTOUT_INBOUND_EVENT, "channel.shoutout.receive"}, + {MacroConditionTwitch::Condition::COMMERCIAL_START, + "channel.ad_break.begin"}, {MacroConditionTwitch::Condition::POLL_START_EVENT, "channel.poll.begin"}, {MacroConditionTwitch::Condition::POLL_PROGRESS_EVENT, @@ -689,6 +693,7 @@ bool MacroConditionTwitch::CheckCondition() case Condition::RAID_INBOUND_EVENT: case Condition::SHOUTOUT_OUTBOUND_EVENT: case Condition::SHOUTOUT_INBOUND_EVENT: + case Condition::COMMERCIAL_START: case Condition::POLL_START_EVENT: case Condition::POLL_PROGRESS_EVENT: case Condition::POLL_END_EVENT: @@ -857,6 +862,7 @@ bool MacroConditionTwitch::ConditionIsSupportedByToken() {Condition::SHOUTOUT_INBOUND_EVENT, {{"moderator:read:shoutouts"}, {"moderator:manage:shoutouts"}}}, + {Condition::COMMERCIAL_START, {{"channel:read:ads"}}}, {Condition::POLL_START_EVENT, {{"channel:read:polls"}, {"channel:manage:polls"}}}, {Condition::POLL_PROGRESS_EVENT, @@ -970,6 +976,7 @@ void MacroConditionTwitch::RegisterEventSubscription() case Condition::SUBSCRIPTION_GIFT_EVENT: case Condition::SUBSCRIPTION_MESSAGE_EVENT: case Condition::CHEER_EVENT: + case Condition::COMMERCIAL_START: case Condition::POLL_START_EVENT: case Condition::POLL_PROGRESS_EVENT: case Condition::POLL_END_EVENT: @@ -1197,6 +1204,14 @@ void MacroConditionTwitch::SetupTempVars() setupTempVarHelper("message", ".cheer"); setupTempVarHelper("bits"); break; + case Condition::COMMERCIAL_START: + setupTempVarHelper("duration_seconds", ".commercial"); + setupTempVarHelper("started_at", ".commercial"); + setupTempVarHelper("is_automatic", ".commercial"); + setupTempVarHelper("requester_user_id", ".commercial"); + setupTempVarHelper("requester_user_login", ".commercial"); + setupTempVarHelper("requester_user_name", ".commercial"); + break; case Condition::POLL_START_EVENT: case Condition::POLL_PROGRESS_EVENT: setupTempVarHelper("id", ".poll"); diff --git a/plugins/twitch/macro-condition-twitch.hpp b/plugins/twitch/macro-condition-twitch.hpp index 85f6abc9..519b1d89 100644 --- a/plugins/twitch/macro-condition-twitch.hpp +++ b/plugins/twitch/macro-condition-twitch.hpp @@ -43,6 +43,7 @@ public: RAID_INBOUND_EVENT = 1000, SHOUTOUT_OUTBOUND_EVENT = 1100, SHOUTOUT_INBOUND_EVENT = 1200, + COMMERCIAL_START = 1250, POLL_START_EVENT = 1300, POLL_PROGRESS_EVENT = 1400, POLL_END_EVENT = 1500, diff --git a/plugins/twitch/token.cpp b/plugins/twitch/token.cpp index 2f020b07..1af3c386 100644 --- a/plugins/twitch/token.cpp +++ b/plugins/twitch/token.cpp @@ -31,6 +31,7 @@ const std::unordered_map TokenOption::_apiIdToLocale{ "AdvSceneSwitcher.twitchToken.channel.raids.manage"}, {"moderator:manage:shoutouts", "AdvSceneSwitcher.twitchToken.moderator.shoutouts.manage"}, + {"channel:read:ads", "AdvSceneSwitcher.twitchToken.channel.ads.read"}, {"channel:read:polls", "AdvSceneSwitcher.twitchToken.channel.polls.read"}, {"channel:manage:polls",