custom chat and shit

This commit is contained in:
Parker2991 2024-08-30 11:56:58 -04:00
parent 2a7819cf09
commit 088e0a4c02
29 changed files with 1730 additions and 825 deletions

1046
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
{ {
"dependencies": { "dependencies": {
"cowsay": "^1.6.0",
"cowsay2": "^2.0.4", "cowsay2": "^2.0.4",
"discord.js": "^14.11.0", "discord.js": "^14.11.0",
"java-parser": "^2.3.2", "java-parser": "^2.3.2",
@ -8,7 +9,6 @@
"json5": "^2.2.3", "json5": "^2.2.3",
"jvm": "^0.5.3", "jvm": "^0.5.3",
"man-db": "^1.0.3", "man-db": "^1.0.3",
"matrix-js-sdk": "^31.5.0",
"minecraft-data": "^3.36.1", "minecraft-data": "^3.36.1",
"minecraft-protocol": "^1.47.0", "minecraft-protocol": "^1.47.0",
"mojangson": "^2.0.4", "mojangson": "^2.0.4",

View file

@ -1,7 +1,5 @@
const mc = require('minecraft-protocol') const mc = require('minecraft-protocol')
const { EventEmitter } = require('events') const { EventEmitter } = require('events')
const fs = require('fs')
const path = require('path')
require("events").EventEmitter.defaultMaxListeners = Infinity; require("events").EventEmitter.defaultMaxListeners = Infinity;
const util = require('util'); const util = require('util');
function createBot(options = {}, config) { function createBot(options = {}, config) {
@ -65,9 +63,7 @@ function createBot(options = {}, config) {
const client = options.client ?? mc.createClient(options) const client = options.client ?? mc.createClient(options)
bot._client = client bot._client = client
bot.emit('init_client', client) bot.emit('init_client', client)
bot.bots = options.bots ?? [bot] bot.bots = options.bots ?? [bot]
return bot return bot
} }
module.exports = createBot module.exports = createBot

View file

@ -1,299 +1,4 @@
// TODO: Maybe add more authors const bots = require('../data/bots.json');
const bots = [
{
name: { text: "HBot", color: "aqua", bold: false },
authors: ["hhhzzzsss"],
exclaimer: "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO",
foundation: "java/mcprotocollib",
prefixes: ["#"],
},
{
name: [{ text: "FBot", color: "gold" }],
authors: ["popbob/aaa"],
exclaimer: "",
foundation: "nodejs/node-minecraft-protocol",
prefixes: ["+"],
},
{
name: { text: "CddehhBot", color: "red", bold: false },
authors: ["CaydennO1","spyingcreeper09"],
exclaimer: "WHAT IS THIS GOOFY AAAH FUCKING BOT FUCKING PIECE OF RETARDED ASS SHIT BOT ITS SO FUCKING SHIT I WANNA IPFILTER IT WITH FUCKING CHOMENS",
foundation: "nodejs/mineflayer",
prefixes: [","],
},
{
name: { text: "TurtleBot", color: "green", bold: false },
authors: ["TurtleKid"],
exclaimer: "nmp when?",
foundation: "nodejs/mineflayer",
prefixes: ["\\"],
},
{
name: { text: "NothingBot", color: "dark_red", bold: false },
authors: ["Yaode_owo"],
exclaimer: "uwu",
foundation: "nodejs/mineflayer",
prefixes: ["?"],
},
{
name: { text: "SC09Bot", color: "dark_gray", bold: false },
authors: ["spyingcreeper09"],
exclaimer: ":3",
foundation: "nodejs/node-minecraft-protocol",
prefixes: ["@"],
},
{
name: { text: "HorizonBot", color: "gold", bold: false },
authors: ["ZenZoya","Yaode_owo","Parker2991", "and others"],
exclaimer: "originally called §5FleamBot§r",
foundation: "nodejs/node-minecraft-protocol",
prefixes: ["^"],
},
{
name: { text: "64Bot", color: "gold", bold: false },
authors: ["64Will64"],
exclaimer: "NINTENDO 64?!?!??!?! 69Bot when??????",
foundation: "NodeJS/Mineflayer",
prefixes: ["w="],
},
{
name: { text: "Nebulabot", color: "dark_purple", bold: false },
authors: ["IuCC"],
exclaimer: "the void",
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: ["["],
},
{
name: [
{ text: "Prism", color: "#00FF9C", bold: true },
{ text: "Bot", color: "white",bold:true },
],
authors: ["IuCC"],
exclaimer: "prismarine :3",
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: ["["],
},
{
name: { text: "SharpBot", color: "aqua", bold: false },
authors: ["64Will64"],
exclaimer:
"sharp as in the tv? idfk im out of jokes also the first c# bot on the list??",
foundation: "C#/MineSharp",
prefixes: ["s="],
},
{
name: { text: "MoonBot", color: "red", bold: false },
authors: ["64Will64"],
exclaimer: "stop mooning/mooing me ",
foundation: "NodeJS/Mineflayer",
prefixes: ["m="],
},
{
name: { text: "TableBot", color: "yellow", bold: false },
authors: ["12alex12"],
exclaimer: "TABLE CLOTH BOT?!?! ",
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: ["t!"],
},
{
name: [
{ text: "Evil", color: "dark_red", bold: false },
{ text: "Bot", color: "dark_purple" },
],
authors: ["FusseligerDev"],
exclaimer: "",
foundation: "Java/Custom",
prefixes: ["!"],
},
{
name: { text: "SBot Java", color: "white", bold: false }, // TODO: Gradient
authors: ["evkc"],
foundation: "Java/MCProtocolLib",
prefixes: [":"],
},
{
name: { text: "SBot Rust", color: "white", bold: false }, // TODO: Gradient
authors: ["evkc"],
foundation: "Rust",
prefixes: ["re:"],
},
{
name: { text: "Z-Boy-Bot", color: "dark_purple", bold: false }, // TODO: Gradient
exclaimer: "Most likely skidded along with kbot that the dev used",
authors: ["Romnci"],
foundation: "NodeJS/mineflayer or Java/mcprotocollib idfk",
prefixes: ["Z]"],
},
{
name: { text: "ABot", color: "gold", bold: true }, // TODO: Gradient
exclaimer: "not used anymore (replaced by V2)",
authors: [{ text: "_yfd", color: "light_purple" }],
foundation: "NodeJS/Node-Minecraft-Protocol",
prefixes: ["<"],
},
{
name: { text: "ABot-V2", color: "gold", bold: true }, // TODO: Gradient
exclaimer: "",
authors: [{ text: "_yfd", color: "light_purple" }],
foundation: "NodeJS/Node-Minecraft-Protocol",
prefixes: ["<"],
},
{
name: { text: "FardBot", color: "light_purple", bold: false },
authors: ["_yfd"],
exclaimer: "bot is dead lol",
foundation: "NodeJS/Mineflayer",
prefixes: ["<"],
},
{
name: { text: "ChipmunkBot Java", color: "green", bold: false },
authors: ["_ChipMC_"],
exclaimer:
"chips? also shoutout to chip and chayapak for helping in the rewrite",
foundation: "Java/MCProtocolLib",
prefixes: ["'", "/'"],
},
{
name: { text: "ChipmunkBot NodeJS", color: "green", bold: false },
authors: ["_ChipMC_"],
foundation: "NodeJS/Node-Minecraft-Protocol",
},
{
name: { text: "TestBot", color: "aqua", bold: false },
authors: ["Blackilykat"],
foundation: "Java/MCProtocolLib",
prefixes: ["-"],
},
{
name: { text: "UBot", color: "gray", bold: false },
authors: ["HexWoman"],
exclaimer: "UwU OwO",
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ['"'],
},
{
name: { text: "ChomeNS Bot Java", color: "yellow", bold: false },
authors: ["chayapak"],
exclaimer: "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak \n rip ChomeNS bot i wonder what chayapak is currently doing -- Parker2991",
foundation: "Java/MCProtocolLib",
prefixes: ["*", "cbot ", "/cbot "],
},
{
name: { text: "ChomeNS Bot NodeJS", color: "yellow", bold: false },
authors: ["chayapak"],
foundation: "NodeJS/Node-Minecraft-Protocol",
prefixes: ["*", "cbot", "/cbot"],
},
{
name: { text: "RecycleBot", color: "dark_green", bold: false },
foundation: ["MorganAnkan"],
exclaimer: "nice bot",
language: "NodeJS/node-minecraft-protocol",
prefixes: ["="],
},
{
name: { text: "neobot", color: "blue", bold: false },
exclaimer: "n e o b o t ;oslkdfj;salkdfj;ladsjf",
authors: ["mirkokral"],
foundation: "java/MCProtocolLib",
prefixes: ["_"],
},
{
name: { text: "ManBot", color: "dark_green", bold: false },
exclaimer:
"(more like men bot :skull:) OH HAAAAAAAAAAAAAAIIILL LOGINTIMEDOUT",
authors: ["Man/LogintimedOut"],
foundation: "NodeJS/mineflayer",
prefixes: ["(Note:I dont remember!!)"],
},
{
name: [
{ text: "Useless", color: "red", bold: false },
{ text: "Bot", color: "gray", bold: false },
],
exclaimer: "it isnt useless its a good bot................",
authors: ["IuCC"],
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ["["],
},
/* {
name: [
{ text: "Blurry", color: "dark_purple", bold: false },
{ text: "Bot", color: "red" },
],
exclaimer: "KILL YOURSELF BIIIIIIIIIIIIIIIIIITCCCCCCCCCCCCH;lksadjklaklsjjk;lavsklja;kjlvkjladv;kjavdjkavjk;lvdkj;lsajvk;ds",
authors: ["SirLennox"],
foundation: "Java/custom",
prefixes: [","],
},*/
{
name: [{ text: "SnifferBot", color: "gold", bold: false }],
exclaimer: "sniff sniff FNFBoyfriendBot simp",
authors: ["popbob/aaa"],
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: [">"],
},
{
name: [{ text: "XBot", color: "dark_purple", bold: false }],
exclaimer: "",
authors: ["popbob/aaa"],
foundation: "ts-Node/Node-minecraft-protocol",
prefixes: ["$"],
},
{
name: [
{ text: "Kitty", color: "gold", bold: false },{text:"Corp", color:'aqua',bold:false},
{ text: "Bot", color: "yellow",bold:false },
],
exclaimer: "3 words ginlang is gay",
authors: ["ginlang , G6_, ArrayBuffer, and i guess more??"],
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ["^"],
},
{
name: [
{ text: "FNF", color: "dark_purple", bold: false },
{ text: "Boyfriend", color: "aqua", bold: false },
{ text: "Bot", color: "dark_red", bold: false },
{ text: " nmp", color: "black", bold: false },
],
authors: [
{ text: "Parker2991", color: "dark_red" },
{ text: " _ChipMC_", color: "dark_green", bold: false },
{ text: " chayapak", color: "yellow", bold: false },
{ text: " _yfd", color: "light_purple", bold: false },
{ text: "popbob/aaa", color: "gold" },
{ text: "MorganAnkan", color: "dark_green" },
{ text: "TurtleKid", color: "green" },
],
exclaimer: "v4.0x - current",
foundation: "NodeJS/node-minecraft-protocol",
prefixes: [ '~', 'fnfbfbot ', '', '', '█' ],
},
{
name: [
{ text: "FNF", color: "dark_purple", bold: false },
{ text: "Boyfriend", color: "aqua", bold: false },
{ text: "Bot", color: "dark_red", bold: false },
{ text: " legacy", color: "green", bold: false },
],
authors: [
{ text: "Parker2991", color: "dark_red" },
{ text: " _ChipMC_", color: "dark_green", bold: false },
],
exclaimer:
"1037 LINES OF CODE WTFARD!??! also this version is in console commands only",
foundation: "NodeJS/mineflayer",
prefixes: [],
},
];
const CommandError = require('../util/command_error') const CommandError = require('../util/command_error')
module.exports = { module.exports = {
name: "bots", name: "bots",
@ -314,7 +19,7 @@ module.exports = {
} }
bot.tellraw("@a", bot.tellraw("@a",
bot.getMessageAsPrismarine(["Known bots (", bots.length, ") - ", ...list]).toMotd().replaceAll('\xa7','\xa7'), ["Known bots (", JSON.stringify(bots.length), ") - ", ...list],
false, false,
); );
return; return;

View file

@ -27,7 +27,8 @@ module.exports = {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Added \'%s\' with interval %s to the cloops', translate: 'Added \'%s\' with interval %s to the cloops',
with: [ command, interval ] color: 'gray',
with: [ command, { text: `${interval}`, color: 'gold' } ]
}) })
break break
case 'remove': case 'remove':
@ -39,7 +40,8 @@ module.exports = {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Removed cloop %s', translate: 'Removed cloop %s',
with: [ index ] color: 'gray',
with: [ { text: `${index}`, color: 'gold' } ]
}) })
break break
case 'clear': case 'clear':
@ -55,14 +57,14 @@ module.exports = {
for (const cloop of bot.cloop.list) { for (const cloop of bot.cloop.list) {
listComponent.push({ listComponent.push({
translate: '%s \u203a %s (%s)', translate: '%s \u203a %s (%s)',
color: 'gray',
with: [ with: [
i, { text: `${i}`, color: 'gold' },
cloop.command, cloop.command,
cloop.interval { text: `${cloop.interval}`, color: 'gold'},
] ]
}) })
listComponent.push('\n') listComponent.push('\n')
i++ i++
} }
@ -70,14 +72,15 @@ module.exports = {
component.push({ component.push({
translate: 'Cloops (%s):', translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ] with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
}) })
component.push('\n') component.push('\n')
component.push(listComponent) component.push(listComponent)
if (bot.cloop.list.length === 0) { if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, { bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):', translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ] color: 'gray',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
}) })
} else { } else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)

