From d45f7cd93bf50565e0402c2a95b4060f93f05f0d Mon Sep 17 00:00:00 2001 From: 4Parker02991 Date: Sun, 24 Dec 2023 17:11:42 +0000 Subject: [PATCH] FNFBoyfriendBot v5.0.1 Build:310 --- CommandModules/command_source.js | 6 +-- bot.js | 19 +++++++- commands/botsrun.js | 45 ++++++++++++++++++ commands/changelog.js | 9 +++- commands/consoleserver.js | 17 +++---- commands/help.js | 10 ++-- commands/info.js | 9 ++-- commands/list.js | 2 +- commands/netmsg.js | 81 ++++++++++++++++++++++++++++---- commands/test.js | 50 ++++++++++++++++++-- index.js | 4 ++ modules/chat_command_handler.js | 21 ++++++--- modules/command_core.js | 17 +++++-- modules/command_manager.js | 49 +++++++++++++------ modules/music.js | 2 +- modules/player_list.js | 2 +- modules/reconnect.js | 3 +- modules/selfcare.js | 4 +- 18 files changed, 281 insertions(+), 69 deletions(-) create mode 100644 commands/botsrun.js diff --git a/CommandModules/command_source.js b/CommandModules/command_source.js index ca170cb..bd17f29 100644 --- a/CommandModules/command_source.js +++ b/CommandModules/command_source.js @@ -4,15 +4,15 @@ class CommandSource { // 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 - this.displayName = player + } diff --git a/bot.js b/bot.js index a16558f..6d84567 100644 --- a/bot.js +++ b/bot.js @@ -17,7 +17,14 @@ const rs = require('randomstring') options.hideErrors ??= false // HACK: Hide errors by default as a lazy fix to console being spammed with them options.console ??= true options.input ??= true - + + // MainPrefix: "~", + // SecondaryPrefix:'%', + //TertiaryPrefix:'@' + + options.commands.MainPrefix ??= '!' + options.commands.SecondaryPrefix ??= '!' + options.commands.TertiaryPrefix ??= '!' options.selfcare.unmuted ??= true options.selfcare.vanished ??= true @@ -36,7 +43,7 @@ options.input ??= true options.Core.core ??= true - options.commands.prefix ??= '!' + options.discord.commandPrefix ??= '!' @@ -86,12 +93,20 @@ options.input ??= true }) const buildstring = process.env['buildstring'] +bot.end = (reason = 'end', event) => { + bot.emit('end', reason, event) + bot.removeAllListeners() + bot._client.end() + bot._client.removeAllListeners() + } const client = options.client ?? mc.createClient(options) bot._client = client bot.emit('init_client', client) bot.bots = options.bots ?? [bot] +bot.setMaxListeners(20) + bot._client.setMaxListeners(20) // Modules bot.loadModule = module => module(bot, options) diff --git a/commands/botsrun.js b/commands/botsrun.js new file mode 100644 index 0000000..a23ce40 --- /dev/null +++ b/commands/botsrun.js @@ -0,0 +1,45 @@ +const CommandError = require('../CommandModules/command_error') + +module.exports = { + name: 'botsrun', + description:[''], + aliases:[], + trustLevel: 2, + execute (context) { + const bot = context.bot + // const client = context.client + const args = context.arguments + const source = context.source + const message = context.arguments.join(' ') + //const source = context.source + // if (args.length === 0){ +//source.sendFeedback({translate:"Too few Arguments!", color:"red"}) + const amogus = args.slice(1).join(' '); + if (!args && !args[0] && !args[1] && !args[2]) return +try{ + switch (args[1]) { + case 'source': + + for (const eachBot of bot.bots) { + eachBot.commandManager.executeString(source, `${args.slice(2).join(' ')} `) + } + break + case 'consolesource': + + for (const eachBot of bot.bots) { + eachBot.commandManager.executeString(bot.console.source, `${args.slice(2).join(' ')} `) + } + break + default: + context.source.sendError([ { text: 'Invalid action', color: 'dark_red', bold:false }]) + source.sendFeedback({text:'Args are source and consolesource', color:'green'}) +} + +}catch(error){ +source.sendFeedback(error.stack) +} + // context.source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }) + + + }// +} \ No newline at end of file diff --git a/commands/changelog.js b/commands/changelog.js index 114a15a..60a892a 100644 --- a/commands/changelog.js +++ b/commands/changelog.js @@ -14,7 +14,14 @@ const bots = [ 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 + {// + name: { text: 'v5.0.1', color: 'green', bold:false }, + authors: [''], + + foundation: 'added botsrun for the funni along with making the bot be able to auto refill its core now and fill the core from a command block and adding a hover event to netmsg along with having the test command tellraw the players display name in the command', + exclaimer:'', + }, +]// //back diff --git a/commands/consoleserver.js b/commands/consoleserver.js index ece930c..efca136 100644 --- a/commands/consoleserver.js +++ b/commands/consoleserver.js @@ -9,16 +9,13 @@ module.exports = { const bot = context.bot const args = context.arguments const source = context.source - if (args.length === 0){ -source.sendFeedback({translate:"Too few Arguments!", color:"red"}) - } else if (args.length === 2){ - source.sendFeedback({translate:"Too many Arguments!", color:"red"}) - } + const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) const servers = bot.bots.map(eachBot => eachBot.options.host) const ports = bot.bots.map(eachBot => eachBot.options.port) - for (const eachBot of bot.bots) { + if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return + for (const eachBot of bot.bots) { if (args.join(' ').toLowerCase() === 'all') { @@ -33,16 +30,16 @@ const ports = bot.bots.map(eachBot => eachBot.options.port) }//.repeat(Math.floor((32767 - 22) / 16)) //"a".repeat(10) - const server = servers.find(server => server.toLowerCase().includes(args.join(' '))) - //const port = ports.find(port => port.toLowerCase().includes(args.join(' '))) - if (!server /*&& !port*/) { + const server = servers.find(server => server.toLowerCase().includes(args[0])) + + if (!server) { source.sendFeedback({ text: 'Invalid server', color: 'red' }) return } bot.console.info(`Set the console server to ` + server) - eachBot.console.consoleServer = server + eachBot.console.consoleServer = server // eachBot.console.consoleServer = port } diff --git a/commands/help.js b/commands/help.js index e28b0cd..d081ef9 100644 --- a/commands/help.js +++ b/commands/help.js @@ -55,7 +55,7 @@ module.exports = { } else { const args = context.arguments - source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefix}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.prefix}help` } : undefined}]) + 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 @@ -124,7 +124,7 @@ module.exports = { {text:'click on me to use me :)'}, ] },clickEvent:{ - action:"run_command",value:`${bot.options.commands.prefix}${command.name}` + action:"run_command",value:`${bot.options.commands.MainPrefix}${command.name}` }, // ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description} @@ -154,7 +154,7 @@ module.exports = { {text:'click on me to use me :)'}, ] },clickEvent:{ - action:"run_command",value:`${bot.options.commands.prefix}${command.name}` + action:"run_command",value:`${bot.options.commands.MainPrefix}${command.name}` }, // ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description} @@ -178,14 +178,14 @@ module.exports = { text:`Command:${command.name}\n`, color:'white' },{ - text:`Trust Level: `,color:'green'}, + 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 :)'}, ] },clickEvent:{ - action:"suggest_command",value:`${bot.options.commands.prefix}${command.name}`} + action:"suggest_command",value:`${bot.options.commands.MainPrefix}${command.name}`} }) diff --git a/commands/info.js b/commands/info.js index 99ec080..c666931 100644 --- a/commands/info.js +++ b/commands/info.js @@ -181,11 +181,10 @@ module.exports = { - source.sendFeedback({text:`Prefix: "${bot.options.commands.prefix}"`, color:"gray"}) - - - - source.sendFeedback({text:`Discord Prefix: "${bot.options.discord.commandPrefix}"`, 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:`Discord Username: "${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}"`, color:'gray'}) diff --git a/commands/list.js b/commands/list.js index df2eaee..da28ef5 100644 --- a/commands/list.js +++ b/commands/list.js @@ -4,7 +4,7 @@ module.exports = { name: 'list', description:['check the player list'], trustLevel: 0, - aliases:['playerlist', 'plist'], + aliases:['playerlist', 'plist', 'pl'], execute (context) { const bot = context.bot const args = context.arguments diff --git a/commands/netmsg.js b/commands/netmsg.js index 2e27af5..3b6d227 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -7,10 +7,20 @@ module.exports = { execute (context) { const message = context.arguments.join(' ') + function tryParse (json) { + try { + return JSON.parse(json) + } catch (error) { + return { text: '' } + } +} + const args = context.arguments const bot = context.bot -//throw new CommandError('ohio') + const source = context.source + const player = context.source.player.displayName +//throw n const component = { translate: '[%s] [%s] %s \u203a %s', with: [ @@ -22,6 +32,7 @@ module.exports = { text: 'FNF', bold: true, color: 'dark_purple' + }, { text: 'Boyfriend', @@ -37,12 +48,50 @@ module.exports = { clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined, hoverEvent: { action: 'show_text', contents: `idfk what to put here` } }, - bot.options.host + ':' + bot.options.port, + { + text:`${bot.options.host}:${bot.options.port}`, + bold:false, + color:'white', + translate:"", + hoverEvent:{ + action:"show_text", + value:[ + { + text:`Server: ${bot.options.host}:${bot.options.port}`, + color:'white', + } + ], + clickEvent:{ + action:"copy_to_clipboard",value:`${bot.options.host}:${bot.options.port}`} + } - context.source.player.displayName ?? context.source.player.profile.name, - message + + }, + + +context.source.player.displayName ?? context.source.player.profile.name, + + //entry.displayName + {text:message} ]//command.split(' ')[0] - }//string.replace() + } + + + // context.source.player.displayName ?? context.source.player.profile.name, + /* + function tryParse (json) { + try { + return JSON.parse(json) + } catch (error) { + return { text: '' } + } +} + *///obj + /* + const amogus2 = {text:`${JSON.stringify(context.source.player.displayName ?? context.source.player.profile.name)}`} + + bot.tellraw({text:'amogus ' + JSON.parse(context.source.player.displayName)}) + */ //context.source.sendFeedback({text:`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`}) if (!message[0]) { context.source.sendFeedback({text:'Message is empty', color:'red'}, false) } else { @@ -51,8 +100,22 @@ module.exports = { } } /* - bot.options.host + ':' + bot.options.port, - context.source.player.displayName ?? context.source.player.profile.name, - message - [%s%s%s] [%s] %s \u203a %s + translate:"", + hoverEvent:{ + action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr) + value:[ + { + text:`Command:${command.name}\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 :)'}, + ] + },clickEvent:{ + action:"suggest_command",value:`${bot.options.commands.MainPrefix}${command.name}`} + + }) */ \ No newline at end of file diff --git a/commands/test.js b/commands/test.js index 505c14a..571ec16 100644 --- a/commands/test.js +++ b/commands/test.js @@ -12,11 +12,55 @@ trustLevel: 0, const player = context.source.player.profile.name const uuid = context.source.player.uuid const message = context.arguments.join(' ') // WHY SECTION SIGNS!! - - context.source.sendFeedback(`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`, false) + const component = { + translate: '[%s] %s %s %s %s %s', + with: [ + { + translate: '%s%s%s', + bold:false, + with: [ + { + text: 'FNF', + bold: true, + color: 'dark_purple' + + }, + { + text: 'Boyfriend', + bold: true, + color: 'aqua' + }, + { + text: 'Bot', + bold: true, + color: 'dark_red' + }, + ], + clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined, + hoverEvent: { action: 'show_text', contents: `idfk what to put here` } + }, + { + text:'Hello, World!,' + },{ + text:'Player:' + }, + + +context.source.player.displayName ?? context.source.player.profile.name, + { + text:`, uuid: ${uuid}, ` + }, + //entry.displayName + {text:`Argument: ${message}`} + ]//command.split(' ')[0] + } + bot.tellraw(component) + // context.source.sendFeedback({text:`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`}) } } - + /* + +*/ //context.source.player.displayName ?? context.source.player.profile.name, diff --git a/index.js b/index.js index 9c8a7ac..1a5f367 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,11 @@ const bots = [] bot.console.useReadlineInterface(rl) // bot.on('error', (error), util.inspect(error)) + try{ bot.on('error', console.error) + }catch(error){ + console.log(error.stack) + } } diff --git a/modules/chat_command_handler.js b/modules/chat_command_handler.js index 526f6b8..0bf68b7 100644 --- a/modules/chat_command_handler.js +++ b/modules/chat_command_handler.js @@ -6,34 +6,41 @@ function inject (bot) { if (data.type !== 'minecraft:chat') return const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString() - if (!plainMessage.startsWith(bot.commandManager.prefix)) return - const command = plainMessage.substring(bot.commandManager.prefix.length) - + 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 prefix = { translate: '[%s%s%s] \u203a ', bold: false, - color: 'white', + color: 'dark_gray', with: [ { color: 'dark_purple', text: 'FNF', bold:true, - hoverEvent: { action:"show_text", value: `${process.env["buildstring"]}`}, + 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: `${process.env["FoundationBuildString"]}`}, + 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] } ] diff --git a/modules/command_core.js b/modules/command_core.js index 86ea6ab..b1b6583 100644 --- a/modules/command_core.js +++ b/modules/command_core.js @@ -15,10 +15,11 @@ 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 ~ ~ ~0 ~ ~ ~ command_block replace`) + bot.core.run(`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`) }, + move (pos = bot.position) { bot.core.position = { x: Math.floor(pos.x / 16) * 16, @@ -67,13 +68,21 @@ async function inject (bot, options) { bot.core.incrementCurrentBlock() // added .substring(0, 32767) so it won't kick the bot if the command is too long. - } + }, + } if (!bot.options.Core.core) return bot.on('move', () => { bot.core.move(bot.position) //setTimeout(() => bot.core.run('say hi'), 100) }) + bot.on('packet.login', (data) =>{ + const timer = setInterval(() => { + bot.core.refill() + }, 60000) + bot.on('end', (bot) => { + clearInterval(timer) + }) +}) } - module.exports = inject diff --git a/modules/command_manager.js b/modules/command_manager.js index d157449..5335a53 100644 --- a/modules/command_manager.js +++ b/modules/command_manager.js @@ -5,7 +5,9 @@ const CommandError = require('../CommandModules/command_error.js') //it would be both the command_source.js and command_manager.js files function inject (bot, options) { bot.commandManager = { - prefix: options.commands?.prefix ?? 'default', + MainPrefix: options.commands?.MainPrefix ?? 'default', + SecondaryPrefix: options.commands?.SecondaryPrefix ?? 'default', + TertiaryPrefix: options.commands?.TertiaryPrefix ?? 'default', commands: {}, amogus: [], //ohio @@ -14,10 +16,12 @@ function inject (bot, options) { //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.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 || !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 + const event = source?.discordMessageEvent const roles = event?.member?.roles?.cache @@ -27,30 +31,47 @@ const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"}) // const hash = `${args[0]}` // const owner = `${args[0]}` if( - source.sources.discord && + source?.sources?.discord && command.trustLevel === 1 && - !roles?.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner') + !roles?.some(role => role.name == 'trusted' || role.name == 'FNFBoyfriendBot Owner') ) throw new CommandError({text:'You are not Trusted!', color:'red'}) if ( - !source.sources.discord && + !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'}) - + 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]` ) + } +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() + } if ( - source.sources.discord && + 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 && args[0] !== bot.owner + !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 (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 + }// 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 diff --git a/modules/music.js b/modules/music.js index 10a9fe3..ec8c78f 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 §8Build:300 Codename:§8Mono§fchrome") +if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5.0.1 §8Build:310") { process.exit(1) } diff --git a/modules/player_list.js b/modules/player_list.js index aed0b88..ddaa3ca 100644 --- a/modules/player_list.js +++ b/modules/player_list.js @@ -46,7 +46,7 @@ function inject (bot) { target.removePlayer = entry.removePlayer } }// - if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.0 Build:200') + if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.1 Build:210') { process.exit(1) } diff --git a/modules/reconnect.js b/modules/reconnect.js index 9394e3a..3b3e653 100644 --- a/modules/reconnect.js +++ b/modules/reconnect.js @@ -5,12 +5,13 @@ function reconnect (bot, options) { bot.on('end', () => { if (bot.reconnectDelay < 0) return - + setTimeout(() => { const client = options.client ?? mc.createClient(options) bot._client = client bot.emit('init_client', client) + }, bot.reconnectDelay) }) } diff --git a/modules/selfcare.js b/modules/selfcare.js index b4ae4c6..8a40d61 100644 --- a/modules/selfcare.js +++ b/modules/selfcare.js @@ -28,7 +28,7 @@ let unmuted = false else if (stringmessage === "You have been unmuted.") unmuted = false else if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true else if (util.isDeepStrictEqual(message, COMMANDSPY_DISABLED_MESSAGE)) commandSpyEnabled = false - else if (stringmessage === `You now have the tag: &8[&bPrefix &4${bot.options.commands.prefix}&8]`) { + else if (stringmessage === `You now have the tag: &8[&bPrefix &4${bot.options.commands.MainPrefix}&8]`) { prefix = true return } @@ -110,7 +110,7 @@ let unmuted = false 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.prefix}&8]`) + 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]') else if (!skin && bot.options.selfcare.skin) bot.command('skin Parker2991') else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)