summaryrefslogtreecommitdiff
path: root/scripts/chat.js
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-10-26 00:03:54 +0500
committerilotterytea <iltsu@alright.party>2025-10-26 00:03:54 +0500
commit73c9099e90e1a279f65567cfe751afdc11adcbb2 (patch)
treee61c7f0b9aa8219115e34355a0f184cc8def08bf /scripts/chat.js
parentd6eb4a393b602358e67a4348289bae5592e5520b (diff)
feat: betterttv emotes
Diffstat (limited to 'scripts/chat.js')
-rw-r--r--scripts/chat.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/chat.js b/scripts/chat.js
index 2c0eaad..6f48a6b 100644
--- a/scripts/chat.js
+++ b/scripts/chat.js
@@ -72,7 +72,14 @@ function addMessage(message) {
usernameElem.textContent = `${message.nick}:`;
// message text
- elem.innerHTML += ' ' + message.params[1];
+ let msgWords = message.params[1].split(" ");
+ for (let i = 0; i < msgWords.length; i++) {
+ if (msgWords[i] in emotes) {
+ msgWords[i] = `<img src="${emotes[msgWords[i]]}" loading="lazy" alt="${msgWords[i]}" />`;
+ }
+ }
+
+ elem.innerHTML += ' ' + msgWords.join(" ");
messages.append(elem);