View file

@ -28,6 +28,27 @@ module.exports = {
eachBot.console.consoleServer = server; eachBot.console.consoleServer = server;
} }
break break
case 'customchat':
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
bot.console.customChat.enabled = false
bot.console.info('Custom Chat disabled');
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
bot.console.customChat.enabled = true;
bot.console.info('Custom Chat enabled');
}
break
case 'say':
if (!bot.console.customChat.enabled) {
bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
} else if (bot.console.customChat.enabled) {
if (args.slice(1).join(' ').startsWith('/')) {
bot.chat.command(`${args.slice(1).join(' ').substring(1)}`)
return;
}
bot.console.customChat.chat(args.slice(1).join(' '));
}
break
case "validate": case "validate":
case "validation": case "validation":
case "val": case "val":
@ -35,15 +56,27 @@ module.exports = {
switch (args[1]?.toLowerCase()) { switch (args[1]?.toLowerCase()) {
case "owner": case "owner":
case "o": case "o":
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`) if (bot.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
} else if (!bot.console.customChat.enabled) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
}
break break
case "admin": case "admin":
case "a": case "a":
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`) if (bot.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
} else if (!bot.console.customChat.enabled) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
}
break break
case "trusted": case "trusted":
case "t": case "t":
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`) if (bot.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`);
} else if (!bot.console.customChat.enabled) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`)
}
break break
default: default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&")) bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))

View file

@ -16,6 +16,7 @@ module.exports = {
bot.chat.command(message.substring(1)) bot.chat.command(message.substring(1))
return return
} }
// if
bot.chat.message(message) bot.chat.message(message)
}, },
discordExecute (context) { discordExecute (context) {

View file

@ -21,7 +21,7 @@ module.exports = {
"", "",
"<command>", "<command>",
], ],
async execute (context) { execute (context) {
const commandList = []; const commandList = [];
const bot = context.bot; const bot = context.bot;
const source = context.source; const source = context.source;
@ -66,7 +66,7 @@ module.exports = {
}, },
{ {
text: "Usages \u203a\n", text: "Usages \u203a\n",
color: "dark_gray" color: "gray"
}, },
]); ]);
// } // }
@ -229,7 +229,7 @@ module.exports = {
if (bot.options.useChat) { if (bot.options.useChat) {
bot.chat.message(bot.getMessageAsPrismarine([ bot.chat.message(bot.getMessageAsPrismarine([
{ {
text: 'Commands (', text: 'Commands (',
color: 'gray' color: 'gray'
}, },
{ {
@ -242,12 +242,30 @@ module.exports = {
}, },
category, category,
])?.toMotd().replaceAll('§','&')) ])?.toMotd().replaceAll('§','&'))
await sleep(100) setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&")) bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
await sleep(100) }, 200)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&")); bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
await sleep(100) }, 200)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 200)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&")); bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 200)
} else if (admin.length === 0) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
// admin,
owner
])
} else { } else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [ bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' }, { text: 'Commands (', color: 'gray' },
@ -261,7 +279,6 @@ module.exports = {
owner owner
]) ])
} }
// bot.tellraw([ public, trusted, owner ])
}, },
discordExecute (context) { discordExecute (context) {
const bot = context.bot; const bot = context.bot;

View file

@ -4,6 +4,7 @@ const fs = require("fs");
const botInfo = require('../data/info.json'); const botInfo = require('../data/info.json');
const fixansi = require('../util/ansi.js'); const fixansi = require('../util/ansi.js');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { exec } = require('child_process')
function format(seconds) { function format(seconds) {
function pad(s) { function pad(s) {
return (s < 10 ? "0" : "") + s; return (s < 10 ? "0" : "") + s;
@ -88,7 +89,7 @@ module.exports = {
color: "gray", color: "gray",
}, },
{ {
text: `isSavage \u203a ${bot.options.isSavage}\n`, text: `isSavage \u203a ${bot.options.isSavage}`,
color: "gray", color: "gray",
}, },
]); ]);
@ -116,64 +117,101 @@ module.exports = {
]) ])
break break
case "server": case "server":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [ if (process.platform === 'win32') {
{ exec('rmdir /s /q ..\FridayNightFunkinBoyfriendBot')
text: `Hostname \u203a ${os.hostname()}\n`, process.exit(0) // fuck you windows
color: "gray" } else {
}, bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ {
text: `User \u203a ${os.userInfo().username}\n`, text: `Hostname \u203a ${os.hostname()}\n`,
color: "gray", color: "gray"
}, },
{ {
text: `Working Directory \u203a ${process.mainModule.path}\n`, text: `User \u203a ${os.userInfo().username}\n`,
color: "gray" color: "gray",
}, },
{ {
text: `Arch \u203a ${os.arch()}\n`, text: `Working Directory \u203a ${process.mainModule.path}\n`,
color: "gray" color: "gray"
}, },
{ {
text: `OS \u203a ${os.platform()}\n`, text: `Arch \u203a ${os.arch()}\n`,
color: "gray" color: "gray"
}, },
{ {
text: `OS Version/distro \u203a ${os.version()}\n`, text: `OS \u203a ${os.platform()}\n`,
color: "gray", color: "gray"
}, },
{ {
text: `Kernel Version \u203a ${os.release()}\n`, text: `OS Version/distro \u203a ${os.version()}\n`,
color: "gray" color: "gray",
}, },
{ {
text: `Cores \u203a ${os.cpus().length}\n`, text: `Kernel Version \u203a ${os.release()}\n`,
color: "gray", color: "gray"
}, },
{ {
text: `CPU \u203a ${os.cpus()[0].model}\n`, text: `Cores \u203a ${os.cpus().length}\n`,
color: "gray" color: "gray",
}, },
{ {
text: `Server Free memory `, text: `CPU \u203a ${os.cpus()[0].model}\n`,
color: 'gray' color: "gray"
}, },
{ {
text: `${Math.floor( os.freemem() / 1048576, )} `, text: `Server Free memory `,
color: 'gray' color: 'gray'
}, },
{ {
text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB\n`, text: `${Math.floor( os.freemem() / 1048576, )} `,
color: 'gray' color: 'gold'
}, },
{ {
text: `Device uptime \u203a ${format(os.uptime())}\n`, text: 'MiB / ',
color: 'gray' color: 'gray'
}, },
{ {
text: `Node version \u203a ${process.version}`, text: `${Math.floor(os.totalmem() / 1048576)} `,
color: 'gray' color: "gold",
} },
]) {
text: 'MiB\n',
color: "gray",
},
{
text: `Bot memory usage `, color: "gray"
},
{
text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `,
color: "gold",
},
{
text: "MiB / ",
color: "gray",
},
{
text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `,
color: "gold"
},
{
text: 'MiB\n',
color: "gray"
},
{
text: `Device uptime \u203a ${format(os.uptime())}\n`,
color: 'gray'
},
// {text:`${format(process.uptime())}`,color:'gray'}
{
text: `Bot uptime \u203a ${format(process.uptime())}\n`,
color: "gray"
},
{
text: `Node version \u203a ${process.version}`,
color: 'gray'
}
])
}
break break
case "contributors": case "contributors":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [ bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [

View file

@ -2,7 +2,7 @@ const CommandError = require('../util/command_error');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
module.exports = { module.exports = {
name: 'kick', name: 'kick',
trustLevel: 2, trustLevel: 1,
aliases: [ aliases: [
], ],
description: 'kick or crash players', description: 'kick or crash players',

View file

@ -15,13 +15,13 @@ module.exports = {
await bot.chat.message("killing process"); await bot.chat.message("killing process");
await bot.console.info("killing process"); await bot.console.info("killing process");
await bot.discord.channel?.send("killing process"); await bot.discord.channel?.send("killing process");
await process.exit(69420); // sure why the hell not await process.kill(0);
}, },
async discordExecute (context) { async discordExecute (context) {
const bot = context.bot; const bot = context.bot;
await bot.chat.message("killing process"); await bot.chat.message("killing process");
await bot.console.info("killing process"); await bot.console.info("killing process");
await bot.discord.channel?.send("killing process"); await bot.discord.channel?.send("killing process");
await process.exit(69420); await process.exit(0);
} }
} }

View file

@ -9,7 +9,13 @@ module.exports = {
], ],
execute (context) { execute (context) {
const bot = context.bot const bot = context.bot
bot.tellraw("@a", "Reloading Commands,..........") bot.tellraw("@a", [
{ text: "Reloading ", color: "gray" },
{ text: '(', color: "gray" },
{ text: `${bot.commandManager.commandlist.length}`, color: "gold" },
{ text: ') ', color: "gray" },
{ text: 'commands', color: "gray" },
])
for (const eachBot of bot.bots) { for (const eachBot of bot.bots) {
eachBot.commandManager.reload(); eachBot.commandManager.reload();
} }

View file

@ -6,7 +6,7 @@ module.exports = {
trustLevel: 1, trustLevel: 1,
aliases:['rtp', 'teleportrandom', 'randomteleport'], aliases:['rtp', 'teleportrandom', 'randomteleport'],
usage:[""], usage:[""],
async execute (context) { execute (context) {
const bot = context.bot const bot = context.bot
const sender = context.source.player const sender = context.source.player
const source = context.source const source = context.source
@ -15,6 +15,6 @@ module.exports = {
const y = 100 const y = 100
const z = between(-1_000_000, 1_000_000) const z = between(-1_000_000, 1_000_000)
bot.tellraw("@a", `Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `) bot.tellraw("@a", `Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `)
bot.core.run(`tp ${sender.uuid} ${x} ${y} ${z}`) bot.core.run(`minecraft:tp ${sender.profile.name} ${x} ${y} ${z}`)
} }
} }

View file

@ -6,15 +6,40 @@ module.exports = {
], ],
description: 'Make me say something', description: 'Make me say something',
usages: [ usages: [
"<message>" "error stack <message>",
"error message <message>",
"message <message>"
], ],
execute (context) { execute (context) {
const bot = context.bot const bot = context.bot
const args = context.arguments; const args = context.arguments;
if (!args && !args[0] && !args[1]) return
switch (args[0]) { switch (args[0]) {
case 'error': case 'error':
throw new Error(args.slice(1).join(' ')); switch (args[1]) {
break case 'stack':
throw new Error(args.slice(2).join(' '));
break
case 'message':
throw new CommandError(args.slice(2).join(' '));
break
}
// throw new Error(args.slice(1).join(' '));
break;
case "message":
bot.tellraw("@a", [
{
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
color: 'gray',
bold: false
},
{
text: ` Args: ${args.slice(1).join(' ')}`,
color: 'gray',
bold: false,
}
])
break;
} }
} }
} }

