Fixed bug with Fourthwall Subscriptions/Donations

This commit is contained in:
nuttylmao
2025-07-29 02:44:49 +10:00
parent 38929ba471
commit 3c9f940a55
+9 -6
View File
@@ -408,14 +408,17 @@ async function CustomEvent(data) {
// Fourthwall Events // Fourthwall Events
case ('FourthwallDonation'): case ('FourthwallDonation'):
{ {
const avatarURL = await GetAvatar(data.username, 'twitch'); const avatarURL = await GetAvatar(data["fw.username"], 'twitch');
if (IsValidUrl(avatarURL)) if (IsValidUrl(avatarURL))
avatarEl.src = avatarURL; avatarEl.src = avatarURL;
else else
avatarEl.style.display = 'none' avatarEl.style.display = 'none'
titleEl.style.fontSize = '2em'; titleEl.style.fontSize = '2em';
titleEl.innerText = FormatCurrency(data.amount, data.currency); titleEl.innerText = FormatCurrency(data["fw.amount"], data["fw.currency"]);
subtitleEl.innerText = `${data.username}`; if (data["fw.username"])
subtitleEl.innerText = `${data["fw.username"]}`;
else if (data["fw.email"])
subtitleEl.innerText = `${data["fw.email"]}`;
if (data.message) { if (data.message) {
const messageEl = document.createElement('div'); const messageEl = document.createElement('div');
@@ -485,16 +488,16 @@ async function CustomEvent(data) {
break; break;
case ('FourthwallSubscriptionPurchased'): case ('FourthwallSubscriptionPurchased'):
{ {
const avatarURL = await GetAvatar(data.nickname, 'twitch'); const avatarURL = await GetAvatar(data["fw.nickname"], 'twitch');
if (IsValidUrl(avatarURL)) if (IsValidUrl(avatarURL))
avatarEl.src = avatarURL; avatarEl.src = avatarURL;
else else
avatarEl.style.display = 'none' avatarEl.style.display = 'none'
titleEl.innerText = `New Member`; titleEl.innerText = `New Member`;
subtitleEl.innerText = `${data.nickname}`; subtitleEl.innerText = `${data["fw.nickname"]}`;
const messageEl = document.createElement('div'); const messageEl = document.createElement('div');
messageEl.innerText = `Thanks for joining at the ${FormatCurrency(data.amount, data.currency)} tier!`; messageEl.innerText = `Thanks for joining at the ${FormatCurrency(data["fw.amount"], data["fw.currency"])} tier!`;
contentEl.appendChild(messageEl); contentEl.appendChild(messageEl);
} }