diff --git a/horizontal-chat/script.js b/horizontal-chat/script.js index 62643ae..5c71c63 100644 --- a/horizontal-chat/script.js +++ b/horizontal-chat/script.js @@ -62,6 +62,7 @@ const showKickGifts = GetBooleanParam("showKickGifts", true); const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true); const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true); const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true); +const showYouTubeJewelsGifted = GetBooleanParam("showYouTubeJewelsGifted", true); const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false); const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true); @@ -236,6 +237,11 @@ client.on('YouTube.SuperSticker', (response) => { YouTubeSuperSticker(response.data); }) +client.on('YouTube.JewelsGifted', (response) => { + console.debug(response.data); + YouTubeJewelsGifted(response.data); +}) + client.on('YouTube.NewSubscriber', (response) => { console.debug(response.data); YouTubeNewSubscriber(response.data); @@ -1049,6 +1055,15 @@ function YouTubeSuperSticker(data) { ShowAlert(message, 'youtube'); } +function YouTubeJewelsGifted(data) { + if (!showYouTubeJewelsGifted) + return; + + let message = `${data.user.name} gifted ${data.jewelsAmount} Jewels`; + + ShowAlert(message, 'youtube'); +} + function YouTubeNewSubscriber(data) { if (!showYouTubeSubscribers) return; diff --git a/horizontal-chat/settings/settings.json b/horizontal-chat/settings/settings.json index ee7fe66..fe23d26 100644 --- a/horizontal-chat/settings/settings.json +++ b/horizontal-chat/settings/settings.json @@ -250,6 +250,14 @@ "defaultValue": true, "group": "Which YouTube messages do you want to see?" }, + { + "id": "showYouTubeJewelsGifted", + "label": "Jewels Gifted", + "description": "", + "type": "checkbox", + "defaultValue": true, + "group": "Which YouTube messages do you want to see?" + }, { "id": "showYouTubeSubscribers", "label": "New Subscribers", diff --git a/multichat-overlay/script.js b/multichat-overlay/script.js index 7537628..f1c905d 100644 --- a/multichat-overlay/script.js +++ b/multichat-overlay/script.js @@ -68,6 +68,7 @@ const showKickGifts = GetBooleanParam("showKickGifts", true); const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true); const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true); const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true); +const showYouTubeJewelsGifted = GetBooleanParam("showYouTubeJewelsGifted", true); const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false); const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true); @@ -272,6 +273,11 @@ client.on('YouTube.SuperSticker', (response) => { YouTubeSuperSticker(response.data); }) +client.on('YouTube.JewelsGifted', (response) => { + console.debug(response.data); + YouTubeJewelsGifted(response.data); +}) + client.on('YouTube.NewSubscriber', (response) => { console.debug(response.data); YouTubeNewSubscriber(response.data); @@ -1668,6 +1674,41 @@ function YouTubeSuperSticker(data) { AddMessageItem(instance); } +function YouTubeJewelsGifted(data) { + if (!showYouTubeJewelsGifted) + return; + + // Get a reference to the template + const template = document.getElementById('cardTemplate'); + + // Create a new instance of the template + const instance = template.content.cloneNode(true); + + // Get divs + const cardDiv = instance.querySelector("#card"); + const headerDiv = instance.querySelector("#header"); + const avatarDiv = instance.querySelector("#avatar"); + const iconDiv = instance.querySelector("#icon"); + const titleDiv = instance.querySelector("#title"); + const contentDiv = instance.querySelector("#content"); + + // Set the card background colors + cardDiv.classList.add('youtube'); + + avatarDiv.style.width = 'auto'; + + // Set the text + const user = data.user.name; + const amount = data.jewelsAmount; + const jewelURL = data.url; + const jewelImage = ``; + + avatarDiv.innerHTML = jewelImage; + titleDiv.innerHTML = `${user} gifted ${amount} Jewels`; + + AddMessageItem(instance); +} + function YouTubeNewSubscriber(data) { if (!showYouTubeSubscribers) return; @@ -1694,7 +1735,7 @@ function YouTubeNewSubscriber(data) { titleDiv.innerText = `${username} subscribed`; - AddMessageItem(instance, JSON.stringify(data)); + AddMessageItem(instance); } function YouTubeNewSponsor(data) { diff --git a/multichat-overlay/settings/settings.json b/multichat-overlay/settings/settings.json index aeb1699..b738e4b 100644 --- a/multichat-overlay/settings/settings.json +++ b/multichat-overlay/settings/settings.json @@ -379,6 +379,14 @@ "defaultValue": true, "group": "Which YouTube messages do you want to see?" }, + { + "id": "showYouTubeJewelsGifted", + "label": "Jewels Gifted", + "description": "", + "type": "checkbox", + "defaultValue": true, + "group": "Which YouTube messages do you want to see?" + }, { "id": "showYouTubeSubscribers", "label": "New Subscribers", diff --git a/multistream-alerts/script.js b/multistream-alerts/script.js index a3c5e8a..02b31ba 100644 --- a/multistream-alerts/script.js +++ b/multistream-alerts/script.js @@ -89,6 +89,8 @@ const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true); const youtubeSuperChatAction = urlParams.get("youtubeSuperChatAction") || ""; const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true); const youtubeSuperStickerAction = urlParams.get("youtubeSuperStickerAction") || ""; +const showYouTubeJewelsGifted = GetBooleanParam("showYouTubeJewelsGifted", true); +const youtubeJewelsGiftedAction = urlParams.get("youtubeJewelsGiftedAction") || ""; const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false); const youtubeSubscriberAction = urlParams.get("youtubeSubscriberAction") || ""; const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true); @@ -249,6 +251,11 @@ client.on('YouTube.SuperSticker', (response) => { YouTubeSuperSticker(response.data); }) +client.on('YouTube.JewelsGifted', (response) => { + console.debug(response.data); + YouTubeJewelsGifted(response.data); +}) + client.on('YouTube.NewSubscriber', (response) => { console.debug(response.data); YouTubeNewSubscriber(response.data); @@ -834,6 +841,23 @@ function YouTubeSuperSticker(data) { ); } +function YouTubeJewelsGifted(data) { + if (!showYouTubeJewelsGifted) + return; + + UpdateAlertBox( + 'youtube', + data.url, + `${data.user.name}`, + `gifted ${data.jewelsAmount} Jewels`, + '', + data.user.name, + '', + youtubeJewelsGiftedAction, + data + ); +} + function YouTubeNewSubscriber(data) { if (!showYouTubeSubscribers) return; diff --git a/multistream-alerts/settings/settings.json b/multistream-alerts/settings/settings.json index b5346b2..a4cff71 100644 --- a/multistream-alerts/settings/settings.json +++ b/multistream-alerts/settings/settings.json @@ -380,6 +380,23 @@ "showIf": "showYouTubeSuperStickers", "group": "Which YouTube alerts do you want to see?" }, + { + "id": "showYouTubeJewelsGifted", + "label": "Jewels Gifted", + "description": "", + "type": "checkbox", + "defaultValue": true, + "group": "Which YouTube alerts do you want to see?" + }, + { + "id": "youtubeJewelsGiftedAction", + "label": "", + "description": "Also run this Streamer.bot Action", + "type": "sb-actions", + "defaultValue": "", + "showIf": "showYouTubeJewelsGifted", + "group": "Which YouTube alerts do you want to see?" + }, { "id": "showYouTubeSubscribers", "label": "New Subscribers",