From 3344fc6e2e05046b3b1c280c82d513613d7bf810 Mon Sep 17 00:00:00 2001 From: Parker2991 Date: Thu, 24 Oct 2024 10:48:45 -0400 Subject: [PATCH] v6.0.8 build: 1090 added private option to the config for netmsg for right now added icu selfcare made vanish selfcare toggleable --- src/commands/console.js | 2 +- src/commands/help.js | 10 +++---- src/commands/netmsg.js | 56 ++++++++++++++++++++++++------------- src/commands/vanish.js | 31 ++++++++++++++++++++ src/data/default_config.yml | 1 + src/data/info.json | 4 +-- src/modules/console.js | 2 +- src/modules/selfcare.js | 20 ++++++++++++- 8 files changed, 96 insertions(+), 30 deletions(-) create mode 100644 src/commands/vanish.js diff --git a/src/commands/console.js b/src/commands/console.js index c97e0e0..7878bf2 100644 --- a/src/commands/console.js +++ b/src/commands/console.js @@ -80,7 +80,7 @@ module.exports = { case "trusted": case "t": if (bot.console.customChat.enabled) { - bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`); + bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`); } else if (!bot.console.customChat.enabled) { bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`); } diff --git a/src/commands/help.js b/src/commands/help.js index f128c3b..26919b4 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -409,28 +409,28 @@ module.exports = { bot.discord.message.reply({ embeds: [Embed] }) return } - if (command?.trustLevel === 0) { + if (command?.trustLevel === 0 && command.discordExecute) { public.push([ { text: command.name + ' ', color: "aqua", } ]) - } else if (command?.trustLevel === 1) { + } else if (command?.trustLevel === 1 && command.discordExecute) { trusted.push([ { text: command.name + ' ', color: "dark_aqua" } ]) - } else if (command?.trustLevel === 2) { + } else if (command?.trustLevel === 2 && command.discordExecute) { admin.push([ { text: command.name + ' ', color: 'blue' } ]) - } else if (command?.trustLevel === 3) { + } else if (command?.trustLevel === 3 && command.discordExecute) { owner.push([ { text: command.name + ' ', @@ -439,7 +439,7 @@ module.exports = { ]) } } - const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length + const length = bot.commandManager.commandlist.filter(c => c.trustLevel !== 3 && c.discordExecute).length const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi(); const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b')) const Embed = new EmbedBuilder() diff --git a/src/commands/netmsg.js b/src/commands/netmsg.js index 9d2d1dc..96d68d4 100644 --- a/src/commands/netmsg.js +++ b/src/commands/netmsg.js @@ -1,7 +1,7 @@ const CommandError = require('../util/command_error.js') module.exports = { name: 'netmsg', - trustLevel: 1, + trustLevel: 0, aliases: [ ], @@ -14,23 +14,25 @@ module.exports = { const bot = context.bot; const source = context.source; const config = context.config; - if (config.patches.netmsg) { - component = [ - { text: '[', color: "dark_gray" }, - { text: bot.options.serverName, color: "gray" }, - { text: "] ", color: "dark_gray" }, - source.player.displayName, - { text: " \u203a ", color: "dark_gray", bold: false }, - { text: args.join(' '), color: "gray", bold: false } - ] - } else { + if (bot.options.private) { component = { translate: '[%s] %s \u203a %s', color: "dark_gray", with: [ - { text: bot.options.serverName, color: "gray" }, + { text: bot.options.serverName, color: "blue" }, source.player.displayName ?? source.player.profile.name, - { text: args.join(' '), color: "gray" }, + { text: args.join(' '), color: "blue" }, + ] + } + } else if (!bot.options.private) { + component = { + translate: '[%s:%s] %s \u203a %s', + color: "dark_gray", + with: [ + { text: bot.options.host, color: "blue" }, + { text: `${bot.options.port}`, color: "gold" }, + source.player.displayName ?? source.player.profile.name, + { text: args.join(' '), color: "blue" }, ] } } @@ -53,13 +55,27 @@ module.exports = { const bot = context.bot; const args = context.arguments; const source = context.source; - const component = { - translate: '[%s] %s \u203a %s', - with: [ - bot.options.serverName, - source.player.displayName ?? source.player.profile.name, - args.join(' ') - ] + if (bot.options.private) { + component = { + translate: '[%s] %s \u203a %s', + color: "dark_gray", + with: [ + { text: bot.options.serverName, color: "blue" }, + source.player.displayName ?? source.player.profile.name, + { text: args.join(' '), color: "blue" }, + ] + } + } else if (!bot.options.private) { + component = { + translate: '[%s:%s] %s \u203a %s', + color: "dark_gray", + with: [ + { text: bot.options.host, color: "blue" }, + { text: `${bot.options.port}`, color: "gold" }, + source.player.displayName ?? source.player.profile.name, + { text: args.join(' '), color: "blue" }, + ] + } } bot.bots.filter((eachBot) => { if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) { diff --git a/src/commands/vanish.js b/src/commands/vanish.js new file mode 100644 index 0000000..92a5da4 --- /dev/null +++ b/src/commands/vanish.js @@ -0,0 +1,31 @@ +module.exports = { + name: 'vanish', + trustLevel: 2, + aliases: [ + "vanishtoggle" + ], + description: 'toggle the bots vanish selfcare', + usages: [ + + ], + execute (context) { + const bot = context.bot + const args = context.arguments; + if (args.slice(1).join('') === 'true') { + bot.vanished = true + bot.chat.message('enabled vanish selfcare') + } + if (args.slice(1).join('') === 'false') { + bot.vanished = false; + bot.chat.message('disabled vanish selfcare') + } + }, + discordExecute (context) { + const bot = context.bot; + const args = context.arguments; + bot.vanished = false; + bot.chat.message('disabling vanish selfcare,...'); + bot.chat.command('v off') + } + } + \ No newline at end of file diff --git a/src/data/default_config.yml b/src/data/default_config.yml index fdc5896..66f7eef 100644 --- a/src/data/default_config.yml +++ b/src/data/default_config.yml @@ -51,6 +51,7 @@ bots: usernameGen: true version: "1.20.2" serverName: "localhost" + private: false reconnectDelay: 6000 channelId: "discord channel id here" logging: false diff --git a/src/data/info.json b/src/data/info.json index 58ec9d9..75475c2 100644 --- a/src/data/info.json +++ b/src/data/info.json @@ -1,8 +1,8 @@ { "bot": { "buildstring": { - "version": "v6.0.7", - "build":"1080", + "version": "v6.0.8", + "build":"1090", "codename":"" }, "source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/" diff --git a/src/modules/console.js b/src/modules/console.js index acca850..530bbde 100644 --- a/src/modules/console.js +++ b/src/modules/console.js @@ -19,7 +19,7 @@ function Console (bot, options, config) { }) }) }, - source: new CommandSource(bot.options.username, { console: true, discord: false }), + source: new CommandSource(bot._client.username, { console: true, discord: false }), refreshLine (...args) { this.readline.output.write("\x1b[2K\r"); console.log.apply(console, arguments); diff --git a/src/modules/selfcare.js b/src/modules/selfcare.js index 10f5f08..23e9f88 100644 --- a/src/modules/selfcare.js +++ b/src/modules/selfcare.js @@ -12,6 +12,8 @@ function selfcare (bot, options, config) { let nickname = false; let login = false; let register = false; + let positionCount = 0; + bot.vanished = true // You now have the tag: &8[&bPrefix&8: &3~&8] // You no longer have a tag bot.on('message', (message) => { @@ -63,18 +65,34 @@ You already have registered this username! else if (stringMessage.startsWith('Your nickname is now ')) nickname = true; } }) + bot.on('packet.entity_status', packet => { if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return permissionLevel = packet.entityStatus - 24 }) + bot.on('packet.game_state_change', packet => { if (packet.reason !== 3) return // Reason 3 = Change Game Mode gameMode = packet.gameMode; }); + bot.on("packet.game_state.change", packet => { if (packet.reason !== 4) return // checks if the bot is seeing the endcredits or died clientLock = packet.gameMode; }) + + bot.on("packet.position", (packet, position) => { + positionCount++ + setTimeout(() => { + positionCount-- + if (positionCount > 4) { + bot.core.run('sudo * icu stop'); + } if (permissionLevel < 2 || gameMode !== 1) { + bot._client.end('anti icu :3'); + } + }, 1000) + }) + let timer; bot.on('packet.login', (packet) => { entityId = packet.entityId; @@ -96,7 +114,7 @@ You already have registered this username! else if (username) bot.chat.command(`username ${bot.options.username}`) else if (nickname) bot.chat.command(`nick off`) else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`); - else if (!vanished) bot.chat.command(`essentials:vanish on`); + else if (!vanished && bot.vanished) bot.chat.command(`essentials:vanish on`); else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`); else if (!god) bot.core.run(`god ${bot.options.username} enable`); else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);