diff --git a/.bot.js.2274242318~ b/.bot.js.2274242318~ new file mode 100644 index 0000000..b49c522 --- /dev/null +++ b/.bot.js.2274242318~ @@ -0,0 +1,75 @@ +const mc = require('minecraft-protocol') +const { EventEmitter } = require('node:events') +const fs = require('fs') +const path = require('path') +const util = require('node:util') + + 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 ??= 'Player' + Math.floor(Math.random() * 1000) + options.hideErrors ??= false // HACK: Hide errors by default as a lazy fix to console being spammed with them + + 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'] + }) + + client.on('end', reason => { bot.emit('end', reason) + try { + if (reason.text) { + if + } + } + })if + + client.on('error', error => bot.emit('error', error), ) + + }) + +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] + + // 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) + } catch (error) { + + console.error('\x1b[0m\x1b[91m[ERROR]: \x1b[0m\x1b[90mFailed to load module', filename, ':', error) + + } + } + + return bot +} + +// ABot username function mabe mabe + +module.exports = createBot diff --git a/CommandModules/command_source.js b/CommandModules/command_source.js index 2168b58..ca170cb 100644 --- a/CommandModules/command_source.js +++ b/CommandModules/command_source.js @@ -1,8 +1,14 @@ class CommandSource { - constructor (player, sources, hash = false, owner = false, discordMessageEvent = null, consoleOnly = sources) { + constructor (player, sources, hash, owner, discordMessageEvent = null, consoleOnly, name, profile, bot) {//this worked just fine in v4.3.4 + //does it get defined in discord thingy wherever dat is + // sus + this.player = player + this.name = player this.sources = sources + this.profile = bot this.hash = hash + this.trustLevel this.owner = owner this.consoleOnly = consoleOnly this.discordMessageEvent = discordMessageEvent diff --git a/bot.js b/bot.js new file mode 100644 index 0000000..a16558f --- /dev/null +++ b/bot.js @@ -0,0 +1,144 @@ +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....') + + 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.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.commands.prefix ??= '!' + + 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 + + // 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.username}`) + console.log(`Host: ${bot.host}:${bot.port}`) + console.log(`Minecraft java version: ${bot.version}`) + }) + //bot.visibility = false + client.on('end', reason => { bot.emit('end', reason) + + }) + client.on('keep_alive', ({ keepAliveId }) => { + bot.emit('keep_alive', { keepAliveId }) + }) + client.on('error', error => bot.emit('error', error), ) + + }) + +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] + + // 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') + + 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 diff --git a/chat/chatTypeEmote.js b/chat/chatTypeEmote.js index dec1686..9a6ff77 100644 --- a/chat/chatTypeEmote.js +++ b/chat/chatTypeEmote.js @@ -1,4 +1,5 @@ function parseMessage (message, data, context) { + try{ if (message === null || typeof message !== 'object') return if (message.with?.length < 2 || (message.translate !== 'chat.type.emote' && message.translate !== '%s %s')) return @@ -26,6 +27,8 @@ function parseMessage (message, data, context) { if (!sender) return undefined return { sender, contents, type: 'minecraft:chat', senderComponent } +}catch(e){ + console.log(e.stack) } - -module.exports = parseMessage +} +module.exports = parseMessage \ No newline at end of file diff --git a/chat/chatTypeText.js b/chat/chatTypeText.js index 60b9048..54fa7d2 100644 --- a/chat/chatTypeText.js +++ b/chat/chatTypeText.js @@ -1,5 +1,6 @@ function parseMessage (message, data, context) { - if (message === null || typeof message !== 'object') return +try { + if (message === null || typeof message !== 'object') return if (message.with?.length < 2 || (message.translate !== 'chat.type.text' && message.translate !== '%s %s')) return @@ -26,6 +27,8 @@ function parseMessage (message, data, context) { if (!sender) return undefined return { sender, contents, type: 'minecraft:chat', senderComponent } +}catch(e){ + console.log(e.stack) +} } - module.exports = parseMessage diff --git a/commands/botdevhistory.js b/commands/botdevhistory.js index 9233148..266a9ad 100644 --- a/commands/botdevhistory.js +++ b/commands/botdevhistory.js @@ -3,9 +3,8 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'botdevhistory', description:['bots dev history'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + +trustLevel: 0, execute (context) { const message = context.arguments.join(' ') diff --git a/commands/bots.js b/commands/bots.js index fbe9fba..ccb4519 100644 --- a/commands/bots.js +++ b/commands/bots.js @@ -196,9 +196,7 @@ module.exports = { name: 'bots', description:['shows a list of known bots'], aliases:['knownbots'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const query = context.arguments.join(' ').toLowerCase() const bot = context.bot diff --git a/commands/bruhify.js b/commands/bruhify.js index 631098c..25ad895 100644 --- a/commands/bruhify.js +++ b/commands/bruhify.js @@ -4,9 +4,7 @@ module.exports = { name: 'bruhify', description:['bruhify text'], aliases:['bruhifytext', 'bruh'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const bot = context.bot const args = context.arguments diff --git a/commands/calculator.js b/commands/calculator.js index ae61db4..e12ca72 100644 --- a/commands/calculator.js +++ b/commands/calculator.js @@ -2,9 +2,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'calculator', description:['calculate maths'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['calc'], execute (context) { const bot = context.bot diff --git a/commands/changelog.js b/commands/changelog.js index f081190..114a15a 100644 --- a/commands/changelog.js +++ b/commands/changelog.js @@ -1,334 +1,18 @@ const bots = [ - { - name: { text: 'v0.1.0 - v0.5.0-beta', color: 'blue', bold:false }, - authors: ['Prototypes'], +{// + name: { text: 'v5.0.0-Beta', color: 'blue', bold:false }, + authors: ['Monochrome'], - foundation: '11/22/22 - 1/24/23', - exclaimer:'ehh nothing much just the release of the betas', - }, - { - name: { text: 'v1.0.0-beta', color: 'blue', bold:false }, - authors: ['in console test'], - - foundation: '1/25/23', - exclaimer:'original commands:!cloop bcraw,!cloop sudo,!troll,!say,!op (broke),!deop (broke), !gms (broke),!freeze,!icu <--- these commands no longer can be used in game but in console for beta 1.0 commands added: fake kick,ban,kick,crashserver,stop,gmc,greetin,test(broken idk),bypass,entity spam ,gms ,stop,tntspam ,prefix ,annoy (broke results in a complete server crash keeping ayunboom down for 3 to 5 hours),freeze,crashserver,troll ,trol(more destructive),icu ,say,sudo,cloop', - }, - { - name: { text: 'v1.0.0', color: 'dark_red', bold:false }, - authors: ['FNFBoyfriendBot'], - - foundation: '1/26/23', - exclaimer:'FNFBoyfriendBot. commands added: BOOM,deop,troll and trol(added extra code to both commands),kaboom,serverdeop, commands fixed:tp,gms,annoy(attemps to crash the server but not as bad as it was) commands untested:prefix command Broke:icu,freeze,tntspam,entityspam,tntspam? changed name to &b &lFNFBoyfriendBot may change later idk', - }, - { - name: { text: 'v1.0.1', color: 'green', bold:false }, - authors: [''], - - foundation: '1/26/23', - exclaimer:'reworked the kaboom command and fixed the description commands but thats about it. also reworked the greeting command', - }, - { - name: { text: 'v1.1.0', color: 'green', bold:false }, - authors: [''], - - foundation: '1/26/23 2:00pm', - exclaimer:'nothing much just added extra stuff to the troll, trol and that is about it', - }, - { - name: { text: 'v1.2.0', color: 'green', bold:false }, - authors: [''], - - foundation: '1/28/23 1:51', - exclaimer:'for ppl me making me really mad -.- got released early', - }, -{ - name: { text: 'v2.0.0', color: 'dark_red', bold:false }, - authors: ['Major'], - - foundation: '2/07/23 8:01pm', - exclaimer:'added DREAMSTANALERT,technoblade,GODSWORD,KFC,MYLEG,OHHAIL,altcrash,MyHead Reworked tntspam,entityspam,soundbreaker added Spim to the whitelist of the bot released too early than it was planned gonna be released due do the code almost leaked it had to be released early', - }, - { - name: { text: 'v2.1.0', color: 'green', bold:false }, - authors: [''], - - foundation: '2/11/23 5:30pm', - exclaimer:'added: refillcore(had early prototypes of this was original), vanish,deop,cloopdeop,mute,cloopmute reworked: op (supposed to already op the bot but didnt work until this release) and reworked gmc (same problem with op) (had early prototypes of vanish,refillcore,gmc,and op but these were original gonna be automatic but after alot of attempts i said screw it and added 2 commands refillcore, and vanish reworked gmc and op and got them working finally) removed Spim because come to find out he couldnt be trusted', - }, - { - name: { text: 'v2.2.0', color: 'green', bold:false }, - authors: [''], - - foundation: '2/20/23', - exclaimer:'added ckill(added back after trial and error),serversuicidal changed username of the bot from hex code to FNFBoyfriendBot because hex code for the username was confusing as it changes everytime', - }, - { - name: { text: 'v3.0.0-Beta', color: 'blue', bold:false }, - authors: ['blue-balled corruption'], - - foundation: '', - exclaimer:'was canceled due to ayunboom being rewriten and renamed to creayun barely usable on there because commands blocks are disabled which i created a bot for that server that has no command blocks just finished the final build of the Creayun build of the bot due to chip announcing that he may make a kaboom clone yk what 1.5.2 and 1.8 support but anyway onto what is in the v3.0-beta well the beta for right now commands added:discord,version,online,list,iownyou,endmysuffering,wafflehouse,whopper,bcraw,destroycore Notes:the original say command was reworked into talking in chat without bcraw and command blocks which the bcraw chatting code is still in the bot but was reworked into the bcraw commmand. maybe some commands removed? i dont know yet edit there is 2 commands removed commands removed:tpe and serverdeop??? reworked commands :say command for right now relay chat mabe will be added as a seperate repl i dont know yet possible would need a whole code rewrite for relay chat', - }, - { - name: { text: 'v3.0.0', color: 'dark_red', bold:false }, - authors: ['Sky Remanifested'], - - foundation: '', - exclaimer:'the full release of 3.0 the rewrite has been pushed back to 4.0 due to 3.0 already pass its release date and the code i had on hand was done but the rewrite wasnt done Added: SelfCare Made during development:Relay chat prototypes for several servers', - }, - { - name: { text: 'v3.0.5', color: 'green', bold:false }, - authors: [''], - - foundation: '', - exclaimer:'bug fixes', - }, - { - name: { text: 'v3.0.9', color: 'green', bold:false }, - authors: [''], - - foundation: '', - exclaimer:'commands added:Help(finally added after about a year),consolelog(added cuz yes),cloopconsolelog(added cuz yes)', - }, - { - name: { text: 'v3.3.0', color: 'dark_red', bold:false }, - authors: [''], - - foundation: '', - exclaimer:'switched it base to 4.0s base during 4.0s development', - }, - { - name: { text: 'v4.0.0-beta', color: 'blue', bold:false }, - authors: ['FNFBoyfriendBot Ultimate'], - - foundation: '', - exclaimer:'all of the command removed and or rewriten from version 3.0.9 Commands added or rewriten:ban,buyrealminecraft,cloop,discord,echo,errortest,freeze,help,icu,info,kick,bots,skids,romncitrash,say,selfdestruct,serversuicidal,sudo,test,trol,troll (note that this is different and is not CommandModules)Modules Added:discord,chat,chat_command_handler,command_manager,position,registry,reconnect,command_core CustomChats added:kaboom(for normal chat) (note that this is different and is not Modules)CommandModules Added:command_error,Command_source a beta release for rn', - }, - { - name: { text: 'v4.0.0-Alpha ', color: 'aqua', bold:false }, - authors: ['FNFBoyfriendBot Ultimate'], - - foundation: '', - exclaimer:'Commands added: calculator,ckill,evaljs,urban,crash,cloopcrash,core,list,ping,netmsg,skin,tpr Commands Removed:Buyrealminecraft (note that this is different and is not CommandModules)Modules Added:op selfcare,gmc selfcare,vanish selfcare,cspy selfcare,console (note that this is different and is not Modules)CustomChats Added:u2O3a(for custom chat) added util with between(for urban) eval_colors(for evaljs)', - }, - { - name: { text: 'v4.0.0', color: 'dark_red', bold:false }, - authors: ['FNFBoyfriendBotX'], - - foundation: '8/11/23', - exclaimer:'Bot is finished with the rewrite thank you ChipMC and chayapak for helping me rewrite the bot Heres the commands ban (mabe removing), blacklist (currently being worked on), botdevhistory, bots, calculator, changelog, ckill, cloop, cloopcrash(probably removing), core, crash, creators, discord, echo, errortest, evaljs, freeze, help, icu, list, meminfo, mineflayerbot, netmsg (Hello World!), ping (pong!), reconnect, say, selfdestruct, serversuicidal (probably removing because theres ckill), skin, sudo, test, tpr, trol (mabe renaming it to troll), troll (mabe removing it and replacing it with the trol command), urban (ong sus asf), validate, version', - }, - { - name: { text: 'v4.0.5', color: 'green', bold:false }, - authors: [''], - - foundation: '8/17/23', - exclaimer:'bug fixes, did what i said i was gonna do in the last update', - - }, - { - name: { text: 'v4.0.6', color: 'green', bold:false }, - authors: [''], - - foundation: '8/22/23', - exclaimer:'added 1 console command along with updating console.js so that the bot sends a message to 1 server at a time and not a message to all the servers at a time', - }, - { - name: { text: 'v4.0.7', color: 'green', bold:false }, - authors: [''], - - foundation: '9/4/23', - exclaimer:'merged server and botusername commands and naming the command logininfo cuz it now shows the server ip, server port, Minecraft java Version, and the Bots Username', - }, - { - name: { text: 'v4.0.8', color: 'green', bold:false }, - authors: [''], - - foundation: '9/7/23', - exclaimer:'added the wiki command even though its semi working. bug fixes. some bugs still in the bot is netmsg showing the bots username when i used the netmsg cmd from my end and not the console i find it funny asf though', - }, - { - name: { text: 'v4.0.8A', color: 'gold', bold:false }, - authors: [''], - - foundation: '9/7/23', - exclaimer:'added some things to the changelog cmd. still needing to fix the issue with custom chat and netmsg also added a bugs command to check what bugs are needing to be fixed', - }, - { - name: { text: 'v4.0.8B', color: 'gold', bold:false }, - authors: [''], - - foundation: '9/8/23', - exclaimer:'made it to where it sends more messages on start up and made it to where the buildstring is in secrets', - }, - { - name: { text: 'v4.0.8C', color: 'gold', bold:false }, - authors: [''], - - foundation: '9/14/23', - exclaimer:'added the nodejs version to the version command but thats about it still fixing the bugs with the relay chat and mabe rewriting the validation system in the bot', - }, -{ - name: { text: 'v4.0.8D', color: 'gold', bold:false }, - authors: [''], - - foundation: '9/16/23', - exclaimer:'added onto the changelog command along with adding spambot and lol commands (cuz yes) along with removing the bugs command maybe adding it back sometime later also the discord relay chat and validation system mabe getting a rewrite and also updated node from v18 to v20.6.0', - }, - { - name: { text: 'v4.0.8E', color: 'gold', bold:false }, - authors: [''], - - foundation: '9/17/23', - exclaimer:'changed the name for meminfo to serverinfo along with adding onto it and moving the nodejs, node-minecraft-protocol, and discord.js versions from the version command to the serverinfo command', - }, -{ - name: { text: 'v4.0.8F', color: 'gold', bold:false }, - authors: [''], - - foundation: '9/24/23', - exclaimer:'added filesdirectories command but thats about it', - }, - { - name: { text: 'v4.0.9', color: 'green', bold:false }, - authors: [''], - - foundation: '9/26/23', - exclaimer:'added a hover event to the custom chat for the bot', - }, -{ - name: { text: 'v4.1.0', color: 'green', bold:false }, - authors: [''], - - foundation: '9/27/23', - exclaimer:'Finally changed how the validation/hashing works in the bot instead of it being sent in discord there will be a key for trusted to validate', - }, - { - name: { text: 'v4.1.1', color: 'green', bold:false }, - authors: [''], - - foundation: '9/28/23', - exclaimer:'added uppercase and lowercase function for commands and soon gonna be completely overhauling the validation system in the bot again', - }, - { - name: { text: 'v4.1.2', color: 'green', bold:false }, - authors: [''], - - foundation: '10/02/23', - exclaimer:'added uptime as a command but thats it', - }, - { - name: { text: 'v4.1.4', color: 'green', bold:false }, - authors: [''], - - foundation: '10/03/23', - exclaimer:'moved the custom chat text and cmd block text to config.js', - }, - { - name: { text: 'v4.1.6', color: 'green', bold:false }, - authors: [''], - - foundation: '10/08/23', - exclaimer:'fixed the relay chat and fixed the cr issue with urban and also fixed reconnect', - }, - { - name: { text: 'v4.1.7', color: 'green', bold:false }, - authors: [''], - - foundation: '10/08/03', - exclaimer:'added mute, tag, and skin to selfcare', - }, // am I even gonna be credited? - { - name: { text: 'v4.1.8', color: 'green', bold:false }, - authors: [''],//cai cee mmm deee sus - - foundation: '10/11/23', - exclaimer:'fixed the issue with memused cee mmm dee', - }, - {// - name: { text: 'v4.1.9', color: 'green', bold:false }, - authors: [''], - - foundation: '10/12/23', - exclaimer:'rewrote evaljs its now using isolated-vm and not vm2', - }, - {// - name: { text: 'v4.2.0-restore', color: 'green', bold:false }, - authors: [''], - - foundation: '10/19/23', - exclaimer:'fixed the disconnect message for discord and the bug with the say command', - }, - {// - name: { text: 'v4.2.1', color: 'green', bold:false }, - authors: [''], - - foundation: '10/24/23', - exclaimer:'rewrote the help command to allow descriptions finally along with adding things to the base of the bot for the descriptions', - }, - {// - name: { text: 'v4.2.2', color: 'green', bold:false }, - authors: [''], - - foundation: '10/25/23', - exclaimer:'merged serverinfo, memused, discord, logininfo, creators, version, uptime together', - }, - {// - name: { text: 'v4.2.3', color: 'green', bold:false }, - authors: [''], - - foundation: '10/30/23', - exclaimer:'added a antiskid measure (thanks _yfd)', - }, - {// - name: { text: 'v4.2.4', color: 'green', bold:false }, - authors: ['Spooky update (note: might as well give it a codename since its halloween)'], - - foundation: '10/31/23', - exclaimer:'merged fard and reconnect together making recend, added more crash methods to the crash command, and remove 12 commands', - }, - {// - name: { text: 'v4.2.5', color: 'green', bold:false }, - authors: [''], - - foundation: '11/8/23', - exclaimer:'patched the exploit in the discordmsg command and made it to were with the netmsg command players cannot send empty messages', - }, - {// - name: { text: 'v4.3.0', color: 'green', bold:false }, - authors: [''], - - foundation: '11/16/23', - exclaimer:`color coded the console logs are LOGS in the color gold consoleserver are in the category INFO in the color green, errors after start up are in the category WARN in the color yellow, Fatal Errors/start-up errors are in the category ERROR in the color red and hashs/validation codes sent to console are in the category HASH in the color green. added the command servereval. changed config.json to config.js and moved the username() function from the end of bot.js to the end of config.js and replacing where username() after options.username with 'Player' + Math.floor(Math.random() * 1000) and added player ping/latency to list along with fixing the bug with cloop list`, - }, - {// - name: { text: 'v4.3.1', color: 'green', bold:false }, - authors: [''], - - foundation: '11/21/23 one day till the bots anniversary?!?!', - exclaimer:'modified the bots boot originally it would spam the bots buildstring each time it logged into a server on boot but now it will only send it once to console on boot along with it now sending the foundationbuildstring after the buildstring sent in console. ported some commands over since chomens is pretty much dead along with adding chat support for chat.type.text and chat.type.emote', - }, - {// - name: { text: 'v4.3.2', color: 'green', bold:false }, - authors: [''], - - foundation: '11/23/23', - exclaimer:'made the bots selfcare, the selfcares interval and console toggle-able along with making default options for the selfcare and its interval, the bots prefix, the bots discord prefix, the reconnectDelay interval, the core customname, and the console, partically fixed the issue with the trusted commands no being able to be ran in discord, edited the bots boot again it now also logs the amount of files its loading on boot its discord username its logged in with(also added the discord username to the info command)', + foundation: '12/18/23', + exclaimer:'added owner validation to the bot thats about it', }, {// - name: { text: 'v4.3.3', color: 'dark_red', bold:false }, - authors: ["Lullaby Girlfriend's LostCause"], + name: { text: 'v5.0.0', color: 'dark_red', bold:false }, + authors: ['Monochrome'], - foundation: '12/3/23', - exclaimer:'added hover events to the help command for command descriptions, trust console and name along with click events for them added memusage and fixed the category issue with the console and added toggles to the bot for console, selfcare, and skin', - }, - {// - name: { text: 'v4.3.4', color: 'dark_red', bold:false }, - authors: ['Suffering Siblings'], - - foundation: '12/12/23', - exclaimer:'overhauled the console and discord relay chat fixing trusted roles and making the selfcare toggleable in game also fixing the issue with hiding console only commands (thank you poopbob for helping me with that)', + foundation: '12/20/23', + exclaimer:'since the old validation system was able to barely handle owner validation it was completely remove and replaced with trust levels which handle validation way better also added command aliases (shoutouts to poopbob with the command aliases). made a whole new changelog command for v5.0.0 and renamed the old one changelogv4.3.4. also fixed the issue with the console not properly refreshing lines that are sent', }, ]//§4Lullaby §cGirlfriend's §cLost§bCause //back @@ -344,9 +28,7 @@ const bots = [ module.exports = { name: 'changelog', description:['check the bots changelog'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['cl', 'changes'], execute (context) { const query = context.arguments.join(' ').toLowerCase() diff --git a/commands/changelogPreV5.0.js b/commands/changelogPreV5.0.js new file mode 100644 index 0000000..1c50b19 --- /dev/null +++ b/commands/changelogPreV5.0.js @@ -0,0 +1,409 @@ + +const bots = [ + { + name: { text: 'v0.1.0 - v0.5.0-beta', color: 'blue', bold:false }, + authors: ['Prototypes'], + + foundation: '11/22/22 - 1/24/23', + exclaimer:'ehh nothing much just the release of the betas', + }, + { + name: { text: 'v1.0.0-beta', color: 'blue', bold:false }, + authors: ['in console test'], + + foundation: '1/25/23', + exclaimer:'original commands:!cloop bcraw,!cloop sudo,!troll,!say,!op (broke),!deop (broke), !gms (broke),!freeze,!icu <--- these commands no longer can be used in game but in console for beta 1.0 commands added: fake kick,ban,kick,crashserver,stop,gmc,greetin,test(broken idk),bypass,entity spam ,gms ,stop,tntspam ,prefix ,annoy (broke results in a complete server crash keeping ayunboom down for 3 to 5 hours),freeze,crashserver,troll ,trol(more destructive),icu ,say,sudo,cloop', + }, + { + name: { text: 'v1.0.0', color: 'dark_red', bold:false }, + authors: ['FNFBoyfriendBot'], + + foundation: '1/26/23', + exclaimer:'FNFBoyfriendBot. commands added: BOOM,deop,troll and trol(added extra code to both commands),kaboom,serverdeop, commands fixed:tp,gms,annoy(attemps to crash the server but not as bad as it was) commands untested:prefix command Broke:icu,freeze,tntspam,entityspam,tntspam? changed name to &b &lFNFBoyfriendBot may change later idk', + }, + { + name: { text: 'v1.0.1', color: 'green', bold:false }, + authors: [''], + + foundation: '1/26/23', + exclaimer:'reworked the kaboom command and fixed the description commands but thats about it. also reworked the greeting command', + }, + { + name: { text: 'v1.1.0', color: 'green', bold:false }, + authors: [''], + + foundation: '1/26/23 2:00pm', + exclaimer:'nothing much just added extra stuff to the troll, trol and that is about it', + }, + { + name: { text: 'v1.2.0', color: 'green', bold:false }, + authors: [''], + + foundation: '1/28/23 1:51', + exclaimer:'for ppl me making me really mad -.- got released early', + }, +{ + name: { text: 'v2.0.0', color: 'dark_red', bold:false }, + authors: ['Major'], + + foundation: '2/07/23 8:01pm', + exclaimer:'added DREAMSTANALERT,technoblade,GODSWORD,KFC,MYLEG,OHHAIL,altcrash,MyHead Reworked tntspam,entityspam,soundbreaker added Spim to the whitelist of the bot released too early than it was planned gonna be released due do the code almost leaked it had to be released early', + }, + { + name: { text: 'v2.1.0', color: 'green', bold:false }, + authors: [''], + + foundation: '2/11/23 5:30pm', + exclaimer:'added: refillcore(had early prototypes of this was original), vanish,deop,cloopdeop,mute,cloopmute reworked: op (supposed to already op the bot but didnt work until this release) and reworked gmc (same problem with op) (had early prototypes of vanish,refillcore,gmc,and op but these were original gonna be automatic but after alot of attempts i said screw it and added 2 commands refillcore, and vanish reworked gmc and op and got them working finally) removed Spim because come to find out he couldnt be trusted', + }, + { + name: { text: 'v2.2.0', color: 'green', bold:false }, + authors: [''], + + foundation: '2/20/23', + exclaimer:'added ckill(added back after trial and error),serversuicidal changed username of the bot from hex code to FNFBoyfriendBot because hex code for the username was confusing as it changes everytime', + }, + { + name: { text: 'v3.0.0-Beta', color: 'blue', bold:false }, + authors: ['blue-balled corruption'], + + foundation: '', + exclaimer:'was canceled due to ayunboom being rewriten and renamed to creayun barely usable on there because commands blocks are disabled which i created a bot for that server that has no command blocks just finished the final build of the Creayun build of the bot due to chip announcing that he may make a kaboom clone yk what 1.5.2 and 1.8 support but anyway onto what is in the v3.0-beta well the beta for right now commands added:discord,version,online,list,iownyou,endmysuffering,wafflehouse,whopper,bcraw,destroycore Notes:the original say command was reworked into talking in chat without bcraw and command blocks which the bcraw chatting code is still in the bot but was reworked into the bcraw commmand. maybe some commands removed? i dont know yet edit there is 2 commands removed commands removed:tpe and serverdeop??? reworked commands :say command for right now relay chat mabe will be added as a seperate repl i dont know yet possible would need a whole code rewrite for relay chat', + }, + { + name: { text: 'v3.0.0', color: 'dark_red', bold:false }, + authors: ['Sky Remanifested'], + + foundation: '', + exclaimer:'the full release of 3.0 the rewrite has been pushed back to 4.0 due to 3.0 already pass its release date and the code i had on hand was done but the rewrite wasnt done Added: SelfCare Made during development:Relay chat prototypes for several servers', + }, + { + name: { text: 'v3.0.5', color: 'green', bold:false }, + authors: [''], + + foundation: '', + exclaimer:'bug fixes', + }, + { + name: { text: 'v3.0.9', color: 'green', bold:false }, + authors: [''], + + foundation: '', + exclaimer:'commands added:Help(finally added after about a year),consolelog(added cuz yes),cloopconsolelog(added cuz yes)', + }, + { + name: { text: 'v3.3.0', color: 'dark_red', bold:false }, + authors: [''], + + foundation: '', + exclaimer:'switched it base to 4.0s base during 4.0s development', + }, + { + name: { text: 'v4.0.0-beta', color: 'blue', bold:false }, + authors: ['FNFBoyfriendBot Ultimate'], + + foundation: '', + exclaimer:'all of the command removed and or rewriten from version 3.0.9 Commands added or rewriten:ban,buyrealminecraft,cloop,discord,echo,errortest,freeze,help,icu,info,kick,bots,skids,romncitrash,say,selfdestruct,serversuicidal,sudo,test,trol,troll (note that this is different and is not CommandModules)Modules Added:discord,chat,chat_command_handler,command_manager,position,registry,reconnect,command_core CustomChats added:kaboom(for normal chat) (note that this is different and is not Modules)CommandModules Added:command_error,Command_source a beta release for rn', + }, + { + name: { text: 'v4.0.0-Alpha ', color: 'aqua', bold:false }, + authors: ['FNFBoyfriendBot Ultimate'], + + foundation: '', + exclaimer:'Commands added: calculator,ckill,evaljs,urban,crash,cloopcrash,core,list,ping,netmsg,skin,tpr Commands Removed:Buyrealminecraft (note that this is different and is not CommandModules)Modules Added:op selfcare,gmc selfcare,vanish selfcare,cspy selfcare,console (note that this is different and is not Modules)CustomChats Added:u2O3a(for custom chat) added util with between(for urban) eval_colors(for evaljs)', + }, + { + name: { text: 'v4.0.0', color: 'dark_red', bold:false }, + authors: ['FNFBoyfriendBotX'], + + foundation: '8/11/23', + exclaimer:'Bot is finished with the rewrite thank you ChipMC and chayapak for helping me rewrite the bot Heres the commands ban (mabe removing), blacklist (currently being worked on), botdevhistory, bots, calculator, changelog, ckill, cloop, cloopcrash(probably removing), core, crash, creators, discord, echo, errortest, evaljs, freeze, help, icu, list, meminfo, mineflayerbot, netmsg (Hello World!), ping (pong!), reconnect, say, selfdestruct, serversuicidal (probably removing because theres ckill), skin, sudo, test, tpr, trol (mabe renaming it to troll), troll (mabe removing it and replacing it with the trol command), urban (ong sus asf), validate, version', + }, + { + name: { text: 'v4.0.5', color: 'green', bold:false }, + authors: [''], + + foundation: '8/17/23', + exclaimer:'bug fixes, did what i said i was gonna do in the last update', + + }, + { + name: { text: 'v4.0.6', color: 'green', bold:false }, + authors: [''], + + foundation: '8/22/23', + exclaimer:'added 1 console command along with updating console.js so that the bot sends a message to 1 server at a time and not a message to all the servers at a time', + }, + { + name: { text: 'v4.0.7', color: 'green', bold:false }, + authors: [''], + + foundation: '9/4/23', + exclaimer:'merged server and botusername commands and naming the command logininfo cuz it now shows the server ip, server port, Minecraft java Version, and the Bots Username', + }, + { + name: { text: 'v4.0.8', color: 'green', bold:false }, + authors: [''], + + foundation: '9/7/23', + exclaimer:'added the wiki command even though its semi working. bug fixes. some bugs still in the bot is netmsg showing the bots username when i used the netmsg cmd from my end and not the console i find it funny asf though', + }, + { + name: { text: 'v4.0.8A', color: 'gold', bold:false }, + authors: [''], + + foundation: '9/7/23', + exclaimer:'added some things to the changelog cmd. still needing to fix the issue with custom chat and netmsg also added a bugs command to check what bugs are needing to be fixed', + }, + { + name: { text: 'v4.0.8B', color: 'gold', bold:false }, + authors: [''], + + foundation: '9/8/23', + exclaimer:'made it to where it sends more messages on start up and made it to where the buildstring is in secrets', + }, + { + name: { text: 'v4.0.8C', color: 'gold', bold:false }, + authors: [''], + + foundation: '9/14/23', + exclaimer:'added the nodejs version to the version command but thats about it still fixing the bugs with the relay chat and mabe rewriting the validation system in the bot', + }, +{ + name: { text: 'v4.0.8D', color: 'gold', bold:false }, + authors: [''], + + foundation: '9/16/23', + exclaimer:'added onto the changelog command along with adding spambot and lol commands (cuz yes) along with removing the bugs command maybe adding it back sometime later also the discord relay chat and validation system mabe getting a rewrite and also updated node from v18 to v20.6.0', + }, + { + name: { text: 'v4.0.8E', color: 'gold', bold:false }, + authors: [''], + + foundation: '9/17/23', + exclaimer:'changed the name for meminfo to serverinfo along with adding onto it and moving the nodejs, node-minecraft-protocol, and discord.js versions from the version command to the serverinfo command', + }, +{ + name: { text: 'v4.0.8F', color: 'gold', bold:false }, + authors: [''], + + foundation: '9/24/23', + exclaimer:'added filesdirectories command but thats about it', + }, + { + name: { text: 'v4.0.9', color: 'green', bold:false }, + authors: [''], + + foundation: '9/26/23', + exclaimer:'added a hover event to the custom chat for the bot', + }, +{ + name: { text: 'v4.1.0', color: 'green', bold:false }, + authors: [''], + + foundation: '9/27/23', + exclaimer:'Finally changed how the validation/hashing works in the bot instead of it being sent in discord there will be a key for trusted to validate', + }, + { + name: { text: 'v4.1.1', color: 'green', bold:false }, + authors: [''], + + foundation: '9/28/23', + exclaimer:'added uppercase and lowercase function for commands and soon gonna be completely overhauling the validation system in the bot again', + }, + { + name: { text: 'v4.1.2', color: 'green', bold:false }, + authors: [''], + + foundation: '10/02/23', + exclaimer:'added uptime as a command but thats it', + }, + { + name: { text: 'v4.1.4', color: 'green', bold:false }, + authors: [''], + + foundation: '10/03/23', + exclaimer:'moved the custom chat text and cmd block text to config.js', + }, + { + name: { text: 'v4.1.6', color: 'green', bold:false }, + authors: [''], + + foundation: '10/08/23', + exclaimer:'fixed the relay chat and fixed the cr issue with urban and also fixed reconnect', + }, + { + name: { text: 'v4.1.7', color: 'green', bold:false }, + authors: [''], + + foundation: '10/08/03', + exclaimer:'added mute, tag, and skin to selfcare', + }, // am I even gonna be credited? + { + name: { text: 'v4.1.8', color: 'green', bold:false }, + authors: [''],//cai cee mmm deee sus + + foundation: '10/11/23', + exclaimer:'fixed the issue with memused cee mmm dee', + }, + {// + name: { text: 'v4.1.9', color: 'green', bold:false }, + authors: [''], + + foundation: '10/12/23', + exclaimer:'rewrote evaljs its now using isolated-vm and not vm2', + }, + {// + name: { text: 'v4.2.0-restore', color: 'green', bold:false }, + authors: [''], + + foundation: '10/19/23', + exclaimer:'fixed the disconnect message for discord and the bug with the say command', + }, + {// + name: { text: 'v4.2.1', color: 'green', bold:false }, + authors: [''], + + foundation: '10/24/23', + exclaimer:'rewrote the help command to allow descriptions finally along with adding things to the base of the bot for the descriptions', + }, + {// + name: { text: 'v4.2.2', color: 'green', bold:false }, + authors: [''], + + foundation: '10/25/23', + exclaimer:'merged serverinfo, memused, discord, logininfo, creators, version, uptime together', + }, + {// + name: { text: 'v4.2.3', color: 'green', bold:false }, + authors: [''], + + foundation: '10/30/23', + exclaimer:'added a antiskid measure (thanks _yfd)', + }, + {// + name: { text: 'v4.2.4', color: 'green', bold:false }, + authors: ['Spooky update (note: might as well give it a codename since its halloween)'], + + foundation: '10/31/23', + exclaimer:'merged fard and reconnect together making recend, added more crash methods to the crash command, and remove 12 commands', + }, + {// + name: { text: 'v4.2.5', color: 'green', bold:false }, + authors: [''], + + foundation: '11/8/23', + exclaimer:'patched the exploit in the discordmsg command and made it to were with the netmsg command players cannot send empty messages', + }, + {// + name: { text: 'v4.3.0', color: 'green', bold:false }, + authors: [''], + + foundation: '11/16/23', + exclaimer:`color coded the console logs are LOGS in the color gold consoleserver are in the category INFO in the color green, errors after start up are in the category WARN in the color yellow, Fatal Errors/start-up errors are in the category ERROR in the color red and hashs/validation codes sent to console are in the category HASH in the color green. added the command servereval. changed config.json to config.js and moved the username() function from the end of bot.js to the end of config.js and replacing where username() after options.username with 'Player' + Math.floor(Math.random() * 1000) and added player ping/latency to list along with fixing the bug with cloop list`, + }, + {// + name: { text: 'v4.3.1', color: 'green', bold:false }, + authors: [''], + + foundation: '11/21/23 one day till the bots anniversary?!?!', + exclaimer:'modified the bots boot originally it would spam the bots buildstring each time it logged into a server on boot but now it will only send it once to console on boot along with it now sending the foundationbuildstring after the buildstring sent in console. ported some commands over since chomens is pretty much dead along with adding chat support for chat.type.text and chat.type.emote', + }, + {// + name: { text: 'v4.3.2', color: 'green', bold:false }, + authors: [''], + + foundation: '11/23/23', + exclaimer:'made the bots selfcare, the selfcares interval and console toggle-able along with making default options for the selfcare and its interval, the bots prefix, the bots discord prefix, the reconnectDelay interval, the core customname, and the console, partically fixed the issue with the trusted commands no being able to be ran in discord, edited the bots boot again it now also logs the amount of files its loading on boot its discord username its logged in with(also added the discord username to the info command)', + }, + {// + name: { text: 'v4.3.3', color: 'dark_red', bold:false }, + authors: ["Lullaby Girlfriend's LostCause"], + + foundation: '12/3/23', + exclaimer:'added hover events to the help command for command descriptions, trust console and name along with click events for them added memusage and fixed the category issue with the console and added toggles to the bot for console, selfcare, and skin', + }, + {// + name: { text: 'v4.3.4', color: 'dark_red', bold:false }, + authors: ['Suffering Siblings'], + + foundation: '12/12/23', + exclaimer:'overhauled the console and discord relay chat fixing trusted roles and making the selfcare toggleable in game also fixing the issue with hiding console only commands (thank you poopbob for helping me with that)', + }, +]//§4Lullaby §cGirlfriend's §cLost§bCause +//back + + +/*{// + name: { text: '', color: 'gray', bold:false }, + authors: [''], + + foundation: '', + exclaimer:'', + },*/ +module.exports = { + name: 'changelogv4.3.4', + description:['check the bots changelog'], + trustLevel: 0, + aliases:['clv4.3.4', 'changesv4.3.4'], + execute (context) { + const query = context.arguments.join(' ').toLowerCase() + + if (query.length === 0) { + const list = [] + + for (const info of bots) { + if (list.length !== 0) list.push({ text: ', ', color: 'gray' }) + list.push(info.name) + } + const category = { + translate: ' (%s%s%s%s%s%s%s%s%s) ', + bold: false, + color: 'white', + with: [ + + { color: 'aqua', text: 'Alpha Release'}, + { color: 'white', text: ' | '}, + { color: 'blue', text: 'Beta Release'}, + { color: 'white', text: ' | '}, + { color: 'green', text: 'Minor release'}, + { color: 'white', text: ' | '}, + { color: 'gold', text: 'Revision Release'}, + { color: 'white', text: ' | '}, + { color: 'dark_red', text: 'Major Release'}, + + ] + } + context.source.sendFeedback(['Changelogs (', bots.length, ')', category, ' - ', ...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) + } + }, + + sendBotInfo (info, bot) { + const component = [''] + component.push('', info.name) + if (info.exclaimer) component.push('\n', ' ', info.exclaimer) + if (info.authors && info.authors.length !== 0) { + component.push('\n', 'Codename ') + for (const author of info.authors) { + component.push(author, { text: ', ', color: 'gray' }) + } + component.pop() + } + if (info.foundation) component.push('\n', 'Date: ', info.foundation) + if (info.prefixes && info.prefixes.length !== 0) { + component.push('\n', '') + for (const prefix of info.prefixes) { + component.push(prefix, { text: ' ', color: 'gray' }) + } + component.pop() + } + 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/cloop.js b/commands/cloop.js index 2fd7e07..95c1462 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -1,9 +1,10 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'cloop', -hashOnly: true, - consoleOnly:false, - ownerOnly:false, +//hashOnly: true, + // consoleOnly:false, + // ownerOnly:false, + trustLevel: 1, description:['command loop commands, the args are add, remove, clear, and list'], aliases:['commandloop'], execute (context, selector) { diff --git a/commands/console.js b/commands/console.js index 4a00260..ce6ca4c 100644 --- a/commands/console.js +++ b/commands/console.js @@ -3,9 +3,7 @@ const buildstring = process.env['buildstring'] const foundation = process.env['FoundationBuildString'] module.exports = { name: 'console', -consoleOnly:true, - hashOnly:false, - ownerOnly:false, +trustLevel: 3, description:['no :)'], // description:['make me say something in custom chat'], execute (context) { diff --git a/commands/consoleserver.js b/commands/consoleserver.js index e6ce312..ece930c 100644 --- a/commands/consoleserver.js +++ b/commands/consoleserver.js @@ -2,9 +2,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'consoleserver', - consoleOnly: true, - hashOnly:false, - ownerOnly:false, + trustLevel: 3, description:['consoleserver'], aliases:['csvr'], execute (context) { diff --git a/commands/core.js b/commands/core.js index 9b3d084..9d62d42 100644 --- a/commands/core.js +++ b/commands/core.js @@ -4,9 +4,7 @@ module.exports = { name: 'core', description:['make me run a command in core'], aliases:['cb','corerun','run','commandblockrun','cbrun'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const bot = context.bot // const client = context.client diff --git a/commands/cowsay.js b/commands/cowsay.js index 491e9b5..69c86f6 100644 --- a/commands/cowsay.js +++ b/commands/cowsay.js @@ -4,9 +4,7 @@ module.exports = { name: 'cowsay', description:['mooooo'], aliases:['cws', 'cow'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context, selector) { const bot = context.bot const args = context.arguments diff --git a/commands/crash.js b/commands/crash.js index aae8530..fabd7bf 100644 --- a/commands/crash.js +++ b/commands/crash.js @@ -3,9 +3,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'crash', description:['crashes a server'], - hashOnly: true, - consoleOnly:false, - ownerOnly:false, +trustLevel: 1, aliases:['crashserver', '69'],//69 cuz yes execute (context) { diff --git a/commands/discordmsg.js b/commands/discordmsg.js index 92cd073..13854a6 100644 --- a/commands/discordmsg.js +++ b/commands/discordmsg.js @@ -3,9 +3,7 @@ const CommandError = require("../CommandModules/command_error") module.exports = { name: 'discordmsg', description:['make me say something in discord'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['discordmessage', 'ddmsg'], execute (context) { //const args = context.args diff --git a/commands/echo.js b/commands/echo.js index 374faa1..b0b28b8 100644 --- a/commands/echo.js +++ b/commands/echo.js @@ -2,9 +2,7 @@ module.exports = { name: 'echo', description:['make me say something in chat'], aliases:['chatsay'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const bot = context.bot const message = context.arguments.join(' ') diff --git a/commands/end.js b/commands/end.js index e84ffbd..8cd5531 100644 --- a/commands/end.js +++ b/commands/end.js @@ -2,9 +2,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'end', description:['/kill the bot or make it /suicide'], - hashOnly:true, - ownerOnly:false, - consoleOnly:false, + trustLevel: 1, aliases:['kys','kill','suicide'], execute (context) { const bot = context.bot diff --git a/commands/errortest.js b/commands/errortest.js index 1ee80cc..df97858 100644 --- a/commands/errortest.js +++ b/commands/errortest.js @@ -4,9 +4,7 @@ module.exports = { name: 'errortest', description:['test errors'], aliases:['error', 'errtest', 'errtst'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const message = context.arguments.join(' ') //context.source.sendFeedback('hint hover your mouse over the error') diff --git a/commands/evaljs.js b/commands/evaljs.js index a200d92..702fe69 100644 --- a/commands/evaljs.js +++ b/commands/evaljs.js @@ -6,9 +6,7 @@ const { stylize } = require('../util/eval_colors') module.exports = { name: 'evaljs', -hashOnly:true, - consoleOnly:false,// vm owners please dont get mad at me ;-; - ownerOnly:false, +trustLevel: 1, aliases:['evaljsisolatedvm', 'evaljsnew', 'evaljsivm', 'eval', 'evalivm', 'evalisolatedvm', 'evaljsnew'], description:['run code in a vm note: amcforum members had a sh##fit over this command'], async execute (context) { diff --git a/commands/evaljsvm2.js b/commands/evaljsvm2.js index c4ee288..8f8a87c 100644 --- a/commands/evaljsvm2.js +++ b/commands/evaljsvm2.js @@ -9,9 +9,7 @@ let vm = new VM(options) module.exports = { name: 'evaljsvm2', -hashOnly:true, - consoleOnly:false, - ownerOnly:false, +trustLevel: 1, description:['old evaljs code'], aliases:['evaljsold', 'evalvm2', 'evalold'], execute (context) { diff --git a/commands/filter.js b/commands/filter.js index 9785fb5..181f5b6 100644 --- a/commands/filter.js +++ b/commands/filter.js @@ -2,9 +2,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'filter', -hashOnly: true, - consoleOnly:false, - ownerOnly:false, +trustLevel: 1, description:['filter players (not functional)'], execute (context) { //throw new CommandError('temp disabled') diff --git a/commands/fnfval.js b/commands/fnfval.js index 2e30b41..d161b12 100644 --- a/commands/fnfval.js +++ b/commands/fnfval.js @@ -3,7 +3,7 @@ const crypto = require('crypto') module.exports = { name: 'botval', - consoleOnly: true, + trustLevel: 3, execute (context) { const bot = context.bot diff --git a/commands/help.js b/commands/help.js index 4bdec7e..e28b0cd 100644 --- a/commands/help.js +++ b/commands/help.js @@ -4,9 +4,7 @@ module.exports = { name: 'help', aliases:['heko', 'cmd', '?', 'commands', 'cmds' ], description:['shows the command list'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, async execute (context) { const bot = context.bot const commandList = [] @@ -40,9 +38,13 @@ module.exports = { if (args[0].toLowerCase() === command.name ) // if (args[0].toLowerCase() === command.aliases) - { + {//text:`Trust Level: `,color:'white'}, + //{text:`${command.trustLevel}\n`,color:'red'}, valid = true source.sendFeedback([cmd, `Description: ${command.description}`]) + + source.sendFeedback([cmd, {text:`Trust Level: ${command.trustLevel}`}]) + source.sendFeedback([cmd, `aliases: ${command.aliases}`]) break } else valid = false @@ -69,7 +71,7 @@ module.exports = { const command = bot.commandManager.amogus[fard] // if (command.consoleOnly == true) return console.log(command); - if(command.consoleOnly) { + if(command.trustLevel === 3) { cons_ole.push( { text: command.name + ' ', @@ -101,7 +103,7 @@ module.exports = { else - if (command.ownerOnly) { + if (command.trustLevel === 2) { own_her.push( { text: command.name + ' ', @@ -115,15 +117,9 @@ module.exports = { { text:`Command:${command.name}\n`, color:'white' - },{ - text:"HashOnly:", - color:'white'}, - {text:`${command.hashOnly}\n`,color:'red'}, - {text:'consoleOnly:',color:'white'}, - {text:`${command.consoleOnly && !context.console}\n`, color:'red'}, - {text:'ownerOnly:', color:'white'}, - {text:`${command.ownerOnly}\n`, color:'red'}, - {text:`${command.description}\n`, color:'white'}, + }, {text:`Trust Level: `,color:'white'}, + {text:`${command.trustLevel}\n`,color:'dark_red'}, + {text:`${command.description}\n`, color:'white'}, {text:`Command Aliases: ${command.aliases}\n`,color:'white'}, {text:'click on me to use me :)'}, ] @@ -138,7 +134,7 @@ module.exports = { )//my w } // let valid - else if (command.hashOnly && !command.ownerOnly && !command.consoleOnly){ + else if (command.trustLevel === 1){ t_rust.push( { text: command.name + ' ', @@ -152,15 +148,8 @@ module.exports = { { text:`Command:${command.name}\n`, color:'white' - },{ - text:"HashOnly:", - color:'white'}, - {text:`${command.hashOnly}\n`,color:'red'}, - {text:'consoleOnly:',color:'white'}, - {text:`${command.consoleOnly && !context.console}\n`, color:'red'}, - {text:'ownerOnly:', color:'white'}, - {text:`${command.ownerOnly}\n`, color:'red'}, - {text:`${command.description}\n`, color:'white'}, + }, {text:`Trust Level: `,color:'white'}, + {text:`${command.trustLevel}\n`,color:'red'}, {text:`${command.description}\n`, color:'white'}, {text:`Command Aliases: ${command.aliases}\n`,color:'white'}, {text:'click on me to use me :)'}, ] @@ -176,7 +165,7 @@ module.exports = { ) //my w } - else if (!command.hashOnly && !command.ownerOnly && !command.consoleOnly){ + else if (command.trustLevel === 0){ pub_lick.push( { text: command.name + ' ', @@ -189,14 +178,8 @@ module.exports = { text:`Command:${command.name}\n`, color:'white' },{ - text:"HashOnly:", - color:'white'}, - {text:`${command.hashOnly}\n`,color:'red'}, - {text:'consoleOnly:',color:'white'}, - {text:`${command.consoleOnly && !context.console}\n`, color:'red'}, - {text:'ownerOnly:', color:'white'}, - {text:`${command.ownerOnly}\n`,color:'red'}, - + text:`Trust Level: `,color:'green'}, + {text:`${command.trustLevel}\n`,color:'red'}, {text:`${command.description}\n`, color:'white'}, {text:`Command Aliases: ${command.aliases}\n`,color:'white'}, {text:'click on me to use me :)'}, @@ -228,8 +211,8 @@ module.exports = { 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.consoleOnly).length - + const length = context.bot.commandManager.amogus.filter(c => c.trustLevel != 3).length +//trustlevel context.source.sendFeedback([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust ,own_her], false) diff --git a/commands/info.js b/commands/info.js index a2b95be..99ec080 100644 --- a/commands/info.js +++ b/commands/info.js @@ -14,9 +14,7 @@ module.exports = { name: 'info', description:['check the bots info. the args are version, discord, serverinfo, logininfo, uptime, memused, creators'], aliases:['information'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, async execute (context, client) { const bot = context.bot const args = context.arguments @@ -192,9 +190,9 @@ module.exports = { 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) @@ -207,8 +205,26 @@ if (amonger.length === 0){ } } - source.sendFeedback('Servers:' + amonger.length) - + source.sendFeedback('Servers in Config: ' + amonger.length)//real + /* + const util = fs.readdir('./util') + source.sendFeedback({text:`Util Files loaded: ${util.length}`, color:'gray'}) + + const modules = fs.readdir('./modules') + source.sendFeedback({text:`Modules Files loaded: ${modules.length}`, color:'gray'}) + const commands = fs.readdir('./commands') + source.sendFeedback({text:`Commands Files loaded: ${commands.length}`, color:'gray'}) + const CommandModules = fs.readdir('./CommandModules') + source.sendFeedback({text:`CommandModules Files loaded: ${CommandModules.length}`, color:'gray'}) + const chat = fs.readdir('./chat') + source.sendFeedback({text:`Chat Files loaded: ${chat.length}`, color:'gray'}) + /* + const = '../' + fs.readdir(, (err, files) => { + source.sendFeedback({text:` Files loaded: ${file.length}`, color:'gray'}) + }); + */ + /*context.source.sendFeedback({ translate: '\n %s \n %s \n %s \n %s \n %s \n %s \n %s \n %s', with: [ diff --git a/commands/kick.js b/commands/kick.js index 6ab9373..0489dfb 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -4,11 +4,10 @@ let timer = null module.exports = { name: 'kick', -hashOnly:true,//now its not + description:['kicks a player'], - consoleOnly:false, - ownerOnly:false, + trustLevel: 1, aliases:[], execute(context) { // throw new CommandError('temp disabled') diff --git a/commands/list.js b/commands/list.js index efdb205..df2eaee 100644 --- a/commands/list.js +++ b/commands/list.js @@ -3,9 +3,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'list', description:['check the player list'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['playerlist', 'plist'], execute (context) { const bot = context.bot diff --git a/commands/lol.js b/commands/lol.js index b734a0b..e13437b 100644 --- a/commands/lol.js +++ b/commands/lol.js @@ -6,9 +6,7 @@ module.exports = { name: 'lol', description:['idfk dont ask'], aliases:['ohio'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { throw new CommandError('idfk lmao') diff --git a/commands/memusage.js b/commands/memusage.js index c75638a..18b7e6c 100644 --- a/commands/memusage.js +++ b/commands/memusage.js @@ -3,10 +3,8 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'memusage', //<< this one line of code broke it lmao - description:['tps'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + description:['check the bots memusage'], + trustLevel: 0, aliases:['memoryusage', 'memused','memoryused'], execute (context) { const bot = context.bot diff --git a/commands/music.js b/commands/music.js index 4c9b76e..610a9e6 100644 --- a/commands/music.js +++ b/commands/music.js @@ -5,9 +5,7 @@ module.exports = { //<< this one line of code broke it lmao description:[''], aliases:[], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const message = context.arguments.join(' ') diff --git a/commands/netmsg.js b/commands/netmsg.js index ccea4fa..2e27af5 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -2,9 +2,7 @@ const CommandError = require('../CommandModules/command_error.js') module.exports = { name: 'netmsg', description:['send a message to other servers'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['networkmessage', 'netmessage', 'networkmsg'], execute (context) { diff --git a/commands/rc.js b/commands/rc.js index 9ec29d6..89ed406 100644 --- a/commands/rc.js +++ b/commands/rc.js @@ -1,9 +1,7 @@ module.exports = { name: 'rc', description:['refill the bots core'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['refillcore'], execute (context) { const bot = context.bot diff --git a/commands/recend.js b/commands/recend.js deleted file mode 100644 index 9e80eed..0000000 --- a/commands/recend.js +++ /dev/null @@ -1,49 +0,0 @@ -const CommandError = require('../CommandModules/command_error') -module.exports = { - name: 'recend', - description:['reconnect or end the bot the usages are end, and reconnect'], - hashOnly:true, - ownerOnly:false, - consoleOnly:false, - aliases:['reconnectend'], - execute (context) { - const bot = context.bot - const message = context.arguments.join(' ') - const args = context.arguments -//throw new CommandError('disabled until owner hash is added') - // throw new CommandError('temp disabled') - if (!args && !args[0] && !args[1] && !args[2]) return - switch (args[1]) { - case `end`: - context.source.sendFeedback('farding right now....') - process.exit() - break - case `reconnect`: - const randomstring = require('randomstring') - context.source.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.options.port}`, color: 'dark_green'}) - - - bot._client.end() - break - - - - - - default: - const cmd = {//test.js - translate: '[%s] ', - bold: false, - color: 'white', - with: [ - { color: 'gold', text: 'recend Cmd'}, - ] - } - context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }]) - context.source.sendError([cmd, { text: 'the args for the info command is reconnect, and end', color: 'green', bold:false }]) - } -} -} -/*context.source.sendFeedback('farding right now....') - process.exit(1) - */ \ No newline at end of file diff --git a/commands/reconnect.js b/commands/reconnect.js index 9eac9ca..656bc17 100644 --- a/commands/reconnect.js +++ b/commands/reconnect.js @@ -2,9 +2,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'reconnect', description:['reconnect the bot when?'], - hashOnly:true, - ownerOnly:false, - consoleOnly:false, +trustLevel: 1, aliases:['rec'], execute (context) { const bot = context.bot diff --git a/commands/say.js b/commands/say.js index 87cdd48..1cbcdad 100644 --- a/commands/say.js +++ b/commands/say.js @@ -5,9 +5,7 @@ module.exports = { name: 'say', //<< this one line of code broke it lmao description:['make me say something in custom chat'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['tellrawsay', 'tellrawmsg', 'trmessage', 'tellrawmessage', 'sourcesendfeedbacksay','sourcesendfeedbackmsg','sourcesendfeedbackmessage', 'ssfbmsg', 'ssfmessage'], execute (context) { diff --git a/commands/sctoggle.js b/commands/sctoggle.js index 91298cb..bd1ae19 100644 --- a/commands/sctoggle.js +++ b/commands/sctoggle.js @@ -5,14 +5,13 @@ module.exports = { //<< this one line of code broke it lmao description:['selfcare toggle'], aliases:['selfcaretoggle'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 1, execute (context) { const bot = context.bot const source = context.source const args = context.arguments - switch (args[0]) { + if (!args && !args[0] && !args[1] && !args[2]) return + switch (args[1]) { case 'vanishon': bot.visibility.on() source.sendFeedback({text:'Vanish selfcare on', color:'green'}) @@ -88,8 +87,10 @@ break break default: - throw new CommandError('Invalid argument') - } + source.sendFeedback({text:'Invalid argument', color:'red'}) + source.sendFeedback({text:'the on arguments are vanishon, muteon, tptoggleon, godon, prefixon, usernameon, skinon, cspyon, nicknameon'}) + source.sendFeedback({text:'the off arguments are vanishoff, muteoff, tptoggleoff, godoff, prefixoff, usernameoff, skinoff, cspyoff, nicknameoff'}) + } }, } diff --git a/commands/selfdestruct.js b/commands/selfdestruct.js index 8331fe7..d9641b8 100644 --- a/commands/selfdestruct.js +++ b/commands/selfdestruct.js @@ -5,9 +5,7 @@ let timer = null module.exports = { name: 'selfdestruct', //why i put it in here probably cuz so it can be rewritten or smh idk -hashOnly: false, - ownerOnly:true, - consoleOnly:false, +trustLevel: 2, aliases:['sfd'], description:['selfdestruct server'], execute (context) { diff --git a/commands/servereval.js b/commands/servereval.js index cf1e833..146b9b1 100644 --- a/commands/servereval.js +++ b/commands/servereval.js @@ -2,10 +2,7 @@ const CommandError = require('../CommandModules/command_error') module.exports = { name: 'servereval', description:['no'], - hashOnly:false, - //ownerOnly:true, - ownerOnly:true, - consoleOnly:false, + trustLevel: 2, aliases:['svreval'], execute (context, arguments, selector) { const bot = context.bot diff --git a/commands/test.js b/commands/test.js index 58e05fa..505c14a 100644 --- a/commands/test.js +++ b/commands/test.js @@ -3,9 +3,7 @@ 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'], -hashOnly:false, - consoleOnly:false, - ownerOnly:false, +trustLevel: 0, aliases:['tst'], execute (context) { diff --git a/commands/testbench.js b/commands/testbench.js index edc596d..409b94e 100644 --- a/commands/testbench.js +++ b/commands/testbench.js @@ -5,8 +5,7 @@ module.exports = { //<< this one line of code broke it lmao description:[''], aliases:['tstbench'], -hashOnly:false, - consoleOnly:false, +trustLevel: 0, execute (context) { const bot = context.bot const args = context.arguments diff --git a/commands/time.js b/commands/time.js index 758b982..b249a7d 100644 --- a/commands/time.js +++ b/commands/time.js @@ -4,9 +4,7 @@ module.exports = { name: 'time', description:['check the time'], aliases:['clock', 'timezone'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, execute (context) { const bot = context.bot const message = context.arguments.join(' ') diff --git a/commands/tpr.js b/commands/tpr.js index cfb960e..cd809e5 100644 --- a/commands/tpr.js +++ b/commands/tpr.js @@ -3,9 +3,7 @@ const between = require('../util/between') module.exports = { name: 'tpr', description:['teleport to a random place'], -hashOnly:false, - consoleOnly:false, - ownerOnly:false, +trustLevel: 0, aliases:['rtp', 'teleportrandom', 'randomteleport'], execute (context) { const bot = context.bot diff --git a/commands/tps.js b/commands/tps.js index 5e40dbc..8243d24 100644 --- a/commands/tps.js +++ b/commands/tps.js @@ -4,9 +4,7 @@ module.exports = { name: 'tpsbar', //<< this one line of code broke it lmao description:['tps'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, aliases:['tickspersecondbar', 'tickspersecond', 'tps'], execute (context) { const bot = context.bot diff --git a/commands/translate.js b/commands/translate.js index f887d0c..4593d6b 100644 --- a/commands/translate.js +++ b/commands/translate.js @@ -5,9 +5,7 @@ module.exports = { //<< this one line of code broke it lmao description:[' '], aliases:['translation'], - hashOnly:false, - consoleOnly:false, - ownerOnly:false, + trustLevel: 0, async execute (context) { const { translate } = require('@vitalets/google-translate-api') const message = context.arguments.join(' ') diff --git a/commands/urban.js b/commands/urban.js index f1e0853..b6b2946 100644 --- a/commands/urban.js +++ b/commands/urban.js @@ -4,9 +4,7 @@ module.exports = { name: 'urban', description:['urban dictionary'], aliases:['urbandictionary'], -hashOnly:false, - ownerOnly:false, - consoleOnly:false, +trustLevel: 0, async execute (context) { const source = context.source const args = context.arguments @@ -56,9 +54,7 @@ hashOnly:false, //source.sendFeedback(results[0].data) - }).catch((error) => { - console.error(error.message) - }) + }) // source.sendFeedback([cmd, { text: definitions2.replaceAll("\r", ""), color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition.replaceAll("\r", ""), color: 'white' }]) //console.log(urban.define.definition.example(args.join(' '))) diff --git a/commands/validate.js b/commands/validate.js index f70ed59..88405b6 100644 --- a/commands/validate.js +++ b/commands/validate.js @@ -2,9 +2,7 @@ module.exports = { name: 'validate', description:['validate in the bot'], - hashOnly: true, - consoleOnly:false, - ownerOnly:false, +trustLevel: 1, aliases:['val'], execute (context) { const source = context.source diff --git a/commands/wiki.js b/commands/wiki.js index b61a5fc..330f973 100644 --- a/commands/wiki.js +++ b/commands/wiki.js @@ -2,9 +2,7 @@ const wiki = require('wikipedia') // module.exports = { name: 'wiki', description:['wikipedia'], -hashOnly:false, - consoleOnly:false, - ownerOnly:false, +trustLevel: 0, aliases:['wikipedia'], async execute (context) { const source = context.source diff --git a/index.js b/index.js index d56ac0a..9c8a7ac 100644 --- a/index.js +++ b/index.js @@ -19,9 +19,7 @@ const bots = [] bot.console.useReadlineInterface(rl) // bot.on('error', (error), util.inspect(error)) -bot.on('error', error => { - console.log((error)) -}) +bot.on('error', console.error) } diff --git a/modules/command_manager.js b/modules/command_manager.js index 9e54a22..d157449 100644 --- a/modules/command_manager.js +++ b/modules/command_manager.js @@ -1,7 +1,8 @@ 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) { bot.commandManager = { prefix: options.commands?.prefix ?? 'default', @@ -14,83 +15,123 @@ function inject (bot, options) { 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.prefix}help" for help or click on this for the command`, with: [commandName], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help` } : undefined}) + if (command.consoleOnly && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' }) + if (command.trustLevel > 0){ + const event = source.discordMessageEvent + + 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') + ) 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 + ) throw new CommandError({text:'Invalid Hash or Invalid Owner Hash', color:'red'}) + + 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'}) + if ( + !source.sources.discord && + command.trustLevel === 2 && args[0] !== 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 () + }//command.hashOnly && source.hash + //(hash !== bot.hash && owner !== bot.owner //command.unknown.argument command.unknown.command //command.context.here // let hash = 1 // let owner = 2 - if (command.consoleOnly && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' }) + //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' }) + // if (command.hashOnly && args.length === 0) throw new CommandError({ translate: 'Please provide a hash or a OwnerHash', color: 'red' }) - if (command.hashOnly && source.hash) { - // debug - // console.log(`${args} args0 ${args[0]}`) //too sus - const hash = `${args[0]}` // this is undefined -const owner = `${args[0]}` - //\x1b[0m\x1b[91m - //console.log(hash) 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}\x1b[0m]` ) - } + 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}\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() - } else if (args[0] === bot.owner) { - bot.console.ownerHash() - } - console.log(bot.hash) // actual hash + console.log(`` )// actual hash //but look in hashing.js - if (hash !== bot.hash && owner !== bot.owner) throw new CommandError({ translate: 'Invalid hash or Invalid OwnerHash', color: 'red' }) // so true -//message?.member?.displayName - bot.updatehash - bot.updateowner - }else if (command.hashOnly && source.sources.discord) { - //const event = source.discordMessageEvent + //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] - const roles = null.member?.roles?.cache + //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) - const hasRole = roles.some(role => role.name === 'trusted'|| role.name === 'FNFBoyfriendBot Owner') - if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' }) - }//source.discordMessageEvent.event.member.roles?.cache - - /* -else if (command.owner === bot.hash === true){ - throw new CommandError({ translate: 'THATS A TRUSTED HASH NOT A OWNER HASH!', color: 'dark_red' }) - } - */ + // isnt it if(something) {} or i +//if( - -if (command.ownerOnly && !source.owner) { - // debug - // console.log(`${args} args0 ${args[0]}`) //too sus - const owner = `${args[0]}` // this is undefined -if (owner && args.length === 0) throw new CommandError({ translate: 'Please provide a OwnerHash', color: 'dark_red' }) - console.log(bot.owner) - if (owner === bot.hash){ - throw new CommandError({ translate: 'THATS A TRUSTED HASH NOT A OWNER HASH!', color: 'dark_red' }) -} - if (owner !== bot.owner) throw new CommandError({ translate: 'Invalid Owner hash', color: 'dark_red' }) - bot.updateowner - } - -else if (command.owner && source.sources.discord) { - // const event = source.discordMessageEvent + // )//tf - const roles = message.member?.roles?.cache + /* +if (command.trustLevel > 0) { + const discordRoles = message.member?.roles?.cache - const hasRole = roles.some(role => role.name === 'FNFBoyfriendBot Owner') - if (!hasRole) throw new CommandError({ translate: 'You are not the Owner!' }) - } + + 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 }) } catch (error) { const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) @@ -107,7 +148,7 @@ if (error instanceof CommandError) source.sendError(error._message) // else source.sendError({ text:String(error.stack), color:'red' }) else source.sendError({ translate: 'command.failed', color:'red', hoverEvent: { action: 'show_text', contents: String(error.stack) } }) if (source.sources.discord) { - source.sendError(error.stack) + source.sendError(error) } } }, diff --git a/modules/console.js b/modules/console.js index 8bf7fbc..82cfbfd 100644 --- a/modules/console.js +++ b/modules/console.js @@ -33,9 +33,15 @@ bot.console.source, + +//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, +bot.console.source, 'console ' + line.substring(0) ) } @@ -135,8 +141,10 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"} // bot.username //const amogus = username, - //name: message?.member?.displayName - bot.console.source = new CommandSource(null,{console:true, discord:false }); + + //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() diff --git a/modules/discord.js b/modules/discord.js index efa1841..d8255c4 100644 --- a/modules/discord.js +++ b/modules/discord.js @@ -117,7 +117,7 @@ function inject (bot, options) { if (message.author.id === bot.discord.client.user.id) return if (message.channel.id !== bot.discord.channel.id) return - +// if (message.content.startsWith(bot.discord.commandPrefix)) { // TODO: Don't hardcode this const source = new CommandSource({ profile: { name: message?.member?.displayName } }, { discord: true, console: false }, false, message) diff --git a/modules/messagelimit.js b/modules/messagelimit.js deleted file mode 100644 index d1245e0..0000000 --- a/modules/messagelimit.js +++ /dev/null @@ -1,13 +0,0 @@ -function messagelimit (bot, options) { - let spamCount = 0 - setInterval(() => spamCount = 0, 1000 * 2) - - bot.on('message', message => { - if (message == (`${bot.options.commands.prefix} `) && spamCount > 300) { - bot.tellraw('WTF spam detected rate limiting') - return - } - spamCount++ -}) -} -module.exports = messagelimit \ No newline at end of file diff --git a/modules/music.js b/modules/music.js index b38af43..10a9fe3 100644 --- a/modules/music.js +++ b/modules/music.js @@ -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.0-Beta §8Build:290 Codename:§8Mono§fchrome") +if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5.0.0 §8Build:300 Codename:§8Mono§fchrome") { process.exit(1) } diff --git a/modules/player_list.js b/modules/player_list.js index bd7a9e8..aed0b88 100644 --- a/modules/player_list.js +++ b/modules/player_list.js @@ -45,8 +45,8 @@ function inject (bot) { if (!target) return target.removePlayer = entry.removePlayer } - } - if (process.env["Ultimate Foundation v2.0.0-Beta Build:190"]) + }// + if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.0 Build:200') { process.exit(1) } diff --git a/modules/reconnect.js b/modules/reconnect.js index 6c43f82..9394e3a 100644 --- a/modules/reconnect.js +++ b/modules/reconnect.js @@ -2,18 +2,16 @@ const mc = require('minecraft-protocol') function reconnect (bot, options) { bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd - bot.username = '' + bot.on('end', () => { if (bot.reconnectDelay < 0) return setTimeout(() => { - bot._client = mc.createClient(options) - bot.emit('init_client', bot._client) - bot.setMaxListeners(Infinity) - bot._client.setMaxListeners(Infinity) - + + const client = options.client ?? mc.createClient(options) + bot._client = client + bot.emit('init_client', client) }, bot.reconnectDelay) - }) } diff --git a/package-lock.json b/package-lock.json index eaf8f2a..30ebb96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "color-convert": "^2.0.1", "cowsay2": "^2.0.4", "discord.js": "^14.14.1", + "dockerode": "^4.0.0", "dotenv": "^16.3.1", "isolated-vm": "^4.6.0", "minecraft-data": "^3.49.1", @@ -56,6 +57,11 @@ "node": "16|| 18 || 20" } }, + "node_modules/@balena/dockerignore": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2.tgz", + "integrity": "sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==" + }, "node_modules/@discordjs/builders": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.7.0.tgz", @@ -391,6 +397,14 @@ } ] }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -476,6 +490,15 @@ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" }, + "node_modules/buildcheck": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz", + "integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==", + "optional": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -578,6 +601,20 @@ "node": ">= 10" } }, + "node_modules/cpu-features": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.9.tgz", + "integrity": "sha512-AKjgn2rP2yJyfbepsmLfiYcmtNn/2eUvocUyM/09yB0YDiz39HteK/5/T4Onf0pmdYDMgkBoGvRLvEguzyL7wQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "buildcheck": "~0.0.6", + "nan": "^2.17.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -674,6 +711,57 @@ "node": ">=16.11.0" } }, + "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==", + "dependencies": { + "debug": "^4.1.1", + "readable-stream": "^3.5.0", + "split-ca": "^1.0.1", + "ssh2": "^1.11.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==", + "dependencies": { + "@balena/dockerignore": "^1.0.2", + "docker-modem": "^5.0.0", + "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", @@ -1353,6 +1441,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/nan": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "optional": true + }, "node_modules/napi-build-utils": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", @@ -4675,6 +4769,11 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -4796,6 +4895,36 @@ "npm": ">= 3.0.0" } }, + "node_modules/split-ca": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz", + "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==", + "hasInstallScript": true, + "dependencies": { + "asn1": "^0.2.6", + "bcrypt-pbkdf": "^1.0.2" + }, + "engines": { + "node": ">=10.16.0" + }, + "optionalDependencies": { + "cpu-features": "~0.0.8", + "nan": "^2.17.0" + } + }, + "node_modules/ssh2/node_modules/asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -4945,6 +5074,11 @@ "node": "*" } }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" + }, "node_modules/typed-emitter": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-1.4.0.tgz", diff --git a/package.json b/package.json index cfd247f..f0ff94b 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "color-convert": "^2.0.1", "cowsay2": "^2.0.4", "discord.js": "^14.14.1", + "dockerode": "^4.0.0", "dotenv": "^16.3.1", "isolated-vm": "^4.6.0", "minecraft-data": "^3.49.1",