diff --git a/horizontal-chat/icons/platforms/patreon.png b/horizontal-chat/icons/platforms/patreon.png new file mode 100644 index 0000000..22c9748 Binary files /dev/null and b/horizontal-chat/icons/platforms/patreon.png differ diff --git a/horizontal-chat/script.js b/horizontal-chat/script.js index fb229f3..2821690 100644 --- a/horizontal-chat/script.js +++ b/horizontal-chat/script.js @@ -46,6 +46,7 @@ const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true); const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true) const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true); +const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true); // Set fonts for the widget document.body.style.fontFamily = font; @@ -184,6 +185,11 @@ client.on('StreamElements.Tip', (response) => { StreamElementsTip(response.data); }) +client.on('Patreon.PledgeCreated', (response) => { + console.debug(response.data); + PatreonPledgeCreated(response.data); +}) + ///////////////////// @@ -199,7 +205,7 @@ async function TwitchChatMessage(data) { return; // Don't post messages from users from the ignore list - if (ignoreUserList.includes(data.message.username)) + if (ignoreUserList.includes(data.message.username.toLowerCase())) return; // Get a reference to the template @@ -500,7 +506,7 @@ function YouTubeMessage(data) { return; // Don't post messages from users from the ignore list - if (ignoreUserList.includes(data.user.name)) + if (ignoreUserList.includes(data.user.name.toLowerCase())) return; // Get a reference to the template @@ -666,6 +672,19 @@ function StreamElementsTip(data) { 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 = ``; + + let message = `${patreonIcon} ${user} joined Patreon ($${amount})`; + + ShowAlert(message, 'patreon'); +} + ////////////////////// diff --git a/horizontal-chat/settings/script.js b/horizontal-chat/settings/script.js index 41f08d7..91c2789 100644 --- a/horizontal-chat/settings/script.js +++ b/horizontal-chat/settings/script.js @@ -1,5 +1,4 @@ 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` console.log(settingsContainer.src); diff --git a/horizontal-chat/settings/settings.json b/horizontal-chat/settings/settings.json index 776d21c..a109855 100644 --- a/horizontal-chat/settings/settings.json +++ b/horizontal-chat/settings/settings.json @@ -207,6 +207,14 @@ "defaultValue": true, "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", "label": "Address", diff --git a/horizontal-chat/style.css b/horizontal-chat/style.css index 0daa751..1ca9a86 100644 --- a/horizontal-chat/style.css +++ b/horizontal-chat/style.css @@ -241,6 +241,10 @@ li { background: linear-gradient(#263b8abf, #0a112abf) !important; } +.patreon { + background: linear-gradient(#c76633, #fd5e0a) !important; +} + /****************/ /** ANIMATIONS **/ /****************/ diff --git a/multichat-overlay/icons/platforms/patreon.png b/multichat-overlay/icons/platforms/patreon.png new file mode 100644 index 0000000..22c9748 Binary files /dev/null and b/multichat-overlay/icons/platforms/patreon.png differ diff --git a/multichat-overlay/script.js b/multichat-overlay/script.js index 4c7fa2f..f1cdc31 100644 --- a/multichat-overlay/script.js +++ b/multichat-overlay/script.js @@ -45,6 +45,7 @@ const showYouTubeMemberships = GetBooleanParam("showYouTubeMemberships", true); const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true) const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true); +const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true); // Set fonts for the widget document.body.style.fontFamily = font; @@ -198,6 +199,11 @@ client.on('StreamElements.Tip', (response) => { StreamElementsTip(response.data); }) +client.on('Patreon.PledgeCreated', (response) => { + console.debug(response.data); + PatreonPledgeCreated(response.data); +}) + /////////////////////// @@ -213,7 +219,7 @@ async function TwitchChatMessage(data) { return; // Don't post messages from users from the ignore list - if (ignoreUserList.includes(data.message.username)) + if (ignoreUserList.includes(data.message.username.toLowerCase())) return; // Get a reference to the template @@ -783,7 +789,7 @@ function YouTubeMessage(data) { return; // Don't post messages from users from the ignore list - if (ignoreUserList.includes(data.user.name)) + if (ignoreUserList.includes(data.user.name.toLowerCase())) return; // Get a reference to the template @@ -1097,6 +1103,37 @@ async function StreamElementsTip(data) { 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 = ``; + + titleDiv.innerHTML = `${patreonIcon} ${user} joined Patreon ($${amount})`; + + AddMessageItem(instance, data.id); +} + ////////////////////// diff --git a/multichat-overlay/settings/script.js b/multichat-overlay/settings/script.js index 548e43f..91c2789 100644 --- a/multichat-overlay/settings/script.js +++ b/multichat-overlay/settings/script.js @@ -1,5 +1,5 @@ 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); function reloadWidget(data) { diff --git a/multichat-overlay/settings/settings.json b/multichat-overlay/settings/settings.json index 97cc09f..5b9acc1 100644 --- a/multichat-overlay/settings/settings.json +++ b/multichat-overlay/settings/settings.json @@ -269,6 +269,14 @@ "defaultValue": true, "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", "label": "Address", diff --git a/multichat-overlay/style.css b/multichat-overlay/style.css index b0eb3f1..6abd7d8 100644 --- a/multichat-overlay/style.css +++ b/multichat-overlay/style.css @@ -207,6 +207,10 @@ li { background: linear-gradient(#263b8abf, #0a112abf) !important; } +.patreon { + background: linear-gradient(#c76633, #fd5e0a) !important; +} + /****************/ /** ANIMATIONS **/ /****************/