diff --git a/multistream-alerts/script.js b/multistream-alerts/script.js index b365c87..1a5ad8e 100644 --- a/multistream-alerts/script.js +++ b/multistream-alerts/script.js @@ -44,7 +44,8 @@ const hideAfter = GetIntParam("hideAfter", 8); const showAnimation = urlParams.get("showAnimation") || ""; const hideAnimation = urlParams.get("hideAnimation") || ""; const playSounds = GetBooleanParam("playSounds", true); -const globalAction = urlParams.get("globalAction") || ""; +const globalShowAction = urlParams.get("globalShowAction") || ""; +const globalHideAction = urlParams.get("globalHideAction") || ""; const showMesesages = GetBooleanParam("showMesesages", true); // Which Twitch alerts do you want to see? @@ -1236,9 +1237,9 @@ function UpdateAlertBox(platform, avatarURL, headerText, descriptionText, attrib } // Run the Streamer.bot action if there is one - if (globalAction) { - console.debug('Running Streamer.bot action: ' + globalAction); - client.doAction({name: globalAction}, sbData); + if (globalShowAction) { + console.debug('Running Streamer.bot action: ' + globalShowAction); + client.doAction({name: globalShowAction}, sbData); } // Run the Streamer.bot action if there is one @@ -1263,6 +1264,12 @@ function UpdateAlertBox(platform, avatarURL, headerText, descriptionText, attrib theContentThatShowsLastInsteadOfFirst.style.opacity = 1; setTimeout(() => { + // Run the Streamer.bot action if there is one + if (globalHideAction) { + console.debug('Running Streamer.bot action: ' + globalHideAction); + client.doAction({name: globalHideAction}, sbData); + } + alertBox.style.animation = `${hideAnimation} 0.5s ease-out forwards`; setTimeout(() => { @@ -1278,7 +1285,13 @@ function UpdateAlertBox(platform, avatarURL, headerText, descriptionText, attrib } }, 1000); }, hideAfter * 1000); - } else { + } else { + // Run the Streamer.bot action if there is one + if (globalHideAction) { + console.debug('Running Streamer.bot action: ' + globalHideAction); + client.doAction({name: globalHideAction}, sbData); + } + alertBox.style.animation = `${hideAnimation} 0.5s ease-out forwards`; setTimeout(() => { diff --git a/multistream-alerts/settings/settings.json b/multistream-alerts/settings/settings.json index affb182..a0e3f14 100644 --- a/multistream-alerts/settings/settings.json +++ b/multistream-alerts/settings/settings.json @@ -204,9 +204,17 @@ "group": "General" }, { - "id": "globalAction", - "label": "Streamer.bot Action", - "description": "Run this Streamer.bot Action on every alert", + "id": "globalShowAction", + "label": "Show Action", + "description": "Run this Streamer.bot Action at the start of every alert", + "type": "sb-actions", + "defaultValue": "", + "group": "General" + }, + { + "id": "globalHideAction", + "label": "Hide Action", + "description": "Run this Streamer.bot Action at the end of every alert", "type": "sb-actions", "defaultValue": "", "group": "General"