Add files via upload

This commit is contained in:
Rodrigo Emanuel
2025-05-14 18:53:08 -03:00
committed by GitHub
parent f4bb81b5d8
commit 6210db375d
7 changed files with 186 additions and 23 deletions

BIN
images/3k7a2BA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -313,6 +313,6 @@
<script src="https://unpkg.com/@streamerbot/client/dist/streamerbot-client.js"></script>
<script src="js/settings.js?v=0.0.1"></script>
<script src="js/settings.js"></script>
</body>
</html>

View File

@@ -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 = {

View File

@@ -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)
}),
]);

View File

@@ -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;

View File

@@ -106,8 +106,8 @@ const en = {
kofi : {
donation : ({ money, message }) => ` donated 🪙 <strong>${money}</strong>${message ? '<br>'+message : ''}`,
sub : ({ money, tier, message }) => ` subscribed <strong>${money}</strong>${tier ? '(Tier '+tier+')' : ''}${message ? '<br>'+message : ''}`,
resub : ({ money, tier, message }) => ` subscribed <strong>${money}</strong>${tier ? '(Tier '+tier+')' : ''}${message ? '<br>'+message : ''}`,
sub : ({ money, tier, message }) => ` subscribed <strong>(${money}) ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
resub : ({ money, tier, message }) => ` subscribed <strong>${money} ${tier ? '(Tier '+tier+')' : ''}</strong>${message ? '<br>'+message : ''}`,
order : ({ money, items }) => ` ordered <strong>${items} ${items == 1 ? 'item' : 'items'} (${money == 0 ? 'Free' : money})`,
},
@@ -149,13 +149,13 @@ const en = {
drawstart : ({ gift, command }) => `
<strong><i class="fa-solid fa-gift fa-beat"></i> Giveaway started!</strong>
Type ${command} to have a chance to win <strong>${gift}</strong>`,
drawstart : ({ gift, command, time }) => `
<strong><i class="fa-solid fa-gift"></i> Giveaway started!</strong>
<br>Type <strong>${command}</strong> to have a chance to win <strong>${gift}</strong>. You have <strong>${time} seconds!</strong>`,
drawend : ({ winners }) => `
<strong>🎉 Giveaway Ended!</strong>
Congratulations <strong>${winners}</strong>`,
<br>Congratulations <strong>${winners}</strong>`,

View File

@@ -369,4 +369,4 @@ document.querySelectorAll('.nav-bar a').forEach(anchor => {
});
}
});
});
});