Greasy Fork is available in English.

Bots

you can use this bots script with any other script!

// ==UserScript==
// @name         Bots
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  you can use this bots script with any other script!
// @author       Wealthy#8266
// @run-at       document-start
// @require      http://code.jquery.com/jquery-3.3.1.min.js
// @require      https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
// @match        *://*.moomoo.io/*
// @grant        none
// ==/UserScript==
// -----Info------
// Subscribe To Wealthy!
// Wealthy Will Make Advanced Subs At 600 Subs! 
// https://www.youtube.com/channel/UC3hmil0ayHhHB9C9ZSAYatA
// -----Usage-----
// Usage: .send COUNT NAME CLAN
// Example: .send 40 Wealthy abc

let skin = 6;
let combo = [Math.random < .5 ? 7 : 3, 20, 31, 23, 10, 38, 4, 25];
let point;

let bot = [];
let projects = [`lying-splendid-peripheral`,
                `efficacious-tremendous-golf`,
                `workable-equal-push`,
                `brave-small-bagpipe`,
                `efficacious-tremendous-golf`,
                `shade-mint-fur`,
                `ubiquitous-scintillating-stock`,
                `marvelous-classy-inch`,
                `blossom-fascinated-temperature`];
let key = [];
let length = projects.length;
let main;
let serverIp = '';
let freeHats = [51, 50, 28, 29, 30, 36, 37, 38, 44, 35, 42, 43, 49];
let bots = [];

let genHat = () => {
    this.in += 1;
    if(!freeHats[this.in]) this.in = 0;
    return freeHats[this.in];
};

let getToken = async () => {
    return await window.grecaptcha.execute("6LevKusUAAAAAAFknhlV8sPtXAk5Z5dGP5T2FYIZ", {
        action: "homepage",
    }).then((token) => {
        console.log(token)
        return encodeURIComponent(token);
    });
};

let generate = (count, name, clan, reallCount = 0) => {
    for(let id = 0; id < length; id++){
        bot[id] = [];

        let ws = new WebSocket(`wss://${projects[id]}.glitch.me`);

        ws.oldSend = ws.send;
        ws.send = (data) => {
            data = JSON.stringify(data);
            ws.readyState === 1 && ws.oldSend(data);
        };

        ws.onopen = async () => {
            ws.send(['ready']);
            for(let id = 0; id < 4; id++){
                reallCount++;
                if(reallCount > count){
                    let server = window.location.href.split('?server=')[1];
                    return console.log(`Sent ${count} bots to ${server}!`);
                };
                let token = await getToken();
                let url = `wss://ip_${serverIp}.moomoo.io:8008/?gameIndex=0&token=${token}`;
                let data = ['connect', url, name, skin, clan];
                ws.send(data);
            };

            setInterval(() => {
                ws.send(['point', point]);
                ws.send(['hat', genHat()]);
            }, 500);
        };

        ws.onclose = () => {
            console.log(`[${id}] close`)
        }

        let botMessage = (data) => {
            let item = data[0];
            switch(item){
                case "info":
                    for(let i of data[1]){
                        bot[id][Number(i.count)] = i.body;
                    };
                    console.log(bot)
                    break;
            };
        };

        ws.onmessage = data => {
            botMessage(JSON.parse(data.data))
        };
    };
};

let messageHandler = (data) => {
    return null;
};

window.WebSocket = class extends WebSocket {
    constructor(url, protocols) {
        main = super(url, protocols);

        let isFirst = url.includes(`wss://ip_`);
        if(isFirst){
            serverIp = url.split(`ip_`)[1].split(`.`)[0];
            this.addEventListener('message', data => messageHandler(data));
            window.ws = main;
            console.log(url);
        }
    }
    set onmessage(f) {
        console.log('onmessage', f);
        super.onmessage = f;
    }
};


window.addEventListener("keydown", (event) => {
    let code = event.keyCode;
    key[code] = true;

   // code == 80 && generate(50);

    if(code == 13 && 'chatbox' == document.activeElement.id.toLowerCase()){
        console.log(bot)
        let value = document.getElementById("chatBox").value;
        if(!value || value.length <= 1) return null;
        if(value.startsWith('.send')){
            let count = value.split(' ')[1];
            let name = value.split(' ')[2];
            let clan = value.split(' ')[3];
            close = false;
            generate(Math.max(0, Math.min(50, Number(count))), name || "Wealthy", clan || "bots");
        }

    };
});

window.addEventListener("keyup", (event) => {
    let code = event.keyCode;
    key[code] = false;
});