Created
October 13, 2019 08:07
-
-
Save javajawa/91f60a0ba3bc39983abe5533ba644e2b to your computer and use it in GitHub Desktop.
Twitch Chat Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Twitch Chat Filter that hides messags unless they are from mods or in the list of allowed users. | |
// Originally written, and still configured, for LRR's PPR streams, where I wanted to be able to read the rules text LLRBot put into chat. | |
(function() | |
{ | |
const allowed_users = ['LoadingReadyRun', 'LRRbot', 'LRRMTG_Judge']; | |
const allow_mods = true; | |
const log = document.querySelector('div[role="log"]'); | |
window.setInterval(() => | |
{ | |
log.querySelectorAll('div.chat-line__message:not(.processed)').forEach(e => { | |
e.classList.add( 'processed' ); | |
if ( allowed_users.includes(e.querySelector('span.chat-line__username').textContent)) | |
{ | |
return; | |
} | |
if ( allow_mods && e.querySelector( 'img.chat-badge[aria-label="Moderator badge"]' ) ) | |
{ | |
return; | |
} | |
// Uncomment this and remove the line below to only fade out unwanted messages | |
//e.style.opacity = '0.1'; | |
e.style.display = 'none'; | |
}); | |
}, 500); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(d,t){const o=["LoadingReadyRun","LRRbot","LRRMTG_Judge"],a=d[t]('div[role="log"]');window.setInterval(()=>a[t+'All']("div.chat-line__message:not(.processed)").forEach(e=>{e.classList.add("processed"),o.includes(e[t]("span.chat-line__username").textContent)||e[t]('img.chat-badge[aria-label="Moderator badge"]')||(e.style.display="none")}),500)}(document,'querySelector'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment