From 185159c8fed9a345ebb6c0a6af3a93243ff3109b Mon Sep 17 00:00:00 2001 From: Killa Fish <61081555+Fiszh@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:25:21 +0200 Subject: [PATCH] usernames now should show up in the title --- src/index.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index d6ec90b..1749452 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -let broadcaster = 'psp1g'; +let broadcaster = 'uni1g'; let loadedEmotes = false; let autoScroll = true; let holdingCtrl = false; @@ -12,7 +12,7 @@ if (parts[4]) { } if (parts.length == 2) { - broadcaster = 'psp1g'; + broadcaster = 'uni1g'; } const FgBlack = "\x1b[30m"; @@ -49,7 +49,6 @@ client.on('connected', async (address, port) => { let messageCount = 1; //TWITCH -//let accessToken = '0'; let userToken = `Bearer ${accessToken}` let userClientId = '0' let channelTwitchID = '0'; @@ -1301,6 +1300,25 @@ async function update(updateInfo) { `; + const mentions = results.match(/@(\w+)/g) + + if (mentions && mentions.length > 0) { + for (const element of mentions) { + const username = element.replace('@', '') + const user = await getTTVUser(username) + + const replacement = `${element}` + + results = results.replace(element, replacement) + + await new Promise(resolve => setTimeout(resolve, 500)); + }; + } + + const resultsWrapper = document.querySelector('.results-wrapper'); + + resultsWrapper.innerHTML = results; + let nameWrapper = streamTitles[i].querySelector('.name-wrapper'); if (nameWrapper) {