Twitch known bot highlighter

Highlights all known bot accounts from twitchinsights.net when in moderator mode.

ของเมื่อวันที่ 03-03-2023 ดู เวอร์ชันล่าสุด

// ==UserScript==
// @name         Twitch known bot highlighter
// @namespace    sh1n-shark.github.io
// @version      1.0.0
// @description  Highlights all known bot accounts from twitchinsights.net when in moderator mode.
// @author       SH1N_shark
// @match        https://www.twitch.tv/moderator/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitch.tv
// @grant        GM.xmlHttpRequest
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const INSIGHTS_API_URL = 'https://api.twitchinsights.net/v1/bots/online';
    var checkExist = setInterval(function () { //running the script every 10 seconds
        var userList = document.getElementById("chat-viewers-list-header-Users").nextSibling; //get element containing list of current users
        if (userList){
            var users = [];
            for (let user of Array.from(userList.children)) users.push(user.firstChild.getAttribute("data-username")); //parsing html into an array of usernames
            var getBots = GM.xmlHttpRequest({ //fetching currently online bots from twitchinsights.net
                url: INSIGHTS_API_URL,
                method: "GET",
                onload: function(response) {
                    var result = JSON.parse(response.response);
                    var bots = []
                    for (let rawBot of Array.from(result.bots)) { //parsing the response into an array of bot usernames
                        bots.push(rawBot[0])
                    }
                    var botUsers = users.filter(element => bots.includes(element)); //finding matching usernames between two arrays
                    for (var botUser of Array.from(botUsers)) {
                     document.querySelectorAll('[data-username='+botUser+']')[0].style.backgroundColor = "#5c1616"; //adding red background to the every user in the list
                    }
                }
            });
        }

    }, 10000);
})();
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元