diff --git a/.bot.js.3332916295~ b/.bot.js.3332916295~ new file mode 100644 index 0000000..5e601f7 --- /dev/null +++ b/.bot.js.3332916295~ @@ -0,0 +1,147 @@ +const mc = require("minecraft-protocol"); +const { EventEmitter } = require("node:events"); +const fs = require("fs"); +const path = require("path"); +const util = require("node:util"); +console.log(`Starting ${process.env["buildstring"]} .......`); +console.log(`Foundation: ${process.env["FoundationBuildString"]}`); +console.log("this may take a few moments...."); +require("events").EventEmitter.defaultMaxListeners = 30; +function createBot(options = {}) { + const bot = new EventEmitter(); + const rs = require("randomstring"); + // Set some default values in options + let r = Math.floor(Math.random() * 255) + 1; + options.host ??= "localhost"; + options.username ??= "FNFBoyfriendBot"; + options.hideErrors ??= false; // HACK: Hide errors by default as a lazy fix to console being spammed with them + options.console ??= true; + options.input ??= true; + + options.commands.MainPrefix ??= "~"; + options.commands.SecondaryPrefix ??= "%"; + options.commands.TertiaryPrefix ??= "&"; + options.selfcare.unmuted ??= true; + + options.selfcare.vanished ??= true; + + options.selfcare.prefix ??= true; + + options.selfcare.skin ??= true; + + options.selfcare.cspy ??= true; + + options.selfcare.op ??= true; + + options.selfcare.gmc ??= true; + + options.selfcare.interval ??= 500; + + options.selfcare.username ??= true; + + options.selfcare.nickname ??= true; + + options.selfcare.god ??= true; + + options.selfcare.tptoggle ??= true; + + options.discord.commandPrefix ??= "~"; + + options.reconnectDelay ??= 1000; + + bot.options = options; + + // Create our client object, put it on the bot, and register some events + bot.on("init_client", (client) => { + client.on("packet", (data, meta) => { + bot.emit("packet", data, meta); + bot.emit("packet." + meta.name, data); + }); + + client.on("login", async function (data) { + bot.uuid = client.uuid; + bot.username = client.username; + bot.entityId = data.entityId; + bot.host = bot.options.host; + bot.port = bot.options.port; + bot.buildstring = process.env["buildstring"]; + bot.fbs = process.env["FoundationBuildString"]; + bot.version = bot.options.version; + console.log(`Username: ${bot.options.username}`); + console.log(`Host: ${bot.options.host}:${bot.options.port}`); + console.log(`Minecraft java version: ${bot.options.version}`); + /* console.log(`Username: ${bot.username}`) + console.log(`Host: ${bot.host}:${bot.port}`) + console.log(`Minecraft java version: ${bot.version}`)*/ + }); + //reason, fullReason + client.on("end", (reason) => { + bot.emit("end", reason); + console.log(reason); + }); + client.on("disconnect", (reason) => { + bot.emit("disconnect", reason); + console.log(reason); + }); + + client.on("kick_disconnect", (reason) => { + bot.emit("kick_disconnect", reason); + console.log(reason); + }); + client.on("keep_alive", ({ keepAliveId }) => { + bot.emit("keep_alive", { keepAliveId }); + // console.log(keepAliveId) + }); + + client.on("error", (error) => bot.emit("error", error)); + + //client.end(reason, fullReason) + }); + /* + bot._client.on('kick_disconnect', (data) => { + const parsed = JSON.parse(data.reason) + bot.end(parsed, 'kick_disconnect') + }) + + */ + const buildstring = process.env["buildstring"]; + + const client = options.client ?? mc.createClient(options); + bot._client = client; + bot.emit("init_client", client); + + bot.bots = options.bots ?? [bot]; + //bot.setMaxListeners(Infinity) + //bot._client.setMaxListeners(Infinity) + + // Modules + bot.loadModule = (module) => module(bot, options); + + for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) { + try { + const module = require(path.join(__dirname, "modules", filename)); + bot.loadModule(module); + //console.log(filename.length); + } catch (error) { + console.error( + "\x1b[0m\x1b[91m[ERROR]: \x1b[0m\x1b[90mFailed to load module", + filename, + ":", + error, + ); + } + } + + return bot; +} //path.join(__dirname, 'modules', filename) +//path.join(amonger + 'FridayNightFunkinBoyfriendBot') !== path.join(amonger) +//fs.stat +const amonger = "../"; +if (fs.existsSync("../FridayNightFunkinBoyfriendBot") == false) { + process.exit(1); +} +//path.join('') != fs. existsSync('~/FridayNightFunkinBoyfriendBot/index.js') + +// ABot username function mabe mabe + +module.exports = createBot; diff --git a/.index.js.3066437094~ b/.index.js.3066437094~ new file mode 100644 index 0000000..a52b5b7 --- /dev/null +++ b/.index.js.3066437094~ @@ -0,0 +1,74 @@ +const util = require('util') +const createBot = require('./bot.js') +//const chomensjs = require('./ChomensJS') +// TODO: Load a default config +const fs = require('fs/promises') +const fileExist = require('./util/file-exists') +const path = require('path') + +function load () { +//const config = require('./config.js') +const readline = require('readline') + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, +}) +require('dotenv').config() +const bots = [] + for (const options of config.bots) { + const bot = createBot(options) + bots.push(bot) + bot.bots = bots + bot.options.username + bot.console.useReadlineInterface(rl) + +// bot.on('error', (error), util.inspect(error)) + + try{ +bot.on('error', console.error) + }catch(error){ + + console.log(error.stack) + } +} +} +async function checkConfig () { + if (!await fileExist(path.join(__dirname, 'config.js'))) { + console.error('Config not found! Creating a new Config from ') + await fs.copyFile(path.join(__dirname, 'default.js'), path.join(__dirname, 'config.js')) + } if (await fileExist(path.join(__dirname, 'config.js'))){ + console.log('Config found! loading config please wait,......') + } + + config = require('./config.js') + load() +} + +checkConfig() + +const modules = "./modules"; +const util = "./util"; +const CommandModules = "./CommandModules"; +const commands = "./commands"; +const chat = "./chat"; +fs.readdir(util, (err, files) => { + console.log("Successfully loaded: " + files.length + " util files"); +}); +fs.readdir(modules, (err, files) => { + console.log("Successfully loaded: " + files.length + " module files"); +}); +fs.readdir(commands, (err, files) => { + console.log("Successfully loaded: " + files.length + " command files"); +}); +fs.readdir(CommandModules, (err, files) => { + console.log("Successfully loaded: " + files.length + " CommandModule files"); +}); +fs.readdir(chat, (err, files) => { + console.log("Successfully loaded: " + files.length + " chat files"); +}); + +process.on('uncaughtException', (e) => { + console.log('uncaught ' + e.stack) +}) + diff --git a/bot.js b/bot.js index c8743e7..3be71d6 100644 --- a/bot.js +++ b/bot.js @@ -1,176 +1,111 @@ -const mc = require('minecraft-protocol') -const { EventEmitter } = require('node:events') -const fs = require('fs') -const path = require('path') -const util = require('node:util') -console.log(`Starting ${process.env["buildstring"]} .......`) - console.log(`Foundation: ${process.env["FoundationBuildString"]}`) -console.log('this may take a few moments....') -require('events').EventEmitter.defaultMaxListeners = 20; - function createBot(options = {}) { - const bot = new EventEmitter() -const rs = require('randomstring') +const mc = require("minecraft-protocol"); +const { EventEmitter } = require("node:events"); +const fs = require("fs"); +const path = require("path"); +const util = require("node:util"); +console.log(`Starting ${process.env["buildstring"]} .......`); +console.log(`Foundation: ${process.env["FoundationBuildString"]}`); +console.log("this may take a few moments...."); +require("events").EventEmitter.defaultMaxListeners = 30; +function createBot(options = {}) { + const bot = new EventEmitter(); + const rs = require("randomstring"); // Set some default values in options - let r = Math.floor(Math.random() * 255) + 1; - options.host ??= 'localhost' - options.username ??= 'FNFBoyfriendBot' - options.hideErrors ??= false // HACK: Hide errors by default as a lazy fix to console being spammed with them - options.console ??= true -options.input ??= true -//options.logger ??= true - // MainPrefix: "~", - // SecondaryPrefix:'%', - //TertiaryPrefix:'@' - - options.commands.MainPrefix ??= '!' - options.commands.SecondaryPrefix ??= '!' - options.commands.TertiaryPrefix ??= '!' - options.selfcare.unmuted ??= true - - options.selfcare.vanished ??= true - - options.selfcare.prefix ??= true - - options.selfcare.skin ??= true - - options.selfcare.cspy ??= true - - options.selfcare.op ??= true - - options.selfcare.gmc ??= true - - options.selfcare.interval ??= 500 - - options.Core.core ??= true - - - - options.discord.commandPrefix ??= '!' - - options.reconnectDelay ??= 1000 - - options.Core.customName ??= '@' - - options.selfcare.username ??= true - - options.selfcare.nickname ??= true - - options.selfcare.god ??= true - - options.selfcare.tptoggle ??= true - bot.options = options + let r = Math.floor(Math.random() * 255) + 1; + options.host ??= "localhost"; + options.username ??= "FNFBoyfriendBot"; + options.hideErrors ??= false; // HACK: Hide errors by default as a lazy fix to console being spammed with them + options.console ??= true; + options.input ??= true; + + options.commands.MainPrefix ??= "~"; + options.commands.SecondaryPrefix ??= "%"; + options.commands.TertiaryPrefix ??= "&"; + options.selfcare.unmuted ??= true; + + options.selfcare.vanished ??= true; + + options.selfcare.prefix ??= true; + + options.selfcare.skin ??= true; + + options.selfcare.cspy ??= true; + + options.selfcare.op ??= true; + + options.selfcare.gmc ??= true; + + options.selfcare.interval ??= 500; + + options.selfcare.username ??= true; + + options.selfcare.nickname ??= true; + + options.selfcare.god ??= true; + + options.selfcare.tptoggle ??= true; + + options.discord.commandPrefix ??= "~"; + + options.reconnectDelay ??= 1000; + + bot.options = options; // Create our client object, put it on the bot, and register some events - bot.on('init_client', client => { - client.on('packet', (data, meta) => { - bot.emit('packet', data, meta) - bot.emit('packet.' + meta.name, data) - }) + bot.on("init_client", (client) => { + client.on("packet", (data, meta) => { + bot.emit("packet", data, meta); + bot.emit("packet." + meta.name, data); + }); - client.on('login', async function (data) { - - bot.uuid = client.uuid - bot.username = client.username - bot.entityId = data.entityId - bot.host = bot.options.host - bot.port = bot.options.port - bot.buildstring = process.env['buildstring'] - bot.fbs = process.env['FoundationBuildString'] - bot.version = bot.options.version - console.log(`Username: ${bot.options.username}`) - console.log(`Host: ${bot.options.host}:${bot.options.port}`) - console.log(`Minecraft java version: ${bot.options.version}`) - /* console.log(`Username: ${bot.username}`) - console.log(`Host: ${bot.host}:${bot.port}`) - console.log(`Minecraft java version: ${bot.version}`)*/ - }) - //reason, fullReason - client.on('end', reason => { bot.emit('end', reason) - console.log(reason) - - }) - client.on('disconnect', reason => { - bot.emit('disconnect', reason) - console.log(reason) - }) - - client.on('kick_disconnect', reason => { - bot.emit('kick_disconnect', reason) - console.log(reason) - }) - client.on('keep_alive', ({ keepAliveId }) => { - bot.emit('keep_alive', { keepAliveId }) - // console.log(keepAliveId) - }) - - client.on('error', error => bot.emit('error', error), ) - - //client.end(reason, fullReason) - - }) - /* - bot._client.on('kick_disconnect', (data) => { - const parsed = JSON.parse(data.reason) - bot.end(parsed, 'kick_disconnect') - }) + client.on("login", async function (data) { + bot.uuid = client.uuid; + bot.username = client.username; + bot.port = bot.options.port; + bot.version = bot.options.version; + console.log(`Username: ${bot.options.username}`); + console.log(`Host: ${bot.options.host}:${bot.options.port}`); + console.log(`Minecraft java version: ${bot.options.version}`); + + }); - */ -const buildstring = process.env['buildstring'] + client.on("end", (reason) => { + bot.emit("end", reason); + console.log(reason); + bot.cloop.clear() + bot.memusage.off() + }); + client.on("disconnect", (reason) => { + bot.emit("disconnect", reason); + console.log(reason); + }); + + client.on("kick_disconnect", (reason) => { + bot.emit("kick_disconnect", reason); + console.log(reason); + }); + client.on("keep_alive", ({ keepAliveId }) => { + bot.emit("keep_alive", { keepAliveId }); + }); + + client.on("error", (error) => bot.emit("error", error)); + }); - const client = options.client ?? mc.createClient(options) - bot._client = client - bot.emit('init_client', client) - bot.bots = options.bots ?? [bot] - //bot.setMaxListeners(Infinity) - //bot._client.setMaxListeners(Infinity) + const client = options.client ?? mc.createClient(options); + bot._client = client; + bot.emit("init_client", client); + + bot.bots = options.bots ?? [bot]; + - // Modules - bot.loadModule = module => module(bot, options) - for (const filename of fs.readdirSync(path.join(__dirname, 'modules'))) { - try { - const module = require(path.join(__dirname, 'modules', filename)) - bot.loadModule(module) - //console.log(filename.length); - } catch (error) { - console.error('\x1b[0m\x1b[91m[ERROR]: \x1b[0m\x1b[90mFailed to load module', filename, ':', error) - - } - } - - return bot -}//path.join(__dirname, 'modules', filename) - //path.join(amonger + 'FridayNightFunkinBoyfriendBot') !== path.join(amonger) -//fs.stat - const amonger = '../' - if (fs.existsSync('../FridayNightFunkinBoyfriendBot') == false) { - process.exit(1) - } -//path.join('') != fs. existsSync('~/FridayNightFunkinBoyfriendBot/index.js') + return bot; +} +const amonger = "../"; +if (fs.existsSync("../FridayNightFunkinBoyfriendBot") == false) { + process.exit(1); +} - const modules = './modules'; -const util2 = './util'; -const CommandModules = './CommandModules'; -const commands = './commands'; -const chat = './chat' - fs.readdir(util2, (err, files) => { - console.log('Successfully loaded: ' + files.length + ' util files'); - }); - fs.readdir(modules, (err, files) => { - console.log('Successfully loaded: ' + files.length + ' module files'); - }); -fs.readdir(commands, (err, files) => { - console.log('Successfully loaded: ' + files.length + ' command files'); - }); -fs.readdir(CommandModules, (err, files) => { - console.log('Successfully loaded: ' + files.length + ' CommandModule files'); - }); -fs.readdir(chat, (err, files) => { - console.log('Successfully loaded: ' + files.length + ' chat files'); - }); - -// ABot username function mabe mabe - -module.exports = createBot +module.exports = createBot; diff --git a/commands/botsrun.js b/botsrun.js similarity index 100% rename from commands/botsrun.js rename to botsrun.js diff --git a/modules/bruhifytellraw.js b/bruhifytellraw.js similarity index 100% rename from modules/bruhifytellraw.js rename to bruhifytellraw.js diff --git a/modules/bruhifytitle.js b/bruhifytitle.js similarity index 100% rename from modules/bruhifytitle.js rename to bruhifytitle.js diff --git a/commands/calculator.js b/calculator.js similarity index 100% rename from commands/calculator.js rename to calculator.js diff --git a/commands/botdevhistory.js b/commands/botdevhistory.js deleted file mode 100644 index 266a9ad..0000000 --- a/commands/botdevhistory.js +++ /dev/null @@ -1,15 +0,0 @@ -const CommandError = require('../CommandModules/command_error') - -module.exports = { - name: 'botdevhistory', - description:['bots dev history'], - -trustLevel: 0, - execute (context) { - - const message = context.arguments.join(' ') - const bot = context.bot -var prefix = '&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r ' - bot.core.run('bcraw ' + prefix + 'Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!') - } -} diff --git a/commands/bots.js b/commands/bots.js index ccb4519..45d7bb2 100644 --- a/commands/bots.js +++ b/commands/bots.js @@ -1,244 +1,306 @@ - // TODO: Maybe add more authors +// TODO: Maybe add more authors const bots = [ { - name: { text: 'HBot', color: 'aqua', bold:false }, - authors: ['hhhzzzsss'], - exclaimer:'HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO', - foundation: 'java/mcprotocollib', - prefixes: ['#'] + name: { text: "HBot", color: "aqua", bold: false }, + authors: ["hhhzzzsss"], + exclaimer: "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO", + foundation: "java/mcprotocollib", + prefixes: ["#"], }, { - name: { text: '64Bot', color: 'gold', bold:false }, - authors: ['64Will64'], - exclaimer:'NINTENDO 64?!?!??!?! 69Bot when??????', - foundation: 'NodeJS/Mineflayer', - prefixes: ['w='] + 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: "Nebulabot", color: "dark_purple", bold: false }, + authors: ["IuCC"], + exclaimer: "the void", + 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: "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: "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: "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: "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: "SBot Java", color: "white", bold: false }, // TODO: Gradient + authors: ["evkc"], + foundation: "Java/MCProtocolLib", + 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: "SBot Rust", color: "white", bold: false }, // TODO: Gradient + authors: ["evkc"], + foundation: "Rust", + prefixes: ["re:"], }, { - name: { text: 'FardBot', color: 'light_purple', bold:false }, - authors: ['_yfd'], - exclaimer: 'bot is dead lol', - foundation: 'NodeJS/Mineflayer', - prefixes: ['<'] - }, - - { - name: { text: 'ChipmunkBot', 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: "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: 'ChipmunkBot Old', 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: 'grey', bold:false }, - authors: ['HexWoman'], - exclaimer: 'UwU OwO', - - foundation: 'NodeJS/node-minecraft-protocol', - prefixes: ['"'] + 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: 'ChomeNS Bot Java', color: 'yellow', bold:false}, - authors: ['chayapak'], - exclaimer: 'wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak', - foundation: 'Java/MCProtocolLib', - prefixes: ['*', 'cbot ', '/cbot '] + 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: 'ChomeNS Bot NodeJS', color: 'yellow', bold:false}, - authors: ['chayapak'], - foundation: 'NodeJS/Node-Minecraft-Protocol', - prefixes: ['*', 'cbot', '/cbot'] + { + 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: 'RecycleBot', color: 'dark_green', bold:false}, - foundation: ['MorganAnkan'], - exclaimer: 'nice bot', - language: 'NodeJS/node-minecraft-protocol', - prefixes: ['='] + name: { text: "ChipmunkBot NodeJS", color: "green", bold: false }, + authors: ["_ChipMC_"], + foundation: "NodeJS/Node-Minecraft-Protocol", }, { - 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: "TestBot", color: "aqua", bold: false }, + authors: ["Blackilykat"], + foundation: "Java/MCProtocolLib", + prefixes: ["-"], }, { - 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: "UBot", color: "grey", bold: false }, + authors: ["HexWoman"], + exclaimer: "UwU OwO", + + foundation: "NodeJS/node-minecraft-protocol", + prefixes: ['"'], }, { - name: [{ text: 'Blurry', color: 'dark_purple' , bold:false}, { text: 'Bot', color: 'red' }], - exclaimer: '', - authors: ['SirLennox'], - foundation: 'Java/custom', - prefixes: [','] + name: { text: "ChomeNS Bot Java", color: "yellow", bold: false }, + authors: ["chayapak"], + exclaimer: "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak", + foundation: "Java/MCProtocolLib", + prefixes: ["*", "cbot ", "/cbot "], }, { - name: [{ text: 'SnifferBot', color: 'gold' , bold:false}], - exclaimer: 'sniff sniff', - authors: ['Seasnail8169'], - foundation: 'NodeJS/Node-minecraft-protocol', - prefixes: ['>'] - }, - { - name: [{ text: 'KittyCorp', color: 'yellow', bold:false }, { text: 'Bot', color: 'yellow' }], - 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:' Node-Minecraft-Protocol', 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}], - exclaimer: 'FNFBoyfriendBot NMP Rewrite', - foundation: 'NodeJS/node-minecraft-protocol', - prefixes: ['~'] + name: { text: "ChomeNS Bot NodeJS", color: "yellow", bold: false }, + authors: ["chayapak"], + + foundation: "NodeJS/Node-Minecraft-Protocol", + prefixes: ["*", "cbot", "/cbot"], }, { - name: [{ text:'FNF', color: 'dark_purple', bold: false}, {text:'Boyfriend', color: 'aqua', bold:false}, {text:'Bot', color:'dark_red', bold:false}, {text:' Mineflayer', 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: [] - } -] + 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: "", + authors: ["SirLennox"], + foundation: "Java/custom", + prefixes: [","], + }, + { + name: [{ text: "SnifferBot", color: "gold", bold: false }], + exclaimer: "sniff sniff FNFBoyfriendBot simp", + authors: ["popbob"], + foundation: "NodeJS/Node-minecraft-protocol", + prefixes: [">"], + }, + { + name: [{ text: "XBot", color: "dark_purple", bold: false }], + exclaimer: "", + authors: ["popbob"], + 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", color: "gold" }, + ], + exclaimer: "FNFBoyfriendBot NMP Rewrite", + 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: " 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: [], + }, +]; module.exports = { - name: 'bots', - description:['shows a list of known bots'], - aliases:['knownbots'], - trustLevel: 0, - execute (context) { - const query = context.arguments.join(' ').toLowerCase() -const bot = context.bot + name: "bots", + description: ["shows a list of known bots"], + aliases: ["knownbots"], + trustLevel: 0, + execute(context) { + const query = context.arguments.join(" ").toLowerCase(); + const bot = context.bot; if (query.length === 0) { - const list = [] + const list = []; for (const info of bots) { - if (list.length !== 0) list.push({ text: ', ', color: 'gray' })// list.push(info.name) - list.push(info.name) - + if (list.length !== 0) list.push({ text: ", ", color: "gray" }); // list.push(info.name) + list.push(info.name); } - context.source.sendFeedback(['Known bots (', bots.length, ') - ', ...list], false) - return + context.source.sendFeedback( + ["Known bots (", bots.length, ") - ", ...list], + false, + ); + return; } for (const info of bots) { - const plainName = String(context.bot.getMessageAsPrismarine(info.name)).toLowerCase() - if (plainName.includes(query)) this.sendBotInfo(info, context.bot) + const plainName = String( + context.bot.getMessageAsPrismarine(info.name), + ).toLowerCase(); + if (plainName.includes(query)) this.sendBotInfo(info, context.bot); } }, - sendBotInfo (info, bot) { - const component = [''] - component.push('Name: ', info.name) - if (info.exclaimer) component.push('\n', 'Exclaimer: ', info.exclaimer) + sendBotInfo(info, bot) { + const component = [""]; + component.push("Name: ", info.name); + if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer); if (info.authors && info.authors.length !== 0) { - component.push('\n', 'Authors: ') + component.push("\n", "Authors: "); for (const author of info.authors) { - component.push(author, { text: ', ', color: 'gray' }) + component.push(author, { text: ", ", color: "gray" }); } - component.pop() + component.pop(); } - if (info.foundation) component.push('\n', 'Foundation: ', info.foundation) + if (info.foundation) component.push("\n", "Foundation: ", info.foundation); if (info.prefixes && info.prefixes.length !== 0) { - component.push('\n', 'Prefixes: ') + component.push("\n", "Prefixes: "); for (const prefix of info.prefixes) { - component.push(prefix, { text: ', ', color: 'gray' }) + component.push(prefix, { text: ", ", color: "gray" }); } - component.pop() + component.pop(); } - bot.tellraw([component]) - } -}//it doing it just for the ones i added lol + bot.tellraw([component]); + }, +}; //it doing it just for the ones i added lol // prob a replit moment, it probably thinks there are regexes in the strings diff --git a/commands/changelog.js b/commands/changelog.js index 49bbf99..1908ac3 100644 --- a/commands/changelog.js +++ b/commands/changelog.js @@ -29,11 +29,18 @@ const bots = [ exclaimer:'fixed the issue with the cpu checking in the info command added discord hashing back into the bot to work along side the keys made it check to see if the config file is in the directory and if not it will recreate the config from default.js', }, {// - name: { text: 'v5.0.3', color: 'gray', bold:false }, + name: { text: 'v5.0.3', color: 'green', bold:false }, authors: [''], foundation: '12/29/23', exclaimer:'mabe the bot last update of 2023 cuz next year will be 2024 www but anyway expanded the disconnect messages for both console and discord but thats pretty much it', + }, + {// + name: { text: 'v5.0.4', color: 'green', bold:false }, + authors: [''], + + foundation: '1/12/24', + exclaimer:'first update of 2024 for the bot but anyway merged the test and errortest commands into cmdtest, changed the colors for the help command public is #00FFFF, trusted is dark_purple and owner remained as dark red. moved the module loader from bot.js to index.js to split the boot time in half which now allows module functions like bot.chat() to be used in bot.js and also since the command manager is a module it also loads the commands thats a w on all ends also removed some modules to improve the bots boot time and moved the functions for the sctoggle command into the command itself and not as a module which helped the boot time as well and last but not least merged the memused usage in the info command with the serverinfo usage and made the memusage command use the bossbar and not the actionbar', }, ]// //back diff --git a/commands/test.js b/commands/cmdtest.js similarity index 67% rename from commands/test.js rename to commands/cmdtest.js index 571ec16..9be7c66 100644 --- a/commands/test.js +++ b/commands/cmdtest.js @@ -1,10 +1,10 @@ const CommandError = require('../CommandModules/command_error') const CommandSource = require('../CommandModules/command_source') module.exports = { - name: 'test', - description:['very 1st command in the bot to test to see if things are working'], + name: 'cmdtest', + description:['usages are test and msg error'], trustLevel: 0, - aliases:['tst'], + aliases:['cmdtst', 'commandtest', 'commandtst'], execute (context) { const bot = context.bot @@ -12,7 +12,10 @@ trustLevel: 0, const player = context.source.player.profile.name const uuid = context.source.player.uuid const message = context.arguments.join(' ') // WHY SECTION SIGNS!! - const component = { + const args = context.arguments + switch (args[0]) { + case 'msg': +const component = { translate: '[%s] %s %s %s %s %s', with: [ { @@ -51,16 +54,25 @@ context.source.player.displayName ?? context.source.player.profile.name, text:`, uuid: ${uuid}, ` }, //entry.displayName - {text:`Argument: ${message}`} + {text:`Argument: ${args.slice(1).join(' ')}`} ]//command.split(' ')[0] } - bot.tellraw(component) - // context.source.sendFeedback({text:`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`}) - - } +bot.tellraw([component]) + + break + case 'error': + + throw new Error(args.slice(1).join(' ')) + + break + default: + context.source.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }]) + context.source.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }]) + } + +} } /* - - + */ //context.source.player.displayName ?? context.source.player.profile.name, diff --git a/commands/console.js b/commands/console.js index ce6ca4c..a8daff9 100644 --- a/commands/console.js +++ b/commands/console.js @@ -13,7 +13,7 @@ const bot = context.bot const prefix = { translate: '[%s] %s \u203a %s', - color:'gray', + color:'dark_gray', with: [ { text: 'FNFBoyfriendBot Console', color:'#00FFFF' diff --git a/commands/end.js b/commands/end.js index 8cd5531..6c7db51 100644 --- a/commands/end.js +++ b/commands/end.js @@ -10,7 +10,7 @@ module.exports = { const args = context.arguments const source = context.source source.sendFeedback(`${bot.username} fell out of the world`) -process.exit('amongus') +process.exit() } } /*context.source.sendFeedback('farding right now....') diff --git a/commands/errortest.js b/commands/errortest.js deleted file mode 100644 index df97858..0000000 --- a/commands/errortest.js +++ /dev/null @@ -1,14 +0,0 @@ -const CommandError = require('../CommandModules/command_error') - -module.exports = { - name: 'errortest', - description:['test errors'], - aliases:['error', 'errtest', 'errtst'], - trustLevel: 0, - execute (context) { - const message = context.arguments.join(' ') - //context.source.sendFeedback('hint hover your mouse over the error') - throw new Error(message) - - } -} \ No newline at end of file diff --git a/commands/filter.js b/commands/filter.js deleted file mode 100644 index 181f5b6..0000000 --- a/commands/filter.js +++ /dev/null @@ -1,15 +0,0 @@ -const CommandError = require('../CommandModules/command_error') - -module.exports = { - name: 'filter', -trustLevel: 1, - description:['filter players (not functional)'], - execute (context) { - //throw new CommandError('temp disabled') - const target = context.arguments.join(' ') - const bot = context.bot - - - - } -} diff --git a/commands/help.js b/commands/help.js index d081ef9..1fe0975 100644 --- a/commands/help.js +++ b/commands/help.js @@ -23,9 +23,9 @@ module.exports = { bold: false, color: 'white', with: [ - { color: 'green', text: 'Public'}, + { color: '#00FFFF', text: 'Public'}, { color: 'white', text: ' | '}, - { color: 'red', text: 'Trusted'}, + { color: 'dark_purple', text: 'Trusted'}, { color: 'white', text: ' | '}, { color: 'dark_red', text: 'Owner'}, ] @@ -33,8 +33,8 @@ module.exports = { if (args[0]) { let valid - for (const fard in bot.commandManager.amogus) { // i broke a key woops - const command = bot.commandManager.amogus[fard] + for (const commands in bot.commandManager.commandlist) { // i broke a key woops + const command = bot.commandManager.commandlist[commands] if (args[0].toLowerCase() === command.name ) // if (args[0].toLowerCase() === command.aliases) @@ -58,7 +58,7 @@ module.exports = { source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.MainPrefix}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.MainPrefix}help` } : undefined}]) // bot.tellraw([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefix}help" for help or click on this for the command`, with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help`, color:'red' } : undefined}]) }//i will add the descriptions reading as tests and action add the descriptions for the commands after - const length = context.bot.commandManager.amogus.length // ok + const length = context.bot.commandManager.commandlist.length // ok //i guess i did delete smh woops //context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...commandList], false) @@ -67,8 +67,8 @@ module.exports = { let t_rust = [] let own_her = [] let cons_ole = [] - for (const fard in bot.commandManager.amogus) { - const command = bot.commandManager.amogus[fard] + for (const commands in bot.commandManager.commandlist) { + const command = bot.commandManager.commandlist[commands] // if (command.consoleOnly == true) return console.log(command); if(command.trustLevel === 3) { @@ -129,7 +129,7 @@ module.exports = { // ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description} ///tellraw @a {"translate":"","hoverEvent":{"action":"show_text","value":[{"text":""},{"text":""}]},"clickEvent":{"action":"run_command","value":"a"}} - clickEvent: command.name ? { action: 'suggest_command', value: `~${command.name}` } : undefined, + } )//my w } @@ -138,7 +138,7 @@ module.exports = { t_rust.push( { text: command.name + ' ', - color: 'red', + color: 'dark_purple', translate:"", @@ -169,7 +169,7 @@ module.exports = { pub_lick.push( { text: command.name + ' ', - color: 'green', + color: '#00FFFF', translate:"", hoverEvent:{ action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr) @@ -207,15 +207,14 @@ module.exports = { if(isConsole) { // mabe idk - const length = context.bot.commandManager.amogus.length + const length = context.bot.commandManager.commandlist.length context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole], false) } else { - const length = context.bot.commandManager.amogus.filter(c => c.trustLevel != 3).length + const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length //trustlevel context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust ,own_her], false) - - + // bot.tellraw([own_her]) //console.log(t_rust) }// diff --git a/commands/info.js b/commands/info.js index f6b33a5..6f5f45a 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,211 +1,263 @@ -const CommandError = require('../CommandModules/command_error') +const CommandError = require("../CommandModules/command_error"); + +const path = require("path"); +const fs = require("fs/promises"); +const packageJSON = require("../package.json"); -const path = require('path') -const fs = require('fs/promises') -const packageJSON = require("../package.json") -async function getCpuModelName () { - const cpuInfo = await fs.readFile('/proc/cpuinfo') - const lines = cpuInfo.toString().split('\n') - // among us way of doing it - const modelName = lines.find((line) => line.startsWith('model name')).split('\t: ') - return modelName[1] -} module.exports = { - name: 'info', - description:['check the bots info. the args are version, discord, serverinfo, logininfo, uptime, memused, creators'], - aliases:['information'], - trustLevel: 0, - async execute (context, client) { - const bot = context.bot - const args = context.arguments - // const client = context.client - const cmd = {//test.js - translate: '[%s] ', + name: "info", + description: [ + "check the bots info. the usages are version, discord, serverinfo, logininfo, uptime, creators", + ], + aliases: ["information"], + trustLevel: 0, + async execute(context) { + const bot = context.bot; + const args = context.arguments; + // const client = context.client + const cmd = { + //test.js + translate: "[%s] ", bold: false, - color: 'white', - with: [ - { color: 'gold', text: 'Info Cmd'}, - ] - } + color: "white", + with: [{ color: "gold", text: "Info Cmd" }], + }; - -/*context.source.sendFeedback(`${buildstring}`, false) - context.source.sendFeedback(`${foundationbuildstring}`) - context.source.sendFeedback('BotEngine:Node-Minecraft-Protocol', false) - */ - - - const buildstring = process.env['buildstring'] - const foundationbuildstring = process.env['FoundationBuildString'] - const source = context.source + const buildstring = process.env["buildstring"]; + const foundationbuildstring = process.env["FoundationBuildString"]; + const source = context.source; switch (args[0]) { - case 'version': + case "version": const discordJSVersion = packageJSON.dependencies["discord.js"]; - const MinecraftProtocolVersion = packageJSON.dependencies["minecraft-protocol"]; - const npmVersion = packageJSON.dependencies["npm"]; - - context.source.sendFeedback ({ color: "gray", text: `${bot.buildstring}`}) - - context.source.sendFeedback ({ color: "gray", text: `${bot.fbs}`}) + const MinecraftProtocolVersion = + packageJSON.dependencies["minecraft-protocol"]; -//BotEngine:Node-Minecraft-Protocol @${MinecraftProtocolVersion} - - context.source.sendFeedback ({ - text:`BotEngine:Node-Minecraft-Protocol @${MinecraftProtocolVersion}`, - color:'gray', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'Node-Minecraft-protocol', - color:'gray', - - } - ] - },clickEvent:{ - action:"open_url",value:`https://github.com/PrismarineJS/node-minecraft-protocol` - } - }) - - -/* text:bot.options.discord.invite, - color:'gray', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'click here to join!', - color:'gray', - - } - ] - },clickEvent:{ - action:"open_url",value:`${bot.options.discord.invite}` - } - }) -*/ - -//Discord.js @${discordJSVersion} - - - - context.source.sendFeedback ({ text:`Discord.js @${discordJSVersion}`, - color:'gray', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'Discord.js', - color:'gray', - - } - ] - },clickEvent:{ - action:"open_url",value:`https://github.com/discordjs/discord.js` - } - }) - context.source.sendFeedback ({ color: "gray", text: `Node js Version @${process.version}`},) - context.source.sendFeedback({color: 'gray', text:`npm Version:@${npmVersion}`}) - - - - break - case 'discord': - source.sendFeedback({ - text:bot.options.discord.invite, - color:'gray', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'click here to join!', - color:'gray', - - } - ] - },clickEvent:{ - action:"open_url",value:`${bot.options.discord.invite}` - } - }) - - break - case 'serverinfo': - - const os = require('os') context.source.sendFeedback({ - color:'gray',text:`Hostname: ${os.hostname()}`}) - context.source.sendFeedback({ - color: "gray", text: `Working Directory: ${path.join(__dirname, '..')}`}) - context.source.sendFeedback( { color: "gray", text: `OS architecture: ${os.arch()}`}) - context.source.sendFeedback({ color: "gray", text: `OS platform: ${os.platform()}`}) - context.source.sendFeedback({ color: "gray", text: `OS name: ${os.version()}`}) - context.source.sendFeedback({ color: "gray", text: `CPU cores: ${os.cpus().length}`}) - /*const os = require('os') const cpus = os.cpus() for (const cpu of cpus){bot.tellraw(cpu.model)}*/ - //os.cpus()[0].model - /* + color: "gray", + text: `${process.env["buildstring"]}`, + }); + + context.source.sendFeedback({ + color: "gray", + text: `${process.env["FoundationBuildString"]}`, + }); + + const date = new Date().toLocaleDateString("en-US", { + timeZone: "America/CHICAGO", + }); + + context.source.sendFeedback({ + text: `Bot Release: 11/22/2022 `, + color: "gray", + }); + + context.source.sendFeedback({ + text: `BotEngine:Node-Minecraft-Protocol @${MinecraftProtocolVersion}`, + color: "gray", + translate: "", + hoverEvent: { + action: "show_text", + value: [ + { + text: "Node-Minecraft-protocol", + color: "gray", + }, + ], + }, + clickEvent: { + action: "open_url", + value: `https://github.com/PrismarineJS/node-minecraft-protocol`, + }, + }); + + context.source.sendFeedback({ + text: `Discord.js @${discordJSVersion}`, + color: "gray", + translate: "", + hoverEvent: { + action: "show_text", + value: [ + { + text: "Discord.js", + color: "gray", + }, + ], + }, + clickEvent: { + action: "open_url", + value: `https://github.com/discordjs/discord.js`, + }, + }); + context.source.sendFeedback({ + color: "gray", + text: `Node js Version @${process.version}`, + }); + // context.source.sendFeedback({color: 'gray', text:`npm Version:@${npmVersion}`}) + + break; + case "thankyou": + var prefix = + "&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r "; + bot.core.run( + "bcraw " + + prefix + + "Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!", + ); + break; + case "discord": + source.sendFeedback({ + text: bot.options.discord.invite, + color: "gray", + translate: "", + hoverEvent: { + action: "show_text", + value: [ + { + text: "click here to join!", + color: "gray", + }, + ], + }, + clickEvent: { + action: "open_url", + value: `${bot.options.discord.invite}`, + }, + }); + + break; + case "serverinfo": + const os = require("os"); + context.source.sendFeedback({ + color: "gray", + text: `Hostname: ${os.hostname()}`, + }); + context.source.sendFeedback({ + color: "gray", + text: `Working Directory: ${path.join(__dirname, "..")}`, + }); + context.source.sendFeedback({ + color: "gray", + text: `OS architecture: ${os.arch()}`, + }); + context.source.sendFeedback({ + color: "gray", + text: `OS platform: ${os.platform()}`, + }); + context.source.sendFeedback({ + color: "gray", + text: `OS name: ${os.version()}`, + }); + context.source.sendFeedback({ + color: "gray", + text: `CPU cores: ${os.cpus().length}`, + }); + + /* if (os.platform() !== 'linux'){ source.sendFeedback({text:'cannot find the cpu model are you sure the bot is running on linux?', color:'red'}) } else if (os.platform() === 'linux') { - */ source.sendFeedback({ color: "gray", text: `CPU model: ${await os.cpus()[0].model}`}) - // } - /*translate: '\n %s \n %s \n %s \n %s \n %s \n %s \n %s',//lazy fix - with: [ - { color: "gray", text: `Hostname: ${os.hostname()}`}, - { color: "gray", text: `Working Directory: ${path.join(__dirname, '..')}`}, - { color: "gray", text: `OS architecture: ${os.arch()}`}, - { color: "gray", text: `OS platform: ${os.platform()}`}, - { color: "gray", text: `OS name: ${os.version()}`}, - { color: "gray", text: `CPU cores: ${os.cpus().length}`}, - { color: "gray", text: `CPU model: ${await getCpuModelName()}`}, - - - - ] - });*/ - break - case 'logininfo': - source.sendFeedback({text:`Bot Username: "${bot.username}"`, color:'gray'}) - source.sendFeedback({text:`Bot uuid:"${bot.uuid}"`, color:'gray'}) + */ source.sendFeedback({ + color: "gray", + text: `CPU model: ${os.cpus()[0].model}`, + }); + source.sendFeedback({ + translate:'%s%s%s', + color: "gray", + with: [{text:`Server Memory Usage `, color:'gray'},{text:`${Math.floor( + os.freemem() / 1048576, + )} `,color:'gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'gray'}], + }); + break; + case "logininfo": + source.sendFeedback({ + text: `Bot Username: "${bot.username}"`, + color: "gray", + }); + source.sendFeedback({ text: `Bot uuid:"${bot.uuid}"`, color: "gray" }); + source.sendFeedback({ + text: `Minecraft Java Version: "${bot.version}"`, + color: "gray", + }); - - source.sendFeedback({text:`Minecraft Java Version: "${bot.version}"`, color:'gray'}) + source.sendFeedback({ + text: `Server: "${bot.options.host}:${bot.options.port}"`, + color: "gray", + }); + source.sendFeedback({ + text: `Main Prefix: "${bot.options.commands.MainPrefix}"`, + color: "gray", + }); + source.sendFeedback({ + text: `Secondary Prefix: "${bot.options.commands.SecondaryPrefix}"`, + color: "gray", + }); + source.sendFeedback({ + text: `Tertiary Prefix: "${bot.options.commands.TertiaryPrefix}"`, + color: "gray", + }); + source.sendFeedback({ + text: `Discord Prefix: "${bot.options.discord.commandPrefix}"`, + color: "gray", + }); - source.sendFeedback({text:`Server: "${bot.host}:${bot.port}"`, color:'gray'}) + source.sendFeedback({ + text: `Discord Username: "${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}"`, + color: "gray", + }); + source.sendFeedback({ + text: `Discord Channel: ${bot.discord.channel.name}`, + }); + source.sendFeedback({ + color: "gray", + text: `ConsoleServer:"${bot.console.consoleServer}"`, + }); + const amonger = bot.bots.map((eachBot) => eachBot.options.host + "\n"); + const port = bot.bots.map((eachBot) => eachBot.options.port); - source.sendFeedback({text:`Main Prefix: "${bot.options.commands.MainPrefix}"`, color:"gray"}) -source.sendFeedback({text:`Secondary Prefix: "${bot.options.commands.SecondaryPrefix}"`, color:"gray"}) -source.sendFeedback({text:`Tertiary Prefix: "${bot.options.commands.TertiaryPrefix}"`, color:"gray"}) - source.sendFeedback({text:`Discord Prefix: "${bot.options.discord.commandPrefix}"`, color:'gray'}) - - - source.sendFeedback({text:`Discord Username: "${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}"`, color:'gray'}) - -source.sendFeedback({text:`Discord Channel: ${bot.discord.channel.name}`}) - source.sendFeedback({ color: "gray", text: `ConsoleServer:"${bot.console.consoleServer}"`}) - - const amonger = bot.bots.map(eachBot => eachBot.options.host + '\n') - const port = bot.bots.map(eachBot => eachBot.options.port) - -if (amonger.length === 0){ - const list = []; - for (const host of bots){ - if (list.length !== 0) { - list.push(host.name) - } + if (amonger.length === 0) { + const list = []; + for (const host of bots) { + if (list.length !== 0) { + list.push(host.name); + } + } } - -} - source.sendFeedback('Servers in Config: ' + amonger.length)//real - /* + source.sendFeedback({ text: `Servers in Config ${amonger.length}` }); + /* if (query.length === 0) { + const list = [] + + for (const host of bots) { + if (list.length !== 0) list.push({ text: ', ', color: 'gray' })// list.push(info.name) + list.push(info.name) + + } + + context.source.sendFeedback([], false) + return + }*/ + /* + if (query.length === 0) { + const list = [] + + for (const info of bots) { + if (list.length !== 0) list.push({ text: ', ', color: 'gray' })// list.push(info.name) + list.push(info.name) + + } + + context.source.sendFeedback(['Known bots (', bots.length, ') - ', ...list], false) + return + } + + */ + + //real + /* const util = fs.readdir('./util') source.sendFeedback({text:`Util Files loaded: ${util.length}`, color:'gray'}) @@ -223,8 +275,8 @@ if (amonger.length === 0){ source.sendFeedback({text:` Files loaded: ${file.length}`, color:'gray'}) }); */ - - /*context.source.sendFeedback({ + + /*context.source.sendFeedback({ translate: '\n %s \n %s \n %s \n %s \n %s \n %s \n %s \n %s', with: [ { color: "gray", text: `Bot Username: "${bot.username}"`}, @@ -238,153 +290,166 @@ if (amonger.length === 0){ ] }); - */ - // clickevent: { action:"open_url", value: `${context.bot.discord.invite}`}, - - break - case 'test': - // bot.tellraw('test') - // const porta = bot.bots.map(eachBot => eachBot.options.port) - const amongerus = bot.bots.map(eachBot => eachBot.options.host + ':' + eachBot.options.port + '\n') - - - - source.sendFeedback(amongerus) - // source.sendFeedback(amonger) - break - case 'uptime': - function format(seconds){ - function pad(s){ - return (s < 10 ? '0' : '') + s; - } - var hours = Math.floor(seconds / (60*60)); - var minutes = Math.floor(seconds % (60*60) / 60); - var seconds = Math.floor(seconds % 60); - - return pad(`hours: ${hours}`) + ' ' + pad(`Mins: ${minutes}`) + ' ' + pad(`Seconds: ${seconds}`); - } - - var uptime = process.uptime(); + */ + // clickevent: { action:"open_url", value: `${context.bot.discord.invite}`}, + break; + case "test": + // bot.tellraw('test') + // const porta = bot.bots.map(eachBot => eachBot.options.port) + const amongerus = bot.bots.map( + (eachBot) => eachBot.options.host + ":" + eachBot.options.port + "\n", + ); + /* + if (amonger.length === 0){ + const list = []; + for (const host of bots){ + if (list.length !== 0) { + list.push({text:`Server Count: ${host.name}`}) + } + } - source.sendFeedback ({ color: "gray", text: `Bot Uptime: ${format(uptime)}`}) - - +} */ + //source.sendFeedback() + source.sendFeedback(amongerus); + // source.sendFeedback(amonger) + break; + case "uptime": + function format(seconds) { + function pad(s) { + return (s < 10 ? "0" : "") + s; + } + var hours = Math.floor(seconds / (60 * 60)); + var minutes = Math.floor((seconds % (60 * 60)) / 60); + var seconds = Math.floor(seconds % 60); + return ( + pad(`hours: ${hours}`) + + " " + + pad(`Mins: ${minutes}`) + + " " + + pad(`Seconds: ${seconds}`) + ); + } + + var uptime = process.uptime(); + + source.sendFeedback({ + color: "gray", + text: `Bot Uptime: ${format(uptime)}`, + }); + + break; - break - case 'memused': - const os2 = require('os') - source.sendFeedback({ color: "gray", text: `§aMem §aused §a${Math.floor(os2.freemem() / 1048576)} §aMiB §a/ §a${Math.floor(os2.totalmem() / 1048576)} MiB`},) - - /* - context.source.sendFeedback({ - translate: '\n %s', - with: [ - { color: "gray", text: `§aMem §aused §a${Math.floor(os2.freemem() / 1048576)} §aMiB §a/ §a${Math.floor(os2.totalmem() / 1048576)} MiB`}, + case "creators": + source.sendFeedback({ + color: "gray", + text: "Thank you to all that helped!", + }); + source.sendFeedback({ + translate: "%s%s", + with: [ + { color: "dark_red", text: "Parker" }, + { color: "black", text: "2991" }, + ], - ] - }); -*/ - break - - case 'creators': - source.sendFeedback({ color: 'gray', text: 'Thank you to all that helped!' }) - source.sendFeedback({ - translate:'%s%s', - with:[ - { color: 'dark_red', text: 'Parker' }, - { color: 'black', text: '2991' }, - ], - - hoverEvent:{ - action:"show_text", - value:[ - { - text:'FNF', - color:'dark_purple', - bold:true, - },{ - text:'Boyfriend', - color:'aqua', - bold:true, - },{ - text:'Bot ', - color:'dark_red', - bold:true, - },{ - text:'Discord', - color:'blue', - bold:false, - } - - ] - },clickEvent:{ - action:"open_url",value:`${bot.options.discord.invite}` - } - }) - source.sendFeedback( { - text:'_ChipMC_', - color:'dark_green', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'chipmunk dot land', - color:'green', - - } - ] - },clickEvent:{ - action:"open_url",value:`https://chipmunk.land` - } - }) - source.sendFeedback( { - text:'chayapak', - color:'yellow', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'Chomens ', - color:'yellow', - - },{ - text:'Discord', - color:'blue', - - } - ] - },clickEvent:{ - action:"open_url",value:`https://discord.gg/xdgCkUyaA4` - } - }) - source.sendFeedback( { - text:'_yfd', - color:'light_purple', - translate:"", - hoverEvent:{ - action:"show_text", - value:[ - { - text:'ABot ', - color:'gold', - bold:true, - },{ - text:'Discord', - color:'blue', - bold:false, - } - ] - },clickEvent:{ - action:"open_url",value:`https://discord.gg/CRfP2ZbG8T` - } - }) - source.sendFeedback({text:"Poopcorn(Poopbob???)", color:'gold'}) - - /* + hoverEvent: { + action: "show_text", + value: [ + { + text: "FNF", + color: "dark_purple", + bold: true, + }, + { + text: "Boyfriend", + color: "aqua", + bold: true, + }, + { + text: "Bot ", + color: "dark_red", + bold: true, + }, + { + text: "Discord", + color: "blue", + bold: false, + }, + ], + }, + clickEvent: { + action: "open_url", + value: `${bot.options.discord.invite}`, + }, + }); + source.sendFeedback({ + text: "_ChipMC_", + color: "dark_green", + translate: "", + hoverEvent: { + action: "show_text", + value: [ + { + text: "chipmunk dot land", + color: "green", + }, + ], + }, + clickEvent: { + action: "open_url", + value: `https://chipmunk.land`, + }, + }); + source.sendFeedback({ + text: "chayapak", + color: "yellow", + translate: "", + hoverEvent: { + action: "show_text", + value: [ + { + text: "Chomens ", + color: "yellow", + }, + { + text: "Discord", + color: "blue", + }, + ], + }, + clickEvent: { + action: "open_url", + value: `https://discord.gg/xdgCkUyaA4`, + }, + }); + source.sendFeedback({ + text: "_yfd", + color: "light_purple", + translate: "", + hoverEvent: { + action: "show_text", + value: [ + { + text: "ABot ", + color: "gold", + bold: true, + }, + { + text: "Discord", + color: "blue", + bold: false, + }, + ], + }, + clickEvent: { + action: "open_url", + value: `https://discord.gg/CRfP2ZbG8T`, + }, + }); + source.sendFeedback({ text: "Poopcorn(Poopbob???)", color: "gold" }); + + /* text:bot.options.discord.invite, color:'gray', translate:"", @@ -402,7 +467,7 @@ if (amonger.length === 0){ } }) */ - /* + /* context.source.sendFeedback({ translate: '\n %s \n %s%s \n %s \n %s \n %s \n %s \n %s \n %s \n %s \n %s \n %s', with: [ @@ -424,11 +489,20 @@ if (amonger.length === 0){ ] }); */ - break + break; default: - context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }]) - context.source.sendError([cmd, { text: 'the args for the info command is version, discord, serverinfo, logininfo, uptime, memused, creators', color: 'gray', bold:false }]) + context.source.sendError([ + cmd, + { text: "Invalid action", color: "dark_red", bold: false }, + ]); + context.source.sendError([ + cmd, + { + text: "the usages are version, discord, serverinfo, logininfo, uptime, creators", + color: "gray", + bold: false, + }, + ]); } - } -} - + }, +}; diff --git a/commands/lol.js b/commands/lol.js deleted file mode 100644 index e13437b..0000000 --- a/commands/lol.js +++ /dev/null @@ -1,14 +0,0 @@ -//command.unknown.argument command.unknown.command //command.context.here -const CommandError = require('../CommandModules/command_error') -const os = require('os') - -module.exports = { - name: 'lol', - description:['idfk dont ask'], - aliases:['ohio'], - trustLevel: 0, - execute (context) { -throw new CommandError('idfk lmao') - - } -} diff --git a/commands/memusage.js b/commands/memusage.js index 18b7e6c..f8011e8 100644 --- a/commands/memusage.js +++ b/commands/memusage.js @@ -10,15 +10,16 @@ module.exports = { const bot = context.bot const source = context.source const args = context.arguments - switch (args[0]) { + if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return + switch (args[0]) { case 'on': bot.memusage.on() - //source.sendFeedback({text: 'TPSBar is now enabled', color:'green'}) + source.sendFeedback({text: 'Memusage is now enabled', color:'green'}) break case 'off': bot.memusage.off() - // source.sendFeedback({text:'TPSBar is now disabled', color:'red'}) + / source.sendFeedback({text:'Memusage is now disabled', color:'red'}) break default: diff --git a/commands/music.js b/commands/music.js deleted file mode 100644 index 610a9e6..0000000 --- a/commands/music.js +++ /dev/null @@ -1,25 +0,0 @@ -const CommandError = require('../CommandModules/command_error') - -module.exports = { - name: 'music', -//<< this one line of code broke it lmao - description:[''], - aliases:[], - trustLevel: 0, - execute (context) { - - const message = context.arguments.join(' ') -const bot = context.bot - - throw new CommandError('working on it some other time') - - - } -} -//[%s] %s › %s -//was it showing like that before? -// just do text bc too sus rn ig -// You should remove the with thing and the translate and replace - -// Parker, why is hashing just random characters??? -//wdym \ No newline at end of file diff --git a/commands/netmsg.js b/commands/netmsg.js index 3b6d227..2ab2b12 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -37,7 +37,7 @@ module.exports = { { text: 'Boyfriend', bold: true, - color: 'aqua' + color: '#00FFFF' }, { text: 'Bot', diff --git a/commands/say.js b/commands/say.js index 1cbcdad..9141a39 100644 --- a/commands/say.js +++ b/commands/say.js @@ -1,46 +1,54 @@ -const CommandError = require('../CommandModules/command_error') -const buildstring = process.env['buildstring'] -const foundation = process.env['FoundationBuildString'] +const CommandError = require("../CommandModules/command_error"); +const buildstring = process.env["buildstring"]; +const foundation = process.env["FoundationBuildString"]; module.exports = { - name: 'say', -//<< this one line of code broke it lmao - description:['make me say something in custom chat'], - trustLevel: 0, - aliases:['tellrawsay', 'tellrawmsg', 'trmessage', 'tellrawmessage', 'sourcesendfeedbacksay','sourcesendfeedbackmsg','sourcesendfeedbackmessage', 'ssfbmsg', 'ssfmessage'], - execute (context) { + name: "say", + //<< this one line of code broke it lmao + description: ["make me say something in custom chat"], + trustLevel: 0, + aliases: [ + "tellrawsay", + "tellrawmsg", + "trmessage", + "tellrawmessage", + "sourcesendfeedbacksay", + "sourcesendfeedbackmsg", + "sourcesendfeedbackmessage", + "ssfbmsg", + "ssfmessage", + ], + execute(context) { + const message = context.arguments.join(" "); + const bot = context.bot; - const message = context.arguments.join(' ') -const bot = context.bot - const prefix = { - translate: '[%s%s%s] \u203a %s', - bold: false, - color: 'white', - with: [ - { - color: 'dark_purple', - text: 'FNF', bold:true - }, - { - color: 'aqua', - text: 'Boyfriend', bold:true + translate: "[%s%s%s] \u203a %s", + bold: false, + color: "white", + with: [ + { + color: "dark_purple", + text: "FNF", + bold: true, }, - { color: 'dark_red', - text: 'Bot', bold:true + { + color: "#00FFFF", + text: "Boyfriend", + bold: true, }, + { color: "dark_red", text: "Bot", bold: true }, - { color: 'green', text: `${message}` } - ] - } + { color: "green", text: `${message}` }, + ], + }; - -bot.tellraw([prefix]) - } -} + bot.tellraw([prefix]); + }, +}; //[%s] %s › %s //was it showing like that before? // just do text bc too sus rn ig -// You should remove the with thing and the translate and replace +// You should remove the with thing and the translate and replace // Parker, why is hashing just random characters??? -//wdym \ No newline at end of file +//wdym diff --git a/commands/sctoggle.js b/commands/sctoggle.js index bd1ae19..ee7f5cc 100644 --- a/commands/sctoggle.js +++ b/commands/sctoggle.js @@ -13,77 +13,80 @@ module.exports = { if (!args && !args[0] && !args[1] && !args[2]) return switch (args[1]) { case 'vanishon': - bot.visibility.on() + bot.options.selfcare.vanished = true source.sendFeedback({text:'Vanish selfcare on', color:'green'}) break case'vanishoff': source.sendFeedback({text:'Vanish selfcare off', color:'red'}) - bot.visibility.off() + bot.options.selfcare.vanished = false + bot.command('vanish off') break case 'muteon': source.sendFeedback({text:'Mute selfcare on', color:'green'}) - bot.unmuted.on() + bot.options.selfcare.unmuted = true break case 'muteoff': source.sendFeedback({text:'Mute selfcare off', color:'red'}) - bot.unmuted.off() + bot.options.selfcare.unmuted = false break case 'tptoggleon': - bot.tptoggle.on() - source.sendFeedback({text:'Tptoggle on', color:'green'}) + bot.options.selfcare.tptoggle = false + bot.command('tptoggle on') + source.sendFeedback({text:'Tptoggle on', color:'red'}) break case 'tptoggleoff': - bot.tptoggle.off() - source.sendFeedback({text:'Tptoggle off', color: 'red'}) + bot.options.selfcare.tptoggle = true + + source.sendFeedback({text:'Tptoggle off', color: 'green'}) break case 'godon': - bot.god.on() + bot.options.selfcare.god = true source.sendFeedback({text:'God selfcare on', color: 'green'}) break case 'godoff': - bot.god.off() + bot.options.selfcare.god= false source.sendFeedback({text:'Tptoggle off', color: 'red'}) break case 'prefixon': - bot.prefix.on() + bot.options.selfcare.prefix = true source.sendFeedback({text: 'Prefix selfcare on', color: 'green'}) break case 'prefixoff': - bot.prefix.off() + bot.options.selfcare.prefix = false source.sendFeedback({text:'Prefix selfcare off', color:'red'}) break case 'usernameoff': - bot.Username.off() + bot.options.selfcare.username = false source.sendFeedback({text:'Username selfcare off', color: 'red'}) break case 'usernameon': - bot.Username.on() + bot.options.selfcare.username = true source.sendFeedback({text:'Username selfcare on', color:'green'}) break case 'skinon': - bot.skin.on() + bot.options.selfcare.skin = true source.sendFeedback({text:'Skin selfcare on', color:'green'}) break case 'skinoff': - bot.skin.off() + bot.options.selfcare.skin = false source.sendFeedback({text:'Skin selfcare off', color:'red'}) break case 'cspyon': - bot.cspy.on() + bot.options.selfcare.cspy = true source.sendFeedback({text:'Cspy selfcare on', color:'green'}) break case 'cspyoff': - bot.cspy.off() + bot.options.selfcare.cspy = false source.sendFeedback({text:'Cspy selfcare off', color:'red'}) break case 'nicknameon': - bot.nickname.on() + bot.options.selfcare.nickname= true source.sendFeedback({text:'Nickname selfcare on', color:'green'}) break case 'nicknameoff': - bot.nickname.off() - source.sendFeedback({text:'Nickname selfcare off', color:'red'}) + bot.options.selfcare.nickname = false + source.sendFeedback({text:'Nickname selfcare off', color:'red'}) break default: diff --git a/commands/servereval.js b/commands/servereval.js index 146b9b1..b34ed9c 100644 --- a/commands/servereval.js +++ b/commands/servereval.js @@ -12,12 +12,15 @@ const source = context.source const { stylize } = require('../util/eval_colors') const util = require('util') const args = context.arguments + const script = args.slice(1).join(' '); if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return try { - context.source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }) + source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }) + source.sendFeedback({ text: `Script input: ${script}` }) } catch (err) { - context.source.sendFeedback({ text: err.message, color: 'red' }) + source.sendFeedback({ text: err.message, color: 'red' }) + source.sendFeedback({ text: `Script input: ${script}` }) } } } diff --git a/commands/testbench.js b/commands/testbench.js deleted file mode 100644 index 409b94e..0000000 --- a/commands/testbench.js +++ /dev/null @@ -1,22 +0,0 @@ -const CommandError = require('../CommandModules/command_error') - -module.exports = { - name: 'testbench', -//<< this one line of code broke it lmao - description:[''], - aliases:['tstbench'], -trustLevel: 0, - execute (context) { -const bot = context.bot - const args = context.arguments - //bot.core.run(`tag ${context.source.player.profile.name} add bruhify`) - bot.bruhifyTextTellraw = args.join(' ') - - - - } -} -//[%s] %s › %s -//was it showing like that before? -// just do text bc too sus rn ig -// You should remove the with thing and the translate and replace \ No newline at end of file diff --git a/commands/website.js b/commands/website.js new file mode 100644 index 0000000..50f691e --- /dev/null +++ b/commands/website.js @@ -0,0 +1,29 @@ +const CommandError = require('../CommandModules/command_error') + +//const fetch = import("node-fetch"); +module.exports = { + name: 'website', +trustLevel:1, + aliases:['web','websitedata','webdata'], + description:['check website data'], +async execute (context) { + try{ +const fetch = require("node-fetch"); +const source = context.source + const bot = context.bot + const message = context.arguments.join(' ') +const args = context.arguments + if (!args && !args[0] && !args[1] && !args[2]) return +const response = await fetch(args[1]); +const body = await response.text(); + +bot.tellraw({text:body,color:'green'}) + + } catch(e) { + const bot = context.bot + const source = context.source + // source.sendFeedback({text:e.stack, color:'dark_red'}) + source.sendFeedback({text:e.toString(), color:'dark_red'}) + } + } +} \ No newline at end of file diff --git a/default.js b/default.js index 8e3e3f0..0419f71 100644 --- a/default.js +++ b/default.js @@ -3,63 +3,38 @@ module.exports = { bots: [ -{ - host: "localhost", - username:username(), - version:"1.20.1", - reconnectDelay: 6000, -language:"lolus", - console:true, + { + host: "server ip here or comment this out and refer to the bot.js file", + version:"1.20.1",//version here + reconnectDelay: 6000, + username:username(), + console:true, input: true, - commands: { - MainPrefix: "set Main Prefix here", - SecondaryPrefix:'set Secondary prefix here', - TertiaryPrefix:'set Tertiary Prefix here' - }, Core: { - customName:"core customName here", + customName:"core custom name here", core: true, - }, - discord: { - channelId: "discord channelId here", + interval:180000 + }, + discord: { + channelId: "discord channel ip here", invite: "discord invite link here", commandPrefix: "discord command prefix here" }, - skin: { - torso:{ - jacket:true, - cape:true, - }, - arms: { - leftSleeve:true, - rightSleeve:true, - }, - legs:{ - leftPants:true, - rightPants:true, - }, - head:{ - hat:true - }, - }, - selfcare: { - unmuted: true, - vanished: true, - prefix: true, - skin: true, + selfcare: { + vanished: true, + unmuted: true, + prefix: true, cspy: true, - op: true, - gmc: true, - username:true, - nickname: true, - god:true, - tptoggle: true, - interval:500, - } - }, - - - + tptoggle:true, + skin:true, + gmc:true, + op:true, + nickname:true, + username:true, + god: true, + interval:500, +} + }, ] } diff --git a/index.js b/index.js index 375ec67..b666ef2 100644 --- a/index.js +++ b/index.js @@ -1,53 +1,94 @@ -const util = require('util') -const createBot = require('./bot.js') -//const chomensjs = require('./ChomensJS') +const util = require("util"); +const createBot = require("./bot.js"); // TODO: Load a default config -const fs = require('fs/promises') -const fileExist = require('./util/file-exists') -const path = require('path') - -function load () { -//const config = require('./config.js') -const readline = require('readline') +const fs = require("fs"); +const fileExist = require("./util/file-exists"); +const path = require("path"); +const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, -}) -require('dotenv').config() -const bots = [] - for (const options of config.bots) { - const bot = createBot(options) - bots.push(bot) - bot.bots = bots - bot.options.username - bot.console.useReadlineInterface(rl) - -// bot.on('error', (error), util.inspect(error)) - - try{ -bot.on('error', console.error) - }catch(error){ - - console.log(error.stack) - } -} -} -async function checkConfig () { - if (!await fileExist(path.join(__dirname, 'config.js'))) { - console.error('Config not found! Creating a new Config from ') - await fs.copyFile(path.join(__dirname, 'default.js'), path.join(__dirname, 'config.js')) - } if (await fileExist(path.join(__dirname, 'config.js'))){ - console.log('Config found! loading config please wait,......') +}); + +function load() { + //const config = require('./config.js') + + require("dotenv").config(); + const bots = []; + for (const options of config.bots) { + const bot = createBot(options); + bots.push(bot); + bot.bots = bots; + bot.options.username; + bot.loadModule = (module) => module(bot, options); + + for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) { + try { + const module = require(path.join(__dirname, "modules", filename)); + bot.loadModule(module); + } catch (error) { + console.error( + "\x1b[0m\x1b[91m[ERROR]: \x1b[0m\x1b[90mFailed to load module", + filename, + ":", + error, + ); + } + } + + bot.console.useReadlineInterface(rl); + + // bot.on('error', (error), util.inspect(error)) + + try { + bot.on("error", console.error); + } catch (error) { + console.log(error.stack); + } } - - config = require('./config.js') - load() } -checkConfig() +const modules = "./modules"; +const util2 = "./util"; +const CommandModules = "./CommandModules"; +const commands = "./commands"; +const chat = "./chat"; +fs.readdir(util2, (err, files) => { + console.log("Successfully loaded: " + files.length + " util files"); +}); +fs.readdir(modules, (err, files) => { + console.log("Successfully loaded: " + files.length + " module files"); +}); +fs.readdir(commands, (err, files) => { + console.log("Successfully loaded: " + files.length + " command files"); +}); +fs.readdir(CommandModules, (err, files) => { + console.log("Successfully loaded: " + files.length + " CommandModule files"); +}); +fs.readdir(chat, (err, files) => { + console.log("Successfully loaded: " + files.length + " chat files"); +}); -process.on('uncaughtException', (e) => { - console.log('uncaught ' + e.stack) -}) +async function checkConfig() { + if (!(await fileExist(path.join(__dirname, "config.js")))) { + console.error("Config not found! Creating a new Config from "); + await fs.copyFile( + path.join(__dirname, "default.js"), + path.join(__dirname, "config.js"), + ); + } + if (await fileExist(path.join(__dirname, "config.js"))) { + console.log("Config found! loading config please wait,......"); + } + config = require("./config.js"); + + load(); +} + +checkConfig(); + +process.on("uncaughtException", (e) => { + console.log("uncaught " + e.stack); +}); diff --git a/modules/bruhify.js b/modules/bruhify.js index 6d902d2..a786071 100644 --- a/modules/bruhify.js +++ b/modules/bruhify.js @@ -1,6 +1,6 @@ const convert = require('color-convert') - function inject (bot) { + function bruhify (bot) { bot.bruhifyText = '' let startHue = 0 const timer = setInterval(() => { @@ -18,10 +18,10 @@ let tag = 'bruhify' bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`) startHue = (startHue + increment) % 360 - }, 50) + }, 100) bot.on('end', () => { // clearInterval(timer) }) } -module.exports = inject +module.exports = bruhify diff --git a/modules/chat.js b/modules/chat.js index 62436d8..4776704 100644 --- a/modules/chat.js +++ b/modules/chat.js @@ -13,7 +13,7 @@ function tryParse (json) { } } //what was changed?? -function inject (bot) { +function chat (bot, context) { let ChatMessage bot.on('registry_ready', registry => { ChatMessage = loadPrismarineChat(registry) @@ -116,8 +116,172 @@ function inject (bot) { }) } - - + /* + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('amogus')) { + bot.chat('amongus is very sus &4&lඞ') + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('fard')) { + bot.chat('fart') + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('stroke')) { + bot.chat('&4&l&kfaslkjdfhlaskdjfhlaskjfhlakjdfhluiqwhefloewhfkjhasdlfkjhaldkfjhaslfdjhlhadfhlafdshlksajdfhkajsdfhkhjfaslkjdfhlaskdjfhlaskjfhlakjdfhluiqwhefloewhfkjhasdlfkjhaldkfjhaslfdjhlhadfhlafdshlksajdfhkajsdfhkhj') + } return +})/* + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('true')) { + bot.chat(' false') + } return +}) + + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('false')) { + bot.chat(' true') + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('beep')) { + bot.chat('bee do ba') + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('maniaplay')) { + bot.chat('&4[&c&lOP&4] &cmaniaplay: i hate command cores i hope everyone who uses them dies in their sleep 😊') + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('null')) { + bot.chat('n u l l') + + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('undefined')) { + bot.chat('my brain is undefined') + + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('nya')) { + bot.chat(' nya~') + + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('mrrow')) { + bot.chat(' mrrow') + + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('uwu')) { + bot.chat(' OwO') + + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('owo')) { + bot.chat(' UwU') + + } return +}) + + + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('what time is it')) { + bot.chat('time for you to get a watch') + } return +}) + + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('69')) { + bot.chat('funni number') + } return +}) + /* bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('real')) { + bot.chat('very') + } return +})*/ + + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('meow')) { + bot.chat(' :3') + } return +}) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('qwerty')) { + bot.chat(' qwerty') + } return +}) + /* + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('')) { + bot.chat('') + } return +}) + */ bot.command = command => { bot._client.write('chat_command', { command, @@ -133,5 +297,5 @@ function inject (bot) { bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here? } - -module.exports = inject + +module.exports = chat diff --git a/modules/chat_command_handler.js b/modules/chat_command_handler.js index 0bf68b7..187e075 100644 --- a/modules/chat_command_handler.js +++ b/modules/chat_command_handler.js @@ -1,57 +1,89 @@ -const CommandSource = require('../CommandModules/command_source') -const CommandError = require('../CommandModules/command_error') +const CommandSource = require("../CommandModules/command_source"); +const CommandError = require("../CommandModules/command_error"); -function inject (bot) { - bot.on('parsed_message', data => { - if (data.type !== 'minecraft:chat') return +function chat_command_handler(bot) { + bot.on("parsed_message", (data) => { + if (data.type !== "minecraft:chat") return; - const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() - if (!plainMessage.startsWith(bot.commandManager.MainPrefix) && (!plainMessage.startsWith(bot.commandManager.SecondaryPrefix) && (!plainMessage.startsWith(bot.commandManager.TertiaryPrefix)))) return - // else if (!plainMessage.startsWith(bot.commandManager.prefix2)) return - // MainPrefix: "~", - // SecondaryPrefix:'%', - //TertiaryPrefix:'@' - - const command = plainMessage.substring(bot.commandManager.MainPrefix.length || plainMessage.substring(bot.commandManager.SecondaryPrefix.length || plainMessage.substring(bot.commandManager.TertiaryPrefix.length))) // if the prefixes are the same length just make it 1 or the length + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString(); + if ( + !plainMessage.startsWith(bot.commandManager.MainPrefix) && + !plainMessage.startsWith(bot.commandManager.SecondaryPrefix) && + !plainMessage.startsWith(bot.commandManager.TertiaryPrefix) + ) + return; + // else if (!plainMessage.startsWith(bot.commandManager.prefix2)) return + // MainPrefix: "~", + // SecondaryPrefix:'%', + //TertiaryPrefix:'@' + + const command = plainMessage.substring( + bot.commandManager.MainPrefix.length || + plainMessage.substring( + bot.commandManager.SecondaryPrefix.length || + plainMessage.substring(bot.commandManager.TertiaryPrefix.length), + ), + ); // if the prefixes are the same length just make it 1 or the length /* lifes sus */ - const source = new CommandSource(data.sender, { discord: false, console: false }, true) - source.sendFeedback = message => { + const source = new CommandSource( + data.sender, + { discord: false, console: false }, + true, + ); + source.sendFeedback = (message) => { const prefix = { - translate: '[%s%s%s] \u203a ', - bold: false, - color: 'dark_gray', - with: [ - { - color: 'dark_purple', - text: 'FNF', - bold:true, - hoverEvent: { action:"show_text", value: `${process.env["buildstring"]}\n${process.env["FoundationBuildString"]}`}, - clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined, - }, - { - color: 'aqua', - text: 'Boyfriend', bold:true, - clickEvent: bot.options.discord.invite ? { action: 'open_url', value: bot.options.discord.invite } : undefined, hoverEvent: { action:"show_text", value: `Bot Username: ${bot.username}\nBot UUID: ${bot.uuid}\nServer Host: ${bot.options.host}:${bot.options.port}\nBot Minecraft Java Version: ${bot.options.version}`}, + translate: "[%s%s%s] \u203a ", + bold: false, + color: "dark_gray", + with: [ + { + color: "dark_purple", + text: "FNF", + bold: true, + hoverEvent: { + action: "show_text", + value: `${process.env["buildstring"]}\n${process.env["FoundationBuildString"]}`, + }, + clickEvent: bot.options.Core.customName + ? { action: "open_url", value: bot.options.Core.customName } + : undefined, }, - { color: 'dark_red', - text: 'Bot', - bold:true, - clickEvent: bot.options.discord.invite ? { action: 'open_url', value: 'https://code.chipmunk.land' } : undefined, - hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'}, - },//§aMan i like frogs - _ChipMC_ + { + color: "#00FFFF", + text: "Boyfriend", + bold: true, + clickEvent: bot.options.discord.invite + ? { action: "open_url", value: bot.options.discord.invite } + : undefined, + hoverEvent: { + action: "show_text", + value: `Bot Username: ${bot.username}\nBot UUID: ${bot.uuid}\nServer Host: ${bot.options.host}:${bot.options.port}\nBot Minecraft Java Version: ${bot.options.version}`, + }, + }, + { + color: "dark_red", + text: "Bot", + bold: true, + clickEvent: bot.options.discord.invite + ? { action: "open_url", value: "https://code.chipmunk.land" } + : undefined, + hoverEvent: { + action: "show_text", + value: "§aMan i like frogs - _ChipMC_", + }, + }, //§aMan i like frogs - _ChipMC_ - { color: 'green', text: command.split(' ')[0] } - ] - } - - bot.tellraw(['', prefix, message]) - } + { color: "green", text: command.split(" ")[0] }, + ], + }; - bot.commandManager.executeString(source, command) + bot.tellraw(["", prefix, message]); + }; - }) + bot.commandManager.executeString(source, command); + }); } -module.exports = inject \ No newline at end of file +module.exports = chat_command_handler; diff --git a/modules/command_core.js b/modules/command_core.js index 1f80687..65cbdd4 100644 --- a/modules/command_core.js +++ b/modules/command_core.js @@ -1,5 +1,5 @@ const nbt = require('prismarine-nbt'); -async function inject (bot, options) { +async function command_core (bot, options) { bot.core = { // what you think im doing? look at line 17 area: { @@ -15,7 +15,7 @@ async function inject (bot, options) { if (!pos) return - bot.command(`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: '{"text":"${bot.options.Core.customName}","color":"dark_red","clickEvent":{"action":"open_url","value":"${bot.options.Core.customName}"}}'} destroy`) + bot.command(`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: '{"text":"${bot.options.Core.customName}","color":"#00FFFF","clickEvent":{"action":"open_url","value":"https://chipmunk.land"}}'} destroy`) }, @@ -71,6 +71,16 @@ async function inject (bot, options) { }, } + /* + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith(':3')) { + bot.chat(' :3') + } return +}) +*/ if (!bot.options.Core.core) return bot.on('move', () => { bot.core.move(bot.position) @@ -82,7 +92,8 @@ async function inject (bot, options) { }, bot.options.Core.interval) bot.on('end', (bot) => { clearInterval(timer) + }) }) } -module.exports = inject +module.exports = command_core diff --git a/modules/command_loop_manager.js b/modules/command_loop_manager.js index a102da1..b86e25a 100644 --- a/modules/command_loop_manager.js +++ b/modules/command_loop_manager.js @@ -1,4 +1,4 @@ -function inject (bot, options) { +function command_loop_manager (bot, options) { bot.cloop = { list: [], @@ -16,6 +16,7 @@ function inject (bot, options) { this.list = [] } } + } -module.exports = inject +module.exports = command_loop_manager diff --git a/modules/command_manager.js b/modules/command_manager.js index 09b7c75..3b56e74 100644 --- a/modules/command_manager.js +++ b/modules/command_manager.js @@ -1,214 +1,185 @@ -const fs = require('fs') -const path = require('path') -const CommandError = require('../CommandModules/command_error.js') +const fs = require("fs"); +const path = require("path"); +const CommandError = require("../CommandModules/command_error.js"); //check command_source //it would be both the command_source.js and command_manager.js files -function inject (bot, options) { +function command_manager(bot, options) { bot.commandManager = { - MainPrefix: options.commands?.MainPrefix ?? 'default', - SecondaryPrefix: options.commands?.SecondaryPrefix ?? 'default', - TertiaryPrefix: options.commands?.TertiaryPrefix ?? 'default', + MainPrefix: options.commands.MainPrefix ?? "default", + SecondaryPrefix: options.commands.SecondaryPrefix ?? "default", + TertiaryPrefix: options.commands.TertiaryPrefix ?? "default", commands: {}, - amogus: [], -//ohio - execute (source, commandName, args, message) { - const command = this.getCommand(commandName.toLowerCase()) -//Unknown command. Type "/help" for help -const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) + commandlist: [], + //ohio + execute(source, commandName, args, message) { + const command = this.getCommand(commandName.toLowerCase()); + //Unknown command. Type "/help" for help + const now = new Date().toLocaleString("en-US", { + timeZone: "America/CHICAGO", + }); try { - if (!command || !command.execute) throw new CommandError({ translate: `Unknown command %s. Type "${bot.options.commands.MainPrefix}help" for help or click on this for the command`, with: [commandName], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.MainPrefix}help` } : undefined})//ohio - + if (!command || !command.execute) + throw new CommandError({ + translate: `Unknown command %s. Type "${bot.options.commands.MainPrefix}help" for help or click on this for the command`, + with: [commandName], + clickEvent: bot.options.Core.customName + ? { + action: "suggest_command", + value: `${bot.options.commands.MainPrefix}help`, + } + : undefined, + }); //ohio - - if (command.trustLevel > 0){ - const event = source?.discordMessageEvent + if (command.trustLevel > 0) { + const event = source?.discordMessageEvent; - const roles = event?.member?.roles?.cache + const roles = event?.member?.roles?.cache; - // message.member.displayName - //const hash = `${args[0]}` // this is undefined -//const owner = `${args[0]}` - // const hash = `${args[0]}` - // const owner = `${args[0]}` - if( - source?.sources?.discord && - command.trustLevel === 1 && - !roles?.some(role => role?.name == 'trusted' || role?.name == 'FNFBoyfriendBot Owner') ? true : false - ) throw new CommandError({text:'You are not Trusted!', color:'red'}) - if ( - !source?.sources?.discord && - command.trustLevel === 1 && - args[0] !== bot.hash && - args[0] !== bot.owner && - args[0] !== bot.hashing.hash - ) throw new CommandError({text:'Invalid Hash or Invalid Owner Hash', color:'red'}) - bot.hashing.updateHash() - const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) - const player = source?.player?.profile?.name - const uuid = source?.player?.uuid - const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"}) -const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}) - - bot.console.hash = function (error, source) { - console.log(`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hash || bot.hashing.hash}\x1b[0m]` ) - } - bot.console.discordHash = function (error, source) { - console.log(`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]` ) - } -bot.console.ownerHash = function (error, source) { - console.log(`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]` ) - } + if ( + source?.sources?.discord && + command.trustLevel === 1 && + !roles?.some( + (role) => + role?.name == "trusted" || + role?.name == "FNFBoyfriendBot Owner", + ) + ? true + : false + ) + throw new CommandError({ + text: "You are not Trusted!", + color: "red", + }); + if ( + !source?.sources?.discord && + command.trustLevel === 1 && + args[0] !== bot.hash && + args[0] !== bot.owner && + args[0] !== bot.hashing.hash + ) + throw new CommandError({ + text: "Invalid Hash or Invalid Owner Hash", + color: "red", + }); + bot.hashing.updateHash(); + const now = new Date().toLocaleString("en-US", { + timeZone: "America/CHICAGO", + }); + const player = source?.player?.profile?.name; + const uuid = source?.player?.uuid; + const time = new Date().toLocaleTimeString("en-US", { + timeZone: "America/CHICAGO", + }); + const date = new Date().toLocaleDateString("en-US", { + timeZone: "America/CHICAGO", + }); + + bot.console.hash = function (error, source) { + console.log( + `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${ + bot.hash || bot.hashing.hash + }\x1b[0m]`, + ); + }; + bot.console.discordHash = function (error, source) { + console.log( + `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]`, + ); + }; + bot.console.ownerHash = function (error, source) { + console.log( + `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + + `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]`, + ); + }; if (args[0] === bot.hash) { - bot.console.hash() + bot.console.hash(); + } else if (args[0] === bot.owner) { + bot.console.ownerHash(); } - else if (args[0] === bot.owner) { - bot.console.ownerHash() - } - if ( - source?.sources?.discord && - command.trustLevel === 2 && - !roles?.some(role => role.name === 'FNFBoyfriendBot Owner') - ) throw new CommandError({text:'You are not the Owner!', color:'dark_red'}) - const owner = `${args[0]}` - if ( - !source?.sources?.discord && - command.trustLevel === 2 && owner !== bot.owner - )throw new CommandError({text: 'Invalid Owner Hash', color:'dark_red'}) - - if (command.trustLevel === 3 && !source?.sources?.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' }) - //if () - }// if (command.consoleOnly && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' }) - //(hash !== bot.hash && owner !== bot.owner -//command.unknown.argument command.unknown.command - //command.context.here - // let hash = 1 - // let owner = 2 - - //command.hashOnly && command.ownerOnly && args.length !== 0 && source.hash && source.owner - // if (command.hashOnly && args.length === 0) throw new CommandError({ translate: 'Please provide a hash or a OwnerHash', color: 'red' }) - - //<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hash}\x1b[0m]` -// actual hash -//but look in hashing.js - //im looking through chomensjs's command handler for reference - //💀 -// <\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m] + if ( + source?.sources?.discord && + command.trustLevel === 2 && + !roles?.some((role) => role.name === "FNFBoyfriendBot Owner") + ) + throw new CommandError({ + text: "You are not the Owner!", + color: "dark_red", + }); + const owner = `${args[0]}`; + if ( + !source?.sources?.discord && + command.trustLevel === 2 && + owner !== bot.owner + ) + throw new CommandError({ + text: "Invalid Owner Hash", + color: "dark_red", + }); - //command.hashOnly && source.sources.discord - //supposed to be a command error for invalid hash - // if (command.hashOnly && args.length === 0) throw new CommandError({ translate: 'Please provide a hash or a OwnerHash', color: 'red' }) - - // {text:'Invalid Trusted hash or invalid Owner Hash', color:'red'} - // you cant do a empty if - // but i didnt know it can be just undefined :skull: - //sus - //commented smh out about and ig that worked - // sus - // if("e") {} // ok - // idfk how to explain but it does - // real (there was no if) - - - // isnt it if(something) {} or i -//if( - - // )//tf - - /* -if (command.trustLevel > 0) { - const discordRoles = message.member?.roles?.cache - - - - if( - sources.source.discord && - command.trustLevel === 1 && - !discordRoles.some((role) => role.name === 'trusted' || - role.name === 'FNFBoyfriendBot Owner') - )throw new CommandError({text:'You are not trusted!', color:'red'}) - let hash - let owner - if ( - !sources.source.discord && - command.trustLevel === 1 && - args.shift() !== hash && - args.shift() !== owner - ) - */ -// just shift it out of the args (mabe would help with needing to do cloop e add 1 say hi) - - //idfk - //tf - // why the fard did it include the comment in the eror it sent - //so replace args[0] with arg.shift() -// just do args.shift() - // or mabe const hasharg = args.shift() - // idk -//aaa - //expression expected - //ik that but why tf is it erroring - - // wat the fard - // sus - - return command.execute({ bot, source, arguments: args }) + if (command.trustLevel === 3 && !source?.sources?.console) + throw new CommandError({ + translate: "This command can only be executed via console", + color: "blue", + }); + } + return command.execute({ bot, source, arguments: args }); } catch (error) { - const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) - bot.console.warn(error.stack)//const filename of fs.readdirSync(path.join(__dirname, '../commands' -//console.error('Failed to load command', filename, ':', error) -//${path.join(__dirname, '..')} -//const filename of fs.readdirSync(path.join(__dirname, '../commands' -//filenames.forEach(function(filename) { - //fs.readFile(dirname + filename, 'utf-8', function(err, content) { - - -if (error instanceof CommandError) source.sendError(error._message) - // - // else source.sendError({ text:String(error.stack), color:'red' }) - else source.sendError({ translate: 'A Error has occured because the bot shot itself 🔫', color:'red', hoverEvent: { action: 'show_text', contents: String(error.stack) } }) + const now = new Date().toLocaleString("en-US", { + timeZone: "America/CHICAGO", + }); + bot.console.warn(error.stack); + if (error instanceof CommandError) source.sendError(error._message); + + else + source.sendError({ + translate: "An Error has occured because the bot shot itself 🔫", + color: "red", + hoverEvent: { action: "show_text", contents: String(error.stack) }, + }); if (source.sources.discord) { - source.sendError(error) - } + source.sendError(error); + } } }, -// else source.sendError({ translate: 'command.failed', hoverEvent: { action: 'show_text', contents: String(error.message) } }) - executeString (source, command) { - const [commandName, ...args] = command.split(' ') - return this.execute(source, commandName, args) + + executeString(source, command) { + const [commandName, ...args] = command.split(" "); + return this.execute(source, commandName, args); }, - register (command) { - this.commands[command.name] = command - - if(command.aliases) { - command.aliases.map(a => this.commands[a] = command) + register(command) { + this.commands[command.name] = command; + + if (command.aliases) { + command.aliases.map((a) => (this.commands[a] = command)); } }, - getCommand (name) { - return this.commands[name] + getCommand(name) { + return this.commands[name]; }, - getCommands () { - return Object.values(this.commands) - } - } -// -amogus = [] - + getCommands() { + return Object.values(this.commands); + }, + }; + // + commandlist = []; -for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) { + for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) { try { - const command = require(path.join(__dirname, '../commands', filename)) - bot.commandManager.register(command) - bot.commandManager.amogus.push(command) - + const command = require(path.join(__dirname, "../commands", filename)); + bot.commandManager.register(command); + bot.commandManager.commandlist.push(command); } catch (error) { - console.error('Failed to load command', filename, ':', error) + console.error("Failed to load command", filename, ":", error); } - if (process.env['anti-skid'] !== 'amogus is sus') { - process.exit(0) + if (process.env["anti-skid"] !== "amogus is sus") { + process.exit(0); + } } } -} -module.exports = inject +module.exports = command_manager; diff --git a/modules/console.js b/modules/console.js index 976cb70..88dff26 100644 --- a/modules/console.js +++ b/modules/console.js @@ -1,114 +1,88 @@ -const CommandSource = require('../CommandModules/command_source') +const CommandSource = require("../CommandModules/command_source"); //const logger = require('../util/logger') -function inject (bot, options, context, source) { - +function Console(bot, options, context, source) { bot.console = { readline: null, -username:bot.username, - consoleServer: 'all', - //bot._client.username, - useReadlineInterface (rl) { - this.readline = rl - - - - rl.on('line', line => { - if (bot.options.host !== this.consoleServer && this.consoleServer !== 'all') return - - -if (line.startsWith('.')) { - return bot.commandManager.executeString( -bot.console.source, - - line.substring(1), - //null - `${process.env["FNFBoyfriendBot_Owner_key"]}` - - ) -} - - if (line === ',kill') process.exit() - if (line === ',reconnect') bot._client.end() - - - - -//probably gotta somehow have it get its username - //tried that already didnt work just errored - //profile or smh :shrug: + username: bot.username, + consoleServer: "all", + //bot._client.username, + useReadlineInterface(rl) { + this.readline = rl; + + rl.on("line", (line) => { + if ( + bot.options.host !== this.consoleServer && + this.consoleServer !== "all" + ) + return; + + if (line.startsWith(".")) { + return bot.commandManager.executeString( + bot.console.source, + + line.substring(1), + //null + `${process.env["FNFBoyfriendBot_Owner_key"]}`, + ); + } + + if (line === ",kill") process.exit(); + if (line === ",reconnect") bot._client.end(); + + //probably gotta somehow have it get its username + //tried that already didnt work just errored + //profile or smh :shrug: // what does it have to be - -if (line.startsWith('')){ - return bot.commandManager.executeString( -bot.console.source, - 'console ' + line.substring(0) - ) - } - - - + + if (line.startsWith("")) { + return bot.commandManager.executeString( + bot.console.source, + "console " + line.substring(0), + ); + } + + //bot.commandManager.executeString(bot.console.source, line) + }); + + const now = new Date().toLocaleString("en-US", { + timeZone: "America/CHICAGO", + }); + const time = new Date().toLocaleTimeString("en-US", { + timeZone: "America/CHICAGO", + }); + const date = new Date().toLocaleDateString("en-US", { + timeZone: "America/CHICAGO", + }); + + // const source = context.source + + const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `; + + function log(...args) { + rl.output.write("\x1b[2K\r"); + console.log(args.toString()); + rl._refreshLine(); + } + + bot.console.warn = function (error) { + log(prefix + `[\x1b[0m\x1b[93mWARN\x1b[0m]: ${error}`); + }; + bot.console.error = function (error) { + log(prefix + `[\x1b[0m\x1b[31mERROR\x1b[0m]: ${error}`); + }; + + bot.console.info = function (message) { + log(prefix + `[\x1b[0m\x1b[32mInfo\x1b[0m]: ` + message); + }; + bot.console.log = function (message, ansi) { + log(prefix + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message); + }; + bot.console.debug = function (message, ansi) { + log(prefix + `[\x1b[0m\x1b[33mDEBUG\x1b[0m]: ` + message); + }; - - - //bot.commandManager.executeString(bot.console.source, line) - - }) - - - - - - - /* - function prefix (prefix, _message) { - const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) - const message = `[${now} \x1b[0m\x1b[33mLOGS\x1b[0m] [${bot.options.host}:${bot.options.port}]` - - } - */ - - //date.toLocaleDateString() for the date part, and date.toLocaleTimeString() - const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) - const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"}) -const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}) - - // const source = context.source - - - const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` - - function log (...args) { - rl.output.write('\x1b[2K\r') - console.log(args.toString()) - rl._refreshLine() - }; - - bot.console.warn = function (error) { - log(prefix + `[\x1b[0m\x1b[93mWARN\x1b[0m]: ${error}`) - } - bot.console.error = function (error) { - log(prefix + `[\x1b[0m\x1b[31mERROR\x1b[0m]: ${error}`) - } - - bot.console.info = function (message) { - log(prefix + `[\x1b[0m\x1b[32mInfo\x1b[0m]:` + message) - } - bot.console.log = function (message, ansi) { - - log(prefix + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message) - } - bot.console.debug = function (message, ansi) { - - log(prefix + `[\x1b[0m\x1b[33mDEBUG\x1b[0m]: ` + message) - } - /* - const player = source.player.profile.name - const uuid = source.player.uuid - - console.log(`[${now} \x1b[0m\x1b[91mHash\x1b[0m] [\x1b[0m\x1b[92mSender: ${player}, uuid:${uuid}, hash:${bot.hash}\x1b[0m]`) - */ - /* const ansimap = { + /* const ansimap = { 0: '\x1b[0m\x1b[30m', 1: '\x1b[0m\x1b[34m', 2: '\x1b[0m\x1b[32m', @@ -131,63 +105,69 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"} n: '\x1b[4m', m: '\x1b[9m', k: '\x1b[6m' - }*/ /*return bot.commandManager.executeString( - bot.username, - options.commands.prefix + line.substring(1), - bot.uuid, - null, - - )*/ + }*/ + const isConsole = bot.username ? true : false; + bot.console.source = new CommandSource(bot.username, { + console: true, + discord: false, + }); + bot.console.source.sendFeedback = (message) => { + + const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(); -// bot.username - //const amogus = username, - - //name: message?.member?.displayName - const isConsole = bot.username ? true : false - bot.console.source = new CommandSource( bot.username,{console:true, discord:false }); - bot.console.source.sendFeedback = message => { - //profile:{displayName:bot.username} - const ansi = bot.getMessageAsPrismarine(message)?.toAnsi() - - if (!bot.options.input) return - if (!bot.options.console) return - bot.console.log(ansi) - - } + if (!bot.options.input) return; + if (!bot.options.console) return; + bot.console.info(ansi); + }; - bot.on('message', message => { - function log (...args) { - rl.output.write('\x1b[2K\r') - console.log(args.toString()) - rl._refreshLine() - }; - const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"}) -const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}) - const prefixy = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` - - bot.console.logs = function (message, ansi) { - - log(prefixy + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message) - } - const lang = require(`../util/language/${bot.options.language}.json`) - const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang) - const string = bot.getMessageAsPrismarine(message)?.toString() - - const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) - // const logtag = (JSON.stringify({"text":"[LOGS]", "color":"#00FF00"})) - const time2 = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"}) -const date2 = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}) - - //const prefix = `<${time2} ${date2}> [${bot.options.host}:${bot.options.port}] ` - if (!bot.options.input) return - if (!bot.options.console) return - bot.console.logs(`${ansi}`) + bot.on("parsed_message", (data) => { + if (data.type !== "minecraft:chat") return; - }) + const plainMessage = bot + .getMessageAsPrismarine(data.contents) + ?.toString(); + if (plainMessage.startsWith("frog")) { + bot.chat("frok :)"); + } + return; + }); + bot.on("message", (message) => { + function log(...args) { + rl.output.write("\x1b[2K\r"); + console.log(args.toString()); + rl._refreshLine(); + } + const time = new Date().toLocaleTimeString("en-US", { + timeZone: "America/CHICAGO", + }); + const date = new Date().toLocaleDateString("en-US", { + timeZone: "America/CHICAGO", + }); + const prefixy = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `; + + bot.console.logs = function (message, ansi) { + log(prefixy + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message); + }; + const lang = require(`../util/language/lolus.json`); + const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang); + const string = bot.getMessageAsPrismarine(message)?.toString(); + + const now = new Date().toLocaleString("en-US", { + timeZone: "America/CHICAGO", + }); + const time2 = new Date().toLocaleTimeString("en-US", { + timeZone: "America/CHICAGO", + }); + const date2 = new Date().toLocaleDateString("en-US", { + timeZone: "America/CHICAGO", + }); + + + if (!bot.options.input) return; + if (!bot.options.console) return; + bot.console.logs(`${ansi}`); + }); + }, + }; } - }//const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` -} -module.exports = inject -/*const message = `[${moment().format('DD/MM/YY HH:mm:ss')} ${prefix}§r] [${bot.server.host}] ` - const component = chatMessage.MessageBuilder.fromString(message).toJSON() - */ \ No newline at end of file +module.exports = Console; diff --git a/modules/discord.js b/modules/discord.js index 475b9b5..d40bbdd 100644 --- a/modules/discord.js +++ b/modules/discord.js @@ -9,7 +9,7 @@ const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] }) const util = require('util') client.login(process.env.discordtoken) -function inject (bot, options) { +function discord (bot, options) { if (!options.discord?.channelId) { bot.discord = { invite: options.discord?.invite } return @@ -74,7 +74,7 @@ function inject (bot, options) { */ //`\`\`\`\n \n\`\`\` function sendComponent (message) { - const lang = require(`../util/language/${bot.options.language}.json`) + const lang = require(`../util/language/lolus.json`) const ansi = bot.getMessageAsPrismarine(message).toAnsi(lang).replaceAll('```\u001b[9```' + '```\u001b[3```')// I have a function to fix ansi :shrug: /* @@ -202,6 +202,15 @@ function inject (bot, options) { //sendDiscordMessage(reason) }) + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('purr')) { + bot.chat(' puuuuuuuuuurrrrrrrrrrrr~') + + } return +}) /*bot.on('end', (reason, event) => { sendDiscordMessage('event:' + event) sendDiscordMessage('Reason:' + util.inspect(reason)) @@ -244,4 +253,4 @@ function fixansi(message) { } } // -module.exports = inject +module.exports = discord diff --git a/modules/hashing.js b/modules/hashing.js index 72dcfe9..b5ee8e8 100644 --- a/modules/hashing.js +++ b/modules/hashing.js @@ -3,7 +3,7 @@ const crypto = require('crypto') const ownerkey = process.env['FNFBoyfriendBot_Owner_key'] const trustedkey = process.env['FNFBoyfriendBot_key'] -function inject(bot) { +function hashgen (bot) { bot.hash = '' bot.owner = '' bot.updatehashes = update @@ -35,7 +35,14 @@ function inject(bot) { }) */ } - + bot.on('parsed_message', data => { + if (data.type !== 'minecraft:chat') return + + const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() + if (plainMessage.startsWith('fnf sky')) { + bot.chat('sky the fangirl!?!? i simp for her :)') + } return +}) let _hash = generateHash() const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"}) @@ -71,7 +78,7 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"} function generateHash () { return crypto.randomBytes(4).toString('hex') } -module.exports = inject +module.exports = hashgen diff --git a/modules/memusage.js b/modules/memusage.js index b894c16..2eb0707 100644 --- a/modules/memusage.js +++ b/modules/memusage.js @@ -1,35 +1,52 @@ -function memusage (bot, options){ -const clamp = require('../util/clamp') - const title = 'Memusage' +function memusage(bot, options) { + const clamp = require("../util/clamp"); + const bossbarName = "memusage"; - const os = require('os') - let enabled = false - let tag = 'FNFBoyfriendBotMemusage' - bot.memusage = { - on () { - enabled = true + const os = require("os"); + let enabled = false; + let tag = "FNFBoyfriendBotMemusage"; + bot.memusage = { + on() { + enabled = true; }, - off () { - enabled = false - bot.core.run(`minecraft:title @a actionbar ${title}`) - } - } - const tickRates = [] - let nextIndex = 0 - let timeLastTimeUpdate = -1 - let timeGameJoined + off() { + enabled = false; + bot.core.run(`minecraft:bossbar remove ${bossbarName}`); + }, + };// + const interval = setInterval(() => { - if (!enabled) return + if (!enabled) return; - const component = { - - text: `Mem used ${Math.floor(process.memoryUsage().heapUsed / 1000 / 1000)} MiB / ${Math.floor(process.memoryUsage().heapTotal / 1000 / 1000)} MiB. CPU Usage ${JSON.stringify(process.cpuUsage())} `, - color: 'dark_gray' - - }//process.cpuUsage - bot.core.run(`minecraft:title @a[tag=${tag}] actionbar ${JSON.stringify(component)}`) -}, 50)//process.memoryUsage().heapUsed /1024 / 1024 - - } -module.exports = memusage + /* const component = { + text: `Mem used ${Math.floor( + process.memoryUsage().heapUsed / 1000 / 1000, + )} MiB / ${Math.floor( + process.memoryUsage().heapTotal / 1000 / 1000, + )} MiB. `, + color: "dark_gray", + };*/ + const component = { + translate: `memusage %s`, + color: "gray", + bold: false, + with: [{ text: `Memory used ${Math.floor( + process.memoryUsage().heapUsed / 1000 / 1000, + )} Mebibytes / ${Math.floor( + process.memoryUsage().heapTotal / 1000 / 1000, + )} Mebibytes.`, color: "green" }], + }; + //process.cpuUsage + bot.core.run(`minecraft:bossbar add ${bossbarName} ""`); + bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`); + bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`); + bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`); + bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`); + bot.core.run( + `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`, + ); + bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`); + }, 100); //process.memoryUsage().heapUsed /1024 / 1024 +} +module.exports = memusage; diff --git a/modules/music.js b/modules/music.js index 7273b5c..1c78d0a 100644 --- a/modules/music.js +++ b/modules/music.js @@ -23,7 +23,7 @@ const soundNames = { pling: 'minecraft:block.note_block.pling' } -function inject (bot) { +function music (bot) { bot.music = function () {} bot.music.song = null bot.music.loop = 0 @@ -140,7 +140,7 @@ function inject (bot) { noteIndex = 0 bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk } -if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5.0.3 §8Build:325") +if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5.0.4 §8Build:340") { process.exit(1) } @@ -177,4 +177,4 @@ if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5 } } -module.exports = inject +module.exports = music diff --git a/modules/player_list.js b/modules/player_list.js index 11af1dc..7488119 100644 --- a/modules/player_list.js +++ b/modules/player_list.js @@ -1,4 +1,4 @@ -function inject (bot) { +function player_list (bot) { bot.players = [] //chayapak you mentally ok? bot.on('packet.player_info', packet => { @@ -46,7 +46,7 @@ function inject (bot) { target.removePlayer = entry.removePlayer } }// - if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.3 Build:225') + if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.4 Build:240') { process.exit(1) } @@ -103,7 +103,7 @@ removePlayer:undefined, bot.on('end', () => (bot.players = [])) } -module.exports = inject +module.exports = player_list /*function addPlayer (player, packet) { if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet) else bot.emit('player_added', player, packet) diff --git a/modules/position.js b/modules/position.js index 2110596..19048b8 100644 --- a/modules/position.js +++ b/modules/position.js @@ -1,4 +1,4 @@ -function inject (bot) { +function position (bot) { bot.position = null bot.on('packet.position', packet => { @@ -16,4 +16,4 @@ function inject (bot) { bot.on('end', () => { bot.position = null }) } -module.exports = inject +module.exports = position diff --git a/modules/registry.js b/modules/registry.js index 17c9de4..f923353 100644 --- a/modules/registry.js +++ b/modules/registry.js @@ -1,6 +1,6 @@ const createRegistry = require('prismarine-registry') -function inject (bot) { +function registry (bot) { bot.on('packet.login', packet => { bot.registry = createRegistry(bot._client.version) bot.registry.loadDimensionCodec(packet.dimensionCodec) @@ -8,4 +8,4 @@ function inject (bot) { }) } -module.exports = inject +module.exports = registry diff --git a/modules/selfcare.js b/modules/selfcare.js index 8a40d61..c61e91f 100644 --- a/modules/selfcare.js +++ b/modules/selfcare.js @@ -4,7 +4,7 @@ const util = require('util') const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' } const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' } //You now have the tag: &8[&bPrefix &4d~&8] -function inject (bot) { +function selfcare (bot) { let entityId let gameMode let permissionLevel = 2 @@ -108,7 +108,7 @@ let unmuted = false if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]') if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on') - else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`) + else if (unmuted && bot.options.selfcare.unmuted) bot.core.run(`essentials:mute ${bot.uuid}`) else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix &4${bot.options.commands.MainPrefix}&8]`) else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]') @@ -117,6 +117,7 @@ let unmuted = false else if (!nickname && bot.options.selfcare.nickname) bot.command(`nick off`) else if (!god && bot.options.selfcare.god) bot.command('god on') else if (!tptoggle && bot.options.selfcare.tptoggle) bot.command('tptoggle off') + else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`) }, bot.options.selfcare.interval) }) @@ -134,7 +135,7 @@ let unmuted = false }) } -module.exports = inject +module.exports = selfcare /*const buildstring = process.env['buildstring'] bot.on('login', async () => { console.log(`starting ${buildstring}`) diff --git a/modules/settings.js b/modules/settings.js index 4669b96..858b7fe 100644 --- a/modules/settings.js +++ b/modules/settings.js @@ -1,6 +1,6 @@ const assert = require('assert') -module.exports = inject +module.exports = ClientSettings const chatToBits = { enabled: 0, @@ -28,7 +28,7 @@ const controls = { sprint: false, sneak: false } -function inject (bot, options) { +function ClientSettings (bot, options) { function setSettings (settings) { extend(bot.settings, settings) @@ -84,13 +84,13 @@ function inject (bot, options) { : options.difficulty, skinParts: options.skinParts == null ? { - showCape: bot.options.skin.torso.cape, - showJacket: bot.options.skin.torso.jacket, - showLeftSleeve: bot.options.skin.arms.leftSleeve, - showRightSleeve: bot.options.skin.arms.rightSleeve, - showLeftPants: bot.options.skin.legs.leftPants, - showRightPants: bot.options.skin.legs.rightPants, - showHat: bot.options.skin.head.hat + showCape: true, + showJacket: true, + showLeftSleeve: true, + showRightSleeve: true, + showLeftPants: true, + showRightPants: true, + showHat: true } : options.skinParts, mainHand: options.mainHand || 'left', diff --git a/modules/team.js b/modules/team.js deleted file mode 100644 index 350b0ae..0000000 --- a/modules/team.js +++ /dev/null @@ -1,5 +0,0 @@ -function team (bot, context, data) { -const CommandSource = require('../CommandModules/command_source') - -} -module.exports = team \ No newline at end of file diff --git a/modules/tps.js b/modules/tps.js deleted file mode 100644 index df03f79..0000000 --- a/modules/tps.js +++ /dev/null @@ -1,76 +0,0 @@ -const clamp = require('../util/clamp') -function inject (bot, config) { - const bossbarName = 'tps' - - let enabled = false - bot.tps = { - on () { - enabled = true - }, - off () { - enabled = false - bot.core.run(`minecraft:bossbar remove ${bossbarName}`) - } - } - - const tickRates = [] - let nextIndex = 0 - let timeLastTimeUpdate = -1 - let timeGameJoined - - const interval = setInterval(() => { - if (!enabled) return - - const component = { - translate: `https://doin-your.mom TPS - %s`, - color: 'gray', - bold: false, - with: [ - { text: getTickRate(), color: 'green' } - ] - } - bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) - bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`) - bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) - bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`) - bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`) - bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`) - bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`) - bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(getTickRate())}`) - // bot.tellraw(Math.floor(getTickRate())) - }, 50) - - function getTickRate () { - if (Date.now() - timeGameJoined < 4000) return 'Calculating...' - - let numTicks = 0 - let sumTickRates = 0.0 - for (const tickRate of tickRates) { - if (tickRate > 0) { - sumTickRates += tickRate - numTicks++ - } - } - - const value = (sumTickRates / numTicks).toFixed(2) - if (value > 20) return 20 - else return value - } - - bot.on('login', () => { - nextIndex = 0 - timeGameJoined = timeLastTimeUpdate = Date.now() - }) - - bot._client.on('update_time', () => { - const now = Date.now() - const timeElapsed = (now - timeLastTimeUpdate) / 1000.0 - tickRates[nextIndex] = clamp(20.0 / timeElapsed, 0.0, 20.0) - nextIndex = (nextIndex + 1) % tickRates.length - timeLastTimeUpdate = now - }) - - bot.on('end', () => clearInterval(interval)) -} - -module.exports = inject diff --git a/modules/tpsbar.js b/modules/tpsbar.js new file mode 100644 index 0000000..2c7dcdd --- /dev/null +++ b/modules/tpsbar.js @@ -0,0 +1,78 @@ +const clamp = require("../util/clamp"); +function tpsbar(bot, config) { + const bossbarName = "tps"; + + let enabled = false; + bot.tps = { + on() { + enabled = true; + }, + off() { + enabled = false; + bot.core.run(`minecraft:bossbar remove ${bossbarName}`); + }, + }; + + const tickRates = []; + let nextIndex = 0; + let timeLastTimeUpdate = -1; + let timeGameJoined; + + const interval = setInterval(() => { + if (!enabled) return; + + const component = { + translate: `https://doin-your.mom TPS - %s`, + color: "gray", + bold: false, + with: [{ text: getTickRate(), color: "green" }], + }; + bot.core.run(`minecraft:bossbar add ${bossbarName} ""`); + bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`); + bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`); + bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`); + bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`); + bot.core.run( + `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`, + ); + bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`); + bot.core.run( + `minecraft:bossbar set ${bossbarName} value ${Math.floor(getTickRate())}`, + ); + // bot.tellraw(Math.floor(getTickRate())) + }, 100); + + function getTickRate() { + if (Date.now() - timeGameJoined < 4000) return "Calculating..."; + + let numTicks = 0; + let sumTickRates = 0.0; + for (const tickRate of tickRates) { + if (tickRate > 0) { + sumTickRates += tickRate; + numTicks++; + } + } + + const value = (sumTickRates / numTicks).toFixed(2); + if (value > 20) return 20; + else return value; + } + + bot.on("login", () => { + nextIndex = 0; + timeGameJoined = timeLastTimeUpdate = Date.now(); + }); + + bot._client.on("update_time", () => { + const now = Date.now(); + const timeElapsed = (now - timeLastTimeUpdate) / 1000.0; + tickRates[nextIndex] = clamp(20.0 / timeElapsed, 0.0, 20.0); + nextIndex = (nextIndex + 1) % tickRates.length; + timeLastTimeUpdate = now; + }); + + bot.on("end", () => clearInterval(interval)); +} + +module.exports = tpsbar; diff --git a/package-lock.json b/package-lock.json index 5c52c45..875f89c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "mineflayer": "^4.14.0", "mineflayer-cmd": "^1.1.3", "moment-timezone": "^0.5.43", + "node-fetch": "^2.7.0", "npm": "^9.5.1", "prismarine-chat": "^1.9.1", "prismarine-nbt": "^2.2.1", @@ -29,7 +30,7 @@ "randomstring": "^1.3.0", "readline": "^1.3.0", "sharp": "^0.32.6", - "urban-dictionary": "^3.0.2", + "urban-dictionary": "git+https://code.chipmunk.land/ChipmunkMC/urban-dictionary.git", "urban-dictionary-client": "^3.1.0", "uuid-by-string": "^4.0.0", "vec3": "^0.1.8", @@ -38,24 +39,24 @@ } }, "node_modules/@azure/msal-common": { - "version": "14.5.0", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.5.0.tgz", - "integrity": "sha512-Gx5rZbiZV/HiZ2nEKfjfAF/qDdZ4/QWxMvMo2jhIFVz528dVKtaZyFAOtsX2Ak8+TQvRsGCaEfuwJFuXB6tu1A==", + "version": "14.6.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-14.6.0.tgz", + "integrity": "sha512-AGusT/JvxdzJIYi5u0n97cmhd3pUT6UuI6rEkT5iDeT2FGcV0/EB8pk+dy6GLPpYg9vhDCuyoYrEZGd+2UeCCQ==", "engines": { "node": ">=0.8.0" } }, "node_modules/@azure/msal-node": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.6.0.tgz", - "integrity": "sha512-RWAWCYYrSldIYC47oWtofIun41e6SB9TBYgGYsezq6ednagwo9ZRFyRsvl1NabmdTkdDDXRAABIdveeN2Gtd8w==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.6.1.tgz", + "integrity": "sha512-wYwz83pWatTNWUCkTi3cAOXbchad5FnZz/pbZz7b8Z6FuEqohXcTtg6BLip9SmcjN6FlbwUdJIZYOof2v1Gnrg==", "dependencies": { - "@azure/msal-common": "14.5.0", + "@azure/msal-common": "14.6.0", "jsonwebtoken": "^9.0.0", "uuid": "^8.3.0" }, "engines": { - "node": "16|| 18 || 20" + "node": ">=16" } }, "node_modules/@balena/dockerignore": { @@ -179,16 +180,15 @@ } }, "node_modules/@sapphire/shapeshift": { - "version": "3.9.4", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.9.4.tgz", - "integrity": "sha512-SiOoCBmm8O7QuadLJnX4V0tAkhC54NIOZJtmvw+5zwnHaiulGkjY02wxCuK8Gf4V540ILmGz+UulC0U8mrOZjg==", + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.9.5.tgz", + "integrity": "sha512-AGdHe+51gF7D3W8hBfuSFLBocURDCXVQczScTHXDS3RpNjNgrktIx/amlz5y8nHhm8SAdFt/X8EF8ZSfjJ0tnA==", "dependencies": { "fast-deep-equal": "^3.1.3", "lodash": "^4.17.21" }, "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" + "node": ">=v18" } }, "node_modules/@sapphire/snowflake": { @@ -215,17 +215,17 @@ "integrity": "sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w==" }, "node_modules/@types/node": { - "version": "20.10.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz", - "integrity": "sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg==", + "version": "20.10.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", + "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/readable-stream": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.9.tgz", - "integrity": "sha512-4cwuvrmNF96M4Nrx0Eep37RwPB1Mth+nCSezsGRv5+PsFyRvDdLd0pil6gVLcWD/bh69INNdwZ98dJwfHpLohA==", + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.10.tgz", + "integrity": "sha512-AbUKBjcC8SHmImNi4yK2bbjogQlkFSg7shZCcicxPQapniOlajG8GCc39lvXzCWX4lLRRs7DM3VAeSlqmEVZUA==", "dependencies": { "@types/node": "*", "safe-buffer": "~5.1.1" @@ -295,9 +295,9 @@ } }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "bin": { "acorn": "bin/acorn" }, @@ -357,11 +357,11 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -416,7 +416,7 @@ "readable-stream": "^3.4.0" } }, - "node_modules/bl/node_modules/buffer": { + "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", @@ -439,42 +439,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/buffer-equal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.1.tgz", @@ -713,56 +677,32 @@ } }, "node_modules/docker-modem": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.1.tgz", - "integrity": "sha512-vqrE/nrweCyzmCpVpdFRC41qS+tfTF+IoUKlTZr52O82urbUqdfyJBGWMvT01pYUprWepLr8IkyVTEWJKRTQSg==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.3.tgz", + "integrity": "sha512-89zhop5YVhcPEt5FpUFGr3cDyceGhq/F9J+ZndQ4KfqNvfbJpPMfgeixFgUj5OjCYAboElqODxY5Z1EBsSa6sg==", "dependencies": { "debug": "^4.1.1", "readable-stream": "^3.5.0", "split-ca": "^1.0.1", - "ssh2": "^1.11.0" + "ssh2": "^1.15.0" }, "engines": { "node": ">= 8.0" } }, - "node_modules/docker-modem/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/dockerode": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.0.tgz", - "integrity": "sha512-3LF7/3MPz5+9RsUo91rD0MCcx0yxjC9bnbtgtVjOLKyKxlZSJ7/Kk3OPAgARlwlWHqXwAGYhmkAHYx7IwD0tJQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.2.tgz", + "integrity": "sha512-9wM1BVpVMFr2Pw3eJNXrYYt6DT9k0xMcsSCjtPvyQ+xa1iPg/Mo3T/gUcwI0B2cczqCeCYRPF8yFYDwtFXT0+w==", "dependencies": { "@balena/dockerignore": "^1.0.2", - "docker-modem": "^5.0.0", + "docker-modem": "^5.0.3", "tar-fs": "~2.0.1" }, "engines": { "node": ">= 8.0" } }, - "node_modules/dockerode/node_modules/tar-fs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", - "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.0.0" - } - }, "node_modules/dotenv": { "version": "16.3.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", @@ -840,9 +780,9 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", @@ -916,9 +856,9 @@ ] }, "node_modules/infobox-parser": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/infobox-parser/-/infobox-parser-3.6.2.tgz", - "integrity": "sha512-lasdwvbtjCtDDO6mArAs/ueFEnBJRyo2UbZPAkd5rEG5NVJ3XFCOvbMwNTT/rJlFv1+ORw8D3UvZV4brpgATCg==", + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/infobox-parser/-/infobox-parser-3.6.4.tgz", + "integrity": "sha512-d2lTlxKZX7WsYxk9/UPt51nkmZv5tbC75SSw4hfHqZ3LpRAn6ug0oru9xI2X+S78va3aUAze3xl/UqMuwLmJUw==", "dependencies": { "camelcase": "^4.1.0" }, @@ -1184,9 +1124,9 @@ "integrity": "sha512-vGBKTA+jwM4KgjGZ+S/8/Mkj9rWzePyGY6jManXPGhiWu63RYwW8dKPyk5koP+8qNVhPhHgFa1y/MJ4wrjsNrg==" }, "node_modules/magic-bytes.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.6.0.tgz", - "integrity": "sha512-eOGBE+NSCwU9dKKox93BPHjX4KSxIuiRY1/H1lkfxIagT0Llhs6bkRk8iqoP/0aeDl7FEZPa+ln5lay5mcNY4w==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.7.0.tgz", + "integrity": "sha512-YzVU2+/hrjwx8xcgAw+ffNq3jkactpj+f1iSL4LonrFKhvnwDzHSqtFdk/MMRP53y9ScouJ7cKEnqYsJwsHoYA==" }, "node_modules/midi-file": { "version": "1.2.4", @@ -1224,9 +1164,9 @@ } }, "node_modules/minecraft-data": { - "version": "3.53.0", - "resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.53.0.tgz", - "integrity": "sha512-35+XuLCgzG0xvXKaN2huF5EpUXjjW7HE6fRg1bz4lwI+7sjl4DDQRnRTvdJq3gGrNT8lkWvtBf71/NnXvhdh+Q==" + "version": "3.59.2", + "resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.59.2.tgz", + "integrity": "sha512-ra2xsZ1d0UvcxF77ZtpPqKUchU8pjlhPsh/cX/IW7H3yQSA4j7vPSl2ztD+bzfszAmS6qeHjQK/LifUHmlmK/Q==" }, "node_modules/minecraft-folder-path": { "version": "1.2.0", @@ -1311,10 +1251,48 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" }, + "node_modules/minecraft-protocol/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/minecraft-protocol/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/mineflayer": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/mineflayer/-/mineflayer-4.14.0.tgz", - "integrity": "sha512-4EYzUmZNxH3Gpz3GkgO2eaR90ANb50nVhMCU2y6Rl1Ru8M6HqxID1Eg7tRgsodfAOD+AKh5SPwmPnISLcxvnOA==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/mineflayer/-/mineflayer-4.17.0.tgz", + "integrity": "sha512-Bu5vwv3rhVjyMV8jtR/i+2SmJHXPdfUAIHQ2JBCwY/w+dpjsIu+gW97l+zBz365HraRO0i+kKb3xxSluAHp7hQ==", "dependencies": { "minecraft-data": "^3.44.0", "minecraft-protocol": "^1.44.0", @@ -1414,17 +1392,17 @@ } }, "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", "engines": { "node": "*" } }, "node_modules/moment-timezone": { - "version": "0.5.43", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.43.tgz", - "integrity": "sha512-72j3aNyuIsDxdF1i7CEgV2FfxM1r6aaqJyLB2vwb33mXYyoyLly+F1zbWqhA3/bVIoJ4szlUoMbUnVdid32NUQ==", + "version": "0.5.44", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.44.tgz", + "integrity": "sha512-nv3YpzI/8lkQn0U6RkLd+f0W/zy/JnoR5/EyPz/dNkPTBjA2jNLCVxaiQ8QpeLymhSZvX0wCL5s27NQWdOPwAw==", "dependencies": { "moment": "^2.29.4" }, @@ -1475,9 +1453,9 @@ } }, "node_modules/node-abi": { - "version": "3.52.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.52.0.tgz", - "integrity": "sha512-JJ98b02z16ILv7859irtXn4oUaFWADtvkzy2c0IAatNVX2Mc9Yoh8z6hZInn3QwvMEYhHuQloYi+TTQy67SIdQ==", + "version": "3.54.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz", + "integrity": "sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA==", "dependencies": { "semver": "^7.3.5" }, @@ -4448,9 +4426,9 @@ } }, "node_modules/prismarine-auth": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.3.0.tgz", - "integrity": "sha512-giKZiHwuQdpMJ7KX94UncOJqM3u+yqKIR2UI/rqmdmFUuQilV9vhlz/zehpVkvo7FE8gmZsuUMCUPhI+gtgd3A==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.4.0.tgz", + "integrity": "sha512-4tUtvfvVlymRG/KNCm7E8XZWqbmDme6BrfHDmuC11bXQJKZmfkvyrRcblXuq/Vv87jdhD3HokgWZZcjriZTP0w==", "dependencies": { "@azure/msal-node": "^2.0.2", "@xboxreplay/xboxlive-auth": "^3.3.3", @@ -4513,9 +4491,9 @@ } }, "node_modules/prismarine-entity": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/prismarine-entity/-/prismarine-entity-2.3.1.tgz", - "integrity": "sha512-HOv8l7IetHNf4hwZ7V/W4vM3GNl+e6VCtKDkH9h02TRq7jWngsggKtJV+VanCce/sNwtJUhJDjORGs728ep4MA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/prismarine-entity/-/prismarine-entity-2.4.0.tgz", + "integrity": "sha512-DBwjmoCX1IYAhN99KwYkk2rMArn65JHTzuuGXchr4GLWQs7UN4Pf9tELqBwNOu4r57x3RaW0+9+0sI3FvJQWzQ==", "dependencies": { "prismarine-chat": "^1.4.1", "prismarine-item": "^1.11.2", @@ -4638,19 +4616,6 @@ "protodef-validator": "cli.js" } }, - "node_modules/protodef/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -4729,18 +4694,16 @@ } }, "node_modules/readable-stream": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.2.tgz", - "integrity": "sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">= 6" } }, "node_modules/readline": { @@ -4902,9 +4865,9 @@ "integrity": "sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==" }, "node_modules/ssh2": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.14.0.tgz", - "integrity": "sha512-AqzD1UCqit8tbOKoj6ztDDi1ffJZ2rV2SwlgrVVrHPkV5vWqGJOVp5pmtj18PunkPJAuKQsnInyKV+/Nb2bUnA==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.15.0.tgz", + "integrity": "sha512-C0PHgX4h6lBxYx7hcXwu3QWdh4tg6tZZsTfXcdvc5caW/EMxaB4H9dWsl7qk+F7LAW762hp8VbXOX7x4xUYvEw==", "hasInstallScript": true, "dependencies": { "asn1": "^0.2.6", @@ -4914,8 +4877,8 @@ "node": ">=10.16.0" }, "optionalDependencies": { - "cpu-features": "~0.0.8", - "nan": "^2.17.0" + "cpu-features": "~0.0.9", + "nan": "^2.18.0" } }, "node_modules/ssh2/node_modules/asn1": { @@ -4935,9 +4898,9 @@ } }, "node_modules/streamx": { - "version": "2.15.5", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.5.tgz", - "integrity": "sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==", + "version": "2.15.6", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz", + "integrity": "sha512-q+vQL4AAz+FdfT137VF69Cc/APqUbxy+MDOImRrMvchJpigHj9GksgDU2LYbO9rx7RX6osWgxJB2WxhYv4SZAw==", "dependencies": { "fast-fifo": "^1.1.0", "queue-tick": "^1.0.1" @@ -5003,14 +4966,14 @@ } }, "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.1.tgz", + "integrity": "sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==", "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", - "tar-stream": "^2.1.4" + "tar-stream": "^2.0.0" } }, "node_modules/tar-stream": { @@ -5028,19 +4991,6 @@ "node": ">=6" } }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -5108,8 +5058,8 @@ }, "node_modules/urban-dictionary": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/urban-dictionary/-/urban-dictionary-3.0.2.tgz", - "integrity": "sha512-hoYevSg6JNr8NiYRtxz7sqBDBu4RL52Bd45L2jQQ44Rwrz6ACmnKnRcUkH2TIQRILN+viZMT/MYYU3OyBz68AA==", + "resolved": "git+https://code.chipmunk.land/ChipmunkMC/urban-dictionary.git#3b60e3adce74d62f660b2b22a16c5a0084250757", + "license": "MIT", "engines": { "node": ">=14.15.1" } @@ -5169,9 +5119,9 @@ } }, "node_modules/vec3": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/vec3/-/vec3-0.1.8.tgz", - "integrity": "sha512-LfKrP625Bsg/Tj52YdYPsHmpsJuo+tc6fLxZxXjEo9k2xSspKlPvoYTHehykKhp1FvV9nm+XU3Ehej5/9tpDCg==" + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/vec3/-/vec3-0.1.10.tgz", + "integrity": "sha512-Sr1U3mYtMqCOonGd3LAN9iqy0qF6C+Gjil92awyK/i2OwiUo9bm7PnLgFpafymun50mOjnDcg4ToTgRssrlTcw==" }, "node_modules/vm2": { "version": "3.9.19", diff --git a/package.json b/package.json index 0f721fe..f15253f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "mineflayer": "^4.14.0", "mineflayer-cmd": "^1.1.3", "moment-timezone": "^0.5.43", + "node-fetch": "^2.7.0", "npm": "^9.5.1", "prismarine-chat": "^1.9.1", "prismarine-nbt": "^2.2.1", @@ -24,7 +25,7 @@ "randomstring": "^1.3.0", "readline": "^1.3.0", "sharp": "^0.32.6", - "urban-dictionary": "^3.0.2", + "urban-dictionary": "git+https://code.chipmunk.land/ChipmunkMC/urban-dictionary.git", "urban-dictionary-client": "^3.1.0", "uuid-by-string": "^4.0.0", "vec3": "^0.1.8", diff --git a/modules/visibility.js b/visibility.js similarity index 100% rename from modules/visibility.js rename to visibility.js diff --git a/modules/vm.js b/vm.js similarity index 100% rename from modules/vm.js rename to vm.js