@@ -309,7 +309,10 @@ async function TwitchChatMessage(data) {
309309
310310 // Set the username info
311311 if ( showUsername ) {
312- usernameDiv . innerText = data . message . displayName ;
312+ if ( data . message . displayName . toLowerCase ( ) == data . message . username . toLowerCase ( ) )
313+ usernameDiv . innerText = data . message . displayName ;
314+ else
315+ usernameDiv . innerText = `${ data . message . displayName } (${ data . message . username } )` ;
313316 usernameDiv . style . color = data . message . color ;
314317 }
315318
@@ -462,7 +465,9 @@ async function TwitchSub(data) {
462465 if ( ! showTwitchSubs )
463466 return ;
464467
465- const username = data . user . name ;
468+ let username = data . user . name ;
469+ if ( data . user . name . toLowerCase ( ) != data . user . login . toLowerCase ( ) )
470+ username = `${ data . user . name } (${ data . user . login } )` ;
466471 const subTier = data . sub_tier ;
467472 const isPrime = data . is_prime ;
468473
@@ -480,7 +485,9 @@ async function TwitchResub(data) {
480485 if ( ! showTwitchSubs )
481486 return ;
482487
483- const username = data . user . name ;
488+ let username = data . user . name ;
489+ if ( data . user . name . toLowerCase ( ) != data . user . login . toLowerCase ( ) )
490+ username = `${ data . user . name } (${ data . user . login } )` ;
484491 const subTier = data . subTier ;
485492 const isPrime = data . isPrime ;
486493 const cumulativeMonths = data . cumulativeMonths ;
@@ -499,7 +506,9 @@ async function TwitchGiftSub(data) {
499506 if ( ! showTwitchSubs )
500507 return ;
501508
502- const username = data . user . name ;
509+ let username = data . user . name ;
510+ if ( data . user . name . toLowerCase ( ) != data . user . login . toLowerCase ( ) )
511+ username = `${ data . user . name } (${ data . user . login } )` ;
503512 const subTier = data . subTier ;
504513 const recipient = data . recipient . name ;
505514 const fromCommunitySubGift = data . fromCommunitySubGift ;
@@ -521,7 +530,9 @@ async function TwitchGiftBomb(data) {
521530 // const username = data.displayName;
522531 // const gifts = data.gifts;
523532 // const subTier = data.subTier;
524- const username = data . user . name ;
533+ let username = data . user . name ;
534+ if ( data . user . name . toLowerCase ( ) != data . user . login . toLowerCase ( ) )
535+ username = `${ data . user . name } (${ data . user . login } )` ;
525536 const gifts = data . recipients . length ;
526537 const subTier = data . sub_tier . charAt ( 0 ) ;
527538
@@ -534,7 +545,9 @@ async function TwitchRewardRedemption(data) {
534545 if ( ! showTwitchChannelPointRedemptions )
535546 return ;
536547
537- const username = data . user_name ;
548+ let username = data . user_name ;
549+ if ( data . user_name . toLowerCase ( ) != data . user_login . toLowerCase ( ) )
550+ username = `${ data . user_name } (${ data . user_login } )` ;
538551 const rewardName = data . reward . title ;
539552 const cost = data . reward . cost ;
540553 const userInput = data . user_input ;
@@ -549,7 +562,9 @@ async function TwitchRaid(data) {
549562 if ( ! showTwitchRaids )
550563 return ;
551564
552- const username = data . from_broadcaster_user_login ;
565+ let username = data . from_broadcaster_user_name ;
566+ if ( data . from_broadcaster_user_name . toLowerCase ( ) != data . from_broadcaster_user_login . toLowerCase ( ) )
567+ username = `${ data . from_broadcaster_user_name } (${ data . from_broadcaster_user_login } )` ;
553568 const viewers = data . viewers ;
554569
555570 let message = `${ username } is raiding with a party of ${ viewers } ` ;
@@ -1318,16 +1333,4 @@ function SetConnectionStatus(connected) {
13181333 statusContainer . style . transition = "" ;
13191334 statusContainer . style . opacity = 1 ;
13201335 }
1321- }
1322-
1323- // let data = {
1324- // "isAnonymous": false,
1325- // "gifts": 10,
1326- // "totalGifts": 0,
1327- // "subTier": 1, /* 0 - Prime, 1 - Tier 1, 2 - Tier 2, 3 - Tier 3 */
1328- // "userName": "<username of gifter>",
1329- // "displayName": "<displayname of gifter>",
1330- // "role": 1 /* 1 - Viewer, 2 - VIP, 3 - Moderator, 4 - Broadcaster */
1331- // }
1332-
1333- // TwitchGiftBomb(data);
1336+ }
0 commit comments