mpp-scripts/tools/Eval.user.js

23 lines
564 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==UserScript==
// @name Eval
// @namespace Violentmonkey Scripts
// @match https://multiplayerpiano.net/*
// @grant none
// @version 1.0
// @author Hri7566
// @description 4/21/2023, 7:12:33 AM
// ==/UserScript==
MPP.client.on("a", msg => {
if (msg.p._id !== MPP.client.getOwnParticipant()._id) return;
if (!msg.a.startsWith(">")) return;
let out;
try {
out = eval(msg.a.substring(1));
} catch (err) {
out = `${err}`;
}
MPP.client.sendArray([{m: 'a', message: `\u034f✔ ${typeof out} ${out}`}])
});