View file

@ -32,10 +32,9 @@ module.exports = {
}); });
} else if (args.join(' ').toLowerCase().startsWith('https://')) { } else if (args.join(' ').toLowerCase().startsWith('https://')) {
https.get(args.join(' '), (res) => { https.get(args.join(' '), (res) => {
console.log('statusCode:', res.statusCode);
console.log('headers:', res.headers);
res.on('data', (d) => { res.on('data', (d) => {
bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", }) bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
}); });
}).on('error', (e) => { }).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`); bot.chat.message(`&4${e.toString()}`);

View file

@ -1,8 +1,6 @@
const { parseString } = require('xml2js'); const { parseString } = require('xml2js');
const CommandError = require('../util/command_error') const CommandError = require('../util/command_error')
const util = require('util'); const util = require('util');
const fs = require('fs');
const path = require('path');
module.exports = { module.exports = {
name: 'xml', name: 'xml',
trustLevel: 3, trustLevel: 3,
@ -14,20 +12,18 @@ module.exports = {
], ],
execute (context) { execute (context) {
const bot = context.bot; const bot = context.bot;
const args = context.arguments const args = context.arguments;
// fs.writeFileSync(path.join(__dirname, '../data/xmlEval.xml'), args.slice(1).join(' ')) parseString(args.slice(1).join(' '), function (err, result) {
fs.appendFileSync(path.join(__dirname, '../data/xmlEval.xml'), args.slice(1).join(' ')) if (err) throw new CommandError(err.toString())
parseString(args.slice(1).join(' '), function (err, result) { bot.tellraw("@a", [
if (err) throw new CommandError(err.toString()) {
bot.tellraw("@a", [ text: "Result \u203a \n",
{ color: "gray"
text: "Result \u203a \n", },
color: "gray" {
}, text: `${util.inspect(result)}`
{ }
text: `${util.inspect(result)}` ])
} });
])
});
} }
} }

662
src/data/bots.json Normal file
View file

@ -0,0 +1,662 @@
[
{
"name": {
"text": "HBot",
"color": "aqua",
"bold": false
},
"authors": [
"hhhzzzsss"
],
"exclaimer": "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO",
"foundation": "java/mcprotocollib",
"prefixes": [
"#"
]
},
{
"name": [
{
"text": "FBot",
"color": "gold"
}
],
"authors": [
"popbob/aaa"
],
"exclaimer": "",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"+"
]
},
{
"name": [
{
"text": "JokerBot",
"color": "green"
}
],
"authors": [
"zXzy",
"12alex12"
],
"exclaimer": "",
"foundation": "nodejs/mineflayer",
"prefixes": [
"\\"
]
},
{
"name": {
"text": "CddehhBot",
"color": "red",
"bold": false
},
"authors": [
"CaydennO1",
"spyingcreeper09"
],
"exclaimer": "WHAT IS THIS GOOFY AAAH FUCKING BOT FUCKING PIECE OF RETARDED ASS SHIT BOT ITS SO FUCKING SHIT I WANNA IPFILTER IT WITH FUCKING CHOMENS",
"foundation": "nodejs/mineflayer",
"prefixes": [
","
]
},
{
"name": {
"text": "TurtleBot",
"color": "green",
"bold": false
},
"authors": [
"TurtleKid"
],
"exclaimer": "nmp when?",
"foundation": "nodejs/mineflayer",
"prefixes": [
"\\"
]
},
{
"name": {
"text": "NothingBot",
"color": "dark_red",
"bold": false
},
"authors": [
"Yaode_owo"
],
"exclaimer": "uwu",
"foundation": "nodejs/mineflayer",
"prefixes": [
"?"
]
},
{
"name": {
"text": "SC09Bot",
"color": "dark_gray",
"bold": false
},
"authors": [
"spyingcreeper09"
],
"exclaimer": ":3",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"@"
]
},
{
"name": {
"text": "HorizonBot",
"color": "gold",
"bold": false
},
"authors": [
"ZenZoya",
"Yaode_owo",
"Parker2991",
"and others"
],
"exclaimer": "originally called §5FleamBot§r",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"^"
]
},
{
"name": {
"text": "64Bot",
"color": "gold",
"bold": false
},
"authors": [
"64Will64"
],
"exclaimer": "NINTENDO 64?!?!??!?! 69Bot when??????",
"foundation": "NodeJS/Mineflayer",
"prefixes": [
"w="
]
},
{
"name": {
"text": "Nebulabot",
"color": "dark_purple",
"bold": false
},
"authors": [
"IuCC"
],
"exclaimer": "the void",
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
"["
]
},
{
"name": [
{
"text": "Prism",
"color": "#00FF9C",
"bold": true
},
{
"text": "Bot",
"color": "white",
"bold": true
}
],
"authors": [
"IuCC"
],
"exclaimer": "prismarine :3",
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
"["
]
},
{
"name": {
"text": "SharpBot",
"color": "aqua",
"bold": false
},
"authors": [
"64Will64"
],
"exclaimer": "sharp as in the tv? idfk im out of jokes also the first c# bot on the list??",
"foundation": "C#/MineSharp",
"prefixes": [
"s="
]
},
{
"name": {
"text": "MoonBot",
"color": "red",
"bold": false
},
"authors": [
"64Will64"
],
"exclaimer": "stop mooning/mooing me ",
"foundation": "NodeJS/Mineflayer",
"prefixes": [
"m="
]
},
{
"name": {
"text": "TableBot",
"color": "yellow",
"bold": false
},
"authors": [
"12alex12"
],
"exclaimer": "TABLE CLOTH BOT?!?! ",
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
"t!"
]
},
{
"name": [
{
"text": "Evil",
"color": "dark_red",
"bold": false
},
{
"text": "Bot",
"color": "dark_purple"
}
],
"authors": [
"FusseligerDev"
],
"exclaimer": "",
"foundation": "Java/Custom",
"prefixes": [
"!"
]
},
{
"name": {
"text": "SBot Java",
"color": "white",
"bold": false
},
"authors": [
"evkc"
],
"foundation": "Java/MCProtocolLib",
"prefixes": [
":"
]
},
{
"name": {
"text": "SBot Rust",
"color": "white",
"bold": false
},
"authors": [
"evkc"
],
"foundation": "Rust",
"prefixes": [
"re:"
]
},
{
"name": {
"text": "Z-Boy-Bot",
"color": "dark_purple",
"bold": false
},
"exclaimer": "Most likely skidded along with kbot that the dev used",
"authors": [
"Romnci"
],
"foundation": "NodeJS/mineflayer or Java/mcprotocollib idfk",
"prefixes": [
"Z]"
]
},
{
"name": {
"text": "ABot",
"color": "gold",
"bold": true
},
"exclaimer": "not used anymore (replaced by V2)",
"authors": [
{
"text": "_yfd",
"color": "light_purple"
}
],
"foundation": "NodeJS/Node-Minecraft-Protocol",
"prefixes": [
"<"
]
},
{
"name": {
"text": "ABot-V2",
"color": "gold",
"bold": true
},
"exclaimer": "",
"authors": [
{
"text": "_yfd",
"color": "light_purple"
}
],
"foundation": "NodeJS/Node-Minecraft-Protocol",
"prefixes": [
"<"
]
},
{
"name": {
"text": "FardBot",
"color": "light_purple",
"bold": false
},
"authors": [
"_yfd"
],
"exclaimer": "bot is dead lol",
"foundation": "NodeJS/Mineflayer",
"prefixes": [
"<"
]
},
{
"name": {
"text": "ChipmunkBot Java",
"color": "green",
"bold": false
},
"authors": [
"_ChipMC_"
],
"exclaimer": "chips? also shoutout to chip and chayapak for helping in the rewrite",
"foundation": "Java/MCProtocolLib",
"prefixes": [
"'",
"/'"
]
},
{
"name": {
"text": "ChipmunkBot NodeJS",
"color": "green",
"bold": false
},
"authors": [
"_ChipMC_"
],
"foundation": "NodeJS/Node-Minecraft-Protocol"
},
{
"name": {
"text": "TestBot",
"color": "aqua",
"bold": false
},
"authors": [
"Blackilykat"
],
"foundation": "Java/MCProtocolLib",
"prefixes": [
"-"
]
},
{
"name": {
"text": "UBot",
"color": "gray",
"bold": false
},
"authors": [
"HexWoman"
],
"exclaimer": "UwU OwO",
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"\""
]
},
{
"name": {
"text": "ChomeNS Bot Java",
"color": "yellow",
"bold": false
},
"authors": [
"chayapak"
],
"exclaimer": "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak \n rip ChomeNS bot i wonder what chayapak is currently doing -- Parker2991",
"foundation": "Java/MCProtocolLib",
"prefixes": [
"*",
"cbot ",
"/cbot "
]
},
{
"name": {
"text": "ChomeNS Bot NodeJS",
"color": "yellow",
"bold": false
},
"authors": [
"chayapak"
],
"foundation": "NodeJS/Node-Minecraft-Protocol",
"prefixes": [
"*",
"cbot",
"/cbot"
]
},
{
"name": {
"text": "RecycleBot",
"color": "dark_green",
"bold": false
},
"foundation": [
"MorganAnkan"
],
"exclaimer": "nice bot",
"language": "NodeJS/node-minecraft-protocol",
"prefixes": [
"="
]
},
{
"name": {
"text": "neobot",
"color": "blue",
"bold": false
},
"exclaimer": "n e o b o t ;oslkdfj;salkdfj;ladsjf",
"authors": [
"mirkokral"
],
"foundation": "java/MCProtocolLib",
"prefixes": [
"_"
]
},
{
"name": {
"text": "ManBot",
"color": "dark_green",
"bold": false
},
"exclaimer": "(more like men bot :skull:) OH HAAAAAAAAAAAAAAIIILL LOGINTIMEDOUT",
"authors": [
"Man/LogintimedOut"
],
"foundation": "NodeJS/mineflayer",
"prefixes": [
"(Note:I dont remember!!)"
]
},
{
"name": [
{
"text": "Useless",
"color": "red",
"bold": false
},
{
"text": "Bot",
"color": "gray",
"bold": false
}
],
"exclaimer": "it isnt useless its a good bot................",
"authors": [
"IuCC"
],
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"["
]
},
{
"name": [
{
"text": "SnifferBot",
"color": "gold",
"bold": false
}
],
"exclaimer": "sniff sniff FNFBoyfriendBot simp",
"authors": [
"popbob/aaa"
],
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
">"
]
},
{
"name": [
{
"text": "XBot",
"color": "dark_purple",
"bold": false
}
],
"exclaimer": "",
"authors": [
"popbob/aaa"
],
"foundation": "ts-Node/Node-minecraft-protocol",
"prefixes": [
"$"
]
},
{
"name": [
{
"text": "Kitty",
"color": "gold",
"bold": false
},
{
"text": "Corp",
"color": "aqua",
"bold": false
},
{
"text": "Bot",
"color": "yellow",
"bold": false
}
],
"exclaimer": "3 words ginlang is gay",
"authors": [
"ginlang , G6_, ArrayBuffer, and i guess more??"
],
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"^"
]
},
{
"name": [
{
"text": "FNF",
"color": "dark_purple",
"bold": false
},
{
"text": "Boyfriend",
"color": "aqua",
"bold": false
},
{
"text": "Bot",
"color": "dark_red",
"bold": false
},
{
"text": " nmp",
"color": "black",
"bold": false
}
],
"authors": [
{
"text": "Parker2991",
"color": "dark_red"
},
{
"text": " _ChipMC_",
"color": "dark_green",
"bold": false
},
{
"text": " chayapak",
"color": "yellow",
"bold": false
},
{
"text": " _yfd",
"color": "light_purple",
"bold": false
},
{
"text": "popbob/aaa",
"color": "gold"
},
{
"text": "MorganAnkan",
"color": "dark_green"
},
{
"text": "TurtleKid",
"color": "green"
}
],
"exclaimer": "v4.0x - current",
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"~",
"fnfbfbot ",
"",
"",
"█"
]
},
{
"name": [
{
"text": "FNF",
"color": "dark_purple",
"bold": false
},
{
"text": "Boyfriend",
"color": "aqua",
"bold": false
},
{
"text": "Bot",
"color": "dark_red",
"bold": false
},
{
"text": " legacy",
"color": "green",
"bold": false
}
],
"authors": [
{
"text": "Parker2991",
"color": "dark_red"
},
{
"text": " _ChipMC_",
"color": "dark_green",
"bold": false
}
],
"exclaimer": "1037 LINES OF CODE WTFARD!??! also this version is in console commands only",
"foundation": "NodeJS/mineflayer",
"prefixes": []
}
]

View file

@ -1,2 +0,0 @@
<root> </root>
<sause></sauce><root> sex </root><root> sex </root><root> sex </root><root>sus</root><root<root> </root><root>sex</root><root> </root><root>sex</root><root><></root><root><></></root><root><amogus></amogus></root><root><amogus></amogus><sus></sus></root><root>hello :3</root><root>mewo</root><sex>gex</sex>

View file

@ -23,7 +23,6 @@ try {
const rl = readline.createInterface({ const rl = readline.createInterface({
input: process.stdin, input: process.stdin,
output: process.stdout, output: process.stdout,
// prompt: `Boot success! type ${config.console.prefix}help for a list of commands`
}) })
if (config.discord.enabled) discordClient.login(config.discord.token); if (config.discord.enabled) discordClient.login(config.discord.token);
const bots = []; const bots = [];
@ -34,3 +33,10 @@ for (const options of config.bots) {
loadModules(bot, options, config, discordClient); loadModules(bot, options, config, discordClient);
bot.console.useReadlineInterface(rl); bot.console.useReadlineInterface(rl);
} }
/*config.bots.filter((options) => {
const bot = createBot(options, config);
bots.push(bot);
bot.bots = bots;
loadModules(bot, options, config, discordClient);
bot.console.useReadlineInterface(rl);
})*/

View file

@ -39,6 +39,12 @@ function chat (bot, options, config) {
if (packet.type === 3) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.outgoing","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd()) if (packet.type === 3) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.outgoing","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
if (packet.type === 4) bot.emit('message', message); if (packet.type === 4) bot.emit('message', message);
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd()) if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
/* switch (packet.type) {
case "4":
bot.emit('message', message)
// console.log('packet type 4');
break
}*/
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine }) tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
}) })
@ -54,9 +60,9 @@ function chat (bot, options, config) {
bot.on('packet.system_chat', packet => { bot.on('packet.system_chat', packet => {
const message = tryParse(packet.content) const message = tryParse(packet.content)
if (config.commandSetMessage) {
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
}
bot.emit('system_chat', { message, actionbar: packet.isActionBar }) bot.emit('system_chat', { message, actionbar: packet.isActionBar })
if (packet.isActionBar) { if (packet.isActionBar) {
@ -88,22 +94,6 @@ function chat (bot, options, config) {
return undefined return undefined
} }
/*
bot.chat = message => {
const acc = 0
const bitset = Buffer.allocUnsafe(3)
bitset[0] = acc & 0xFF
bitset[1] = (acc >> 8) & 0xFF
bitset[2] = (acc >> 16) & 0xFF
bot._client.write('chat_message', {
message,
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
}
*/
bot.chat = { bot.chat = {
message: message => { message: message => {
const acc = 0; const acc = 0;
@ -122,7 +112,6 @@ function chat (bot, options, config) {
command: command => { command: command => {
bot._client.write('chat_command', { bot._client.write('chat_command', {
command: command?.substring(0, 256), command: command?.substring(0, 256),
timestamp: BigInt(Date.now()), timestamp: BigInt(Date.now()),
salt: 0n, salt: 0n,
argumentSignatures: [], argumentSignatures: [],
@ -133,22 +122,5 @@ function chat (bot, options, config) {
}) })
} }
} }
// console.log(bot.chat.sendMessage)
/*
bot.command = command => {
bot._client.write('chat_command', {
command,
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
}
*/
// bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here?
} }
module.exports = chat; module.exports = chat;

View file

@ -12,6 +12,8 @@ function core (bot, options, config) {
if (!pos) return if (!pos) return
if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
// if (isNaN(pos.x + start.x)) bot.chat.command('world 3');
// console.log(isNaN(pos.x + start.x))
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`) bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
}, },

