Closed Ziegmaster closed 12 months ago
Code snippet
let emoteSearchPointer = 0; let formattedMessage = ""; // Render message.emotes.forEach((emote) => { let searchStr = message.message.substring(emoteSearchPointer); let emoteLocation = searchStr.indexOf(emote.name); console.log(emoteSearchPointer, searchStr); let replacement; if (emote.classes.includes("ffzHyper") || emote.classes.includes("ffzSlide")) { replacement = `<div class="${emote.classes.join(" ")}" style="background-image:url(${emote.imageUrl})"><div>`; } else { replacement = `<img class="${emote.classes.join(" ")}" src="${emote.imageUrl}">` } formattedMessage += searchStr.substring(0, emoteLocation) + replacement + " "; emoteSearchPointer += emoteLocation + emote.name.length; }); if (formattedMessage){ message.message = formattedMessage + message.message.substring(emoteSearchPointer); }
Issue tag just in case
Code snippet