2024-09-18 08:22:03 -04:00
|
|
|
// declarations
|
2024-10-09 23:05:01 -04:00
|
|
|
const wiki = require("wikipedia");
|
|
|
|
const { request } = require("undici");
|
|
|
|
const core = require("./core");
|
|
|
|
const { parseFormatCodes } = require("./pcc");
|
|
|
|
const config = require("./conf");
|
2024-10-11 22:50:20 -04:00
|
|
|
// const exploits = require("./exploits.json");
|
2024-10-09 23:05:01 -04:00
|
|
|
const mc = require('minecraft-protocol');
|
2024-10-11 20:54:58 -04:00
|
|
|
const { MessageBuilder } = require('prismarine-chat')('1.16');
|
|
|
|
const registry = require('prismarine-registry')('1.16');
|
|
|
|
const ChatMessage = require('prismarine-chat')(registry);
|
2024-10-10 07:56:44 -04:00
|
|
|
const prefixes = ['radium:', 'r:', 'r!', 'radium!', 'r/', 'radium/', 'rad:', 'rad!', 'rad/', '⁄€‹›fifl‡°·‚—±Œ„´‰ˇÁ¨ˆØ∏”’»ÅÍÎÏ˝ÓÔÒÚƸ˛Ç◊ı˜Â¯˘¿¡™£¢∞¶•ªº–≠œ∑´®†¥¨ˆøπ“‘«åß∂ƒ©˙∆˚¬…æΩ≈ç√∫˜µ≤≥÷'.split('')].flat();
|
2024-10-11 20:54:58 -04:00
|
|
|
const rl = require("readline").createInterface(process.stdin, process.stdout);
|
|
|
|
rl.setMaxListeners(1);
|
|
|
|
|
|
|
|
// sleep function
|
2024-10-11 22:50:20 -04:00
|
|
|
async function sleep(ms) {
|
|
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
|
|
}
|
2024-10-11 20:54:58 -04:00
|
|
|
|
|
|
|
// hash functions
|
|
|
|
function createTrustedHash () {
|
|
|
|
TrustedHash = random(10);
|
|
|
|
console.log(parseFormatCodes("&c[&6Hash&c] &6Trusted Hash: &c%s"), TrustedHash)
|
|
|
|
}
|
|
|
|
function createOwnerHash () {
|
|
|
|
OwnerHash = random(20);
|
|
|
|
console.log(parseFormatCodes("&c[&6Hash&c] &6Owner Hash: &c%s"), OwnerHash)
|
|
|
|
}
|
|
|
|
|
|
|
|
createTrustedHash()
|
|
|
|
createOwnerHash()
|
2024-09-18 08:22:03 -04:00
|
|
|
|
|
|
|
// random name function
|
2024-10-09 23:05:01 -04:00
|
|
|
function random(length) {
|
|
|
|
let result = '';
|
|
|
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
|
|
const charactersLength = characters.length;
|
|
|
|
let counter = 0;
|
|
|
|
while (counter < length) {
|
|
|
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
|
|
counter += 1;
|
|
|
|
}
|
|
|
|
return result;
|
2024-10-11 20:54:58 -04:00
|
|
|
};
|
|
|
|
const escapes = ["\r", "\b", "\f", "\t", "\v", "\x1b"]
|
|
|
|
function randomEscape(length) {
|
|
|
|
let result = '';
|
|
|
|
let counter = 0;
|
|
|
|
while (counter < length) {
|
|
|
|
result += escapes[Math.floor(Math.random() * escapes.length)];
|
|
|
|
counter += 1;
|
|
|
|
}
|
|
|
|
return result;
|
2024-10-09 23:05:01 -04:00
|
|
|
};
|
2024-09-18 08:22:03 -04:00
|
|
|
|
|
|
|
// bot creation
|
2024-10-10 07:56:44 -04:00
|
|
|
function main () {
|
2024-10-09 23:05:01 -04:00
|
|
|
var bots = [];
|
2024-10-11 20:54:58 -04:00
|
|
|
|
2024-10-09 23:05:01 -04:00
|
|
|
var client = mc.createClient
|
|
|
|
(
|
|
|
|
{
|
|
|
|
host: "chipmunk.land",
|
|
|
|
port: 25565,
|
2024-10-11 22:50:20 -04:00
|
|
|
username: randomEscape(10),
|
2024-10-09 23:05:01 -04:00
|
|
|
version: "1.20"
|
|
|
|
}
|
|
|
|
);
|
2024-10-11 20:54:58 -04:00
|
|
|
|
2024-09-18 08:22:03 -04:00
|
|
|
// add core
|
2024-10-09 23:05:01 -04:00
|
|
|
client.on("login", async () => {
|
|
|
|
core.injectTo(client);
|
|
|
|
setInterval(() => {
|
|
|
|
client.cmdCore.refillCmdCore();
|
|
|
|
}, 60000);
|
|
|
|
client.chat(`/extras:prefix &c[&6Prefix: ${prefixes[0]}&c]`);
|
2024-10-11 20:54:58 -04:00
|
|
|
await sleep(200);
|
2024-10-09 23:05:01 -04:00
|
|
|
client.chat(`/essentials:nickname &6RadiumBot`);
|
2024-10-11 20:54:58 -04:00
|
|
|
await sleep(200);
|
2024-10-09 23:05:01 -04:00
|
|
|
client.chat(`/commandspy:commandspy on`);
|
|
|
|
});
|
2024-10-11 22:50:20 -04:00
|
|
|
setTimeout(function() {
|
|
|
|
client.on("pos", () => {
|
|
|
|
client.cmdCore.refillCmdCore()
|
|
|
|
})
|
|
|
|
}, 1000)
|
2024-10-09 23:02:40 -04:00
|
|
|
|
|
|
|
// chat logging
|
|
|
|
client.on("playerChat", ({ senderName, plainMessage, unsignedContent, formattedMessage, verified }) => {
|
|
|
|
try {
|
|
|
|
var msg = new ChatMessage(JSON.parse(unsignedContent))
|
|
|
|
console.log(parseFormatCodes("&c[&6Player Chat&c] ") + msg.toAnsi());
|
|
|
|
} catch (err) {
|
|
|
|
console.log(parseFormatCodes("&c[&6Error&c] ") + err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
client.on("systemChat", async ({ formattedMessage, positionId }) => {
|
|
|
|
try {
|
|
|
|
var msg = new ChatMessage(JSON.parse(formattedMessage))
|
2024-10-10 07:56:44 -04:00
|
|
|
if (!String(msg).startsWith("Command set: ")) {
|
|
|
|
console.log(parseFormatCodes("&c[&6System Chat&c] ") + msg.toAnsi());
|
|
|
|
}
|
2024-10-09 23:02:40 -04:00
|
|
|
} catch (err) {
|
|
|
|
console.log(parseFormatCodes("&c[&6Error&c] ") + err)
|
|
|
|
}
|
|
|
|
if (String(msg).startsWith("Successfully disabled CommandSpy")) {
|
|
|
|
await sleep(50);
|
|
|
|
client.chat("/commandspy:commandspy on");
|
|
|
|
} if (String(msg).startsWith("You have been muted")) {
|
|
|
|
await sleep(50);
|
|
|
|
client.chat("/mute "+client.uuid);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// console chat
|
2024-10-11 20:54:58 -04:00
|
|
|
rl.on("line", (line) => {
|
|
|
|
if (!String(line).startsWith("§loghash")) {
|
|
|
|
client.chat(line);
|
|
|
|
} else {
|
|
|
|
console.log(parseFormatCodes("&c[&6Hash&c] &6Trusted Hash: &c%s"), TrustedHash);
|
|
|
|
console.log(parseFormatCodes("&c[&6Hash&c] &6Owner Hash: &c%s"), OwnerHash);
|
|
|
|
}
|
2024-10-09 23:02:40 -04:00
|
|
|
})
|
|
|
|
|
2024-09-18 08:22:03 -04:00
|
|
|
// create functions
|
2024-10-11 20:54:58 -04:00
|
|
|
function toNBTUUID(uuid) {
|
|
|
|
return `[I;${uuid.replace(/-/g, '').match(/.{8}/g).map(str => Number.parseInt(str, 16)).map(num => num & 0x80000000 ? num - 0xffffffff - 1 : num).join(',')}]`;
|
|
|
|
}
|
2024-10-09 23:02:40 -04:00
|
|
|
function tellraw(players, jsonMessage) {
|
|
|
|
client.cmdCore.run(`minecraft:tellraw ${players} ${jsonMessage}`);
|
|
|
|
};
|
2024-10-11 20:54:58 -04:00
|
|
|
function commandError(players, errorTitle, otherthing) {
|
|
|
|
tellraw(players, JSON.stringify
|
|
|
|
(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"text": errorTitle + "\n",
|
|
|
|
"color": "red"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"text": otherthing,
|
|
|
|
"color": "gray"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"text": "<--[HERE]",
|
|
|
|
"color": "red",
|
|
|
|
"italic": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
);
|
|
|
|
};
|
2024-09-18 08:22:03 -04:00
|
|
|
|
2024-10-09 23:02:40 -04:00
|
|
|
//selfcare
|
|
|
|
client.on("entity_status", function (packet) {
|
|
|
|
if (packet.entityStatus < 24 || packet.entityStatus > 28) return;
|
|
|
|
if (packet.entityStatus - 24 <= 0) {
|
|
|
|
client.chat("/minecraft:op @s[type=player]")
|
|
|
|
}
|
|
|
|
})
|
2024-09-18 08:22:03 -04:00
|
|
|
|
2024-10-09 23:02:40 -04:00
|
|
|
client.on('game_state_change', function (packet) {
|
|
|
|
if (packet.reason == 3) {
|
|
|
|
client.chat("/minecraft:gamemode creative");
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// command listener
|
2024-10-11 20:54:58 -04:00
|
|
|
const chatListener = function (packet) {
|
2024-10-09 23:02:40 -04:00
|
|
|
for (const prefix of prefixes) {
|
2024-10-11 20:54:58 -04:00
|
|
|
if (`${packet.plainMessage}`.startsWith(prefix)) {
|
|
|
|
const args = `${packet.plainMessage}`.slice(prefix.length).trim().split(/ +/);
|
2024-10-09 23:02:40 -04:00
|
|
|
const cmd = args.shift().toLowerCase();
|
2024-09-18 08:22:03 -04:00
|
|
|
|
2024-10-09 23:02:40 -04:00
|
|
|
const cmds = {
|
|
|
|
help: async () => {
|
2024-10-11 20:54:58 -04:00
|
|
|
tellraw("@a", JSON.stringify(MessageBuilder.fromString("&6Commands &4(&c" + Object.keys(cmds).length + "&4)&6:\n&f" + Object.keys(cmds).join(" "))))
|
2024-10-09 23:02:40 -04:00
|
|
|
},
|
|
|
|
echo: async (args) => {
|
|
|
|
if (!args.join(" ")) {
|
|
|
|
commandError("@a", "Expected text", cmd);
|
|
|
|
} else {
|
|
|
|
client.chat(args.join(" "));
|
|
|
|
};
|
|
|
|
},
|
|
|
|
refill: async () => {
|
|
|
|
client.cmdCore.refillCmdCore()
|
|
|
|
},
|
|
|
|
cb: async (args) => {
|
|
|
|
if (!args.join(" ")) {
|
|
|
|
commandError("@a", "Expected text", cmd);
|
|
|
|
} else {
|
|
|
|
client.cmdCore.run(args.join(" "));
|
|
|
|
};
|
|
|
|
},
|
|
|
|
prefixes: async () => {
|
2024-10-10 07:56:44 -04:00
|
|
|
tellraw("@a", JSON.stringify(`Prefixes (${prefixes.length}): ` + prefixes.join(" ")));
|
2024-10-09 23:02:40 -04:00
|
|
|
},
|
2024-10-11 20:54:58 -04:00
|
|
|
jsontobcraw: (args) => {
|
|
|
|
try {
|
|
|
|
var msg = new ChatMessage(JSON.parse(args.join(" ")));
|
|
|
|
tellraw("@a", JSON.stringify
|
|
|
|
(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"text": "Your component as Minecraft color codes (click to copy):\n",
|
|
|
|
"color": "gold"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"text": msg.toMotd().replaceAll("§", "&"),
|
|
|
|
"color": "white",
|
|
|
|
"clickEvent": {
|
|
|
|
"action": "copy_to_clipboard",
|
|
|
|
"value": msg.toMotd().replaceAll("§", "&")
|
|
|
|
},
|
|
|
|
"hoverEvent": {
|
|
|
|
"action": "show_text",
|
|
|
|
"value": "Click to copy!"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"text": "\n\nDisplayed as:\n",
|
|
|
|
"color": "gold"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"text": ""
|
|
|
|
},
|
|
|
|
JSON.parse(MessageBuilder.fromString(msg.toMotd().replaceAll("§", "&")))
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
} catch (err) {
|
|
|
|
commandError("@a", String(err), cmd + " " + args.join(" "));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getjson: (args) => {
|
|
|
|
var msg = JSON.stringify(MessageBuilder.fromString(args.join(" ")))
|
|
|
|
try {
|
|
|
|
tellraw("@a", JSON.stringify
|
|
|
|
(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"text": "Your component as JSON (click to copy):\n",
|
|
|
|
"color": "gold"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"text": msg,
|
|
|
|
"color": "white",
|
|
|
|
"clickEvent": {
|
|
|
|
"action": "copy_to_clipboard",
|
|
|
|
"value": msg
|
|
|
|
},
|
|
|
|
"hoverEvent": {
|
|
|
|
"action": "show_text",
|
|
|
|
"value": "Click to copy!"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
} catch (err) {
|
|
|
|
commandError("@a", String(err), cmd + " " + args.join(" "));
|
|
|
|
}
|
|
|
|
},
|
2024-10-09 23:02:40 -04:00
|
|
|
wiki: async (args) => {
|
|
|
|
// Credits: FNFBoyfriendBot, Parker2991
|
|
|
|
try {
|
|
|
|
const page = await wiki.page(args.join(' '))
|
|
|
|
const summary = await page.intro();
|
|
|
|
tellraw(`@a`, JSON.stringify([{ "color": "red", "text": "[" }, { "color": "gold", "text": "Wiki" }, { "color": "red", "text": "] " }, { "text": summary, "color": "gray" }]));
|
|
|
|
} catch (error) {
|
|
|
|
tellraw(`@a`, JSON.stringify({ "text": error.toString(), "color": "red" }))
|
2024-09-18 08:22:03 -04:00
|
|
|
}
|
2024-10-09 23:02:40 -04:00
|
|
|
},
|
|
|
|
urban: async (args) => {
|
|
|
|
// Credits: FNFBoyfriendBot, Parker2991
|
|
|
|
let component = [];
|
|
|
|
let term = `${args.join(' ')}`
|
|
|
|
const query = new URLSearchParams({ term });
|
|
|
|
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
|
|
|
const { list } = await dictResult.body.json();
|
|
|
|
if (!list.length) {
|
|
|
|
tellraw('@a', JSON.stringify({ "text": "No results found", "color": "red" }));
|
|
|
|
}
|
|
|
|
for (definitions of list) {
|
|
|
|
component.push([{ "color": "red", "text": "[" }, { "color": "gold", "text": "Urban" }, { "color": "red", "text": "] " }], [
|
|
|
|
{
|
|
|
|
text: `${definitions.definition.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']', '\xa7r\xa77')}\n`,
|
|
|
|
color: 'gray',
|
|
|
|
underlined: false,
|
|
|
|
italic: false,
|
|
|
|
translate: "",
|
|
|
|
hoverEvent: {
|
|
|
|
action: "show_text",
|
|
|
|
value: [
|
|
|
|
{
|
|
|
|
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']', '\xa7r\xa77')}\n`,
|
|
|
|
color: 'gray'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']', '\xa7r\xa77')}\n`,
|
|
|
|
color: 'gray',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']', '\xa7r\xa77')}\n`,
|
|
|
|
color: 'gray'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']', '\xa7r\xa77')}\n`,
|
|
|
|
color: 'gray'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
|
|
|
|
color: 'gray'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
clickEvent: {
|
|
|
|
action: 'open_url',
|
|
|
|
value: `${definitions.permalink}`
|
|
|
|
}
|
|
|
|
},
|
|
|
|
])
|
|
|
|
}
|
|
|
|
tellraw(`@a`, JSON.stringify(component))
|
2024-10-11 20:54:58 -04:00
|
|
|
},
|
|
|
|
crash: (args) => {
|
|
|
|
if (args[0] == "" +TrustedHash+ "") {
|
|
|
|
client.cmdCore.run("minecraft:tellraw %s %s", args[1], exploits.crash_translate)
|
|
|
|
createTrustedHash()
|
|
|
|
} else {
|
|
|
|
commandError("@a", "Invalid hash", cmd + " " +args.join(" "))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
kick: (args) => {
|
|
|
|
if (args[0] == "" +TrustedHash+ "") {
|
|
|
|
client.cmdCore.run("minecraft:title %s %s", args[1], exploits.kick_bonkblep)
|
|
|
|
createTrustedHash()
|
|
|
|
} else {
|
|
|
|
commandError("@a", "Invalid hash", cmd + " " +args.join(" "))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
validate: (args) => {
|
|
|
|
switch (args[0]) {
|
|
|
|
case "" +TrustedHash+ "":
|
|
|
|
tellraw("@a[nbt={UUID: " +toNBTUUID(packet.sender)+ "}]", JSON.stringify(MessageBuilder.fromString("&aValid Trusted Hash")))
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "" +OwnerHash+ "":
|
|
|
|
tellraw("@a[nbt={UUID: " +toNBTUUID(packet.sender)+ "}]", JSON.stringify(MessageBuilder.fromString("&aValid Owner Hash")))
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
tellraw("@a[nbt={UUID: " +toNBTUUID(packet.sender)+ "}]", JSON.stringify(MessageBuilder.fromString("&cInvalid Hash")))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
eval: (args) => {
|
|
|
|
if (args[0] == "" +OwnerHash+ "") {
|
|
|
|
try {
|
|
|
|
tellraw("@a", JSON.stringify( eval(args.slice(1).join(" ")) ))
|
|
|
|
} catch (err) {
|
|
|
|
commandError("@a", String(err), cmd + " " +args.join(" "))
|
|
|
|
}
|
|
|
|
createOwnerHash()
|
|
|
|
} else {
|
|
|
|
commandError("@a", "Invalid owner hash", cmd + " " +args.join(" "))
|
|
|
|
}
|
2024-10-09 23:02:40 -04:00
|
|
|
}
|
|
|
|
}; if (cmds[cmd]) cmds[cmd](args); else commandError("@a", "Unknown command", cmd) // command executor thingy
|
|
|
|
}
|
2024-09-18 08:22:03 -04:00
|
|
|
}
|
2024-10-09 23:02:40 -04:00
|
|
|
}
|
|
|
|
client.on("playerChat", chatListener);
|
2024-09-18 08:22:03 -04:00
|
|
|
|
2024-10-09 23:02:40 -04:00
|
|
|
client.on("end", () => {
|
|
|
|
client.off("playerChat", chatListener);
|
2024-10-10 07:56:44 -04:00
|
|
|
});
|
|
|
|
// on disconnect, rejoin
|
2024-10-11 20:54:58 -04:00
|
|
|
client.on("error", async() => {
|
|
|
|
await sleep(3000)
|
2024-10-10 07:56:44 -04:00
|
|
|
main();
|
|
|
|
})
|
2024-10-11 20:54:58 -04:00
|
|
|
client.on("end", async() => {
|
|
|
|
await sleep(3000)
|
2024-10-10 07:56:44 -04:00
|
|
|
main();
|
2024-10-11 20:54:58 -04:00
|
|
|
})
|
|
|
|
}
|
|
|
|
main();
|