Skip to content

Commit

Permalink
usernames now should show up in the title
Browse files Browse the repository at this point in the history
  • Loading branch information
Fiszh authored Oct 11, 2024
1 parent 044f7bb commit 185159c
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let broadcaster = 'psp1g';
let broadcaster = 'uni1g';
let loadedEmotes = false;
let autoScroll = true;
let holdingCtrl = false;
Expand All @@ -12,7 +12,7 @@ if (parts[4]) {
}

if (parts.length == 2) {
broadcaster = 'psp1g';
broadcaster = 'uni1g';
}

const FgBlack = "\x1b[30m";
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -1301,6 +1300,25 @@ async function update(updateInfo) {
</div>
</div>`;

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 = `<a href="https://fiszh.github.io/YAUTC/${username}" style="color:${lightenColor(await getUserColorFromUserId(user.data[0].id))}; text-decoration: none;">${element}</a>`

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) {
Expand Down

0 comments on commit 185159c

Please sign in to comment.