mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Fixed Fourthwall giveaways
This commit is contained in:
@@ -1167,7 +1167,7 @@ function FourthwallGiftPurchase(data) {
|
|||||||
if (!showFourthwallAlerts)
|
if (!showFourthwallAlerts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let user = data.username;
|
// let user = data.username;
|
||||||
const total = data.total;
|
const total = data.total;
|
||||||
const currency = data.currency;
|
const currency = data.currency;
|
||||||
const gifts = data.gifts.length;
|
const gifts = data.gifts.length;
|
||||||
@@ -1176,7 +1176,8 @@ function FourthwallGiftPurchase(data) {
|
|||||||
let message = "";
|
let message = "";
|
||||||
|
|
||||||
// If the user ordered more than one item, write how many items they ordered
|
// If the user ordered more than one item, write how many items they ordered
|
||||||
message += `${user} gifted`;
|
// message += `${user} gifted`;
|
||||||
|
message += `Someone has gifted`;
|
||||||
|
|
||||||
// If there is more than one gifted item, display the number of gifts
|
// If there is more than one gifted item, display the number of gifts
|
||||||
if (gifts > 1)
|
if (gifts > 1)
|
||||||
@@ -1202,10 +1203,9 @@ function FourthwallGiftDrawStarted(data) {
|
|||||||
const itemName = data.offer.name;
|
const itemName = data.offer.name;
|
||||||
|
|
||||||
let message = "";
|
let message = "";
|
||||||
message += `${user} gifted`;
|
|
||||||
|
|
||||||
// If the user ordered more than one item, write how many items they ordered
|
// If the user ordered more than one item, write how many items they ordered
|
||||||
message += `🎁 ${itemName} Giveaway! • Type !join in the next ${durationSeconds} seconds for your chance to win!`;
|
message += `🎁 ${itemName} Giveaway! • Type 'join' in the next ${durationSeconds} seconds for your chance to win!`;
|
||||||
|
|
||||||
ShowAlert(message, 'fourthwall');
|
ShowAlert(message, 'fourthwall');
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-22
@@ -1946,28 +1946,32 @@ function FourthwallGiftPurchase(data) {
|
|||||||
const contentDiv = instance.querySelector("#content");
|
const contentDiv = instance.querySelector("#content");
|
||||||
|
|
||||||
// Set the card background colors
|
// Set the card background colors
|
||||||
cardDiv.classList.add('blank');
|
cardDiv.classList.add('fourthwall');
|
||||||
titleDiv.classList.add('centerThatShitHomie');
|
|
||||||
contentDiv.classList.add('centerThatShitHomie');
|
// // Set the card background colors
|
||||||
|
// cardDiv.classList.add('blank');
|
||||||
|
// titleDiv.classList.add('centerThatShitHomie');
|
||||||
|
// contentDiv.classList.add('centerThatShitHomie');
|
||||||
|
|
||||||
// Set the text
|
// Set the text
|
||||||
let user = data.username;
|
// let user = data.username;
|
||||||
const total = data.total;
|
const total = data.total;
|
||||||
const currency = data.currency;
|
const currency = data.currency;
|
||||||
const gifts = data.gifts.length;
|
const gifts = data.gifts.length;
|
||||||
const itemName = data.offer.name;
|
const itemName = data.offer.name;
|
||||||
const itemImageUrl = data.offer.imageUrl;
|
// const itemImageUrl = data.offer.imageUrl;
|
||||||
const fourthwallProductImage = `<img src="${itemImageUrl}" class="productImage"/>`;
|
// const fourthwallProductImage = `<img src="${itemImageUrl}" class="productImage"/>`;
|
||||||
const message = DecodeHTMLString(data.statmessageus);
|
// const message = DecodeHTMLString(data.statmessageus);
|
||||||
|
|
||||||
let contents = "";
|
let contents = "";
|
||||||
|
|
||||||
contents += fourthwallProductImage;
|
// contents += fourthwallProductImage;
|
||||||
|
|
||||||
contents += "<br><br>";
|
// contents += "<br><br>";
|
||||||
|
|
||||||
// If the user ordered more than one item, write how many items they ordered
|
// If the user ordered more than one item, write how many items they ordered
|
||||||
contents += `${user} gifted`;
|
// contents += `${user} gifted`;
|
||||||
|
contents += `Someone has gifted`;
|
||||||
|
|
||||||
// If there is more than one gifted item, display the number of gifts
|
// If there is more than one gifted item, display the number of gifts
|
||||||
if (gifts > 1)
|
if (gifts > 1)
|
||||||
@@ -1984,11 +1988,11 @@ function FourthwallGiftPurchase(data) {
|
|||||||
|
|
||||||
titleDiv.innerHTML = contents;
|
titleDiv.innerHTML = contents;
|
||||||
|
|
||||||
// Add the custom message from the user
|
// // Add the custom message from the user
|
||||||
if (message.trim() != "")
|
// if (message.trim() != "")
|
||||||
contentDiv.innerHTML = `${message}`;
|
// contentDiv.innerHTML = `${message}`;
|
||||||
else
|
// else
|
||||||
contentDiv.style.display = 'none'
|
// contentDiv.style.display = 'none'
|
||||||
|
|
||||||
AddMessageItem(instance, data.id);
|
AddMessageItem(instance, data.id);
|
||||||
}
|
}
|
||||||
@@ -2013,8 +2017,11 @@ function FourthwallGiftDrawStarted(data) {
|
|||||||
|
|
||||||
// Set the card background colors
|
// Set the card background colors
|
||||||
cardDiv.classList.add('fourthwall');
|
cardDiv.classList.add('fourthwall');
|
||||||
titleDiv.classList.add('centerThatShitHomie');
|
|
||||||
contentDiv.classList.add('centerThatShitHomie');
|
// // Set the card background colors
|
||||||
|
// cardDiv.classList.add('fourthwall');
|
||||||
|
// titleDiv.classList.add('centerThatShitHomie');
|
||||||
|
// contentDiv.classList.add('centerThatShitHomie');
|
||||||
|
|
||||||
// Set the text
|
// Set the text
|
||||||
const durationSeconds = data.durationSeconds;
|
const durationSeconds = data.durationSeconds;
|
||||||
@@ -2023,10 +2030,10 @@ function FourthwallGiftDrawStarted(data) {
|
|||||||
let contents = "";
|
let contents = "";
|
||||||
|
|
||||||
// If the user ordered more than one item, write how many items they ordered
|
// If the user ordered more than one item, write how many items they ordered
|
||||||
contents += `<h3>🎁 ${itemName} Giveaway!</h3>`;
|
contents += `🎁 ${itemName} Giveaway!`;
|
||||||
|
|
||||||
titleDiv.innerHTML = contents;
|
titleDiv.innerHTML = contents;
|
||||||
contentDiv.innerHTML = `Type !join in the next ${durationSeconds} seconds for your chance to win!`;
|
contentDiv.innerHTML = `Type 'join' in the next ${durationSeconds} seconds for your chance to win!`;
|
||||||
//contentDiv.style.display = `none`;
|
//contentDiv.style.display = `none`;
|
||||||
|
|
||||||
AddMessageItem(instance, data.id);
|
AddMessageItem(instance, data.id);
|
||||||
@@ -2052,13 +2059,16 @@ function FourthwallGiftDrawEnded(data) {
|
|||||||
|
|
||||||
// Set the card background colors
|
// Set the card background colors
|
||||||
cardDiv.classList.add('fourthwall');
|
cardDiv.classList.add('fourthwall');
|
||||||
titleDiv.classList.add('centerThatShitHomie');
|
|
||||||
contentDiv.classList.add('centerThatShitHomie');
|
// // Set the card background colors
|
||||||
|
// cardDiv.classList.add('fourthwall');
|
||||||
|
// titleDiv.classList.add('centerThatShitHomie');
|
||||||
|
// contentDiv.classList.add('centerThatShitHomie');
|
||||||
|
|
||||||
let contents = "";
|
let contents = "";
|
||||||
|
|
||||||
// If the user ordered more than one item, write how many items they ordered
|
// If the user ordered more than one item, write how many items they ordered
|
||||||
contents += `<h3>🥳 GIVEAWAY ENDED 🥳</h3>`;
|
contents += `🥳 GIVEAWAY ENDED 🥳`;
|
||||||
//contents += `Congratulations ${GetWinnersList(data.gifts)}!`
|
//contents += `Congratulations ${GetWinnersList(data.gifts)}!`
|
||||||
|
|
||||||
titleDiv.innerHTML = contents;
|
titleDiv.innerHTML = contents;
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ if (useCustomBackground) {
|
|||||||
hexOpacity = "0" + hexOpacity;
|
hexOpacity = "0" + hexOpacity;
|
||||||
}
|
}
|
||||||
//document.body.style.background = `${background}${hexOpacity}`;
|
//document.body.style.background = `${background}${hexOpacity}`;
|
||||||
console.log(`${background}${hexOpacity}`);
|
//console.log(`${background}${hexOpacity}`);
|
||||||
document.documentElement.style.setProperty('--custom-background', `${background}${hexOpacity}`);
|
document.documentElement.style.setProperty('--custom-background', `${background}${hexOpacity}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,18 +1148,17 @@ function FourthwallSubscriptionPurchased(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function FourthwallGiftPurchase(data) {
|
function FourthwallGiftPurchase(data) {
|
||||||
console.log(data);
|
|
||||||
if (!showFourthwallAlerts)
|
if (!showFourthwallAlerts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Set the text
|
// Set the text
|
||||||
let user = data.username;
|
// let user = data.username;
|
||||||
const total = data.total;
|
const total = data.total;
|
||||||
const currency = data.currency;
|
const currency = data.currency;
|
||||||
const gifts = data.gifts.length;
|
const gifts = data.gifts.length;
|
||||||
const itemName = data.offer.name;
|
const itemName = data.offer.name;
|
||||||
const itemImageUrl = data.offer.imageUrl;
|
// const itemImageUrl = data.offer.imageUrl;
|
||||||
const message = DecodeHTMLString(data.statmessageus);
|
// const message = DecodeHTMLString(data.statmessageus);
|
||||||
|
|
||||||
let contents = '';
|
let contents = '';
|
||||||
let attributesText = '';
|
let attributesText = '';
|
||||||
@@ -1179,12 +1178,12 @@ function FourthwallGiftPurchase(data) {
|
|||||||
|
|
||||||
UpdateAlertBox(
|
UpdateAlertBox(
|
||||||
'fourthwall',
|
'fourthwall',
|
||||||
itemImageUrl,
|
'', // itemImageUrl,
|
||||||
`${user}`,
|
`An item has been gifted!`,// `${user}`,
|
||||||
`gifted ${contents}`,
|
`${contents}`, // `gifted ${contents}`,
|
||||||
attributesText,
|
attributesText,
|
||||||
user,
|
'', // user,
|
||||||
message,
|
'', // message,
|
||||||
fourthwallAlertAction,
|
fourthwallAlertAction,
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
@@ -1202,7 +1201,7 @@ function FourthwallGiftDrawStarted(data) {
|
|||||||
'fourthwall',
|
'fourthwall',
|
||||||
'',
|
'',
|
||||||
`<span style="font-size: 1.2em">🎁 ${itemName} Giveaway!</span>`,
|
`<span style="font-size: 1.2em">🎁 ${itemName} Giveaway!</span>`,
|
||||||
`Type !join in the next ${durationSeconds} seconds for your chance to win!`,
|
`Type 'join' in the next ${durationSeconds} seconds for your chance to win!`,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@@ -1215,13 +1214,9 @@ function FourthwallGiftDrawEnded(data) {
|
|||||||
if (!showFourthwallAlerts)
|
if (!showFourthwallAlerts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Render avatars
|
|
||||||
if (showAvatar) {
|
|
||||||
avatar.src = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateAlertBox(
|
UpdateAlertBox(
|
||||||
'fourthwall',
|
'fourthwall',
|
||||||
|
'',
|
||||||
`<span style="font-size: 1.2em">🥳 GIVEAWAY ENDED 🥳</span>`,
|
`<span style="font-size: 1.2em">🥳 GIVEAWAY ENDED 🥳</span>`,
|
||||||
`Congratulations ${GetWinnersList(data.gifts)}!`,
|
`Congratulations ${GetWinnersList(data.gifts)}!`,
|
||||||
'',
|
'',
|
||||||
|
|||||||
Reference in New Issue
Block a user