mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Added Patreon support
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -46,6 +46,7 @@ const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
|||||||
|
|
||||||
const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true)
|
const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true)
|
||||||
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
||||||
|
const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true);
|
||||||
|
|
||||||
// Set fonts for the widget
|
// Set fonts for the widget
|
||||||
document.body.style.fontFamily = font;
|
document.body.style.fontFamily = font;
|
||||||
@@ -184,6 +185,11 @@ client.on('StreamElements.Tip', (response) => {
|
|||||||
StreamElementsTip(response.data);
|
StreamElementsTip(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('Patreon.PledgeCreated', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
PatreonPledgeCreated(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
@@ -199,7 +205,7 @@ async function TwitchChatMessage(data) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't post messages from users from the ignore list
|
// Don't post messages from users from the ignore list
|
||||||
if (ignoreUserList.includes(data.message.username))
|
if (ignoreUserList.includes(data.message.username.toLowerCase()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get a reference to the template
|
// Get a reference to the template
|
||||||
@@ -500,7 +506,7 @@ function YouTubeMessage(data) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't post messages from users from the ignore list
|
// Don't post messages from users from the ignore list
|
||||||
if (ignoreUserList.includes(data.user.name))
|
if (ignoreUserList.includes(data.user.name.toLowerCase()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get a reference to the template
|
// Get a reference to the template
|
||||||
@@ -666,6 +672,19 @@ function StreamElementsTip(data) {
|
|||||||
ShowAlert(message, 'streamelements');
|
ShowAlert(message, 'streamelements');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PatreonPledgeCreated(data) {
|
||||||
|
if (!showPatreonMemberships)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const user = data.attributes.full_name;
|
||||||
|
const amount = (data.attributes.will_pay_amount_cents/100).toFixed(2);
|
||||||
|
const patreonIcon = `<img src="icons/platforms/patreon.png" class="platform"/>`;
|
||||||
|
|
||||||
|
let message = `${patreonIcon} ${user} joined Patreon ($${amount})`;
|
||||||
|
|
||||||
|
ShowAlert(message, 'patreon');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
let settingsContainer = document.getElementById('settings-container');
|
let settingsContainer = document.getElementById('settings-container');
|
||||||
//settingsContainer.src = `https://nuttylmao.github.io/widget-customizer?settingsJson=${window.location.href}/settings.json`
|
|
||||||
settingsContainer.src = `../../widget-customizer?settingsJson=${window.location.href}/settings.json`
|
settingsContainer.src = `../../widget-customizer?settingsJson=${window.location.href}/settings.json`
|
||||||
console.log(settingsContainer.src);
|
console.log(settingsContainer.src);
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,14 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "Which donation messages do you want to see?"
|
"group": "Which donation messages do you want to see?"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "showPatreonMemberships",
|
||||||
|
"label": "Patreon Memberships",
|
||||||
|
"description": "",
|
||||||
|
"type": "checkbox",
|
||||||
|
"defaultValue": true,
|
||||||
|
"group": "Which donation messages do you want to see?"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "address",
|
"id": "address",
|
||||||
"label": "Address",
|
"label": "Address",
|
||||||
|
|||||||
@@ -241,6 +241,10 @@ li {
|
|||||||
background: linear-gradient(#263b8abf, #0a112abf) !important;
|
background: linear-gradient(#263b8abf, #0a112abf) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.patreon {
|
||||||
|
background: linear-gradient(#c76633, #fd5e0a) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/** ANIMATIONS **/
|
/** ANIMATIONS **/
|
||||||
/****************/
|
/****************/
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -45,6 +45,7 @@ const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true);
|
|||||||
|
|
||||||
const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true)
|
const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true)
|
||||||
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true);
|
||||||
|
const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true);
|
||||||
|
|
||||||
// Set fonts for the widget
|
// Set fonts for the widget
|
||||||
document.body.style.fontFamily = font;
|
document.body.style.fontFamily = font;
|
||||||
@@ -198,6 +199,11 @@ client.on('StreamElements.Tip', (response) => {
|
|||||||
StreamElementsTip(response.data);
|
StreamElementsTip(response.data);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('Patreon.PledgeCreated', (response) => {
|
||||||
|
console.debug(response.data);
|
||||||
|
PatreonPledgeCreated(response.data);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@@ -213,7 +219,7 @@ async function TwitchChatMessage(data) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't post messages from users from the ignore list
|
// Don't post messages from users from the ignore list
|
||||||
if (ignoreUserList.includes(data.message.username))
|
if (ignoreUserList.includes(data.message.username.toLowerCase()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get a reference to the template
|
// Get a reference to the template
|
||||||
@@ -783,7 +789,7 @@ function YouTubeMessage(data) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't post messages from users from the ignore list
|
// Don't post messages from users from the ignore list
|
||||||
if (ignoreUserList.includes(data.user.name))
|
if (ignoreUserList.includes(data.user.name.toLowerCase()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get a reference to the template
|
// Get a reference to the template
|
||||||
@@ -1097,6 +1103,37 @@ async function StreamElementsTip(data) {
|
|||||||
AddMessageItem(instance, data.id);
|
AddMessageItem(instance, data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PatreonPledgeCreated(data) {
|
||||||
|
if (!showPatreonMemberships)
|
||||||
|
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('patreon');
|
||||||
|
|
||||||
|
// Set the text
|
||||||
|
const user = data.attributes.full_name;
|
||||||
|
const amount = (data.attributes.will_pay_amount_cents/100).toFixed(2);
|
||||||
|
const patreonIcon = `<img src="icons/platforms/patreon.png" class="platform"/>`;
|
||||||
|
|
||||||
|
titleDiv.innerHTML = `${patreonIcon} ${user} joined Patreon ($${amount})`;
|
||||||
|
|
||||||
|
AddMessageItem(instance, data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
let settingsContainer = document.getElementById('settings-container');
|
let settingsContainer = document.getElementById('settings-container');
|
||||||
settingsContainer.src = `https://widgets.nutty.gg/widget-customizer?settingsJson=${window.location.href}/settings.json`
|
settingsContainer.src = `../../widget-customizer?settingsJson=${window.location.href}/settings.json`
|
||||||
console.log(settingsContainer.src);
|
console.log(settingsContainer.src);
|
||||||
|
|
||||||
function reloadWidget(data) {
|
function reloadWidget(data) {
|
||||||
|
|||||||
@@ -269,6 +269,14 @@
|
|||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"group": "Which donation messages do you want to see?"
|
"group": "Which donation messages do you want to see?"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "showPatreonMemberships",
|
||||||
|
"label": "Patreon Memberships",
|
||||||
|
"description": "",
|
||||||
|
"type": "checkbox",
|
||||||
|
"defaultValue": true,
|
||||||
|
"group": "Which donation messages do you want to see?"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "address",
|
"id": "address",
|
||||||
"label": "Address",
|
"label": "Address",
|
||||||
|
|||||||
@@ -207,6 +207,10 @@ li {
|
|||||||
background: linear-gradient(#263b8abf, #0a112abf) !important;
|
background: linear-gradient(#263b8abf, #0a112abf) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.patreon {
|
||||||
|
background: linear-gradient(#c76633, #fd5e0a) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/** ANIMATIONS **/
|
/** ANIMATIONS **/
|
||||||
/****************/
|
/****************/
|
||||||
|
|||||||
Reference in New Issue
Block a user