View file

@ -91,6 +91,7 @@ function command_manager (bot, options, config, discordClient) {
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)
bot?.console?.filelogging(error.stack);
if (source?.sources?.discord && !source?.sources?.console) { if (source?.sources?.discord && !source?.sources?.console) {
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`) .setColor(`${config.colors.discord.error}`)
@ -104,7 +105,7 @@ function command_manager (bot, options, config, discordClient) {
} else if (!source?.sources?.discord && !source?.sources?.console) { } else if (!source?.sources?.discord && !source?.sources?.console) {
if (error instanceof CommandError) if (error instanceof CommandError)
bot.tellraw("@a", { text: error.message, color: "dark_red" }) bot.tellraw("@a", { text: error.message, color: "dark_red" })
else bot.tellraw("@a", bot.getMessageAsPrismarine({ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } })?.toMotd(bot.registry.language)) else bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
} }
} }
}, },
@ -146,6 +147,7 @@ function command_manager (bot, options, config, discordClient) {
bot.commandManager.commandlist.push(command) bot.commandManager.commandlist.push(command)
} catch (error) { } catch (error) {
console.error('Failed to load command', filename, ':', error) console.error('Failed to load command', filename, ':', error)
bot?.console.filelogging(error.stack)
} }
} }
let ratelimit = 0; let ratelimit = 0;
@ -169,22 +171,25 @@ function command_manager (bot, options, config, discordClient) {
}) })
}) })
bot.commandManager.reload = function () { bot.commandManager.reload = function () {
commandlist = []; //commandlist = [];
bot.commandManager.unregister(); // bot.commandManager.unregister();
bot.commandManager.commandlist = []; // bot.commandManager.commandlist = [];
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) { for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
try { try {
delete require.cache[require.resolve(path.join(__dirname, "../commands", filename))] // bot.commandManager.unregister();
const command = require(path.join(__dirname, "../commands", filename)); delete require.cache[require.resolve(path.join(__dirname, "../commands/", filename))]
// bot.commandManager.unregister(command); const command = require(path.join(__dirname, "../commands/", filename));
// this.commands = {}; // bot.commandManager.unregister();
// delete require.cache[require.resolve(path.join(__dirname, "../commands", filename))]
// bot.commandManager.register(command);
// bot.commandManager.commandlist.push(command);
bot.commandManager.register(command); bot.commandManager.register(command);
// bot.commandManager.commandlist.pop(command); bot.commandManager.commandlist.pop(command)
// bot.commandManager.register(command);
bot.commandManager.commandlist.push(command) bot.commandManager.commandlist.push(command)
} catch (error) { } catch (error) {
bot.console.error(["Failed to load File ", filename, ":", error.stack]) // bot.console.error(["Failed to load File ", filename, ":", error.stack])
bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" }) bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" })
bot?.console?.filelogger(error.stack);
} }
} }
} }

View file

@ -9,9 +9,9 @@ function CommandConsole (bot, options, config) {
rl.on('line', line => { rl.on('line', line => {
if (bot.options.serverName !== this.consoleServer && this.consoleServer !== 'all') return if (bot.options.serverName !== this.consoleServer && this.consoleServer !== 'all') return
if (line.startsWith(config.console.prefix)) { if (line.startsWith(config.console.prefix)) {
return bot.commandManager.executeString(bot.console.source, line.substring(2)) return bot.commandManager.executeString(bot.console.source, line.substring(config.console.prefix.length))
} if (line.startsWith("")) { } if (line.startsWith("")) {
return bot.commandManager.executeString(bot.console.source, `echo ${line.substring(0)}`) return bot.commandManager.executeString(bot.console.source, `console say ${line.substring(0)}`)
} }
}) })
@ -43,6 +43,34 @@ function CommandConsole (bot, options, config) {
bot.console.error = function (message) { bot.console.error = function (message) {
console.log(ChatMessage.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + message) console.log(ChatMessage.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
} }
bot.console.customChat = {
enabled: false,
chat (message) {
const prefix = {
translate: '[%s] %s \u203a %s',
color:'dark_gray',
with: [
{
text: 'FNFBoyfriendBot Console',
color:'#00FFFF'
},
{
selector: `${bot.username}`, color:'#00FFFF',
clickEvent: { action: 'suggest_command', value: '~help' }
},
{
text: '',
extra: [`${message}`],
color:'white'
},
],
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
clickEvent: 'https://doin-your.mom' ?
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
}
bot.tellraw('@a', prefix)
}
}
bot.on('message', message => { bot.on('message', message => {
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt") const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
const string = bot.getMessageAsPrismarine(message)?.toString(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt") const string = bot.getMessageAsPrismarine(message)?.toString(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")

View file

@ -53,7 +53,7 @@ function discord(bot, options, config, discordClient) {
function sendComponent(message) { function sendComponent(message) {
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('```\u001b[9```' + '```\u001b[3```').replaceAll('https://discord','https:\rdiscord')?.replaceAll('discord.gg', 'discord.\rgg').replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt"); const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('```\u001b[9```' + '```\u001b[3```').replaceAll('https://discord','https:\rdiscord')?.replaceAll('discord.gg', 'discord.\rgg').replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt");
try { try {
sendDiscordMessage(fixansi(ansi.replaceAll('`', '`\u200b'))) sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
} catch (e) { } catch (e) {
bot.console.error(`Error sending a message to Discord:\n${e.message}`) bot.console.error(`Error sending a message to Discord:\n${e.message}`)
sendDiscordMessage(e.message) sendDiscordMessage(e.message)

View file

@ -15,15 +15,6 @@ function consolefilelogger(bot, options, message) {
if (!fs.existsSync(path.join(__dirname, "../../logs"))) { if (!fs.existsSync(path.join(__dirname, "../../logs"))) {
fs.mkdirSync(path.join(__dirname, "../../logs")) fs.mkdirSync(path.join(__dirname, "../../logs"))
} }
/*
const {
createReadStream,
createWriteStream,
} = require('node:fs');
*/
// if (!bot.Console.filelogging) return;
// ${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })}
// if (new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", }) === "10:45:00 PM") process.exit("daily reset");
try { try {
if (!fs.existsSync(logFolder)) { if (!fs.existsSync(logFolder)) {
fs.mkdirSync(logFolder); fs.mkdirSync(logFolder);
@ -60,38 +51,10 @@ const {
newFileName = path.join(logFolder, `${name}.log.gz`); newFileName = path.join(logFolder, `${name}.log.gz`);
counter++; counter++;
} }
// if (plainName !== timestamp) {
compressFile(logFilePath, newFileName); compressFile(logFilePath, newFileName);
// }
} }
// console?.info(
// `File logging: ${bot.Console.filelogging ? "enabled" : "disabled"}`
// );
// if (!bot.Console.filelogging) return; // instead of using bot why not just use options cause you already defined it
// if (toFile) logStream.write(toWrite + '\n');
bot.console.filelogging = function logging (message) { bot.console.filelogging = function logging (message) {
logStream.write(message + "\n"); // toFile is not defined logStream.write(message + "\n");
}; };
// console.log(process.stdin.setEncoding('utf-8'))
} }
/*
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
*/
module.exports = consolefilelogger; module.exports = consolefilelogger;
/*
child.stdin.setEncoding('utf-8');
child.stdout.pipe(process.stdout);
child.stdin.write("console.log('Hello from PhantomJS')\n");
child.stdin.end();
*/

View file

@ -33,6 +33,8 @@ function selfcare (bot, options, config) {
} }
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
else if (stringMessage === `You already have the username "${bot.username}"`) username = false else if (stringMessage === `You already have the username "${bot.username}"`) username = false
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage.startsWith('Your nickname is now ')) nickname = true;
}) })
bot.on('packet.entity_status', packet => { bot.on('packet.entity_status', packet => {
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
@ -43,34 +45,31 @@ function selfcare (bot, options, config) {
gameMode = packet.gameMode; gameMode = packet.gameMode;
}); });
bot.on("packet.game_state.change", packet => { bot.on("packet.game_state.change", packet => {
if (packet.reason !== 4) return // checks if the client is locked if (packet.reason !== 4) return // checks if the bot is seeing the endcredits or died
clientLock = packet.gameMode; clientLock = packet.gameMode;
}) })
let timer; let timer;
bot.on('packet.login', (packet) => { bot.on('packet.login', (packet) => {
entityId = packet.entityId; entityId = packet.entityId;
gameMode = packet.gameMode; gameMode = packet.gameMode;
clientLock = packet.gameMode; clientLock = packet.gameMode;
// console.log(packet.gameMode); timer = setInterval(() => {
timer = setInterval(() => { if (bot.options.isSavage && !bot.options.isKaboom) {
if (bot.options.isSavage && !bot.options.isKaboom) { if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 }); } else if (bot.options.isKaboom && !bot.options.isSavage) {
} else if (bot.options.isKaboom && !bot.options.isSavage) { if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
if (permissionLevel < 2) bot.chat.command('op @s[type=player]'); else if (gameMode !== 1) bot.chat.command('gamemode creative @s[type=player]');
else if (gameMode !== 1) bot.chat.command('gamemode creative @s[type=player]'); else if (!commandSpy) bot.chat.command('commandspy on');
else if (!commandSpy) bot.chat.command('commandspy on'); else if (username) bot.chat.command(`username ${bot.options.username}`)
else if (username) bot.chat.command(`username ${bot.options.username}`) else if (nickname) bot.chat.command(`nick off`)
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`); else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
else if (!vanished) bot.core.run(`vanish ${bot.options.username} on`); else if (!vanished) bot.core.run(`vanish ${bot.options.username} on`);
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`); else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
else if (!god) bot.core.run(`god ${bot.options.username} enable`); else if (!god) bot.core.run(`god ${bot.options.username} enable`);
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`); else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 }); else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
// else if (username) bot.chat.command(`username ${bot.options.username}`) }
// else if (unmuted) bot.chat.command(`mute ${bot.options.username} 0s`); }, 1000);
// else if (unmuted) bot.core.run(`/essentials:mute ${bot.options.username}`);
}
}, 1000);
}); });
bot.on('end', () => { bot.on('end', () => {
if (timer) clearInterval(timer) if (timer) clearInterval(timer)

View file

@ -1,5 +1,5 @@
// TODO: Improve how messages are stringified // TODO: Improve how messages are stringified
const ChatMessage = require('prismarine-chat')('1.20.1') const ChatMessage = require('prismarine-chat')('1.20.2')
const stringify = message => new ChatMessage(message).toString() const stringify = message => new ChatMessage(message).toString()
class CommandError extends Error { class CommandError extends Error {

View file

@ -3,12 +3,5 @@ class CommandSource {
this.player = player; this.player = player;
this.sources = sources; this.sources = sources;
} }
/* sendFeedback () {}
sendError (message) {
this.sendFeedback([{ text: '', color: 'dark_red' }, message], false)
}*/
} }
module.exports = CommandSource module.exports = CommandSource

View file

@ -1,6 +1,6 @@
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const path = require("path");
const readline = require("readline"); //const readline = require("readline");
function loadModules (bot, options, config, discordClient) { function loadModules (bot, options, config, discordClient) {
bot.loadModule = module => module(bot, options, config, discordClient) bot.loadModule = module => module(bot, options, config, discordClient)