From 6210db375d65539226e322b796899bb494a826fa Mon Sep 17 00:00:00 2001 From: Rodrigo Emanuel Date: Wed, 14 May 2025 18:53:08 -0300 Subject: [PATCH] Add files via upload --- images/3k7a2BA.png | Bin 0 -> 7419 bytes index.html | 2 +- js/app-mockup.js | 125 ++++++++++++++++++++++++++++++++++++++++ js/fourthwall/module.js | 62 +++++++++++++++----- js/kofi/module.js | 6 +- js/lang/en.js | 12 ++-- js/settings.js | 2 +- 7 files changed, 186 insertions(+), 23 deletions(-) create mode 100644 images/3k7a2BA.png diff --git a/images/3k7a2BA.png b/images/3k7a2BA.png new file mode 100644 index 0000000000000000000000000000000000000000..be3e7ea75493ca843c385c53fe8f5d37d03b2b0f GIT binary patch literal 7419 zcmeHMXH-*Zw?;-Z6e$7$C4dn@N@xNSx<-*f35Ws`B?8i9lt83K>L3Ax0KrkI5oS=s z2pF1D0)!fZMqo5TfY1XXMhHzq=R4kSzV-dMYu$hM-~4!2)_HT@w)eZA=h^$DUUalO zAa+}eMq>FekwhT}$E^jUl($=|?aplStTjzIH z4tk8$D2wgcxE4N@62$RVoH9X?G?}|JrfRbHLRF10qFYKS+1q^J_Cin{ry9lusV9)o zO@FF1y|Rwo_*ff+Wdk4amgWojoneFJ@tRx2x*N$T9 zV#g!Vv$ow%(ulahZ{NbvY^+3nH0&8zN0u}H{mU0^#Gqh%baZrtd&3W(b!BdoR$4mR z{35=ixgllWuIp$cl{!2hQCC-&((wn+ocXLNS$bKUb?4^S)4$Sx$=7g%bSc$0q;!aZ zpcU1l7+&<)jhc`SgU%N`ZnNgmm=xgU#?fAntQjQ+_G(wrSY04={5Zbp_rUxY_iUX9 zA2WVK>c6k=p553mM<`lc@Z9Qat_?kipdHt)AG$r|S#sgESC!)xzE5;0J6wzr34-?J zYb)}rXH_J(((C8n8%Uh&U4#V0;s#vW8ukkZA6#i~uxq;`3Uwj`6>E2w((~GL6D>Jl2v_V3qox7xXT(YFEKx0b2)pSZLQSyMt zv(nPH)vIHf`yu?bbLE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index.html index 06f7b1f..9c787cf 100644 --- a/index.html +++ b/index.html @@ -313,6 +313,6 @@ - + diff --git a/js/app-mockup.js b/js/app-mockup.js index b986e46..eeb5a86 100644 --- a/js/app-mockup.js +++ b/js/app-mockup.js @@ -219,6 +219,10 @@ function generateMockEvent() { 'patreon-membership', 'tipeeestream-tip', + 'kofi-donation', 'kofi-sub', 'kofi-resub', 'kofi-order', + + 'fourthwall-donation', 'fourthwall-sub', 'fourthwall-order', + 'streamlabs-tip', 'streamelements-tip', ]; @@ -770,6 +774,127 @@ function generateMockEvent() { + case 'kofi-donation' : + + var data = { + from: user.name, + amount: Math.floor(Math.random() * 2000) + 1, + currency: 'USD', + message: messagetext + }; + + kofiDonationMessage(data); + + break; + + + case 'kofi-sub' : + + var data = { + from: user.name, + amount: Math.floor(Math.random() * 2000) + 1, + currency: 'USD', + message: messagetext + }; + + kofiSubMessage(data); + + break; + + case 'kofi-resub' : + + var data = { + from: user.name, + amount: Math.floor(Math.random() * 2000) + 1, + currency: 'USD', + tier: parseInt(Math.floor(Math.random() * 3) + 1), + message: messagetext + }; + + kofiReSubMessage(data); + + break; + + case 'kofi-order' : + + var data = { + from: user.name, + amount: Math.floor(Math.random() * 200) + 1, + items: badgeschosen, + currency: 'USD', + message: messagetext + }; + + kofiOrderMessage(data); + + break; + + + + + + + + + + + + case 'fourthwall-donation' : + + var data = { + username: user.name, + amount: Math.floor(Math.random() * 2000) + 1, + currency: 'USD', + message: messagetext + }; + + fourthwallDonationMessage(data); + + break; + + + case 'fourthwall-sub' : + + var data = { + nickname: user.name, + amount: Math.floor(Math.random() * 2000) + 1, + currency: 'USD' + }; + + fourthwallSubMessage(data); + + break; + + + case 'fourthwall-order' : + + var data = { + username: user.name, + total: Math.floor(Math.random() * 200) + 1, + variants: [ + { + name: 'Fake Product', + image: 'images/3k7a2BA.png' + } + ], + currency: 'USD', + statmessageus: messagetext + }; + + fourthwallOrderMessage(data); + + break; + + + + + + + + + + + case 'streamlabs-tip' : var data = { diff --git a/js/fourthwall/module.js b/js/fourthwall/module.js index 724f981..f4e83e4 100644 --- a/js/fourthwall/module.js +++ b/js/fourthwall/module.js @@ -1,20 +1,53 @@ -const showShopifyOrders = getURLParam("showShopifyOrders", true); +const showFourthwallDonations = getURLParam("showFourthwallDonations", true); -const shopifyMessageHandlers = { - 'Shopify.OrderPaid': (response) => { - console.debug('Shopify Order Paid', response.data); - //shopifyOrderPaidMessage(response.data); +const showFourthwallOrders = getURLParam("showFourthwallOrders", true); +const showFourthwallShowImage = getURLParam("showFourthwallShowImage", true); +const showFourthwallBigImage = getURLParam("showFourthwallBigImage", true); + +const showFourthwallSubscriptions = getURLParam("showFourthwallSubscriptions", true); + +const showFourthwallGiftPurchase = getURLParam("showFourthwallGiftPurchase", true); +const showFourthwallShowGiftImage = getURLParam("showFourthwallShowGiftImage", true); +const showFourthwallBigGiftImage = getURLParam("showFourthwallBigGiftImage", true); + +const showFourthwallGiftDraw = getURLParam("showFourthwallGiftDraw", true); +const fourthWallGiftDrawCommand = getURLParam("fourthWallGiftDrawCommand", "!enter"); + +const fourthwallMessageHandlers = { + 'Fourthwall.Donation': (response) => { + console.debug('Fourthwall Donation', response.data); + fourthwallDonationMessage(response.data); + }, + 'Fourthwall.OrderPlaced': (response) => { + console.debug('Fourthwall Order', response.data); + fourthwallOrderMessage(response.data); + }, + 'Fourthwall.SubscriptionPurchased': (response) => { + console.debug('Fourthwall Sub', response.data); + fourthwallSubMessage(response.data); + }, + 'Fourthwall.GiftPurchase': (response) => { + console.debug('Fourthwall Gift', response.data); + fourthwallGiftMessage(response.data); + }, + 'Fourthwall.GiftDrawStarted': (response) => { + console.debug('Fourthwall Gift Draw Start', response.data); + fourthwallGiftDrawStartMessage(response.data); + }, + 'Fourthwall.GiftDrawEnded': (response) => { + console.debug('Fourthwall Gift Draw Start', response.data); + fourthwallGiftDrawEndMessage(response.data); }, }; -for (const [event, handler] of Object.entries(shopifyMessageHandlers)) { +for (const [event, handler] of Object.entries(fourthwallMessageHandlers)) { streamerBotClient.on(event, handler); } -async function shopifyOrderPaidMessage(data) { +async function fourthwallDonationMessage(data) { - if (showShopifyOrders == false) return; + if (showFourthwallDonations == false) return; const { username : userName, @@ -181,7 +214,7 @@ async function fourthwallGiftMessage(data) { }), ]); - const classes = ['gift']; + const classes = ['order']; if (showFourthwallBigGiftImage == true) { classes.push('giantimage'); } @@ -210,6 +243,7 @@ async function fourthwallGiftDrawStartMessage(data) { durationSeconds } = data; + var userName = ''; const userID = createRandomString(40); const messageID = createRandomString(40); @@ -217,7 +251,8 @@ async function fourthwallGiftDrawStartMessage(data) { '', currentLang.fourthwall.drawstart({ gift: itemName, - command: fourthWallGiftDrawCommand + command: fourthWallGiftDrawCommand, + time: durationSeconds }), ]); @@ -240,18 +275,17 @@ async function fourthwallGiftDrawEndMessage(data) { if (showFourthwallGiftDraw == false) return; const { - data: { - gifts - } + gifts } = data; + var userName = ''; const userID = createRandomString(40); const messageID = createRandomString(40); const [avatar, message] = await Promise.all([ '', currentLang.fourthwall.drawend({ - winners: getWinnersList(gifts) + winners: await getWinnersList(gifts) }), ]); diff --git a/js/kofi/module.js b/js/kofi/module.js index 6f48ea4..93087b3 100644 --- a/js/kofi/module.js +++ b/js/kofi/module.js @@ -110,6 +110,8 @@ async function kofiReSubMessage(data) { const { from : userName, + amount, + currency, tier, message: text } = data; @@ -117,9 +119,12 @@ async function kofiReSubMessage(data) { const userID = createRandomString(40); const messageID = createRandomString(40); + var money = formatCurrency(amount,currency); + const [avatar, message] = await Promise.all([ '', currentLang.kofi.resub({ + money: money, tier: tier, message: text }), @@ -147,7 +152,6 @@ async function kofiOrderMessage(data) { from : userName, amount, currency, - message: text, items } = data; diff --git a/js/lang/en.js b/js/lang/en.js index d31e258..a953491 100644 --- a/js/lang/en.js +++ b/js/lang/en.js @@ -106,8 +106,8 @@ const en = { kofi : { donation : ({ money, message }) => ` donated 🪙 ${money}${message ? '
'+message : ''}`, - sub : ({ money, tier, message }) => ` subscribed ${money}${tier ? '(Tier '+tier+')' : ''}${message ? '
'+message : ''}`, - resub : ({ money, tier, message }) => ` subscribed ${money}${tier ? '(Tier '+tier+')' : ''}${message ? '
'+message : ''}`, + sub : ({ money, tier, message }) => ` subscribed (${money}) ${tier ? '(Tier '+tier+')' : ''}${message ? '
'+message : ''}`, + resub : ({ money, tier, message }) => ` subscribed ${money} ${tier ? '(Tier '+tier+')' : ''}${message ? '
'+message : ''}`, order : ({ money, items }) => ` ordered ${items} ${items == 1 ? 'item' : 'items'} (${money == 0 ? 'Free' : money})`, }, @@ -149,13 +149,13 @@ const en = { - drawstart : ({ gift, command }) => ` - Giveaway started! - Type ${command} to have a chance to win ${gift}`, + drawstart : ({ gift, command, time }) => ` + Giveaway started! +
Type ${command} to have a chance to win ${gift}. You have ${time} seconds!`, drawend : ({ winners }) => ` 🎉 Giveaway Ended! - Congratulations ${winners}`, +
Congratulations ${winners}`, diff --git a/js/settings.js b/js/settings.js index 9c86aaa..8f3b061 100644 --- a/js/settings.js +++ b/js/settings.js @@ -369,4 +369,4 @@ document.querySelectorAll('.nav-bar a').forEach(anchor => { }); } }); -}); +}); \ No newline at end of file