Detect Low Player Servers

A userscript that detects servers with a low amount of players in them, but also not 0 players.

Versione datata 21/03/2022. Vedi la nuova versione l'ultima versione.

// ==UserScript==
// @name  Detect Low Player Servers
// @description  A userscript that detects servers with a low amount of players in them, but also not 0 players.
// @author TheThreeBowlingBulbs
// @match  *://arras.io/*
// @version 1.0.1
// @namespace https://greasyfork.org/users/812261
// ==/UserScript==

// Modify setBar for client limit
let setBar = 5;

async function detector() {
    let fetchN = await fetch('https://ak7oqfc2u4qqcu6i.uvwx.xyz:2222/status');
    let fetchC = await fetch('https://ak7oqfc2u4qqcu6i.uvwx.xyz:2222/clientCount');
    let server = await fetchN.json();
    let client = await fetchC.json();
    let clientCount = client.clients;
    let sum = 0;
    let servers = server.status;
    console.log(servers);
    let convertArray = [];
    for (let count in servers) {
        convertArray.push(servers[count]);
    }
    for (let c = 0; c < convertArray.length; c++) {
        if (convertArray[c].clients > setBar) {
            sum = sum + convertArray[c].clients;
        }
        if (convertArray[c].clients > 0 && convertArray[c].clients < setBar) {
            console.table(convertArray[c]);
        }

    }
    console.log(clientCount - sum);
}
detector();