v6.1.1 build: 1145, refractured the info command and more

This commit is contained in:
Parker2991 2024-11-13 14:44:41 -05:00
parent ab87e748f9
commit 8f61177250
13 changed files with 345 additions and 570 deletions

6
package-lock.json generated
View file

@ -1,9 +1,9 @@
{ {
"name": "FridayNightFunkinBoyfriendBot", "name": "FridayNightFunkinBoyfriendBot",
"version": "v6.1.0", "version": "v6.1.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"build": "1130", "build": "1145",
"codename": "", "codename": "",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot", "url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot",
"packages": { "packages": {
@ -27,6 +27,7 @@
"prismarine-chat": "^1.10.1", "prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.7.0", "prismarine-registry": "^1.7.0",
"proxy-agent": "^6.4.0", "proxy-agent": "^6.4.0",
"socks": "^2.8.3",
"wikipedia": "^2.1.2", "wikipedia": "^2.1.2",
"xml2js": "^0.6.2" "xml2js": "^0.6.2"
} }
@ -2510,6 +2511,7 @@
"version": "2.8.3", "version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"license": "MIT",
"dependencies": { "dependencies": {
"ip-address": "^9.0.5", "ip-address": "^9.0.5",
"smart-buffer": "^4.2.0" "smart-buffer": "^4.2.0"

View file

@ -18,6 +18,7 @@
"prismarine-chat": "^1.10.1", "prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.7.0", "prismarine-registry": "^1.7.0",
"proxy-agent": "^6.4.0", "proxy-agent": "^6.4.0",
"socks": "^2.8.3",
"wikipedia": "^2.1.2", "wikipedia": "^2.1.2",
"xml2js": "^0.6.2" "xml2js": "^0.6.2"
} }

View file

@ -1,122 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'filter',
trustLevel: 2,
aliases: [
"blacklist"
],
description: 'filters players',
usages: [
"list",
"--regex(-r) --ignorecase(-i) add <player>",
"--ignorecase(-i) add <player>",
"add <player>",
"clear",
"remove(rm) <index>"
],
},
execute (context) {
/*
note:
bot.filter.add(ignoreCase(true/false), regexed(true/false), name(args))
*/
const bot = context.bot
const args = context.arguments;
const config = context.config;
let component = [];
if (bot.options.isCreayun || bot.options.isSavage) throw new CommandError('this command is meant for kaboom.pw and its clones')
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4]) return
switch (args[1]?.toLowerCase()) {
case 'list':
// bot.tellraw(`@a`, JSON.stringify(bot.filter.list().length));
if (bot.filter.list().length === 0) {
component.push({
translate: '%s: (%s)',
color: 'dark_gray',
with: [
{ text: 'Players', color: 'dark_blue' },
{ text: JSON.stringify(bot.filter.list().length), color: 'gold' },
]
})
} else {
let i = 0;
let listComponent = []
for (const players of bot.filter.list()) {
listComponent.push({
translate: '%s \u203a %s',
color: 'dark_blue',
with: [
{ text: `${i}`, color: 'gold' },
{ text: players.name, color: 'blue' },
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: '%s: (%s)',
color: 'dark_gray',
with: [
{ text: 'Players', color: 'dark_blue' },
{ text: `${bot.filter.list().length}`, color: 'gold' }
]
})
component.push('\n')
component.push(listComponent)
// bot.tellraw("@a", component)
}
bot.tellraw("@a", component)
break;
case "--regex":
case "-r":
switch (args[2]?.toLowerCase()) {
case "--ignorecase":
case "-i":
switch (args[3]?.toLowerCase()) {
case "add":
case "a":
bot.filter.add(true, true, args[4])
bot.chat.message(`Added ${args[4]} to the filter`)
break;
}
break;
case "add":
bot.filter.add(false, true, args[3]);
bot.chat.message(`Added ${args[3]} to the filter`);
break;
}
break;
case "--ignorecase":
case "-i":
switch (args[2]?.toLowerCase()) {
case "add":
bot.filter.add(true, false, args[3]);
bot.chat.message(`Added ${args[3]} to the filter`)
break;
}
break;
case "add":
case "a":
bot.filter.add(false, false, args.slice(2).join(' '));
bot.chat.message(`Added ${args.slice(2).join(' ')} to the filter`);
break;
case "clear":
case "c":
bot.filter.clear();
bot.chat.message('Cleared filter');
break
case "remove":
case "rm": // rm linux command reference
if (isNaN(args.slice(2))) throw new CommandError('argument must be a integer!');
bot.filter.remove(args.slice(2));
bot.chat.message(`Removed ${args.slice(2)} from the filter`);
break
default:
throw new CommandError('invalid argument')
}
},
}

