mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-18 19:50:58 -04:00
Added YouTube Jewels Gifted events
This commit is contained in:
@@ -62,6 +62,7 @@ const showKickGifts = GetBooleanParam("showKickGifts", true);
|
|||||||
const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true);
|
const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true);
|
||||||
const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true);
|
const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true);
|
||||||
const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true);
|
const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true);
|
||||||
|
const showYouTubeJewelsGifted = GetBooleanParam("showYouTubeJewelsGifted", true);
|
||||||
const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
||||||
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
||||||
|
|
||||||
@@ -236,6 +237,11 @@ client.on('YouTube.SuperSticker', (response) => {
|
|||||||
YouTubeSuperSticker(response.data);
|
YouTubeSuperSticker(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('YouTube.JewelsGifted', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
YouTubeJewelsGifted(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
client.on('YouTube.NewSubscriber', (response) => {
|
client.on('YouTube.NewSubscriber', (response) => {
|
||||||
console.debug(response.data);
|
console.debug(response.data);
|
||||||
YouTubeNewSubscriber(response.data);
|
YouTubeNewSubscriber(response.data);
|
||||||
@@ -1049,6 +1055,15 @@ function YouTubeSuperSticker(data) {
|
|||||||
ShowAlert(message, 'youtube');
|
ShowAlert(message, 'youtube');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function YouTubeJewelsGifted(data) {
|
||||||
|
if (!showYouTubeJewelsGifted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
let message = `${data.user.name} gifted ${data.jewelsAmount} Jewels`;
|
||||||
|
|
||||||
|
ShowAlert(message, 'youtube');
|
||||||
|
}
|
||||||
|
|
||||||
function YouTubeNewSubscriber(data) {
|
function YouTubeNewSubscriber(data) {
|
||||||
if (!showYouTubeSubscribers)
|
if (!showYouTubeSubscribers)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -250,6 +250,14 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "Which YouTube messages do you want to see?"
|
"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",
|
"id": "showYouTubeSubscribers",
|
||||||
"label": "New Subscribers",
|
"label": "New Subscribers",
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ const showKickGifts = GetBooleanParam("showKickGifts", true);
|
|||||||
const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true);
|
const showYouTubeMessages = GetBooleanParam("showYouTubeMessages", true);
|
||||||
const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true);
|
const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true);
|
||||||
const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true);
|
const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true);
|
||||||
|
const showYouTubeJewelsGifted = GetBooleanParam("showYouTubeJewelsGifted", true);
|
||||||
const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
||||||
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
||||||
|
|
||||||
@@ -272,6 +273,11 @@ client.on('YouTube.SuperSticker', (response) => {
|
|||||||
YouTubeSuperSticker(response.data);
|
YouTubeSuperSticker(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('YouTube.JewelsGifted', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
YouTubeJewelsGifted(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
client.on('YouTube.NewSubscriber', (response) => {
|
client.on('YouTube.NewSubscriber', (response) => {
|
||||||
console.debug(response.data);
|
console.debug(response.data);
|
||||||
YouTubeNewSubscriber(response.data);
|
YouTubeNewSubscriber(response.data);
|
||||||
@@ -1668,6 +1674,41 @@ function YouTubeSuperSticker(data) {
|
|||||||
AddMessageItem(instance);
|
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 = `<img src="${jewelURL}" class="youtube-super-sticker"/>`;
|
||||||
|
|
||||||
|
avatarDiv.innerHTML = jewelImage;
|
||||||
|
titleDiv.innerHTML = `${user} gifted ${amount} Jewels`;
|
||||||
|
|
||||||
|
AddMessageItem(instance);
|
||||||
|
}
|
||||||
|
|
||||||
function YouTubeNewSubscriber(data) {
|
function YouTubeNewSubscriber(data) {
|
||||||
if (!showYouTubeSubscribers)
|
if (!showYouTubeSubscribers)
|
||||||
return;
|
return;
|
||||||
@@ -1694,7 +1735,7 @@ function YouTubeNewSubscriber(data) {
|
|||||||
|
|
||||||
titleDiv.innerText = `${username} subscribed`;
|
titleDiv.innerText = `${username} subscribed`;
|
||||||
|
|
||||||
AddMessageItem(instance, JSON.stringify(data));
|
AddMessageItem(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
function YouTubeNewSponsor(data) {
|
function YouTubeNewSponsor(data) {
|
||||||
|
|||||||
@@ -379,6 +379,14 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "Which YouTube messages do you want to see?"
|
"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",
|
"id": "showYouTubeSubscribers",
|
||||||
"label": "New Subscribers",
|
"label": "New Subscribers",
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ const showYouTubeSuperChats = GetBooleanParam("showYouTubeSuperChats", true);
|
|||||||
const youtubeSuperChatAction = urlParams.get("youtubeSuperChatAction") || "";
|
const youtubeSuperChatAction = urlParams.get("youtubeSuperChatAction") || "";
|
||||||
const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true);
|
const showYouTubeSuperStickers = GetBooleanParam("showYouTubeSuperStickers", true);
|
||||||
const youtubeSuperStickerAction = urlParams.get("youtubeSuperStickerAction") || "";
|
const youtubeSuperStickerAction = urlParams.get("youtubeSuperStickerAction") || "";
|
||||||
|
const showYouTubeJewelsGifted = GetBooleanParam("showYouTubeJewelsGifted", true);
|
||||||
|
const youtubeJewelsGiftedAction = urlParams.get("youtubeJewelsGiftedAction") || "";
|
||||||
const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
const showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
||||||
const youtubeSubscriberAction = urlParams.get("youtubeSubscriberAction") || "";
|
const youtubeSubscriberAction = urlParams.get("youtubeSubscriberAction") || "";
|
||||||
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
||||||
@@ -249,6 +251,11 @@ client.on('YouTube.SuperSticker', (response) => {
|
|||||||
YouTubeSuperSticker(response.data);
|
YouTubeSuperSticker(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('YouTube.JewelsGifted', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
YouTubeJewelsGifted(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
client.on('YouTube.NewSubscriber', (response) => {
|
client.on('YouTube.NewSubscriber', (response) => {
|
||||||
console.debug(response.data);
|
console.debug(response.data);
|
||||||
YouTubeNewSubscriber(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) {
|
function YouTubeNewSubscriber(data) {
|
||||||
if (!showYouTubeSubscribers)
|
if (!showYouTubeSubscribers)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -380,6 +380,23 @@
|
|||||||
"showIf": "showYouTubeSuperStickers",
|
"showIf": "showYouTubeSuperStickers",
|
||||||
"group": "Which YouTube alerts do you want to see?"
|
"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",
|
"id": "showYouTubeSubscribers",
|
||||||
"label": "New Subscribers",
|
"label": "New Subscribers",
|
||||||
|
|||||||
Reference in New Issue
Block a user