diff --git a/horizontal-chat/icons/platforms/tipeeeStream.png b/horizontal-chat/icons/platforms/tipeeeStream.png new file mode 100644 index 0000000..cd981f3 Binary files /dev/null and b/horizontal-chat/icons/platforms/tipeeeStream.png differ diff --git a/horizontal-chat/script.js b/horizontal-chat/script.js index 953362e..4f30dbb 100644 --- a/horizontal-chat/script.js +++ b/horizontal-chat/script.js @@ -48,6 +48,7 @@ const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true) const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true); const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true); const showKofiDonations = GetBooleanParam("showKofiDonations", true); +const showTipeeestreamDonations = GetBooleanParam("showTipeeestreamDonations", true); // Set fonts for the widget document.body.style.fontFamily = font; @@ -211,6 +212,11 @@ client.on('Kofi.ShopOrder', (response) => { KofiShopOrder(response.data); }) +client.on('TipeeeStream.Donation', (response) => { + console.debug(response.data); + TipeeeStreamDonation(response.data); +}) + ///////////////////// @@ -774,6 +780,24 @@ function KofiShopOrder(data) { ShowAlert(message, 'kofi'); } +function TipeeeStreamDonation(data) { + if (!showTipeeestreamDonations) + return; + + const user = data.username; + const amount = data.amount; + const currency = data.currency; + const tipeeeStreamIcon = ``; + + let message = ""; + if (currency == "USD") + message = `${tipeeeStreamIcon} ${user} donated $${amount}`; + else + message = `${tipeeeStreamIcon} ${user} ordered ${itemTotal} item(s) on Ko-fi (${currency} ${amount})`; + + ShowAlert(message, 'tipeeeStream'); +} + ////////////////////// diff --git a/horizontal-chat/settings/settings.json b/horizontal-chat/settings/settings.json index e2daf94..a54c57f 100644 --- a/horizontal-chat/settings/settings.json +++ b/horizontal-chat/settings/settings.json @@ -223,6 +223,14 @@ "defaultValue": true, "group": "Which donation messages do you want to see?" }, + { + "id": "showTipeeeStreamDonations", + "label": "TipeeeStream Donations", + "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 5e3df9c..850bf5b 100644 --- a/horizontal-chat/style.css +++ b/horizontal-chat/style.css @@ -249,6 +249,10 @@ li { background: linear-gradient(#54c7ee, #08c2ff) !important; } +.tipeeeStream { + background: linear-gradient(#120e23, #5d192a) !important; +} + /****************/ /** ANIMATIONS **/ /****************/ diff --git a/multichat-overlay/icons/platforms/tipeeeStream.png b/multichat-overlay/icons/platforms/tipeeeStream.png new file mode 100644 index 0000000..cd981f3 Binary files /dev/null and b/multichat-overlay/icons/platforms/tipeeeStream.png differ diff --git a/multichat-overlay/script.js b/multichat-overlay/script.js index 33910b1..82d3dbc 100644 --- a/multichat-overlay/script.js +++ b/multichat-overlay/script.js @@ -47,6 +47,7 @@ const showStreamlabsDonations = GetBooleanParam("showStreamlabsDonations", true) const showStreamElementsTips = GetBooleanParam("showStreamElementsTips", true); const showPatreonMemberships = GetBooleanParam("showPatreonMemberships", true); const showKofiDonations = GetBooleanParam("showKofiDonations", true); +const showTipeeestreamDonations = GetBooleanParam("showTipeeestreamDonations", true); // Set fonts for the widget document.body.style.fontFamily = font; @@ -225,6 +226,11 @@ client.on('Kofi.ShopOrder', (response) => { KofiShopOrder(response.data); }) +client.on('TipeeeStream.Donation', (response) => { + console.debug(response.data); + TipeeeStreamDonation(response.data); +}) + /////////////////////// @@ -1276,6 +1282,45 @@ function KofiShopOrder(data) { AddMessageItem(instance, data.id); } +function TipeeeStreamDonation(data) { + if (!showTipeeestreamDonations) + 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('tipeeeStream'); + + // Set the text + const user = data.username; + const amount = data.amount; + const currency = data.currency; + const message = data.message; + const tipeeeStreamIcon = ``; + + if (currency == "USD") + titleDiv.innerHTML = `${tipeeeStreamIcon} ${user} donated $${amount}`; + else + titleDiv.innerHTML = `${tipeeeStreamIcon} ${user} donated ${currency} ${amount}`; + + if (message != null) + contentDiv.innerHTML = `${message}`; + + AddMessageItem(instance, data.id); +} + ////////////////////// diff --git a/multichat-overlay/settings/settings.json b/multichat-overlay/settings/settings.json index c53c3d1..663d71b 100644 --- a/multichat-overlay/settings/settings.json +++ b/multichat-overlay/settings/settings.json @@ -285,6 +285,14 @@ "defaultValue": true, "group": "Which donation messages do you want to see?" }, + { + "id": "showTipeeeStreamDonations", + "label": "TipeeeStream Donations", + "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 f1cb362..2c7f31e 100644 --- a/multichat-overlay/style.css +++ b/multichat-overlay/style.css @@ -215,6 +215,10 @@ li { background: linear-gradient(#54c7ee, #08c2ff) !important; } +.tipeeeStream { + background: linear-gradient(#120e23, #5d192a) !important; +} + /****************/ /** ANIMATIONS **/ /****************/