v6.0.0-beta

This commit is contained in:
Parker2991 2024-08-09 22:08:42 -04:00
parent bca181e8ec
commit 0b31c50a29
28 changed files with 261058 additions and 185 deletions

17
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "~/Downloads/vscodium/node"
}
]
}

File diff suppressed because it is too large Load diff

1970
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
"dependencies": {
"cowsay2": "^2.0.4",
"discord.js": "^14.11.0",
"java-parser": "^2.3.2",
"js-yaml": "^4.1.0",
"json-stringify": "^1.0.0",
"json5": "^2.2.3",
@ -11,6 +12,7 @@
"minecraft-data": "^3.36.1",
"minecraft-protocol": "^1.47.0",
"mojangson": "^2.0.4",
"node-gyp": "^10.2.0",
"prismarine-auth": "^2.2.0",
"prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.7.0",

17
prototyping-crap/e.js Normal file
View file

@ -0,0 +1,17 @@
const https = require('node:https');
https.get('https://encrypted.google.com/', (res) => {
console.log('statusCode:', res.statusCode);
// console.log('headers:', res.headers);
console.log((res.complete))
let data;
res.on('data', (d) => {
process.stdout.write(d);
// if (data === undefined) data = chunk;
// else data += chunk;
// console.log(data);
});
}).on('error', (e) => {
console.error(e);
});

5
src/TO-DO.txt Normal file
View file

@ -0,0 +1,5 @@
1. add discord hashes back to the bot (v6.0.0-beta)
2. add a reset interval to cloops (v6.0.0-beta)
3. finish useChat (v6.0.1)
4. finish isSavage (v6.0.2)
5. start working on isCreayun (v6.0.7) fuck you creayun

View file

@ -12,7 +12,7 @@ function createBot(options = {}) {
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
};
bot.options = options
const ChatMessage = require('prismarine-chat')(bot.options.version);
// Create our client object, put it on the bot, and register some events
bot.on('init_client', client => {
client.on('packet', (data, meta) => {
@ -33,7 +33,8 @@ function createBot(options = {}) {
client.on('error', error => {
// bot.emit('error', error)
console.log(error.toString())
// console.log(error.toString())
bot.console.logs(ChatMessage.fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + error.toString())
bot?.discord?.channel?.send(error.toString())
})
@ -43,10 +44,11 @@ function createBot(options = {}) {
client.on('kick_disconnect', (data) => {
bot.emit("kick_disconnect", data.reason)
bot.console.logs(ChatMessage.fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + data.toString())
})
process.on("uncaughtException", (e) => {
console?.warn(e.stack)
// console?.warn(e.stack)
});
})

View file

@ -222,7 +222,7 @@ const bots = [
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ["["],
},
{
/* {
name: [
{ text: "Blurry", color: "dark_purple", bold: false },
{ text: "Bot", color: "red" },
@ -231,7 +231,7 @@ const bots = [
authors: ["SirLennox"],
foundation: "Java/custom",
prefixes: [","],
},
},*/
{
name: [{ text: "SnifferBot", color: "gold", bold: false }],
exclaimer: "sniff sniff FNFBoyfriendBot simp",

View file

@ -1,3 +1,5 @@
const { EmbedBuilder } = require('discord.js');
const CommandError = require('../util/command_error');
module.exports = {
name: 'cloop',
trustLevel: 1,
@ -72,12 +74,82 @@ module.exports = {
})
component.push('\n')
component.push(listComponent)
if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ]
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
break
default:
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
break
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed;
switch (args[0]) {
case "add":
const interval = parseInt(args[1])
const command = args.slice(2).join(' ')
bot.cloop.add(command, interval)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break;
case "remove":
var index = (args[1])
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
bot.cloop.remove(index)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`removed cloop ${index}`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'clear':
bot.cloop.clear()
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`cleared cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
with: [
`id ${i}`,
cloop.command,
cloop.interval
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ]
})
component.push('\n')
component.push(listComponent)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
bot?.discord?.message?.reply({ embeds: [Embed] })
break
}
}
}

View file

@ -28,6 +28,9 @@ module.exports = {
eachBot.console.consoleServer = server;
}
break
case "validate":
bot.chat.message(`${config.prefixes[0]}${args.slice(1).shift()} ${bot.validation.owner} ${args.slice(2).join(' ')}`)
break
}
}
}

View file

@ -1,17 +0,0 @@
module.exports = {
name: 'coresettings',
trustLevel: 0,
aliases: [
],
description: 'Make me say something',
usages: [
"<message>"
],
execute (context) {
const bot = context.bot
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
}
}

View file

@ -1,5 +1,7 @@
const cowsay = require('cowsay2');
const cows = require('cowsay2/cows')
const cows = require('cowsay2/cows');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
module.exports = {
name: 'cowsay',
trustLevel: 0,
@ -34,5 +36,43 @@ module.exports = {
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed
if (args[0] === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
}
])
}
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else if (cows[args[0]]) {
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else {
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] });
}
}
}

View file

@ -12,7 +12,6 @@ module.exports = {
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
if (message.startsWith('/')) {
bot.chat.command(message.substring(1))
return

View file

@ -34,7 +34,7 @@ module.exports = {
const source = context.source;
switch (args[0]) {
case 'version':
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-v6.0.0-beta-700-§bSk§4y §bRedux\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-v6.0.0-beta-#800-§#fe019aGraffiti §7Groovin\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
break // &9 &3 &1
case 'config':
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [

39
src/commands/ipinfo.js Normal file
View file

@ -0,0 +1,39 @@
const { request } = require('undici');
const util = require('util');
module.exports = {
name: 'ipinfo',
trustLevel: 0,
aliases: [
],
description: 'Make me say something',
usages: [
"<message>"
],
async execute (context) {
const bot = context.bot;
const args = context.arguments;
try {
const url = await request(`https://get.geojs.io/v1/ip/geo/${args}.json`)
const outputJson = await url.body.json();
console.log(outputJson)
// bot.tellraw("@a", util.inspect(outputJson));
bot.tellraw("@a", [
{ text: `Ip \u203a `, color: "gray" },
{ text: `${outputJson.ip}\n`, color: "gold" },
{ text: `Country \u203a ${outputJson.country}\n`, color: "gray" },
{ text: `Region \u203a ${outputJson.region}\n`, color: "gray" },
{ text: `City \u203a ${outputJson.city}\n`, color: "gray" },
{ text: `Timezone \u203a ${outputJson.timezone}\n`, color: "gray" },
{ text: `Organization \u203a ${outputJson.organization_name}\n`, color: "gray" },
{ text: 'I dont leak cords dont worry :3' }
])
} catch (e) {
bot.tellraw("@a", { text: e.toString(), color: 'dark_red' })
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
}
}

View file

@ -1,4 +1,5 @@
const CommandError = require('../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'kick',
trustLevel: 1,
@ -19,5 +20,15 @@ module.exports = {
bot.core.run(`minecraft:tellraw ${args.slice(2).join(' ')} ${JSON.stringify(bot.exploits.invalidString)}`)
break
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
switch (args[0]) {
case "invalidstring":
bot.core.run(`minecraft:tellraw ${args.slice(1).join(' ')} ${JSON.stringify(bot.exploits.invalidString)}`)
break
}
}
}

View file

@ -9,8 +9,18 @@ module.exports = {
""
],
async execute (context) {
const bot = context.bot
const bot = context.bot;
// ik theres a better way to do but shut the fuck up about it
await bot.chat.message("killing process");
await process.exit(69420) // sure why the hell not
await bot.console.info("killing process");
await bot.discord.channel?.send("killing process");
await process.exit(69420); // sure why the hell not
},
async discordExecute (context) {
const bot = context.bot;
await bot.chat.message("killing process");
await bot.console.info("killing process");
await bot.discord.channel?.send("killing process");
await process.exit(69420);
}
}

View file

@ -16,10 +16,11 @@ module.exports = {
//throw new CommandError('ohio')
const component = {
translate: '[%s] %s \u203a %s',
color: "dark_gray",
with: [
bot.options.serverName,
{ text: bot.options.serverName, color: "gray" },
source.player.displayName ?? source.player.profile.name,
args.join(' ')
{ text: args.join(' '), color: "gray" },
]
}
// bot.bots.filter((eachBot) => { if (eachBot.options.useChat) eachBot.chat.message('sussy');

24
src/commands/reload.js Normal file
View file

@ -0,0 +1,24 @@
module.exports = {
name: 'reload',
trustLevel: 0,
aliases: [
],
description: 'reloads commands',
usages: [
""
],
execute (context) {
const bot = context.bot
bot.tellraw("@a", "Reloading Commands,..........")
for (const eachBot of bot.bots) {
eachBot.commandManager.reload();
}
},
discordExecute (context) {
const bot = context.bot;
bot.discord.message.reply("Reloading Commands,.........");
for (const eachBot of bot.bots) {
eachBot.commandManager.reload();
}
}
}

View file

@ -3,7 +3,7 @@ const CommandError = require('../util/command_error')
module.exports = {
name: 'tpr',
description:['teleport to a random place'],
trustLevel: 0,
trustLevel: 1,
aliases:['rtp', 'teleportrandom', 'randomteleport'],
usage:[""],
async execute (context) {

View file

@ -6,7 +6,7 @@ module.exports = {
trustLevel: 2,
aliases: [
],
description: 'run commands unisolated',
description: 'run code unisolated',
usages: [
"<code>",
],

View file

@ -7,11 +7,10 @@ module.exports = {
aliases:['urbandictionary'],
trustLevel: 0,
usage:[
"all <definition>",
"single <definition>",
"<definition>",
],
usages: [
"<definition",
"<definition>",
],
async execute (context) {
const source = context.source
@ -42,20 +41,20 @@ module.exports = {
action:"show_text",
value: [
{
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}`,
color: 'dark_blue'
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'dark_blue',
color: 'gray',
},
{
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'dark_blue'
color: 'gray'
},
{
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'dark_blue'
color: 'gray'
},
{
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,

49
src/commands/website.js Normal file
View file

@ -0,0 +1,49 @@
const http = require('http');
const https = require('https');
const util = require('util');
module.exports = {
name: 'website',
trustLevel: 0,
aliases: [
],
description: 'look up website data',
usages: [
"<url>"
],
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.join(' ').toLowerCase().startsWith("http://")) {
http.get(args.join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
try {
bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
} catch (e) {
bot.tellraw("@a", e.toString());
}
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
} else if (args.join(' ').toLowerCase().startsWith('https://')) {
https.get(args.join(' '), (res) => {
console.log('statusCode:', res.statusCode);
console.log('headers:', res.headers);
res.on('data', (d) => {
bot.tellraw("@a", { text: util.inspect(d), color: "dark_green", })
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
}
}

View file

@ -1,21 +1,12 @@
const readline = require('readline');
function boot (bot, options, discordClient, config) {
bot.on("packet.login", (data) => {
if (new Date().getDay() === 5) {
bot.chat.message('Gettin\' freaky on a friday night!');
} else {
bot.chat.message('&9FNF&3Boyfriend&1Bot &fcreated by &4Parker&02991');
}
}) // &9 &3 &1
}
module.exports = boot;
/*
const readline = require('readline');
readline.emitKeypressEvents(process.stdin);
process.stdin.on('keypress', (str, key) => {
// console.log(str)
// console.log(key)
if (key && key.ctrl && key.name === 'c') {
console.log('mrrow >:3');
process.exit(69420);
}
})
*/

View file

@ -3,7 +3,8 @@ const KaboomChatParser = require('../util/ChatParsers/Kaboom');
const ChipmunkModChatParser = require('../util/ChatParsers/ChipmunkMod');
const CreayunChatParser = require('../util/ChatParsers/Creayun');
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
const VanillaChatParser = require("../util/ChatParsers/VanillaChat")
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
const nbt = require('prismarine-nbt');
function tryParse (json) {
try {
return JSON.parse(json)
@ -25,7 +26,7 @@ function chat (bot, options, config) {
bot.on('packet.profileless_chat', packet => {
const message = tryParse(packet.message)
const sender = tryParse(packet.name)
// bot.tellraw("@a", `Packet type ${packet.type}`)
bot.emit('profileless_chat', {
message,
type: packet.type,
@ -38,12 +39,13 @@ function chat (bot, options, config) {
if (packet.type === 3) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.outgoing","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
if (packet.type === 4) bot.emit('message', message);
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
})
bot.on('packet.player_chat', (packet, data) => {
const unsigned = tryParse(packet.unsignedChatContent)
// const unsigned = JSON.parse(loadPrismarineChat.processNbtMessage(nbt.comp(nbt.string(packet.unsignedChatContent))))
// const unsigned = loadPrismarineChat.processNbtMessage(tryParse(packet.unsignedChatContent))
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({ translate: "chat.type.announcement", with: [`${bot.players.find(player => player.uuid === packet.senderUuid).profile.name}`, `${packet.plainMessage}`]})?.toMotd())
if (packet.type !== 5) bot.emit("message", unsigned)

View file

@ -129,7 +129,9 @@ function command_manager (bot, options, config, discordClient) {
command.aliases.map((a) => (this.commands[a] = command));
}
},
unregister (command) {
this.commands = {}
},
getCommand (name) {
return this.commands[name]
},
@ -169,5 +171,23 @@ function command_manager (bot, options, config, discordClient) {
}
})
})
bot.commandManager.reload = function () {
commandlist = [];
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
try {
delete require.cache[require.resolve(path.join(__dirname, "../commands", filename))]
const command = require(path.join(__dirname, "../commands", filename));
// bot.commandManager.unregister(command);
// this.commands = {};
bot.commandManager.register(command);
bot.commandManager.commandlist.pop(command);
// bot.commandManager.register(command);
bot.commandManager.commandlist.push(command)
} catch (error) {
bot.console.error(["Failed to load File ", filename, ":", error.stack])
bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" })
}
}
}
}
module.exports = command_manager;

View file

@ -38,7 +38,7 @@ function CommandConsole (bot, options, config) {
bot.console.source.sendFeedback = message => {
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
if (!options.logging) return
bot.console.info(ansi);
bot.console.logs(ChatMessage.fromNotch('§8[§6Command§8]')?.toAnsi() + ansi);
}
bot.console.error = function (message) {
console.log(ChatMessage.fromNotch(`§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() + message)

31
src/sus.js Normal file
View file

@ -0,0 +1,31 @@
module.exports = {
name: 'sus',
trustLevel: 0,
aliases: [
"say",
"botsay",
],
description: 'Make me say something',
usages: [
"<message>"
],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
if (message.startsWith('/')) {
bot.chat.command(message.substring(1))
return
}
bot.chat.message(message)
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (args.join(' ').startsWith('/')) {
bot.chat.command(args.join(' ').substring(1))
return
}
bot.chat.message(args.join(' '))
}
}