mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-18 19:50:58 -04:00
Added support for YouTube Subscriber events
This commit is contained in:
@@ -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 showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
||||
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
||||
|
||||
const enableTikTokSupport = GetBooleanParam("enableTikTokSupport", false);
|
||||
@@ -235,6 +236,11 @@ client.on('YouTube.SuperSticker', (response) => {
|
||||
YouTubeSuperSticker(response.data);
|
||||
})
|
||||
|
||||
client.on('YouTube.NewSubscriber', (response) => {
|
||||
console.debug(response.data);
|
||||
YouTubeNewSubscriber(response.data);
|
||||
})
|
||||
|
||||
client.on('YouTube.NewSponsor', (response) => {
|
||||
console.debug(response.data);
|
||||
YouTubeNewSponsor(response.data);
|
||||
@@ -1043,6 +1049,18 @@ function YouTubeSuperSticker(data) {
|
||||
ShowAlert(message, 'youtube');
|
||||
}
|
||||
|
||||
function YouTubeNewSubscriber(data) {
|
||||
if (!showYouTubeSubscribers)
|
||||
return;
|
||||
|
||||
// Set the text
|
||||
let username = data.user.name;
|
||||
|
||||
const message = `${username} subscribed`;
|
||||
|
||||
ShowAlert(message, 'youtube');
|
||||
}
|
||||
|
||||
function YouTubeNewSponsor(data) {
|
||||
if (!showYouTubeMemberships)
|
||||
return;
|
||||
|
||||
@@ -250,6 +250,14 @@
|
||||
"defaultValue": true,
|
||||
"group": "Which YouTube messages do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "showYouTubeSubscribers",
|
||||
"label": "New Subscribers",
|
||||
"description": "",
|
||||
"type": "checkbox",
|
||||
"defaultValue": false,
|
||||
"group": "Which YouTube messages do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "showYouTubeMemberships",
|
||||
"label": "Memberships",
|
||||
|
||||
@@ -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 showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
||||
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
||||
|
||||
const enableTikTokSupport = GetBooleanParam("enableTikTokSupport", false);
|
||||
@@ -271,6 +272,11 @@ client.on('YouTube.SuperSticker', (response) => {
|
||||
YouTubeSuperSticker(response.data);
|
||||
})
|
||||
|
||||
client.on('YouTube.NewSubscriber', (response) => {
|
||||
console.debug(response.data);
|
||||
YouTubeNewSubscriber(response.data);
|
||||
})
|
||||
|
||||
client.on('YouTube.NewSponsor', (response) => {
|
||||
console.debug(response.data);
|
||||
YouTubeNewSponsor(response.data);
|
||||
@@ -1662,6 +1668,35 @@ function YouTubeSuperSticker(data) {
|
||||
AddMessageItem(instance);
|
||||
}
|
||||
|
||||
function YouTubeNewSubscriber(data) {
|
||||
if (!showYouTubeSubscribers)
|
||||
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');
|
||||
|
||||
// Set the text
|
||||
let username = data.user.name;
|
||||
|
||||
titleDiv.innerText = `${username} subscribed`;
|
||||
|
||||
AddMessageItem(instance, JSON.stringify(data));
|
||||
}
|
||||
|
||||
function YouTubeNewSponsor(data) {
|
||||
if (!showYouTubeMemberships)
|
||||
return;
|
||||
|
||||
@@ -379,6 +379,14 @@
|
||||
"defaultValue": true,
|
||||
"group": "Which YouTube messages do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "showYouTubeSubscribers",
|
||||
"label": "New Subscribers",
|
||||
"description": "",
|
||||
"type": "checkbox",
|
||||
"defaultValue": false,
|
||||
"group": "Which YouTube messages do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "showYouTubeMemberships",
|
||||
"label": "Memberships",
|
||||
|
||||
@@ -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 showYouTubeSubscribers = GetBooleanParam("showYouTubeSubscribers", false);
|
||||
const youtubeSubscriberAction = urlParams.get("youtubeSubscriberAction") || "";
|
||||
const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
||||
const youtubeMembershipAction = urlParams.get("youtubeMembershipAction") || "";
|
||||
|
||||
@@ -247,6 +249,11 @@ client.on('YouTube.SuperSticker', (response) => {
|
||||
YouTubeSuperSticker(response.data);
|
||||
})
|
||||
|
||||
client.on('YouTube.NewSubscriber', (response) => {
|
||||
console.debug(response.data);
|
||||
YouTubeNewSubscriber(response.data);
|
||||
})
|
||||
|
||||
client.on('YouTube.NewSponsor', (response) => {
|
||||
console.debug(response.data);
|
||||
YouTubeNewSponsor(response.data);
|
||||
@@ -827,6 +834,29 @@ function YouTubeSuperSticker(data) {
|
||||
);
|
||||
}
|
||||
|
||||
function YouTubeNewSubscriber(data) {
|
||||
if (!showYouTubeSubscribers)
|
||||
return;
|
||||
|
||||
// Set the text
|
||||
const username = data.user.name;
|
||||
|
||||
// Render avatars
|
||||
const avatarURL = data.user.profileImageUrl;
|
||||
|
||||
UpdateAlertBox(
|
||||
'youtube',
|
||||
avatarURL,
|
||||
`${username}`,
|
||||
`subscribed`,
|
||||
``,
|
||||
username,
|
||||
``,
|
||||
youtubeSubscriberAction,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
function YouTubeNewSponsor(data) {
|
||||
if (!showYouTubeMemberships)
|
||||
return;
|
||||
|
||||
@@ -380,6 +380,23 @@
|
||||
"showIf": "showYouTubeSuperStickers",
|
||||
"group": "Which YouTube alerts do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "showYouTubeSubscribers",
|
||||
"label": "New Subscribers",
|
||||
"description": "",
|
||||
"type": "checkbox",
|
||||
"defaultValue": false,
|
||||
"group": "Which YouTube alerts do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "youtubeSubscriberAction",
|
||||
"label": "",
|
||||
"description": "Also run this Streamer.bot Action",
|
||||
"type": "sb-actions",
|
||||
"defaultValue": "",
|
||||
"showIf": "showYouTubeSubscribers",
|
||||
"group": "Which YouTube alerts do you want to see?"
|
||||
},
|
||||
{
|
||||
"id": "showYouTubeMemberships",
|
||||
"label": "Memberships",
|
||||
|
||||
Reference in New Issue
Block a user