SBCanvas.ready(() => {
const wall = document.getElementById('emote-wall');
SBCanvas.on('chat:message', (msg) => {
const words = msg.text.split(' ');
for (const word of words) {
const url = SBCanvas.emotes.resolve(word);
if (url) {
const img = document.createElement('img');
img.src = url;
img.alt = word;
img.style.position = 'absolute';
img.style.left = `${Math.random() * 90}%`;
img.style.top = `${Math.random() * 90}%`;
wall.appendChild(img);
SBCanvas.setTimeout(() => img.remove(), 3000);
}
}
});
});