View file

@ -1,5 +1,5 @@
const CommandError = require('../../util/command_error') const CommandError = require('../../util/command_error')
const sleep = require('../../util/sleep');
module.exports = { module.exports = {
data: { data: {
name: 'core', name: 'core',
@ -14,10 +14,16 @@ module.exports = {
"<command>", "<command>",
], ],
}, },
execute (context) { async execute (context) {
const bot = context.bot const bot = context.bot
const message = context.arguments.join(' '); const message = context.arguments.join(' ');
bot.core.run(message) bot.core.run(message);
await sleep(45);
/* bot.on('commandBlockOutput', (packet) => {
bot.tellraw("@a", require('util').inspect(packet));
console.log(packet);
})*/
// bot.core.commandBlockOutput()
}, },
discordExecute (context) { discordExecute (context) {
const bot = context.bot; const bot = context.bot;

View file

@ -59,7 +59,7 @@ module.exports = {
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b')) const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder() Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`) .setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`) .setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``) .setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] }) bot.discord.message.reply({ embeds: [Embed] })
} else if (cows[args[0]]) { } else if (cows[args[0]]) {
@ -67,7 +67,7 @@ module.exports = {
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b')) const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder() Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`) .setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`) .setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``) .setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] }) bot.discord.message.reply({ embeds: [Embed] })
} else { } else {

View file

@ -4,7 +4,7 @@ const fs = require("fs");
const botInfo = require('../../../package-lock.json'); const botInfo = require('../../../package-lock.json');
const fixansi = require('../../util/ansi.js'); const fixansi = require('../../util/ansi.js');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { exec } = require('child_process') const { execSync } = require('child_process')
function format(seconds) { function format(seconds) {
function pad(s) { function pad(s) {
return (s < 10 ? "0" : "") + s; return (s < 10 ? "0" : "") + s;
@ -26,12 +26,14 @@ module.exports = {
], ],
description: 'check the bots info', description: 'check the bots info',
usages: [ usages: [
"version", "about",
"config", "config <client, discord, options, all>",
"contributors/credits",
"discord", "discord",
"usages <bot, server, all>",
"uptimes/uptime <bot, server, all>",
"server", "server",
"contributors", "version/ver",
"about"
], ],
}, },
execute (context) { execute (context) {
@ -40,102 +42,145 @@ module.exports = {
const config = context.config; const config = context.config;
const discordClient = context.discordClient; const discordClient = context.discordClient;
const source = context.source; const source = context.source;
let component = [];
switch (args[0]?.toLowerCase()) { switch (args[0]?.toLowerCase()) {
case 'version': case "about":
if (botInfo.codename === '') { component.push({
if (bot.options.isSavage) { text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.url}`,
bot.chat.message(`&9Friday &9Night &9Funkin &3Boyfriend &1Bot&8&r-${botInfo.version}-#${botInfo.build}`) color: `${config.colors.commands.primary}`,
setTimeout(() => { translate: "",
bot.chat.message(`11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`) hoverEvent: {
}, 300) action: "show_text",
} else { value: [
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.version}-#${botInfo.build}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`); { text: "click here to view bots source code", color: `${config.colors.commands.primary}` }
]
},
clickEvent: {
action: "open_url",
value: `${botInfo.url}`
} }
} else { })
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.version}-#${botInfo.build}-${botInfo.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
}
break
case 'config':
if (bot.options.isKaboom) {
mode = 'Kaboom'
} else if (bot.options.isCreayun) {
mode = 'Creayun'
} else if (bot.options.useChat) {
mode = 'useChat / Kaboom'
} else if (bot.options.isSavage) {
mode = 'Savage'
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: `Minecraft username \u203a ${bot.options.username}\n`,
color: 'gray',
},
{
text: `Ip \u203a ${bot.options.host}:`,
color: "gray"
},
{
text: `${bot.options.port}\n`,
color: 'gold'
},
{
text: `Version \u203a ${bot.options.version}\n`,
color: "gray",
},
{
text: `Discord username \u203a ${discordClient.user.tag}\n`,
color: 'gray',
},
{
text: `Channel \u203a ${bot.discord.channel?.name}\n`,
color: "gray"
},
{
text: `Server name \u203a ${bot.options.serverName}\n`,
color: "gray",
},
{
text: `Server count \u203a `,
color: "gray"
},
{
text: `${bot.bots.length}\n`,
color: 'gold'
},
{
text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`,
color: "gray"
},
{
text: `Prefix Length: `,
color: "gray"
},
{
text: `${config.prefixes.length}\n`,
color: 'gold'
},
{
text: 'Mode \u203a ',
color: 'gray'
},
{
text: `${mode}`,
color: 'gray',
}
]);
break; break;
case 'discord': case "config":
bot.tellraw("@a", [ if (bot.options.isKaboom) {
{ mode = "Kaboom";
} if (bot.options.useChat && bot.options.isKaboom) {
mode = "Kaboom/Coreless";
} if (bot.options.isSavage) {
mode = "Savage";
} if (bot.options.isCreayun) {
mode = "Creayun";
}
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "client":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.integer },
]
})
break;
case "discord":
if (!config.discord.enabled || discordClient.user === null) {
throw new CommandError('Token is incorrect or discord isnt enabled!')
} else {
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
]
})
}
break;
case "options":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${mode}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${mode}`, color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "contributors":
case "credits":
component.push({
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Parker", color: "dark_red" },
{ text: "2991", color: "black" },
{ text: "Owner" },
{ text: "Contributors" },
{ text: "_ChipMC_", color: "dark_blue" },
{ text: "chayapak", color: "yellow" },
{ text: "_yfd", color: "light_purple" },
{ text: "aaa", color: "gold" },
{ text: "Morgan", color: "green" },
{ text: "Ankan", color: "dark_green" },
{ text: "TurtleKid", color: "green" }
]
})
break;
case "discord":
component.push({
text: `the discord server invite is ${config.discord.invite}`, text: `the discord server invite is ${config.discord.invite}`,
color: "gray", color: config.colors.commands.primary,
translate: "", translate: "",
hoverEvent: { hoverEvent: {
action: "show_text", action: "show_text",
value: [ value: [
{ {
text: "click here to join the discord server!", text: "click here to join the discord server!",
color: "gray", color: config.colors.commands.secondary,
} }
] ]
}, },
@ -143,251 +188,168 @@ module.exports = {
action: "open_url", action: "open_url",
value: `${config.discord.invite}` value: `${config.discord.invite}`
} }
}, })
]) break;
break case "usages":
case "server": switch (args.slice(1).join(' ')?.toLowerCase()) {
if (process.platform === 'win32') { case "bot":
exec('rmdir /s /q ..\\FridayNightFunkinBoyfriendBot') component.push({
process.exit(0) // fuck you windows translate: "%s: %s %s / %s %s",
} else { color: config.colors.commands.tertiary,
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [ with: [
{ { text: "Bot Memory Usage", color: config.colors.commands.primary },
text: `Hostname \u203a ${os.hostname()}\n`, { text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
color: "gray" { text: "MiB", color: config.colors.commands.secondary },
}, { text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ { text: "MiB", color: config.colors.commands.secondary }
text: `User \u203a ${os.userInfo().username}\n`,
color: "gray",
},
{
text: `Working Directory \u203a ${process.mainModule.path}\n`,
color: "gray"
},
{
text: `Arch \u203a ${os.arch()}\n`,
color: "gray"
},
{
text: `OS \u203a ${os.platform()}\n`,
color: "gray"
},
{
text: `OS Version/distro \u203a ${os.version()}\n`,
color: "gray",
},
{
text: `Kernel Version \u203a ${os.release()}\n`,
color: "gray"
},
{
text: `Core Count \u203a `,
color: "gray",
},
{
text: `${os.cpus().length}\n`,
color: 'gold'
},
{
text: `CPU \u203a ${os.cpus()[0].model}\n`,
color: "gray"
},
{
text: `Server Free memory `,
color: 'gray'
},
{
text: `${Math.floor( os.freemem() / 1048576, )} `,
color: 'gold'
},
{
text: 'MiB / ',
color: 'gray'
},
{
text: `${Math.floor(os.totalmem() / 1048576)} `,
color: "gold",
},
{
text: 'MiB\n',
color: "gray",
},
{
text: `Bot memory usage `, color: "gray"
},
{
text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `,
color: "gold",
},
{
text: "MiB / ",
color: "gray",
},
{
text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `,
color: "gold"
},
{
text: 'MiB\n',
color: "gray"
},
{
text: `Device uptime \u203a ${format(os.uptime())}\n`,
color: 'gray'
},
{
text: `Bot uptime \u203a ${format(process.uptime())}\n`,
color: "gray"
},
{
text: `Node version \u203a ${process.version}`,
color: 'gray'
}
])
}
break
case "contributors":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: "Parker",
color: "dark_red",
},
{
text: "2991",
color: "black"
},
{
text: " - Owner\n",
color: "gray"
},
{
text: "Contributors -\n",
color: "gray",
},
{
text: "_ChipMC_ - ChipmunkBot js & java\n",
color: "dark_blue"
},
{
text: "chayapak - ChomeNS js & java\n",
color: "yellow"
},
{
text: "_yfd - abot\n",
color: "light_purple"
},
{
text: "aaa - FBot, SnifferBot, Xbot, Hydra\n",
color: "gold",
},
{
text: "Morgan Ankan - RecycleBot\n",
color: "dark_green"
},
{
text: "TurtleKid - TurtleBot",
color: "dark_green"
},
])
break
case "about":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.url}`,
color: "gray",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: "click here to view bots source code",
color: "gray",
}
] ]
}, })
clickEvent: { break;
action: "open_url",
value: `${botInfo.url}`
}
}
])
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
const discordClient = context.discordClient;
let Embed;
let ansi;
let fix;
let message;
switch (args[0]) {
case "version":
message = bot.getMessageAsPrismarine(`§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" })}`)?.toString()
fix = fixansi(message.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] });
break
case "config":
message = bot.getMessageAsPrismarine([
{ text: `Minecraft username \u203a ${bot.options.username}\n`, color: 'gray', },
{ text: `Ip \u203a ${bot.options.host}:${bot.options.port}\n`, color: "gray" },
{ text: `Version \u203a ${bot.options.version}\n`, color: "gray" },
{ text: `Discord username \u203a ${discordClient.user.tag}\n`, color: 'gray' },
{ text: `Channel \u203a ${bot.discord.channel?.name}\n`, color: "gray" },
{ text: `Server name \u203a ${bot.options.serverName}\n`, color: "gray" },
{ text: `Server count \u203a ${bot.bots.length}\n`, color: "gray" },
{ text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`, color: "gray" },
{ text: `Prefix Length: ${config.prefixes.length}\n`, color: "gray" },
{ text: `isKaboom \u203a ${bot.options.isKaboom}\n`, color: "gray" },
{ text: `isCreayun \u203a ${bot.options.isCreayun}\n`, color: "gray" },
{ text: `isSavage \u203a ${bot.options.isSavage}\n`, color: "gray", } ])?.toAnsi();
fix = fixansi(message.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
break
case "server": case "server":
message = bot.getMessageAsPrismarine([ component.push({
{ text: `Hostname \u203a ${os.hostname()}\n`, color: "gray" }, translate: "%s: %s %s / %s %s",
{ text: `User \u203a ${os.userInfo().username}\n`, color: "gray" }, color: config.colors.commands.tertiary,
{ text: `Working Directory \u203a ${process.mainModule.path}\n`, color: "gray" }, with: [
{ text: `Arch \u203a ${os.arch()}\n`, color: "gray" }, { text: `OS \u203a ${os.platform()}\n`, color: "gray" }, { text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `OS Version/distro \u203a ${os.version()}\n`, color: "gray" }, { text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: `Kernel Version \u203a ${os.release()}\n`, color: "gray" }, { text: "MiB", color: config.colors.commands.secondary },
{ text: `Cores \u203a ${os.cpus().length}\n`, color: "gray" }, { text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: `CPU \u203a ${os.cpus()[0].model}\n`, color: "gray" }, { text: "MiB", color: config.colors.commands.secondary },
{ text: `Server Free memory `, color: 'gray' }, ]
{ text: `${Math.floor( os.freemem() / 1048576, )} `, color: 'gold' }, })
{ text: 'MiB / ', color: 'gray' }, break;
{ text: `${Math.floor(os.totalmem() / 1048576)} `, color: "gold" }, case "all":
{ text: 'MiB\n', color: "gray", }, component.push({
{ text: `Bot memory usage `, color: "gray" }, translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
{ text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `, color: "gold", }, color: config.colors.commands.tertiary,
{ text: "MiB / ", color: "gray", }, with: [
{ text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `, color: "gold" }, { text: "Free Server Memory", color: config.colors.commands.primary },
{ text: 'MiB\n', color: "gray" }, { text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: `Device uptime \u203a ${format(os.uptime())}\n`, color: 'gray' }, { text: "MiB", color: config.colors.commands.secondary },
{ text: `Bot uptime \u203a ${format(process.uptime())}\n`, color: "gray" }, { text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: `Node version \u203a ${process.version}`, color: 'gray' } ])?.toAnsi(); { text: "MiB", color: config.colors.commands.secondary },
fix = fixansi(message.replace('`', '`\u200b')) { text: "Bot Memory Usage", color: config.colors.commands.primary },
Embed = new EmbedBuilder() { text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
.setColor(`${config.colors.discord.embed}`) { text: "MiB", color: config.colors.commands.secondary },
.setTitle(`${this.name} command`) { text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``) { text: "MiB", color: config.colors.commands.secondary }
bot.discord.message.reply({ embeds: [Embed] }) ]
break })
break;
default: default:
throw new CommandError('Invalid argument'); throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
} }
break;
case "uptimes":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "server":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
} }
break;
case "server":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Hostname", color: config.colors.commands.primary },
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
{ text: "User", color: config.colors.commands.primary },
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
{ text: "Working Directory", color: config.colors.commands.primary },
{ text: `${process.mainModule.path}`, color: config.colors.commands.secondary },
{ text: "Arch", color: config.colors.commands.primary },
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
{ text: "OS", color: config.colors.commands.primary },
{ text: `${os.platform}`, color: config.colors.commands.secondary },
{ text: "OS Version", color: config.colors.commands.primary },
{ text: `${os.version()}`, color: config.colors.commands.secondary },
{ text: "Kernel Version", color: config.colors.commands.primary },
{ text: `${os.release()}`, color: config.colors.commands.secondary },
{ text: "CPU", color: config.colors.commands.primary },
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
{ text: "CPU cores", color: config.colors.commands.primary },
{ text: `${os.cpus().length}`, color: config.colors.integer },
{ text: "Node Version", color: config.colors.commands.primary },
{ text: `${process.version}`, color: config.colors.commands.secondary },
{ text: "NPM Version", color: config.colors.commands.primary },
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
]
})
break;
case "version":
case "ver":
if (botInfo.codename === '') {
component.push({
translate: "%s %s %s-%s-%s%s\n%s - %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.version}`, color: config.colors.integer },
{ text: "#" },
{ text: `${botInfo.build}`, color: config.colors.integer },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
]
})
/*
`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-
${botInfo.version}-#${botInfo.build}-${botInfo.codename}\n11/22/22 -
${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}
*/
} else {
component.push({
translate: "%s %s %s-%s-%s%s-%s\n%s - %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.version}`, color: config.colors.integer },
{ text: "#" },
{ text: `${botInfo.build}`, color: config.colors.integer },
{ text: `${botInfo.codename}` },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
]
})
}
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
bot.tellraw(`@a[name="${source.player.profile.name}"]`, component);
},
} }

