core pos NaN patch v6.0.2 build: 1000

This commit is contained in:
Parker2991 2024-09-19 11:30:06 -04:00
parent e5741ffac1
commit 2a812961e1
15 changed files with 137 additions and 38 deletions

View file

@ -75,7 +75,7 @@ module.exports = {
if (bot.console.customChat.enabled) { 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.owner} ${args.slice(3).join(' ')}`);
} else if (!bot.console.customChat.enabled) { } else if (!bot.console.customChat.enabled) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`) bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
} }
break break
default: default:

View file

@ -40,7 +40,11 @@ module.exports = {
const source = context.source; const source = context.source;
switch (args[0]?.toLowerCase()) { switch (args[0]?.toLowerCase()) {
case 'version': case 'version':
if (botInfo.bot.buildstring.codename === '') {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`); bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
}
break break
case 'config': case 'config':
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [ bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
@ -275,7 +279,7 @@ module.exports = {
case "about": case "about":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [ bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ {
text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source can be found here ${botInfo.bot.source}`, text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.bot.source}`,
color: "gray", color: "gray",
translate: "", translate: "",
hoverEvent: { hoverEvent: {

View file

@ -35,7 +35,7 @@ module.exports = {
} }
} }
bot.bots.filter((eachBot) => { bot.bots.filter((eachBot) => {
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) { if (eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom || eachBot.options.isCreayun && !eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`) eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) { } else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
eachBot.tellraw("@a", component); eachBot.tellraw("@a", component);

View file

@ -5,7 +5,7 @@ const fixansi = require('../util/ansi');
const CommandError = require('../util/command_error') const CommandError = require('../util/command_error')
module.exports = { module.exports = {
name: 'website', name: 'website',
trustLevel: 4, trustLevel: 1,
aliases: [ aliases: [
], ],
description: 'look up website data', description: 'look up website data',

View file

@ -30,6 +30,25 @@
"+" "+"
] ]
}, },
{
"name": [
{
"text": "Hydra",
"color": "dark_red"
}
],
"authors": [
"popbob/aaa"
],
"exclaimer": "",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"+",
"$",
"h:",
"hydra:"
]
},
{ {
"name": [ "name": [
{ {

View file

@ -1,8 +1,8 @@
{ {
"bot": { "bot": {
"buildstring": { "buildstring": {
"version": "v6.0.1", "version": "v6.0.2",
"build":"990", "build":"1000",
"codename":"" "codename":""
}, },
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/" "source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"

View file

@ -1,6 +1,7 @@
const readline = require('readline'); const readline = require('readline');
function boot (bot, options, discordClient, config) { function boot (bot, options, discordClient, config) {
bot.on("packet.login", (data) => { bot.on("packet.login", (data) => {
if (bot.options.isCreayun) return
if (new Date().getDay() === 5) { if (new Date().getDay() === 5) {
bot.chat.message('Gettin\' freaky on a friday night!'); bot.chat.message('Gettin\' freaky on a friday night!');
} else { } else {

View file

@ -18,7 +18,7 @@ function chat (bot, options, config) {
bot.on('registry_ready', registry => { bot.on('registry_ready', registry => {
ChatMessage = loadPrismarineChat(registry) ChatMessage = loadPrismarineChat(registry)
}) })
if (options.isSavage) { if (options.isSavage || options.isCreayun) {
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser] bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
} else { } else {
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser] bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
@ -129,5 +129,8 @@ function chat (bot, options, config) {
}) })
} }
} }
bot.tellraw = (selector, message) => {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
}
} }
module.exports = chat; module.exports = chat;

View file

@ -11,9 +11,16 @@ function core (bot, options, config) {
const { start, end } = bot.core.area const { start, end } = bot.core.area
if (!pos) return if (!pos) return
if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return
// if (isNaN(pos.x + start.x)) bot.chat.command('world 3'); if (isNaN(pos.x + start.x)) {
// console.log(isNaN(pos.x + start.x)) bot.chat.command('spawn');
return
}
/*^^^
for checking is the core pos is null and if so
it will not refill core until the pos is not NaN
instead of tping to a set cords cuz fuck you im not doing that
*/
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`) bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
}, },
@ -68,7 +75,7 @@ function core (bot, options, config) {
} }
} }
// if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return // if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
if (bot.options.isSavage) return if (bot.options.isSavage || bot.options.isCreayun) return
bot.on('move', () => { bot.on('move', () => {
// if (bot.options.isSavage) return // if (bot.options.isSavage) return
bot.core.move(bot.position) bot.core.move(bot.position)

View file

@ -36,7 +36,7 @@ function command_manager (bot, options, config, discordClient) {
]) ])
} else if (source?.sources?.console && !source?.sources?.discord) { } else if (source?.sources?.console && !source?.sources?.discord) {
if (!command || !command.execute) if (!command || !command.execute)
bot.console.warn(bot.getMessageAsPrismarine([ bot.console.warn([
{ {
translate: 'command.unknown.command', translate: 'command.unknown.command',
color: "dark_red" color: "dark_red"
@ -52,21 +52,20 @@ function command_manager (bot, options, config, discordClient) {
translate: "command.context.here", translate: "command.context.here",
color: "dark_red" color: "dark_red"
} }
])?.toAnsi()) ])
} }
if (command?.trustLevel > 0) { if (command?.trustLevel > 0) {
const event = bot.discord.message; const event = bot.discord.message;
const roles = event?.member?.roles?.cache; const roles = event?.member?.roles?.cache;
if (command?.trustLevel === 1 && !source?.sources?.discord) { if (command?.trustLevel === 1 && !source?.sources?.discord) {
const hash = args[0] const hash = args[0]
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or and admin or an owner hash" }) if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or and admin or an owner hash" })
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' }) if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' })
} else if (command?.trustLevel === 1 && source?.sources.discord) { } else if (command?.trustLevel === 1 && source?.sources.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`) const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!' }) if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!' })
} }
if (command?.trustLevel === 2 && !source.sources.console) { if (command?.trustLevel === 2 && !source.sources.console) {
// bot.chat.message('trust level 2 does nothing currently'); placeholder code
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash" }) if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash" })
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' }) if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' })
} }
@ -79,13 +78,14 @@ function command_manager (bot, options, config, discordClient) {
} else if (command?.trustLevel === 4 && !source.sources.console) { } else if (command?.trustLevel === 4 && !source.sources.console) {
throw new CommandError('This command can only be ran via console'); throw new CommandError('This command can only be ran via console');
} }
} if (!command?.discordExecute && command && source.sources.discord) { }
if (!command?.discordExecute && command && source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in discord!`) throw new CommandError(`${command.name} command is not supported in discord!`)
} else if (command?.discordExecute && command && source.sources.discord) { } else if (command?.discordExecute && command && source?.sources?.discord) {
return command.discordExecute({ bot, source, arguments: args, config, discordClient }) return command.discordExecute({ bot, source, arguments: args, config, discordClient })
} else if (!command?.execute && command && !source.sources.discord) { } else if (!command?.execute && command && !source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in game!`) throw new CommandError(`${command.name} command is not supported in game!`)
} else if (command?.execute && command && !source.sources.discord) { } else if (command?.execute && command && !source?.sources?.discord) {
return command?.execute({ bot, source, arguments: args, config, discordClient}) return command?.execute({ bot, source, arguments: args, config, discordClient})
} }
} catch (error) { } catch (error) {

View file

@ -1,6 +1,7 @@
const CommandSource = require('../util/command_source'); const CommandSource = require('../util/command_source');
const prismarineChat = require('prismarine-chat')('1.20.2'); const prismarineChat = require('prismarine-chat')('1.20.2');
function Console (bot, options, config) { function Console (bot, options, config) {
let rateLimit = 0;
bot.console = { bot.console = {
readline: null, readline: null,
server: 'all', server: 'all',
@ -34,7 +35,7 @@ function Console (bot, options, config) {
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + error) this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
}, },
info (message) { info (message) {
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message) this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
}, },
customChat: { customChat: {
enabled: false, enabled: false,
@ -66,7 +67,14 @@ function Console (bot, options, config) {
} }
} }
bot.on('message', (message) => { bot.on('message', (message) => {
rateLimit++
setTimeout(() => {
rateLimit--
}, 1000)
if (!options.logging) return; if (!options.logging) return;
/* if (rateLimit > 100) {
return
}*/
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi()); bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`); bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
}) })

View file

@ -58,8 +58,10 @@ function selfcare (bot, options, config) {
gameMode = packet.gameMode; gameMode = packet.gameMode;
clientLock = packet.gameMode; clientLock = packet.gameMode;
timer = setInterval(() => { timer = setInterval(() => {
if (bot.options.isSavage && !bot.options.isKaboom) { if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 }); if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
} else if (bot.options.isKaboom && !bot.options.isSavage) { } else if (bot.options.isKaboom && !bot.options.isSavage) {
if (permissionLevel < 2) bot.chat.command('op @s[type=player]'); if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative'); else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');

View file

@ -17,7 +17,7 @@ function ChipmunkMod (message, data, context, bot) {
sender = data.players.find(player => player.profile.name === stringUsername) sender = data.players.find(player => player.profile.name === stringUsername)
} }
if (!sender) return null if (!sender) return null;
return { sender, contents, type: 'minecraft:chat', senderComponent } return { sender, contents, type: 'minecraft:chat', senderComponent }
} catch(e) { } catch(e) {

View file

@ -9,6 +9,61 @@ function ansi (message) {
"\x1B\[92m": "\x1B\[32m", // Green "\x1B\[92m": "\x1B\[32m", // Green
"\x1B\[0m": "\x1B\[0m\x1B\[37m", // White "\x1B\[0m": "\x1B\[0m\x1B\[37m", // White
"\x1B\[97m": "\x1B\[0m\x1B\[37m", // White "\x1B\[97m": "\x1B\[0m\x1B\[37m", // White
"\x1B\[30m": "\x1B[30m", // black
"\x1B\[35m": "\x1B[35m", // purple
'\x1B[3m': "\x1B[23m", // italic
'\x1B[4m': "\x1B[24m", // underline
'\x1B[9m': "\x1B[29m", // strike through
'\x1B[6m': "\x1B[29m" // obfuscated
/*
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47
Default 39 49
Reset 0 0
ESC[1;34;{...}m Set graphics modes for cell, separated by semicolon (;).
ESC[0m reset all modes (styles and colors)
ESC[1m ESC[22m set bold mode.
ESC[2m ESC[22m set dim/faint mode.
ESC[3m ESC[23m set italic mode.
ESC[4m ESC[24m set underline mode.
ESC[5m ESC[25m set blinking mode
ESC[7m ESC[27m set inverse/reverse mode
ESC[8m ESC[28m set hidden/invisible mode
ESC[9m ESC[29m set strikethrough mode.
*/
/*
const defaultAnsiCodes = {
'§0': '\u001b[30m',
'§1': '\u001b[34m',
'§2': '\u001b[32m',
'§3': '\u001b[36m',
'§4': '\u001b[31m',
'§5': '\u001b[35m',
'§6': '\u001b[33m',
'§7': '\u001b[37m',
'§8': '\u001b[90m',
'§9': '\u001b[94m',
'§a': '\u001b[92m',
'§b': '\u001b[96m',
'§c': '\u001b[91m',
'§d': '\u001b[95m',
'§e': '\u001b[93m',
'§f': '\u001b[97m',
'§l': '\u001b[1m',
'§o': '\u001b[3m',
'§n': '\u001b[4m',
'§m': '\u001b[9m',
'§k': '\u001b[6m',
'§r': '\u001b[0m'
}
*/
}; };
let i = message; let i = message;