Add support for commercial start event

This commit is contained in:
WarmUpTill
2025-08-12 22:27:46 +02:00
committed by WarmUpTill
parent 058e941a46
commit 2ea00d94c5
4 changed files with 31 additions and 0 deletions

View File

@@ -113,6 +113,8 @@ const static std::map<MacroConditionTwitch::Condition, std::string> 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<MacroConditionTwitch::Condition, std::string> 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");

View File

@@ -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,

View File

@@ -31,6 +31,7 @@ const std::unordered_map<std::string, std::string> 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",