View file

@ -94,7 +94,7 @@ module.exports = {
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080)) const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`) .setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`) .setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``) .setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] }) bot.discord.message.reply({ embeds: [Embed] })
} }

View file

@ -67,7 +67,7 @@ module.exports = {
fix = fixansi(ansi.replaceAll('`', '`\u200b')) fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder() Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`) .setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`) .setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``) .setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] }) bot.discord.message.reply({ embeds: [Embed] })
// } catch (e) { // } catch (e) {
@ -87,7 +87,7 @@ module.exports = {
fix = fixansi(ansi.replaceAll('`', '`\u200b')) fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder() Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`) .setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`) .setTitle(`${this.datta.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``) .setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] }) bot.discord.message.reply({ embeds: [Embed] })
// bot.discord.message.reply('e'); // bot.discord.message.reply('e');

View file

@ -1 +1 @@
[] [{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"04928"},{"ignoreCase":false,"regexed":false,"name":"Parker2991"}]

View file

@ -1,11 +1,15 @@
function core (bot, options, config) { function core (bot, options, config) {
let number = 0;
bot.core = { bot.core = {
area: { area: {
start: config.core?.area.start ?? { x: 0, y: 0, z: 0 }, start: config.core?.area.start ?? { x: 0, y: 0, z: 0 },
end: config.core?.area.end ?? { x: 15, y: 0, z: 15 } end: config.core?.area.end ?? { x: 15, y: 0, z: 15 }
}, },
position: null, position: null,
currentBlockRelative: { x: 0, y: 0, z: 0 }, currentBlockRelative: { x: 0, y: 0, z: 0 },
refill () { refill () {
const pos = bot.core.position const pos = bot.core.position
const { start, end } = bot.core.area const { start, end } = bot.core.area
@ -64,22 +68,22 @@ function core (bot, options, config) {
}, },
run (command) { run (command) {
const eee = Math.floor(Math.random() * 10000)
const location = bot.core.currentBlock() const location = bot.core.currentBlock()
if (!location) return if (!location) return
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) { if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
return return
} else { } else {
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 }) bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 });
bot._client.write('query_block_nbt', ({ location: location, transactionId: eee}));
bot.core.incrementCurrentBlock() bot.core.incrementCurrentBlock()
} }
},
} }
}
// if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
if (bot.options.isSavage || bot.options.isCreayun) return if (bot.options.isSavage || bot.options.isCreayun) return
bot.on('move', () => { bot.on('move', () => {
// if (bot.options.isSavage) return
bot.core.move(bot.position) bot.core.move(bot.position)
// setTimeout(() => bot.core.run('say Hello, world!'), 1000)
}) })
} }

View file

@ -101,7 +101,7 @@ function Console (bot, options, config) {
bot.on('actionBar', (message) => { bot.on('actionBar', (message) => {
if (!options.logging) return; if (!options.logging) return;
if (ratelimit > 10) return if (ratelimit > 10) 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()}`);
ratelimit++ ratelimit++
}) })

