MPP Minibot

Minibot

目前為 2021-11-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MPP Minibot
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Minibot
// @author       You
// @match        *://mppclone.com/*
// @license      MIT
// @grant        none
// ==/UserScript==

var hello = "(",
    calls = 1,
    catchedmsg = 0,
    sentmsgp = 0,
    sentmsg = 0,
    totalmsg = 0,
    th = ["", "thousand", "million", "billion", "trillion"],
    dg = "zero one two three four five six seven eight nine".split(" "),
    tn = "ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen".split(" "),
    tw = "twenty thirty forty fifty sixty seventy eighty ninety".split(" "),
    a = new Date().toLocaleTimeString();
setInterval(function () {
    a !== new Date().toLocaleTimeString() &&
        ((a = new Date().toLocaleTimeString()),
        setTimeout(function () {
            document.getElementById("timebtn").childNodes[0].nodeValue = new Date().toLocaleTimeString();
        }, 0));
}, 0);
$("body").append('<div id="timebtn" class="ugly-button" style="position: fixed; bottom: 17.5px !important; left: 1120px !important; z-index: 500;">0:0:0 PM/AM</div>');
$("#timebtn").on("click", function (d) {
    MPP.chat.send(new Date().toLocaleTimeString());
});
MPP.client.on("a", function (d) {
    function f(c) {
        MPP.chat.send("Bot: " + c.replace("undefined", ""));
        calls++;
        sentmsgp--;
        sentmsg++;
    }
    function m(c) {
        c = c.toString();
        c = c.replace(/[, ]/g, "");
        if (c != parseFloat(c)) return "not a number";
        var e = c.indexOf(".");
        -1 == e && (e = c.length);
        if (15 < e) return "too big";
        for (var k = c.split(""), g = "", n = 0, b = 0; b < e; b++)
            2 == (e - b) % 3 ? ("1" == k[b] ? ((g += tn[Number(k[b + 1])] + " "), b++, (n = 1)) : 0 != k[b] && ((g += tw[k[b] - 2] + " "), (n = 1))) : 0 != k[b] && ((g += dg[k[b]] + " "), 0 == (e - b) % 3 && (g += "hundred "), (n = 1)),
                1 == (e - b) % 3 && (n && (g += th[(e - b - 1) / 3] + " "), (n = 0));
        if (e != c.length) for (c = c.length, g += "point ", b = e + 1; b < c; b++) g += dg[k[b]] + " ";
        return g.replace(/\s+/g, " ");
    }
    catchedmsg++;
    var l = d.a.split(" "),
        h = l[0].toLowerCase(),
        p = d.p._id,
        r = d.p.color,
        q = d.p.name,
        t = new Color(d.p.color).getName();
    d.p._id === MPP.client.getOwnParticipant()._id && (sentmsgp++, sentmsg--, totalmsg++);
    h === hello + "help" && (sentmsg++, f("Commands: " + hello + "about " + hello + "me " + hello + "eat " + hello + "drink " + hello + "calls"));
    h === hello + "about" && f("Creators: CreepX7021 and Addison | Thanks to Addison for creating this bot! \u2764\ufe0f\ud83e\udde1\ud83d\udc9b\ud83d\udc9a\ud83d\udc99\ud83d\udc9c\ud83e\udd0e\ud83d\udda4\ud83e\udd0d");
    h === hello + "me" && f('Information | Name: "' + q + '" | ID: ' + p + " | Hex: " + r + " [" + t + "]");
    h === hello + "calls" &&
        f(
            "There are " +
                m(calls) +
                " commands used and " +
                m(catchedmsg) +
                " chat messages seen by the bot, and " +
                m(sentmsgp) +
                " chat messages sent by the player and " +
                m(sentmsg) +
                " messages sent by the bot, in total there are " +
                m(totalmsg) +
                "messagase sent by " +
                MPP.client.getOwnParticipant().name +
                " and bot".replace(void 0, "")
        );
    h === hello + "eat" && ((l = l.slice(1)), (p = d.a.substring(3 + hello.length + 1).trim()), 0 === l.length ? f("Usage: " + d.a + " <food>") : f(q + " ate " + p.replace(d.p.name, "Theirself")));
    h === hello + "drink" && ((l = l.slice(1)), (h = d.a.substring(5 + hello.length + 1).trim()), 0 === l.length ? f("Usage: " + d.a + " <drink>") : f(q + " drank " + h));
});