View file

@ -1,83 +0,0 @@
const fs = require('fs');
const path = require('path');
function filter (bot, options, config, discordClient) {
if (options.isSavage || options.isCreayun) return;
// filter v6 (not to be confused with the bot version)
bot.filter = {
list () {
try {
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
} catch (e) {
console.log(e.stack)
}
},
add (ignoreCase, regexed, player) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
var arrayadd = { ignoreCase: ignoreCase, regexed: regexed, name: player }
data.push(arrayadd);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
this.doAll();
},
remove (index) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data.splice(index, 1);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
clear () {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data = [];
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
},
doAll () {
}
}
bot.on('message', async (data) => {
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
// for (const eachBot of bot.bots) {
let player_completion = (await bot.tab_complete('deop ')).filter(_ => _.tooltip == undefined);
player_completion.forEach(async (player) => {
if (filteredPlayer.ignoreCase) {
} else {
// if (player.match !== eachBot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
if (bot.players.find((players) => players.profile.name === player.match).profile.name === filteredPlayer.name === true) {
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
}
}
})
if (filteredPlayer.ignoreCase) {
} else {
// if (!eachBot.players.find((player) => players.profile.name === filteredPlayer.name)) return
if (bot.players.find((players) => players.profile.name === JSON.parse(filteredPlayer.name)).gamemode !== 2) {
// if (eachBot.players.find((player) => players.profile.name !== filteredPlayer.name)) return
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((player) => player.profile.name === filteredPlayer.name).profile.name}"]`);
}
}
}
// }
})
bot.on('parsed_message', (data) => {
try {
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filteredPlayer.ignoreCase) {
} else {
if (bot?.players?.find((player) => player?.profile?.name === filteredPlayer.name)?.profile?.name === data?.sender?.profile?.name) {
bot.core.run(`essentials:mute ${bot?.players?.find((player) => player?.profile?.name === filteredPlayer.name)?.uuid} 10y`);
}
}
}
} catch (e) {
console.log(e.stack);
}
})
}
module.exports = filter;

5
src/util/proxy/chat.js Normal file
View file

@ -0,0 +1,5 @@
module.exports = (bot, options, config, discordClient, proxyClient) => {
proxyClient.on('packet.player_chat', (packet) => {
proxyClient.emit('playerChat', packet.unsignedChatContent)
})
}