FNFBoyfriendBot v5.0.7a gaaaaaaaaaaaaay seeeeeeeeeeeeex aplsdfj;laksdfjladsjf;k;asdfkl;dsaf

This commit is contained in:
Parker2991 2024-03-29 16:05:43 -04:00
commit 2e753c583b
132 changed files with 15506 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
src/node_modules
src/config.js
src/.env
amog

0
README.md Normal file
View file

0
random-bullshit/amogus Normal file
View file

16
random-bullshit/amogus.js Normal file
View file

@ -0,0 +1,16 @@
module.exports = {
name: 'sus',
description:['make me say something in chat'],
aliases:['chatsay'],
trustLevel: 0,
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
if (message.startsWith('/')) {
bot.command(message.substring(1))
return
}
bot.chat(message)
}
}

View file

@ -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) })
}//
}

View file

@ -0,0 +1,33 @@
const convert = require('color-convert')
function inject (bot) {
bot.bruhifyTextTellraw = ''
let startHue = 0
const timer = setInterval(() => {
if (bot.bruhifyTextTellraw === '') return
let hue = startHue
const displayName = bot.bruhifyTextTellraw
const increment = (360 / Math.max(displayName.length, 20))
const component = []
for (const character of displayName) {
const color = convert.hsv.hex(hue, 100, 100)
component.push({
text: character,
color: `#${color}`,
})
// hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
hue = (hue + increment) % 360
}
bot.core.run(`tellraw @a ${JSON.stringify(component)}`) // instead of doing just "tellraw" do "minecraft:tellraw"
startHue = (startHue + increment) % 360
}, 50)
bot.on('end', () => {
clearInterval(timer)
})
}
module.exports = inject

View file

@ -0,0 +1,33 @@
const convert = require('color-convert')
function inject (bot) {
bot.bruhifyTextTitle = ''
let startHue = 0
const timer = setInterval(() => {
if (bot.bruhifyTextTitle === '') return
let hue = startHue
const displayName = bot.bruhifyTextTitle
const increment = (360 / Math.max(displayName.length, 20))
const component = []
for (const character of displayName) {
const color = convert.hsv.hex(hue, 100, 100)
component.push({
text: character,
color: `#${color}`,
})
// hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
hue = (hue + increment) % 360
}
bot.core.run(`title @a title ${JSON.stringify(component)}`) // instead of doing just "tellraw" do "minecraft:tellraw"
startHue = (startHue + increment) % 360
}, 100)
bot.on('end', () => {
clearInterval(timer)
})
}
module.exports = inject

View file

@ -0,0 +1,74 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'calculator',
description:['calculate maths'],
trustLevel: 0,
aliases:['calc'],
execute (context) {
const bot = context.bot
const args = context.arguments
const cmd = {//test.js
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'blue', text: 'Calculator Cmd'},
]
}
const operation = args[0]
const operator1 = parseFloat(args[1])
const operator2 = parseFloat(args[2])
//
switch (operation) {
case 'add':
context.source.sendFeedback({
translate: '[%s] %s is %s',
with: [
{color: 'blue', text:'Calculator Cmd'},
`${operator1} + ${operator2}`,
operator1 + operator2
]
});
break
case 'subtract':
context.source.sendFeedback({
translate: `[%s] %s is %s`,
with: [
{ color: 'blue', text: 'Calculator Cmd'},
`${operator1} - ${operator2}`,
operator1 - operator2
]
});
break
case 'multiply':
context.source.sendFeedback({
translate: '[%s] %s is %s',
with: [
{ color: 'blue', text: 'Calculator Cmd'},
`${operator1} x ${operator2}`,
operator1 * operator2
]
});
break
case 'divide':
context.source.sendFeedback({
translate: '[%s] %s is %s',
with: [
{ color: 'blue', text: 'Calculator Cmd'},
`${operator1} / ${operator2}`,
operator1 / operator2
]
});
break
default:
context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red' }])
}
}
}

View file

View file

@ -0,0 +1,65 @@
const { VM } = require('vm2')
const util = require('util')
const { stylize } = require('../util/eval_colors')
const options = {
timeout: 1000
}
let vm = new VM(options)
module.exports = {
name: 'evaljsvm2',
trustLevel: 1,
description:['old evaljs code'],
aliases:['evaljsold', 'evalvm2', 'evalold'],
execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
const ChatMessage = require('prismarine-chat')(bot.options.version)
const cmd = {
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'dark_green', text: 'EvalJS Cmd'},
]
}
// throw new CommandError('temp disabled')
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[1]) {
case 'run':
try {
const output = vm.run(args.slice(2).join(' '))
if (!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: util.inspect(output, { stylize }) }]).toMotd().replaceAll('§', '&'))
}else
source.sendFeedback([cmd, { text: util.inspect(output, { stylize }) }])
} catch (e) {
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: e.toString(), color: 'black' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: e.toString(), color: 'black' }])
}
}
break
case 'reset':
vm = new VM(options)
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Successfully reset the eval context', color: 'green' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }])
}
break
default:
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Invalid option!', color: 'dark_red' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }])
}
}
}
}

View file

@ -0,0 +1,62 @@
const nbs = require('./nbs-file.js')
const instrumentNames = [
'harp',
'bass',
'basedrum',
'snare',
'hat',
'guitar',
'flute',
'bell',
'chime',
'xylophone',
'iron_xylophone',
'cow_bell',
'didgeridoo',
'bit',
'banjo',
'pling'
]
function convertNBS (buf) {
const parsed = nbs.parse(buf)
const song = {
name: parsed.songName,
notes: [],
loop: false,
loopPosition: 0,
length: 0
}
if (parsed.loop > 0) {
song.loop = true
song.loopPosition = parsed.loopStartTick
}
for (const note of parsed.nbsNotes) {
let instrument = note.instrument
if (note.instrument < instrumentNames.length) {
instrument = instrumentNames[note.instrument]
} else continue
if (note.key < 33 || note.key > 55) continue
const layerVolume = 100
// will add layer volume later
const time = tickToMs(note.tick, parsed.tempo)
song.length = Math.max(song.length, time)
song.notes.push({
instrument,
pitch: note.key - 33,
volume: note.velocity * layerVolume / 10000,
time
})
}
return song
}
function tickToMs (tick = 1, tempo) {
return Math.floor(1000 * tick * 100 / tempo)
}
module.exports = convertNBS

42
random-bullshit/time.js Normal file
View file

@ -0,0 +1,42 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'time',
description:['check the time'],
aliases:['clock', 'timezone'],
trustLevel: 0,
async execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
const moment = require('moment-timezone')
const source = context.source
const args = context.arguments
const timezone = args.join(' ')
if (!bot.options.Core.enabled) {
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
if (!moment.tz.names().map((zone) => zone.toLowerCase()).includes(timezone.toLowerCase()) && !bot.options.Core.enabled) {
bot.chat('Invalid timezone')
}else{
throw new CommandError('Invalid timezone')
}
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: momented, color: 'green' }]
if (!bot.options.Core.enabled) {
bot.chat(`The current time and date for the timezone &b${timezone}`)
await sleep(1000)
bot.chat(`is:`)
await sleep(1000)
bot.chat(`&a${momented}`)
}else{
source.sendFeedback(component)
}
}
}
}

View file

@ -0,0 +1,90 @@
function selfcaretoggle (bot, options, context) {
bot.visibility = {
on () {
enabled = true
bot.options.selfcare.vanished = true
},
off () {
enabled = false
bot.options.selfcare.vanished = false
bot.command('v off')
}
},
bot.unmuted = {
on () {
enabled = true
bot.options.selfcare.unmuted = true
bot.core.run(`mute ${bot.uuid}`)
},
off () {
enabled = false
bot.options.selfcare.unmuted = false
}
},
bot.tptoggle = {
on () {
bot.options.selfcare.tptoggle = false
bot.command('tptoggle on')
},
off () {
bot.options.selfcare.tptoggle = true
bot.command('tptoggle off')
}
},
bot.god = {
on () {
bot.options.selfcare.god = true
},
off () {
bot.options.selfcare.god = false
bot.command('god off')
}
},
bot.prefix = {
on () {
bot.options.selfcare.prefix = true
},
off () {
bot.options.selfcare.prefix = false
}
},
bot.Username = {
on () {
bot.options.selfcare.username = true
},
off () {
bot.options.selfcare.username = false
}
},
bot.skin = {
on () {
bot.options.selfcare.skin = true
},
off () {
bot.options.selfcare.skin = false
}
},
bot.cspy = {
on () {
bot.options.selfcare.cspy = true
},
off () {
bot.options.selfcare.cspy = false
}
},
bot.nickname = {
on () {
bot.options.selfcare.nickname = true
},
off () {
bot.options.selfcare.nickname = false
}
}
}
module.exports = selfcaretoggle

47
random-bullshit/vm.js Normal file
View file

@ -0,0 +1,47 @@
const mc = require('minecraft-protocol')
const crypto = require('crypto')
const colorConvert = require('color-convert')
const CommandError = require('../CommandModules/command_error')
const uuid = require('uuid-by-string')
const moment = require('moment-timezone')
const cowsay = require('cowsay2')
const cows = require('cowsay2/cows')
const ivm = require('isolated-vm')
const randomstring = require('randomstring')
const mineflayer = require('mineflayer')
const Vec3 = require('vec3')
function inject (bot) {
const chatMessage = require('prismarine-chat')
const mcData = require('minecraft-data')(bot.version)
bot.vmOptions = {
timeout: 2000,
sandbox: {
run (cmd) {
bot.core.run(cmd)
},
mc,
mineflayer,
CommandError,
chat: bot.chat,
moment,
randomstring,
uuid,
chatMessage,
crypto,
colorConvert,
bruhifyText (message) {
if (
typeof message !== 'string'
) throw new SyntaxError('message must be a string')
bot.bruhifyText = message.substring(0, 1000)
},
cowsay,
cows,
mcData,
Vec3
}
}
bot.vm = new ivm.Isolate({ memoryLimit: 50 })
};
//let isolate = new ivm.Isolate({ memoryLimit: 50 })
module.exports = inject

View file

@ -0,0 +1,17 @@
// TODO: Improve how messages are stringified
const ChatMessage = require('prismarine-chat')('1.20.2')
const stringify = message => new ChatMessage(message).toString()
class CommandError extends Error {
constructor (message, filename, lineError) {
super(stringify(message), filename, lineError)
this.name = 'CommandError'
this._message = message
}
get message () {
return stringify(this._message)
}
}
module.exports = CommandError

View file

@ -0,0 +1,26 @@
class CommandSource {
constructor (player, sources, hash, owner, discordMessageEvent = null, consoleOnly, name, profile, bot, prefix = "~") {
this.player = player//kaboom on crack!
// idk fr // mabe
// /shrug
//am i good to restart it?
this.sources = sources
this.profile = bot
this.hash = hash
this.owner = owner
this.consoleOnly = consoleOnly
this.discordMessageEvent = discordMessageEvent
this.prefix = prefix
}
sendFeedback () {}
sendError (message) {
this.sendFeedback([{ text: '', color: 'red' }, message], false)
}
}
module.exports = CommandSource

0
src/README.md Normal file
View file

110
src/bot.js Normal file
View file

@ -0,0 +1,110 @@
const mc = require("minecraft-protocol");
const { EventEmitter } = require("node:events");
const fs = require("fs");
const path = require("path");
const util = require("node:util");
require("events").EventEmitter.defaultMaxListeners = Infinity;
const ChatMessage = require('prismarine-chat')('1.20.2')
function createBot(options = {}) {
const bot = new EventEmitter();
// const rs = require("randomstring");
// Set some default values in options
bot.options = {
host: options.host ??= "localhost",
username: options.username ??= "FNFBoyfriendBot",
hideErrors: options.hideErrors ??= false, // HACK: Hide errors by default as a lazy fix to console being spammed with the console
version: options.version ??= '1.20.2',
}
bot.options = options;
// Create our client object, put it on the bot, and register some events
bot.on("init_client", (client) => {
client.on("packet", (data, meta) => {
bot.emit("packet", data, meta);
try{
bot.emit('packet.' + meta.name, data)
} catch(e) {
if(e.toString() === 'RangeError: Invalid string length'){
bot._client.end()
}else{
console.log(e)
}
}
});
const timer = setInterval(() => {
if(!bot.options.endcredits){
return
}else{
bot.chat(`Join the FNFBoyfriendBot discord ${bot.options.discord.invite}`)
}
}, 280000)
client.on("login", async function (data) {
bot.uuid = client.uuid;
bot.username = client.username;
bot.port = bot.options.port;
bot.version = bot.options.version;
var day = new Date().getDay()
if(day === 5){
bot.chat('Getting freaky on a Friday Night!')
}else{
const buildstring = process.env["buildstring"]
bot.chat(ChatMessage.fromNotch(JSON.stringify(process.env['buildstring'])).toMotd().replaceAll('§', '&'))
}
timer
})
client.on("end", (reason) => {
bot.emit("end", reason);
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
bot.cloop.clear()
bot.memusage.off()
bot.tps.off()
clearInterval(timer)
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
});
client.on("disconnect", (reason) => {
bot.emit("disconnect", reason);
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
});
client.on("kick_disconnect", (reason) => {
bot.emit("kick_disconnect", reason);
bot.console.warn(`Disconnected: ${JSON.stringify(reason)}`);
//console.log(reason)
bot?.discord?.channel?.send('``Disconnected:' + JSON.stringify(reason) + '``' )
});
client.on("keep_alive", ({ keepAliveId }) => {
bot.emit("keep_alive", { keepAliveId });
});
client.on("error", (error) => {
bot?.discord?.channel?.send('``' + error.toString() + '``' )
bot.emit("error", error)
})
});
const client = options.client ?? mc.createClient(options);
bot._client = client;
bot.emit("init_client", client);
bot.bots = options.bots ?? [bot];
return bot;
}
module.exports = createBot;

34
src/chat/chatTypeEmote.js Normal file
View file

@ -0,0 +1,34 @@
function chatTypeEmote (message, data, context) {
try{
if (message === null || typeof message !== 'object') return
if (message.with?.length < 2 || (message.translate !== 'chat.type.emote' && message.translate !== '%s %s')) return
const senderComponent = message.with[0]
// wtf spam again - console.log(senderComponent)//wtf...
//console.log(senderComponent)
const contents = message.with[1]
// spam lol - console.log(contents)
//console.log(contents)
let sender
const hoverEvent = senderComponent.hoverEvent
if (hoverEvent?.action === 'show_entity') {
const id = hoverEvent.contents.id
//
sender = data.players.find(player => player.uuid === id)
} else {
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
sender = data.players.find(player => player.profile.name) //=== stringusername)
}
if (!sender) return undefined
return { sender, contents, type: 'minecraft:chat', senderComponent }
}catch(e){
console.log(e.stack)
}
}
module.exports = chatTypeEmote

34
src/chat/chatTypeText.js Normal file
View file

@ -0,0 +1,34 @@
function chatTypeText (message, data, context) {
try {
if (message === null || typeof message !== 'object') return
if (message.with?.length < 2 || (message.translate !== 'chat.type.text' && message.translate !== '%s %s')) return
const senderComponent = message.with[0]
// wtf spam again - console.log(senderComponent)//wtf...
//console.log(senderComponent)
const contents = message.with[1]
// spam lol - console.log(contents)
//console.log(contents)
let sender
const hoverEvent = senderComponent.hoverEvent
if (hoverEvent?.action === 'show_entity') {
const id = hoverEvent.contents.id
//
sender = data.players.find(player => player.uuid === id)
} else {
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
sender = data.players.find(player => player.profile.name) //=== stringusername)
}
if (!sender) return undefined
return { sender, contents, type: 'minecraft:chat', senderComponent }
}catch(e){
console.log(e.stack)
}
}
module.exports = chatTypeText

35
src/chat/chipmunkmod.js Normal file
View file

@ -0,0 +1,35 @@
function chipmunkmod (message, data, context, bot) {
try{
if (message === null || typeof message !== 'object') return
if (message.with?.length < 3 || (message.translate !== '[%s] %s %s' && message.translate !== '%s %s %s')) return
const senderComponent = message.with[1]
// wtf spam again -
//console.log(senderComponent)//wtf...
const contents = message.with[2]
// spam lol - console.log(contents)
let sender
const hoverEvent = senderComponent.hoverEvent
//console.log(JSON.stringify(hoverEvent))
if (hoverEvent?.action === 'show_entity') {
const id = hoverEvent.contents.id
//
sender = data.players.find(player => player.uuid === id)
} else {
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
sender = data.players.find(player => player.profile.name) //=== stringusername)
}
if (!sender) return null
return { sender, contents, type: 'minecraft:chat', senderComponent }
}catch(e){
console.error(e)
}
}
module.exports = chipmunkmod

View file

@ -0,0 +1,27 @@
function chipmunkmodBlackilyKat (message, data) {
if (message === null || typeof message !== 'object') return
if (message.with?.length < 4 || (message.translate !== '[%s%s] %s %s', message.color !== '#55FFFF' && message.translate !== '%s%s %s %s', message.color !== '#55FFFF')) return
const senderComponent = message.with[1]
const contents = message.with[3]
let sender
const hoverEvent = senderComponent.hoverEvent
if (hoverEvent?.action === 'show_entity') {
const id = hoverEvent.contents.id
//
sender = data.players.find(player => player.uuid === id)
} else {
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
sender = data.players.find(player => player.profile.name) //=== stringusername)
}
if (!sender) return undefined
return { sender, contents, type: 'minecraft:chat', senderComponent }
}
module.exports = chipmunkmodBlackilyKat

33
src/chat/creayun.js Normal file
View file

@ -0,0 +1,33 @@
function creayun (messageobj, data) { // this function is not getting called
const ChatMessage = require('prismarine-chat')('1.20.1')
const stringify = message => new ChatMessage(message).toString()
const message = stringify(messageobj);
var pattern = /^(.*?) (\S*?) » (.*?)$/;
// var pattern = /^(.*?) (\S*?) \u203a (.*?)$/;
//console.log('[debug] parsing a message');
const match = message.match(pattern);
if(pattern.test(message)) {
// console.log('[debug]', match);
return { sender: match[2], contents: match[3], type: 'minecraft:chat'}; //
} else {
//console.log('[debug] pattern does not match');
}//i just realized that the bot uses tellraw
//ima try to fix that
}//it picks players up as undefined in creayun
//and i tried using the kaboom chat parser but edited and that didnt work
// [] username »
module.exports = creayun//:troll:
// •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
// function(function(function(function(function(function(function(function(function(function(function(function(function(function(function(function)))))))))))))))
// i guess so because it connects you
// i think?
//🐔💨💩😎🐒🥶😁😂⏰❌🐒🛏
//very real
// theres so much things that get logged :sob:
//gotta love when it refuses to connect
// someones trying to be fake me in kaboom
//the bot is being waaay to sus
// i will crash him when i get on // sus // very
//k
// getting the fake parker out of kaboom
// pcrashed

42
src/chat/kaboom.js Normal file
View file

@ -0,0 +1,42 @@
const util = require('util')
function kaboom (message, data) {
if (message === null || typeof message !== 'object') return
if (message.text !== '' || !Array.isArray(message.extra) || message.extra.length < 3) return
const children = message.extra
const prefix = children[0]
let displayName = data.senderName ?? { text: '' }
let contents = { text: '' }
if (isSeparatorAt(children, 1)) { // Missing/blank display name
if (children.length > 3) contents = children[3]
} else if (isSeparatorAt(children, 2)) {
displayName = children[1]
if (children.length > 4) contents = children[4]
} else {
return undefined
}
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
let sender
if (data.uuid) {
sender = data.players.find(player => player.uuid === data.senderUuid)
} else {
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
}
if (!sender) return undefined
return { sender, contents, type: 'minecraft:chat', displayName }
}
function isSeparatorAt (children, start) {
return (children[start]?.text === ':' || children[start]?.text === '\xa7f:') && children[start + 1]?.text === ' '
}
module.exports = kaboom

310
src/commands/bots.js Normal file
View file

@ -0,0 +1,310 @@
// TODO: Maybe add more authors
const bots = [
{
name: { text: "HBot", color: "aqua", bold: false },
authors: ["hhhzzzsss"],
exclaimer: "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO",
foundation: "java/mcprotocollib",
prefixes: ["#"],
},
{
name: { text: "64Bot", color: "gold", bold: false },
authors: ["64Will64"],
exclaimer: "NINTENDO 64?!?!??!?! 69Bot when??????",
foundation: "NodeJS/Mineflayer",
prefixes: ["w="],
},
{
name: { text: "Nebulabot", color: "dark_purple", bold: false },
authors: ["IuCC"],
exclaimer: "the void",
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: ["["],
},
{
name: [
{ text: "Prism", color: "#00FF9C", bold: true },
{ text: "Bot", color: "white",bold:true },
],
authors: ["IuCC"],
exclaimer: "prismarine :3",
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: ["["],
},
{
name: { text: "SharpBot", color: "aqua", bold: false },
authors: ["64Will64"],
exclaimer:
"sharp as in the tv? idfk im out of jokes also the first c# bot on the list??",
foundation: "C#/MineSharp",
prefixes: ["s="],
},
{
name: { text: "MoonBot", color: "red", bold: false },
authors: ["64Will64"],
exclaimer: "stop mooning/mooing me ",
foundation: "NodeJS/Mineflayer",
prefixes: ["m="],
},
{
name: { text: "TableBot", color: "yellow", bold: false },
authors: ["12alex12"],
exclaimer: "TABLE CLOTH BOT?!?! ",
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: ["t!"],
},
{
name: [
{ text: "Evil", color: "dark_red", bold: false },
{ text: "Bot", color: "dark_purple" },
],
authors: ["FusseligerDev"],
exclaimer: "",
foundation: "Java/Custom",
prefixes: ["!"],
},
{
name: { text: "SBot Java", color: "white", bold: false }, // TODO: Gradient
authors: ["evkc"],
foundation: "Java/MCProtocolLib",
prefixes: [":"],
},
{
name: { text: "SBot Rust", color: "white", bold: false }, // TODO: Gradient
authors: ["evkc"],
foundation: "Rust",
prefixes: ["re:"],
},
{
name: { text: "Z-Boy-Bot", color: "dark_purple", bold: false }, // TODO: Gradient
exclaimer: "Most likely skidded along with kbot that the dev used",
authors: ["Romnci"],
foundation: "NodeJS/mineflayer or Java/mcprotocollib idfk",
prefixes: ["Z]"],
},
{
name: { text: "ABot", color: "gold", bold: true }, // TODO: Gradient
exclaimer: "not used anymore (replaced by V2)",
authors: [{ text: "_yfd", color: "light_purple" }],
foundation: "NodeJS/Node-Minecraft-Protocol",
prefixes: ["<"],
},
{
name: { text: "ABot-V2", color: "gold", bold: true }, // TODO: Gradient
exclaimer: "",
authors: [{ text: "_yfd", color: "light_purple" }],
foundation: "NodeJS/Node-Minecraft-Protocol",
prefixes: ["<"],
},
{
name: { text: "FardBot", color: "light_purple", bold: false },
authors: ["_yfd"],
exclaimer: "bot is dead lol",
foundation: "NodeJS/Mineflayer",
prefixes: ["<"],
},
{
name: { text: "ChipmunkBot Java", color: "green", bold: false },
authors: ["_ChipMC_"],
exclaimer:
"chips? also shoutout to chip and chayapak for helping in the rewrite",
foundation: "Java/MCProtocolLib",
prefixes: ["'", "/'"],
},
{
name: { text: "ChipmunkBot NodeJS", color: "green", bold: false },
authors: ["_ChipMC_"],
foundation: "NodeJS/Node-Minecraft-Protocol",
},
{
name: { text: "TestBot", color: "aqua", bold: false },
authors: ["Blackilykat"],
foundation: "Java/MCProtocolLib",
prefixes: ["-"],
},
{
name: { text: "UBot", color: "grey", bold: false },
authors: ["HexWoman"],
exclaimer: "UwU OwO",
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ['"'],
},
{
name: { text: "ChomeNS Bot Java", color: "yellow", bold: false },
authors: ["chayapak"],
exclaimer: "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak",
foundation: "Java/MCProtocolLib",
prefixes: ["*", "cbot ", "/cbot "],
},
{
name: { text: "ChomeNS Bot NodeJS", color: "yellow", bold: false },
authors: ["chayapak"],
foundation: "NodeJS/Node-Minecraft-Protocol",
prefixes: ["*", "cbot", "/cbot"],
},
{
name: { text: "RecycleBot", color: "dark_green", bold: false },
foundation: ["MorganAnkan"],
exclaimer: "nice bot",
language: "NodeJS/node-minecraft-protocol",
prefixes: ["="],
},
{
name: { text: "neobot", color: "blue", bold: false },
exclaimer: "n e o b o t ;oslkdfj;salkdfj;ladsjf",
authors: ["mirkokral"],
foundation: "java/MCProtocolLib",
prefixes: ["_"],
},
{
name: { text: "ManBot", color: "dark_green", bold: false },
exclaimer:
"(more like men bot :skull:) OH HAAAAAAAAAAAAAAIIILL LOGINTIMEDOUT",
authors: ["Man/LogintimedOut"],
foundation: "NodeJS/mineflayer",
prefixes: ["(Note:I dont remember!!)"],
},
{
name: [
{ text: "Useless", color: "red", bold: false },
{ text: "Bot", color: "gray", bold: false },
],
exclaimer: "it isnt useless its a good bot................",
authors: ["IuCC"],
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ["["],
},
{
name: [
{ text: "Blurry", color: "dark_purple", bold: false },
{ text: "Bot", color: "red" },
],
exclaimer: "",
authors: ["SirLennox"],
foundation: "Java/custom",
prefixes: [","],
},
{
name: [{ text: "SnifferBot", color: "gold", bold: false }],
exclaimer: "sniff sniff FNFBoyfriendBot simp",
authors: ["popbob"],
foundation: "NodeJS/Node-minecraft-protocol",
prefixes: [">"],
},
{
name: [{ text: "XBot", color: "dark_purple", bold: false }],
exclaimer: "",
authors: ["popbob"],
foundation: "ts-Node/Node-minecraft-protocol",
prefixes: ["$"],
},
{
name: [
{ text: "Kitty", color: "gold", bold: false },{text:"Corp", color:'aqua',bold:false},
{ text: "Bot", color: "yellow",bold:false },
],
exclaimer: "3 words ginlang is gay",
authors: ["ginlang , G6_, ArrayBuffer, and i guess more??"],
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ["^"],
},
{
name: [
{ text: "FNF", color: "dark_purple", bold: false },
{ text: "Boyfriend", color: "aqua", bold: false },
{ text: "Bot", color: "dark_red", bold: false },
{ text: " nmp", color: "black", bold: false },
],
authors: [
{ text: "Parker2991", color: "dark_red" },
{ text: " _ChipMC_", color: "dark_green", bold: false },
{ text: " chayapak", color: "yellow", bold: false },
{ text: " _yfd", color: "light_purple", bold: false },
{ text: "popbob", color: "gold" },
],
exclaimer: "FNFBoyfriendBot NMP Rewrite",
foundation: "NodeJS/node-minecraft-protocol",
prefixes: ["~ % &"],
},
{
name: [
{ text: "FNF", color: "dark_purple", bold: false },
{ text: "Boyfriend", color: "aqua", bold: false },
{ text: "Bot", color: "dark_red", bold: false },
{ text: " legacy", color: "green", bold: false },
],
authors: [
{ text: "Parker2991", color: "dark_red" },
{ text: " _ChipMC_", color: "dark_green", bold: false },
],
exclaimer:
"1037 LINES OF CODE WTFARD!??! also this version is in console commands only",
foundation: "NodeJS/mineflayer",
prefixes: [],
},
];
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: "bots",
description: ["shows a list of known bots"],
aliases: ["knownbots"],
trustLevel: 0,
usage:[""],
execute(context) {
const query = context.arguments.join(" ").toLowerCase();
const bot = context.bot;
if (query.length === 0) {
const list = [];
if(!bot.options.Core.enabled){
throw new CommandError('Coreless mode is active can not execute command!')
}else{
for (const info of bots) {
if (list.length !== 0) list.push({ text: ", ", color: "gray" }); // list.push(info.name)
list.push(info.name);
}
context.source.sendFeedback(
bot.getMessageAsPrismarine(["Known bots (", bots.length, ") - ", ...list]).toMotd().replaceAll('\xa7','\xa7'),
false,
);
return;
}
}
for (const info of bots) {
const plainName = String(
context.bot.getMessageAsPrismarine(info.name),
).toLowerCase();
if (plainName.includes(query)) this.sendBotInfo(info, context.bot);
}
},
sendBotInfo(info, bot) {
const component = [""];
component.push("Name: ", info.name);
if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer);
if (info.authors && info.authors.length !== 0) {
component.push("\n", "Authors: ");
for (const author of info.authors) {
component.push(author, { text: ", ", color: "gray" });
}
component.pop();
}
if (info.foundation) component.push("\n", "Foundation: ", info.foundation);
if (info.prefixes && info.prefixes.length !== 0) {
component.push("\n", "Prefixes: ");
for (const prefix of info.prefixes) {
component.push(prefix, { text: ", ", color: "gray" });
}
component.pop();
}
bot.tellraw([component]);
},
};
//it doing it just for the ones i added lol
// prob a replit moment, it probably thinks there are regexes in the strings

20
src/commands/bruhify.js Normal file
View file

@ -0,0 +1,20 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'bruhify',
description:['bruhify text'],
aliases:['bruhifytext', 'bruh'],
trustLevel: 0,
usage:["smexy text here"],
execute (context) {
const bot = context.bot
const args = context.arguments
const message = context.arguments.join(' ')
bot.bruhifyText = args.join(' ')
context.source.sendFeedback(JSON.stringify(bot.bruhifyText))
}
}

137
src/commands/changelog.js Normal file
View file

@ -0,0 +1,137 @@
const bots = [
{//
name: { text: 'v5.0.0-Beta', color: 'blue', bold:false },
authors: ['Monochrome'],
foundation: '12/18/23',
exclaimer:'added owner validation to the bot thats about it',
},
{//
name: { text: 'v5.0.0', color: 'dark_red', bold:false },
authors: ['Monochrome'],
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',
},
{//
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(edit: nevermind its very buggy reverting it back to how it originally filled its core) and adding a hover event to netmsg along with having the test command tellraw the players display name in the command and added support for 3 command prefixes',
exclaimer:'12/23/23',
},
{//
name: { text: 'v5.0.2', color: 'green', bold:false },
authors: [''],
foundation: '12/26/23',
exclaimer:'fixed the issue with the cpu checking in the info command added discord hashing back into the bot to work along side the keys made it check to see if the config file is in the directory and if not it will recreate the config from default.js',
},
{//
name: { text: 'v5.0.3', color: 'green', bold:false },
authors: [''],
foundation: '12/29/23',
exclaimer:'mabe the bot last update of 2023 cuz next year will be 2024 www but anyway expanded the disconnect messages for both console and discord but thats pretty much it',
},
{//
name: { text: 'v5.0.4', color: 'green', bold:false },
authors: [''],
foundation: '1/12/24',
exclaimer:'first update of 2024 for the bot but anyway merged the test and errortest commands into cmdtest, changed the colors for the help command public is #00FFFF, trusted is dark_purple and owner remained as dark red. moved the module loader from bot.js to index.js to split the boot time in half which now allows module functions like bot.chat() to be used in bot.js and also since the command manager is a module it also loads the commands thats a w on all ends also removed some modules to improve the bots boot time and moved the functions for the sctoggle command into the command itself and not as a module which helped the boot time as well and last but not least merged the memused usage in the info command with the serverinfo usage and made the memusage command use the bossbar and not the actionbar',
},
{//
name: { text: 'v5.0.5', color: 'dark_red', bold:false },
authors: [{text:'QT ',color:'#f001db'},{text:'KB ',color:'#740000'},{text:'Termination',color:'black'}],
//#f001dbQT #740000KB 0Termination
foundation: '1/26/24',
exclaimer:'added a new feature to the bot called Coreless Mode to where the core can be toggled and most commands using tellraw will use chat instead along with the discord relay chat, fixed the bug with trust and owner commands not running in console along with removing alot of useless commands and made the 3 prefixes a array and added ratelimit for console logging and command usage and added file chat logging back',
},
{//
name: { text: 'v5.0.6A', color: 'gold', bold:false },
authors: ['Interlope'],
foundation: '2/15/24',
exclaimer:'added music finally fixed coreless mode made a seperate function for discord in the command manager and idk what all',
},
]//
//back
/*{//
name: { text: '', color: 'gray', bold:false },
authors: [''],
foundation: '',
exclaimer:'',
},*/
module.exports = {
name: 'changelog',
description:['check the bots changelog'],
trustLevel: 0,
aliases:['cl', 'changes'],
usage:[""],
execute (context) {
const query = context.arguments.join(' ').toLowerCase()
const bot = context.bot
if (query.length === 0) {
const list = []
for (const info of bots) {
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
list.push(info.name)
}
const category = {
translate: ' (%s%s%s%s%s%s%s%s%s) ',
bold: false,
color: 'white',
with: [
{ color: 'aqua', text: 'Alpha Release'},
{ color: 'white', text: ' | '},
{ color: 'blue', text: 'Beta Release'},
{ color: 'white', text: ' | '},
{ color: 'green', text: 'Minor release'},
{ color: 'white', text: ' | '},
{ color: 'gold', text: 'Revision Release'},
{ color: 'white', text: ' | '},
{ color: 'dark_red', text: 'Major Release'},
]
}
context.source.sendFeedback(bot.getMessageAsPrismarine(['Changelogs (', bots.length, ')', category, ' - ', ...list]).toMotd().replaceAll('\u00a7','\u00a7'), false)
return
}
for (const info of bots) {
const plainName = String(context.bot.getMessageAsPrismarine(info.name)).toLowerCase()
if (plainName.includes(query)) this.sendBotInfo(info, context.bot)
}
},
sendBotInfo (info, bot) {
const component = ['']
component.push('', info.name)
if (info.exclaimer) component.push('\n', ' ', info.exclaimer)
if (info.authors && info.authors.length !== 0) {
component.push('\n', 'Codename ')
for (const author of info.authors) {
component.push(author, { text: ', ', color: 'gray' })
}
component.pop()
}
if (info.foundation) component.push('\n', 'Date: ', info.foundation)
if (info.prefixes && info.prefixes.length !== 0) {
component.push('\n', '')
for (const prefix of info.prefixes) {
component.push(prefix, { text: ' ', color: 'gray' })
}
component.pop()
}
bot.tellraw([component])
}
}//it doing it just for the ones i added lol
// prob a replit moment, it probably thinks there are regexes in the strings

View file

@ -0,0 +1,410 @@
const bots = [
{
name: { text: 'v0.1.0 - v0.5.0-beta', color: 'blue', bold:false },
authors: ['Prototypes'],
foundation: '11/22/22 - 1/24/23',
exclaimer:'ehh nothing much just the release of the betas',
},
{
name: { text: 'v1.0.0-beta', color: 'blue', bold:false },
authors: ['in console test'],
foundation: '1/25/23',
exclaimer:'original commands:!cloop bcraw,!cloop sudo,!troll,!say,!op (broke),!deop (broke), !gms (broke),!freeze,!icu <--- these commands no longer can be used in game but in console for beta 1.0 commands added: fake kick,ban,kick,crashserver,stop,gmc,greetin,test(broken idk),bypass,entity spam ,gms ,stop,tntspam ,prefix ,annoy (broke results in a complete server crash keeping ayunboom down for 3 to 5 hours),freeze,crashserver,troll ,trol(more destructive),icu ,say,sudo,cloop',
},
{
name: { text: 'v1.0.0', color: 'dark_red', bold:false },
authors: ['FNFBoyfriendBot'],
foundation: '1/26/23',
exclaimer:'FNFBoyfriendBot. commands added: BOOM,deop,troll and trol(added extra code to both commands),kaboom,serverdeop, commands fixed:tp,gms,annoy(attemps to crash the server but not as bad as it was) commands untested:prefix command Broke:icu,freeze,tntspam,entityspam,tntspam? changed name to &b &lFNFBoyfriendBot may change later idk',
},
{
name: { text: 'v1.0.1', color: 'green', bold:false },
authors: [''],
foundation: '1/26/23',
exclaimer:'reworked the kaboom command and fixed the description commands but thats about it. also reworked the greeting command',
},
{
name: { text: 'v1.1.0', color: 'green', bold:false },
authors: [''],
foundation: '1/26/23 2:00pm',
exclaimer:'nothing much just added extra stuff to the troll, trol and that is about it',
},
{
name: { text: 'v1.2.0', color: 'green', bold:false },
authors: [''],
foundation: '1/28/23 1:51',
exclaimer:'for ppl me making me really mad -.- got released early',
},
{
name: { text: 'v2.0.0', color: 'dark_red', bold:false },
authors: ['Major'],
foundation: '2/07/23 8:01pm',
exclaimer:'added DREAMSTANALERT,technoblade,GODSWORD,KFC,MYLEG,OHHAIL,altcrash,MyHead Reworked tntspam,entityspam,soundbreaker added Spim to the whitelist of the bot released too early than it was planned gonna be released due do the code almost leaked it had to be released early',
},
{
name: { text: 'v2.1.0', color: 'green', bold:false },
authors: [''],
foundation: '2/11/23 5:30pm',
exclaimer:'added: refillcore(had early prototypes of this was original), vanish,deop,cloopdeop,mute,cloopmute reworked: op (supposed to already op the bot but didnt work until this release) and reworked gmc (same problem with op) (had early prototypes of vanish,refillcore,gmc,and op but these were original gonna be automatic but after alot of attempts i said screw it and added 2 commands refillcore, and vanish reworked gmc and op and got them working finally) removed Spim because come to find out he couldnt be trusted',
},
{
name: { text: 'v2.2.0', color: 'green', bold:false },
authors: [''],
foundation: '2/20/23',
exclaimer:'added ckill(added back after trial and error),serversuicidal changed username of the bot from hex code to FNFBoyfriendBot because hex code for the username was confusing as it changes everytime',
},
{
name: { text: 'v3.0.0-Beta', color: 'blue', bold:false },
authors: ['blue-balled corruption'],
foundation: '',
exclaimer:'was canceled due to ayunboom being rewriten and renamed to creayun barely usable on there because commands blocks are disabled which i created a bot for that server that has no command blocks just finished the final build of the Creayun build of the bot due to chip announcing that he may make a kaboom clone yk what 1.5.2 and 1.8 support but anyway onto what is in the v3.0-beta well the beta for right now commands added:discord,version,online,list,iownyou,endmysuffering,wafflehouse,whopper,bcraw,destroycore Notes:the original say command was reworked into talking in chat without bcraw and command blocks which the bcraw chatting code is still in the bot but was reworked into the bcraw commmand. maybe some commands removed? i dont know yet edit there is 2 commands removed commands removed:tpe and serverdeop??? reworked commands :say command for right now relay chat mabe will be added as a seperate repl i dont know yet possible would need a whole code rewrite for relay chat',
},
{
name: { text: 'v3.0.0', color: 'dark_red', bold:false },
authors: ['Sky Remanifested'],
foundation: '',
exclaimer:'the full release of 3.0 the rewrite has been pushed back to 4.0 due to 3.0 already pass its release date and the code i had on hand was done but the rewrite wasnt done Added: SelfCare Made during development:Relay chat prototypes for several servers',
},
{
name: { text: 'v3.0.5', color: 'green', bold:false },
authors: [''],
foundation: '',
exclaimer:'bug fixes',
},
{
name: { text: 'v3.0.9', color: 'green', bold:false },
authors: [''],
foundation: '',
exclaimer:'commands added:Help(finally added after about a year),consolelog(added cuz yes),cloopconsolelog(added cuz yes)',
},
{
name: { text: 'v3.3.0', color: 'dark_red', bold:false },
authors: [''],
foundation: '',
exclaimer:'switched it base to 4.0s base during 4.0s development',
},
{
name: { text: 'v4.0.0-beta', color: 'blue', bold:false },
authors: ['FNFBoyfriendBot Ultimate'],
foundation: '',
exclaimer:'all of the command removed and or rewriten from version 3.0.9 Commands added or rewriten:ban,buyrealminecraft,cloop,discord,echo,errortest,freeze,help,icu,info,kick,bots,skids,romncitrash,say,selfdestruct,serversuicidal,sudo,test,trol,troll (note that this is different and is not CommandModules)Modules Added:discord,chat,chat_command_handler,command_manager,position,registry,reconnect,command_core CustomChats added:kaboom(for normal chat) (note that this is different and is not Modules)CommandModules Added:command_error,Command_source a beta release for rn',
},
{
name: { text: 'v4.0.0-Alpha ', color: 'aqua', bold:false },
authors: ['FNFBoyfriendBot Ultimate'],
foundation: '',
exclaimer:'Commands added: calculator,ckill,evaljs,urban,crash,cloopcrash,core,list,ping,netmsg,skin,tpr Commands Removed:Buyrealminecraft (note that this is different and is not CommandModules)Modules Added:op selfcare,gmc selfcare,vanish selfcare,cspy selfcare,console (note that this is different and is not Modules)CustomChats Added:u2O3a(for custom chat) added util with between(for urban) eval_colors(for evaljs)',
},
{
name: { text: 'v4.0.0', color: 'dark_red', bold:false },
authors: ['FNFBoyfriendBotX'],
foundation: '8/11/23',
exclaimer:'Bot is finished with the rewrite thank you ChipMC and chayapak for helping me rewrite the bot Heres the commands ban (mabe removing), blacklist (currently being worked on), botdevhistory, bots, calculator, changelog, ckill, cloop, cloopcrash(probably removing), core, crash, creators, discord, echo, errortest, evaljs, freeze, help, icu, list, meminfo, mineflayerbot, netmsg (Hello World!), ping (pong!), reconnect, say, selfdestruct, serversuicidal (probably removing because theres ckill), skin, sudo, test, tpr, trol (mabe renaming it to troll), troll (mabe removing it and replacing it with the trol command), urban (ong sus asf), validate, version',
},
{
name: { text: 'v4.0.5', color: 'green', bold:false },
authors: [''],
foundation: '8/17/23',
exclaimer:'bug fixes, did what i said i was gonna do in the last update',
},
{
name: { text: 'v4.0.6', color: 'green', bold:false },
authors: [''],
foundation: '8/22/23',
exclaimer:'added 1 console command along with updating console.js so that the bot sends a message to 1 server at a time and not a message to all the servers at a time',
},
{
name: { text: 'v4.0.7', color: 'green', bold:false },
authors: [''],
foundation: '9/4/23',
exclaimer:'merged server and botusername commands and naming the command logininfo cuz it now shows the server ip, server port, Minecraft java Version, and the Bots Username',
},
{
name: { text: 'v4.0.8', color: 'green', bold:false },
authors: [''],
foundation: '9/7/23',
exclaimer:'added the wiki command even though its semi working. bug fixes. some bugs still in the bot is netmsg showing the bots username when i used the netmsg cmd from my end and not the console i find it funny asf though',
},
{
name: { text: 'v4.0.8A', color: 'gold', bold:false },
authors: [''],
foundation: '9/7/23',
exclaimer:'added some things to the changelog cmd. still needing to fix the issue with custom chat and netmsg also added a bugs command to check what bugs are needing to be fixed',
},
{
name: { text: 'v4.0.8B', color: 'gold', bold:false },
authors: [''],
foundation: '9/8/23',
exclaimer:'made it to where it sends more messages on start up and made it to where the buildstring is in secrets',
},
{
name: { text: 'v4.0.8C', color: 'gold', bold:false },
authors: [''],
foundation: '9/14/23',
exclaimer:'added the nodejs version to the version command but thats about it still fixing the bugs with the relay chat and mabe rewriting the validation system in the bot',
},
{
name: { text: 'v4.0.8D', color: 'gold', bold:false },
authors: [''],
foundation: '9/16/23',
exclaimer:'added onto the changelog command along with adding spambot and lol commands (cuz yes) along with removing the bugs command maybe adding it back sometime later also the discord relay chat and validation system mabe getting a rewrite and also updated node from v18 to v20.6.0',
},
{
name: { text: 'v4.0.8E', color: 'gold', bold:false },
authors: [''],
foundation: '9/17/23',
exclaimer:'changed the name for meminfo to serverinfo along with adding onto it and moving the nodejs, node-minecraft-protocol, and discord.js versions from the version command to the serverinfo command',
},
{
name: { text: 'v4.0.8F', color: 'gold', bold:false },
authors: [''],
foundation: '9/24/23',
exclaimer:'added filesdirectories command but thats about it',
},
{
name: { text: 'v4.0.9', color: 'green', bold:false },
authors: [''],
foundation: '9/26/23',
exclaimer:'added a hover event to the custom chat for the bot',
},
{
name: { text: 'v4.1.0', color: 'green', bold:false },
authors: [''],
foundation: '9/27/23',
exclaimer:'Finally changed how the validation/hashing works in the bot instead of it being sent in discord there will be a key for trusted to validate',
},
{
name: { text: 'v4.1.1', color: 'green', bold:false },
authors: [''],
foundation: '9/28/23',
exclaimer:'added uppercase and lowercase function for commands and soon gonna be completely overhauling the validation system in the bot again',
},
{
name: { text: 'v4.1.2', color: 'green', bold:false },
authors: [''],
foundation: '10/02/23',
exclaimer:'added uptime as a command but thats it',
},
{
name: { text: 'v4.1.4', color: 'green', bold:false },
authors: [''],
foundation: '10/03/23',
exclaimer:'moved the custom chat text and cmd block text to config.js',
},
{
name: { text: 'v4.1.6', color: 'green', bold:false },
authors: [''],
foundation: '10/08/23',
exclaimer:'fixed the relay chat and fixed the cr issue with urban and also fixed reconnect',
},
{
name: { text: 'v4.1.7', color: 'green', bold:false },
authors: [''],
foundation: '10/08/03',
exclaimer:'added mute, tag, and skin to selfcare',
}, // am I even gonna be credited?
{
name: { text: 'v4.1.8', color: 'green', bold:false },
authors: [''],//cai cee mmm deee sus
foundation: '10/11/23',
exclaimer:'fixed the issue with memused cee mmm dee',
},
{//
name: { text: 'v4.1.9', color: 'green', bold:false },
authors: [''],
foundation: '10/12/23',
exclaimer:'rewrote evaljs its now using isolated-vm and not vm2',
},
{//
name: { text: 'v4.2.0-restore', color: 'green', bold:false },
authors: [''],
foundation: '10/19/23',
exclaimer:'fixed the disconnect message for discord and the bug with the say command',
},
{//
name: { text: 'v4.2.1', color: 'green', bold:false },
authors: [''],
foundation: '10/24/23',
exclaimer:'rewrote the help command to allow descriptions finally along with adding things to the base of the bot for the descriptions',
},
{//
name: { text: 'v4.2.2', color: 'green', bold:false },
authors: [''],
foundation: '10/25/23',
exclaimer:'merged serverinfo, memused, discord, logininfo, creators, version, uptime together',
},
{//
name: { text: 'v4.2.3', color: 'green', bold:false },
authors: [''],
foundation: '10/30/23',
exclaimer:'added a antiskid measure (thanks _yfd)',
},
{//
name: { text: 'v4.2.4', color: 'green', bold:false },
authors: ['Spooky update (note: might as well give it a codename since its halloween)'],
foundation: '10/31/23',
exclaimer:'merged fard and reconnect together making recend, added more crash methods to the crash command, and remove 12 commands',
},
{//
name: { text: 'v4.2.5', color: 'green', bold:false },
authors: [''],
foundation: '11/8/23',
exclaimer:'patched the exploit in the discordmsg command and made it to were with the netmsg command players cannot send empty messages',
},
{//
name: { text: 'v4.3.0', color: 'green', bold:false },
authors: [''],
foundation: '11/16/23',
exclaimer:`color coded the console logs are LOGS in the color gold consoleserver are in the category INFO in the color green, errors after start up are in the category WARN in the color yellow, Fatal Errors/start-up errors are in the category ERROR in the color red and hashs/validation codes sent to console are in the category HASH in the color green. added the command servereval. changed config.json to config.js and moved the username() function from the end of bot.js to the end of config.js and replacing where username() after options.username with 'Player' + Math.floor(Math.random() * 1000) and added player ping/latency to list along with fixing the bug with cloop list`,
},
{//
name: { text: 'v4.3.1', color: 'green', bold:false },
authors: [''],
foundation: '11/21/23 one day till the bots anniversary?!?!',
exclaimer:'modified the bots boot originally it would spam the bots buildstring each time it logged into a server on boot but now it will only send it once to console on boot along with it now sending the foundationbuildstring after the buildstring sent in console. ported some commands over since chomens is pretty much dead along with adding chat support for chat.type.text and chat.type.emote',
},
{//
name: { text: 'v4.3.2', color: 'green', bold:false },
authors: [''],
foundation: '11/23/23',
exclaimer:'made the bots selfcare, the selfcares interval and console toggle-able along with making default options for the selfcare and its interval, the bots prefix, the bots discord prefix, the reconnectDelay interval, the core customname, and the console, partically fixed the issue with the trusted commands no being able to be ran in discord, edited the bots boot again it now also logs the amount of files its loading on boot its discord username its logged in with(also added the discord username to the info command)',
},
{//
name: { text: 'v4.3.3', color: 'dark_red', bold:false },
authors: ["Lullaby Girlfriend's LostCause"],
foundation: '12/3/23',
exclaimer:'added hover events to the help command for command descriptions, trust console and name along with click events for them added memusage and fixed the category issue with the console and added toggles to the bot for console, selfcare, and skin',
},
{//
name: { text: 'v4.3.4', color: 'dark_red', bold:false },
authors: ['Suffering Siblings'],
foundation: '12/12/23',
exclaimer:'overhauled the console and discord relay chat fixing trusted roles and making the selfcare toggleable in game also fixing the issue with hiding console only commands (thank you poopbob for helping me with that)',
},
]//§4Lullaby §cGirlfriend's §cLost§bCause
//back
/*{//
name: { text: '', color: 'gray', bold:false },
authors: [''],
foundation: '',
exclaimer:'',
},*/
module.exports = {
name: 'changelogv4.3.4',
description:['check the bots changelog'],
trustLevel: 0,
aliases:['clv4.3.4', 'changesv4.3.4'],
usage:[""],
execute (context) {
const query = context.arguments.join(' ').toLowerCase()
const bot = context.bot
if (query.length === 0) {
const list = []
for (const info of bots) {
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
list.push(info.name)
}
const category = {
translate: ' (%s%s%s%s%s%s%s%s%s) ',
bold: false,
color: 'white',
with: [
{ color: 'aqua', text: 'Alpha Release'},
{ color: 'white', text: ' | '},
{ color: 'blue', text: 'Beta Release'},
{ color: 'white', text: ' | '},
{ color: 'green', text: 'Minor release'},
{ color: 'white', text: ' | '},
{ color: 'gold', text: 'Revision Release'},
{ color: 'white', text: ' | '},
{ color: 'dark_red', text: 'Major Release'},
]
}
context.source.sendFeedback(bot.getMessageAsPrismarine(['Changelogs (', bots.length, ')', category, ' - ', ...list]).toMotd().replaceAll('\xa7','\xa7'), false)
return
}
for (const info of bots) {
const plainName = String(context.bot.getMessageAsPrismarine(info.name)).toLowerCase()
if (plainName.includes(query)) this.sendBotInfo(info, context.bot)
}
},
sendBotInfo (info, bot) {
const component = ['']
component.push('', info.name)
if (info.exclaimer) component.push('\n', ' ', info.exclaimer)
if (info.authors && info.authors.length !== 0) {
component.push('\n', 'Codename ')
for (const author of info.authors) {
component.push(author, { text: ', ', color: 'gray' })
}
component.pop()
}
if (info.foundation) component.push('\n', 'Date: ', info.foundation)
if (info.prefixes && info.prefixes.length !== 0) {
component.push('\n', '')
for (const prefix of info.prefixes) {
component.push(prefix, { text: ' ', color: 'gray' })
}
component.pop()
}
bot.tellraw([component])
}
}//it doing it just for the ones i added lol
// prob a replit moment, it probably thinks there are regexes in the strings

101
src/commands/cloop.js Normal file
View file

@ -0,0 +1,101 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'cloop',
trustLevel: 1,
description:['command loop commands'],
aliases:['commandloop'],
usage:[
"add <interval> <command/message>",
"clear",
"remove <id>",
"list",
],
execute (context, selector) {
const args = context.arguments
const bot = context.bot
const source = context.source
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
// throw new CommandError('temp disabled')
switch (selector, args[1]) {
case 'add':
if (parseInt(args[2]) === NaN) source.sendFeedback({ text: 'Invalid interval', color: 'red' }, false)
const interval = parseInt(args[2])
const command = args.slice(3).join(' ')
bot.cloop.add(command, interval)
source.sendFeedback({
translate: 'Added \'%s\' with interval %s to the cloops',
color:'gray',
with: [ command, interval ]
})
break
case 'remove':
if (bot.cloop.list[args[2]].id === undefined) source.sendFeedback({ text: 'Invalid index', color: 'red' }, false)
const index = (args[2])
bot.cloop.remove(index)
source.sendFeedback({
translate: 'Removed cloop %s',
color: 'gray',
with: [ index ]
})
break
case 'clear':
bot.cloop.clear()
source.sendFeedback({ text: 'Cleared all cloops', color:'gray' }, false)
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
color: 'gray',
with: [
i,
cloop.command,
cloop.interval
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
color:'gray',
with: [ bot.cloop.list.length ]
})
component.push('\n')
component.push(listComponent)
source.sendFeedback(component,true)
//console.log(`tellraw @a ${JSON.stringify(component)}`)
break
default:
source.sendFeedback({ text: 'Invalid action', color: 'red' })
break
}
}
}

108
src/commands/cmdtest.js Normal file
View file

@ -0,0 +1,108 @@
const CommandError = require('../CommandModules/command_error')
const CommandSource = require('../CommandModules/command_source')
module.exports = {
name: 'cmdtest',
description:['usages are test and msg error'],
trustLevel: 0,
aliases:['cmdtst', 'commandtest', 'commandtst'],
usage:[
"msg",
"error",
],
execute (context) {
const bot = context.bot
const player = context.source.player.profile.name
const uuid = context.source.player.uuid
const message = context.arguments.join(' ') // WHY SECTION SIGNS!!
const args = context.arguments
const source = context.source
switch (args[0]) {
case 'msg':
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 ?? context.source.player.uuid } , `
},
//entry.displayName
{text:`Argument: ${args.slice(1).join(' ')}`}
]//command.split(' ')[0]
}//context.source.player.displayName ?? context.source.player.profile.name
//ChatMessage.fromNotch(`${process.env["buildstring"]}`).toMotd().replaceAll('§', '&')
if (!bot.options.Core.enabled){
const ChatMessage = require('prismarine-chat')(bot.options.version)
bot.chat(`Hello, World!, Player: ${ChatMessage.fromNotch(context.source.player.displayName ?? context.source.player.profile.name).toMotd().replaceAll('§', '&')}, uuid: ${context.source.player.uuid}, Argument: ${args.slice(1).join(' ')}`)
} else {
bot.tellraw([component])
}
/*
const bot = context.bot
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)
*/
break
case 'error':
throw new Error(args.slice(1).join(' '))
break
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
default:
if (bot.options.Core.CorelessMode){
bot.chat('&4Invalid action')
sleep(500)
bot.chat('the usages are msg and error')
}else{
context.source.sendError([{ text: 'Invalid action', color: 'dark_red', bold:false }])
context.source.sendError([{ text: 'the usages are msg and error', color: 'gray', bold:false }])
}
}
}
}
/*
*/
//context.source.player.displayName ?? context.source.player.profile.name,

47
src/commands/console.js Normal file
View file

@ -0,0 +1,47 @@
const CommandError = require('../CommandModules/command_error')
const buildstring = process.env['buildstring']
const foundation = process.env['FoundationBuildString']
module.exports = {
name: 'console',
trustLevel: 3,
description:['no :)'],
// description:['make me say something in custom chat'],
execute (context) {
const message = context.arguments.join(' ')
const bot = context.bot
const prefix = {
translate: '[%s] %s \u203a %s',
color:'dark_gray',
with: [
{
text: 'FNFBoyfriendBot Console', color:'#00FFFF'
},
{
selector: `${bot.username}`, color:'#00FFFF',
clickEvent: { action: 'suggest_command', value: '~help' }
},
{
text: '',
extra: [`${message}`],
color:'white'
},
],
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
}
bot.tellraw([prefix])
}
}
//[%s] %s %s
//was it showing like that before?
// just do text bc too sus rn ig
// You should remove the with thing and the translate and replace
// Parker, why is hashing just random characters???
//wdym

View file

@ -0,0 +1,46 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'consoleserver',
trustLevel: 3,
description:['consoleserver'],
aliases:['csvr'],
execute (context) {
const bot = context.bot
const args = context.arguments
const source = context.source
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
// const servers = bot.bots.map(eachBot => eachBot.options.host)
const serverName = bot.bots.map(eachBot => eachBot.options.serverName)
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
for (const eachBot of bot.bots) {
if (args.join(' ').toLowerCase() === 'all') {
eachBot.console.consoleServer = 'all'
bot.console.info(` Set the console server to all servers`)
//Set the console server to all servers
continue
}
const server = serverName.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 = port
}
}
}

25
src/commands/core.js Normal file
View file

@ -0,0 +1,25 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'core',
description:['make me run a command in core'],
aliases:['cb','corerun','run','commandblockrun','cbrun'],
trustLevel: 0,
usage:["<command/message>"],
execute (context) {
const bot = context.bot
// const client = context.client
const args = context.arguments
const source = context.source
const message = context.arguments.join(' ')
// if (args.length === 0){
//source.sendFeedback({translate:"Too few Arguments!", color:"red"})
if (message.startsWith('/')) {
bot.core.run(message.substring(1))
return
}
bot.core.run(message)
}
}

75
src/commands/cowsay.js Normal file
View file

@ -0,0 +1,75 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'cowsay',
description:['mooooo'],
aliases:['cws', 'cow'],
trustLevel: 0,
usage:["list"],
execute (context, selector) {
const bot = context.bot
const args = context.arguments
const component = ['']
// const args = context.arguments
const source = context.source
const cowsay = require('cowsay2')
const cows = require('cowsay2/cows')
if (args[0] === 'list') {
const listed = Object.keys(cows)
let primary = true
const message = []
for (const value of listed) {
message.push({
text: value + ' ',
color: (!((primary = !primary)) ? 'gold' : 'yellow'),
clickEvent: {
action: 'suggest_command',
value: `${context.bot.options.commands.prefixes[0]}cowsay ${value} `
}
})
}
bot.tellraw(message)
} else {
bot.tellraw({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })
}
},
}
// bot.tellraw({ text: cowsay.say(context.arguments.join(' ').slice(1), { cow: cows[args[0]] })
//const listed = JSON.parse(cows)
//source.sendFeedback(`${listed}`, false)
/* if (args[0] === 'list') {
const listed = Object.keys(cows)
let primary = true
const message = []
for (const value of listed) {
message.push({
text: value + ' ',
color: (!((primary = !primary)) ? 'gold' : 'yellow'),
clickEvent: {
action: 'suggest_command',
value: `${prefix}cowsay ${value} `
}
})
}
bot.tellraw(selector, message)
} else {
bot.tellraw(selector, { text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })
}
},
*/
/*if (query.length === 0) {
const list = []
for (const info of bots) {
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
list.push(info.name)
}
*/

56
src/commands/crash.js Normal file
View file

@ -0,0 +1,56 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'crash',
description:['crashes a server'],
trustLevel: 1,
aliases:['crashserver', '69'],//69 cuz yes
usage:["exe","give"],
execute (context) {
const bot = context.bot
// throw new CommandError('temp disabled')
const args = context.arguments
const source = context.source
if (!args && !args[0] && !args[1] && !args[2]) return
if(!bot.options.Core.enabled){
throw new CommandError('&4Coreless mode is active can not execute command!')
}else {
switch (args[1] ?? (!source.sources.console && args[0])) {
case `exe`:
const amogus = process.env['amogus']
bot.core.run(`${amogus}`)
break
case `give`:
const amogus2 = process.env['amogus2']
bot.core.run(`${amogus2}`)
break
default:
const cmd = {//test.js
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'gold', text: 'crash'},
]
}
if(source.sources.console){
bot.console.info([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }])
// bot.console.info([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
}else{
context.source.sendError([cmd, { text: 'Invalid action', color: 'dark_red', bold:false }])
// context.source.sendError([cmd, { text: 'the args are give, and exe', color: 'green', bold:false }])
}
}
}
}
}
//what is wi
// IDK

View file

@ -0,0 +1,40 @@
const CommandError = require("../CommandModules/command_error")
module.exports = {
name: 'discordmsg',
description:['make me say something in discord'],
trustLevel: 0,
aliases:['discordmessage', 'ddmsg'],
usage:["message"],
execute (context) {
//const args = context.args
const bot = context.bot
const args = context.arguments
// if (args.translate !== '\u202e')
// throw new CommandError('u202e detected')
if (!args[0]) {
context.source.sendFeedback({text:'Message is empty', color:'red'}, false)
} else {
bot.discord.channel.send(args.join(' '))
console.log(args[0])
context.source.sendFeedback({ text: `Recieved: ${args.join(' ')}`, color:'green'})
//}
//}
}
}
}
//bot.discord.channel.send(args.join(' '))
/*
if(!args[0])
context.source.sendFeedback('message is empty')
else if (args[0])
bot.discord.channel.send(args[0])
console.log(args[0])
context.source.sendFeedback(`Recieved: ${args[0]}`)
return;
*/

19
src/commands/echo.js Normal file
View file

@ -0,0 +1,19 @@
module.exports = {
name: 'echo',
description:['make me say something in chat'],
aliases:['chatsay'],
trustLevel: 0,
usage:[
"<command/message>",
],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
if (message.startsWith('/')) {
bot.command(message.substring(1))
return
}
bot.chat(message)
}
}

19
src/commands/end.js Normal file
View file

@ -0,0 +1,19 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'end',
description:['/kill the bot or make it /suicide'],
trustLevel: 1,
aliases:['kys','kill','suicide'],
usage:[""],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
const args = context.arguments
const source = context.source
source.sendFeedback(`${bot.username} fell out of the world`)
process.exit()
}
}
/*context.source.sendFeedback('farding right now....')
process.exit(1)
*/

150
src/commands/evaljs.js Normal file
View file

@ -0,0 +1,150 @@
const ivm = require('isolated-vm');//new ivm.Isolate(options)
const CommandError = require('../CommandModules/command_error')
// const isolate = new ivm.isolate({ memoryLimit: 128 });
const { stylize } = require('../util/eval_colors')
// 32 seems fine
module.exports = {
name: 'evaljs',
trustLevel: 1,
aliases:['evaljsisolatedvm', 'evaljsnew', 'evaljsivm', 'eval', 'evalivm', 'evalisolatedvm', 'evaljsnew'],
description:['run code in a vm note: amcforum members had a sh##fit over this command'],
usage:["re fucking doing"],
async execute (context) {
const bot = context.bot
const source = context.source
const args = context.arguments
const util = require('util')
const ChatMessage = require('prismarine-chat')(bot.options.version)
const cmd = {
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'dark_green', text: 'EvalJS'},
]
}
// throw new CommandError('temp disabled')
/* bot.tellraw(selector, { text: util.inspect(bot.vm.run(args.slice(1).join(' ')), { stylize }).substring(0, 32000) })
} catch (err) {
bot.tellraw(selector, { text: util.inspect(err).replaceAll('runner', 'Parker2991'), color: 'red' })
*/
//let hash = bot.hash
const options = {
timeout: 1000//?
}
let isolate = new ivm.Isolate({ memoryLimit: 50, options, global, cachedData: true })
//let cachedData = true
if (!args && !args[0] && !args[1] && !args[2]) return
switch (args[1]) {
case `run`:
try {//context.eval()
/*
let kitty
const output = test.compileScript(args.slice(1).join(' '))// ivm.createContext(args.slice(1).join(' '))
const realoutput = output.then(result => {
kitty = result.run({
context: amonger,
})
}).catch(reason => {
console.error(reason) //
})
*/
// old coding
// YOU KILLED THE TERMINAL LMFAO
//let context = await isolate.createContext({ inspector: true });
//let script = await isolate.compileScript('for(;;)debugger;', { filename: 'example.js' });
// await script.run(context);
try {
let nerd = "";
const script = await args.slice(2).join(' '); // Ensure script is a string
const cOmtext = await isolate.createContextSync({options});
if (script.includes('for(;;);')){
source.sendFeedback({text:'no now fuck off with that script',color:'dark_red'})
return
}
else if (script.includes('Array') || script.includes('\u0041rray') || script.includes('\u0065val') || script.includes('.repeat') || script.includes('concat')){
source.sendFeedback({text:'no now fuck off with that script',color:'dark_red'})
return
} else if(script.includes('eval')){
source.sendFeedback({text:'no',color:'dark_red'})
return
}else if(script.includes('.fill')){
source.sendFeedback({text:'screw off',color:'dark_red'})
return
}
(async () => {
try {
let result = await (await cOmtext).evalSync(script, options, {
timeout: 1000
})
nerd = result;
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: util.inspect(result, { stylize }) }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: util.inspect(result, { stylize }) }]);
}
} catch (reason) {
nerd = reason;
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: String(reason.stack), color: 'white' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: String(reason.stack), color: 'white' }]);
console.log(`AAA at ${reason}\n${reason.stack}`);
}
}
})();
} catch (reason) {
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: String("UwU OwO ewwor" + reason.stack), color: 'white' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: String("UwU OwO ewwor" + reason.stack), color: 'white' }]);
console.log(`AAA at ${reason}\n${reason.stack}`);
}
}
// credits to chatgpt because im lazy mabe mabe? idfk again ty
//
break//
} catch (e) {
// ral
}
case 'reset':
isolate = null
isolate = new ivm.Isolate({ memoryLimit: 50 }) // 32 seems fine
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Successfully reset the eval context', color: 'green' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: 'Successfully reset the eval context', color: 'green' }])
}
break
default:
if(!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch([cmd, { text: 'Successfully reset the eval context', color: 'green' }]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, { text: 'Invalid option!', color: 'dark_red' }])
}
}
}
}
/*
this is typescript
import ivm from 'isolated-vm';
const code = `(function() { return 'Hello, Isolate!'; })()`;
const isolate = new ivm.Isolate({ memoryLimit: 8 }); // mego bites
const script = isolate.compileScriptSync(code);
const context = isolate.createContextSync();
//this
// Prints "Hello, Isolate!"
console.log(script.runSync(context));
*/

45
src/commands/fnfval.js Normal file
View file

@ -0,0 +1,45 @@
const crypto = require('crypto')
module.exports = {
name: 'botval',
trustLevel: 3,
execute (context) {
const bot = context.bot
const prefix = '~' // mabe not hardcode the prefix
const args = context.arguments
const key = process.env['FNFBoyfriendBot_Owner_key']
//al
const time = Math.floor(Date.now() / 11000)
const value = bot.uuid + args[0] + time + key
const hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + key).digest('hex').substring(0, 16)
const command = `${prefix}${args.shift()} ${hash} ${args.join(' ')}`
const customchat = {
translate: '[%s] %s \u203a %s',
color:'gray',
with: [
{ text: 'FNFBoyfriendBot', color:'#00FFFF'},
{ selector: `${bot.username}`, color:'#00FFFF'},
{ text: '', extra: [`${command}`], color:'white'},
],
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
clickevent: { action:"open_url", value: "https://doin-your.mom"}
}
context.bot.tellraw(customchat)
}
}
//const interval = setInterval(() => {
// bot.hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.normalKey).digest('hex').substring(0, 16)
// bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.ownerHashKey).digest('hex').substring(0, 16)
// Make a copy of this

269
src/commands/help.js Normal file
View file

@ -0,0 +1,269 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'help',
aliases:['heko', 'cmd', '?', 'commands', 'cmds' ],
description:['shows the command list or the usage of a command'],
trustLevel: 0,
usage:'[COMMAND]',
async execute (context) {
const bot = context.bot
const commandList = []
const source = context.source
const args = context.arguments
const {EmbedBuilder } = require('discord.js')
// const amogus = bot.prefix
const ChatMessage = require('prismarine-chat')(bot.options.version)
const CommandManager = bot.commandManager
const cmd = {
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'blue', text: 'help cmd'},
]
}
const category = {
translate: ' (%s%s%s%s%s) ',
bold: false,
color: 'white',
with: [
{ color: `${bot.helpTheme.pub_lickColor}`, text: 'Public'},
{ color: 'white', text: ' | '},
{ color: `${bot.helpTheme.t_rustedColor}`, text: 'Trusted'},
{ color: 'white', text: ' | '},
{ color: `${bot.helpTheme.own_herColor}`, text: 'Owner'},
]
}
if (args[0]) {
let valid
for (const commands in bot.commandManager.commandlist) { // i broke a key woops
const command = bot.commandManager.commandlist[commands]
if (args[0].toLowerCase() === command.name)
{
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}//bot.getMessageAsPrismarine([cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi()
valid = true
if(source.sources.console){
bot.console.info(bot.getMessageAsPrismarine([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`${command.aliases} ${command.description}`,color:'dark_purple'}])?.toAnsi())
bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])?.toAnsi())
bot.console.info(bot.getMessageAsPrismarine([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])?.toAnsi())
}else if(!bot.options.Core.enabled && !source.sources.console){
bot.chat(ChatMessage.fromNotch([cmd, `Description: ${command.description}`]).toMotd().replaceAll('§', '&'))
await sleep(1000)
bot.chat(ChatMessage.fromNotch([cmd, {text:`Trust Level: ${command.trustLevel}`}]).toMotd().replaceAll('§', '&'))//[cmd, {text:`Trust Level: ${command.trustLevel}`}]
await sleep(1000)
bot.chat(ChatMessage.fromNotch([cmd, `aliases: ${command.aliases}`]).toMotd().replaceAll('§', '&'))
}else{
source.sendFeedback([cmd, {text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'#00ffff'},{text:`(${command.aliases}) ${command.description}`,color:'dark_purple'}])
source.sendFeedback([cmd,{text:`Trust Level: `,color:'#00ffff'},{text:`${command.trustLevel}`,color:'dark_purple'}])
source.sendFeedback([cmd,{text:`Usage: `,color:'#00ffff'},{text:`${bot.options.commands.prefixes[0]}${command.name} `,color:'dark_purple'},{text:`${command.usage}`,color:'dark_red'}])
break
}
} else valid = false
}
if (valid) {
} else {
const args = context.arguments
source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefixes[0]}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.prefixes[0]}help` } : undefined}])
}
} else {
let pub_lick = []
let t_rust = []
let own_her = []
let cons_ole = []
for (const commands in CommandManager.commandlist) {
const command = CommandManager.commandlist[commands]
if(command.trustLevel === 3) {
cons_ole.push(
{
text: command.name + ' ',
color: 'blue',
translate:"",
hoverEvent:{
action:"show_text",
value:[
{
text:`Command:${command.name}\n`,
color:'white'
},{
text:"HashOnly:",
color:'white'},
{text:`${command.hashOnly}\n`,color:'red'},
{text:'consoleOnly:',color:'white'},
{text:`${command.consoleOnly && !context.console}\n`, color:'red'},
{text:`${command.description}\n`, color:'white'},
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
{text:'click on me to use me :)'},
]
}
}
)// copypasted from below, and removed stuff that wont work in the console
}
else
if (command.trustLevel === 2) {
if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
own_her.push(`&4${command.name + ' '}`)
}else{
own_her.push(
{
text: command.name + ' ',
color: `${bot.helpTheme.own_herColor}`,
translate:"",
hoverEvent:{
action:"show_text",
value:[
{
text:`Command:${command.name}\n`,
color:'white'
}, {text:`Trust Level: `,color:'white'},
{text:`${command.trustLevel}\n`,color:'dark_red'},
{text:`${command.description}\n`, color:'white'},
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
{text:'click on me to use me :)'},
]
},clickEvent:{
action:"run_command",value:`${bot.Commands.prefixes[0]}${command.name}`
},
}
)
}
}
else if (command.trustLevel === 1){
if(!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
t_rust.push(`&5${command.name + ' '}`)
}else {
t_rust.push(
{
text: command.name + ' ',
color:`${bot.helpTheme.t_rustedColor}`,
translate:"",
hoverEvent:{
action:"show_text",
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:"run_command",value:`${bot.Commands.prefixes[0]}${command.name}`
},
}
)
}
}
else if (command.trustLevel === 0){
if (!bot.options.Core.enabled && !source.sources.console && !source.sources.discord){
pub_lick.push(`&b${command.name + ' '}`)
} else{
pub_lick.push(
{
text: command.name + ' ',
color: `${bot.helpTheme.pub_lickColor}`,
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.Commands.prefixes[0]}${command.name}`}
})
}
}
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
const isConsole = context.source.player ? false : true
if(source.sources.console && !source.sources.discord) {
bot.console.info(bot.getMessageAsPrismarine([cmd, 'Commands (', CommandManager.commandlist.length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole])?.toAnsi(), false)//[cmd, 'Commands (', length, ') ', category, ...pub_lick, t_rust, own_her, cons_ole]
} else if(source.sources.discord&& !source.sources.console){
const Embed = new EmbedBuilder()
.setColor('#00FFFF')
.setTitle('help Command')
.setDescription(bot.getMessageAsPrismarine(['Commands (',JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length),')'])?.toString())
.addFields(
{ name: 'Public Commands', value:`${bot.getMessageAsPrismarine(pub_lick)?.toString()}`},
{ name: 'Trusted Commands', value: `${bot.getMessageAsPrismarine(t_rust)?.toString()}`, inline: true },
{ name: 'Owner Commands', value: `${bot.getMessageAsPrismarine(own_her)?.toString()}`, inline: true },
)
bot?.discord?.Message?.reply({ embeds: [Embed] })
}else if (!bot.options.Core.enabled) {
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
bot.chat('Commands (' + JSON.stringify(length) + ') (&bPublic &f| &5Trusted &f| &4Owner&f)')
await sleep(3000)
bot.chat(`${pub_lick}`)
await sleep(3000)
bot.chat(`${t_rust}`)
await sleep(3000)
bot.chat(`${own_her}`)
}else {
const length = context.bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
source.sendFeedback([cmd, 'Commands (', JSON.stringify(CommandManager.commandlist.filter(c => c.trustLevel != 3).length), ') ', category, ...pub_lick, t_rust ,own_her], false)
}
}
}
}

114
src/commands/info.js Normal file
View file

@ -0,0 +1,114 @@
const CommandError = require("../CommandModules/command_error");
const path = require("path");
const fs = require("fs");
const packageJSON = require("../package.json");
const os = require('os');
const date = new Date().toLocaleDateString("en-US", {
timeZone: "America/CHICAGO",
});
module.exports = {
name: "info",
description: [
"check the bots info",
],
aliases: ["information"],
trustLevel: 0,
usage:[
"version",
"invite",
"server",
"packages",
"login",
"config",
"uptime",
"contributors",
],
async execute(context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source
function format(seconds) {
function pad(s) {
return (s < 10 ? "0" : "") + s;
}
var hours = Math.floor(seconds / (60 * 60));
var minutes = Math.floor((seconds % (60 * 60)) / 60);
var seconds = Math.floor(seconds % 60);
return (pad(`${hours} Hours`) + " " +
pad(`${minutes} Minutes`) + " " +
pad(`${seconds} Seconds`))
}
switch(args.join(' ').toLowerCase()) {
case 'version':
source.sendFeedback({text:`${process.env.buildstring}`})
source.sendFeedback({text:`${process.env.FoundationBuildString}`})
source.sendFeedback({text:`11/22/2022 - ${date}`})
break
case 'invites':
source.sendFeedback({ text: 'Discord Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.discord.invite}`, }, });
source.sendFeedback({ text: 'Matrix Invite', color: "dark_gray", translate: "", hoverEvent: { action: "show_text", value: [ { text: "click here to join!", color: "gray", }, ], }, clickEvent: { action: "open_url", value: `${bot.matrix.invite}`, }, });
break
case 'server':
source.sendFeedback({ color: "dark_gray", text: `Hostname \u203a ${os.hostname()}`, });
source.sendFeedback({ color: "dark_gray", text: `Working Directory \u203a ${process.mainModule.path}`, });
source.sendFeedback({ color: "dark_gray", text: `${os.arch()}`})
source.sendFeedback({ color: "dark_gray", text:`OS \u203a ${os.platform()}`})
source.sendFeedback({ color: "dark_gray", text: `OS Version/distro \u203a ${os.version()}`, });
source.sendFeedback({ color: "dark_gray", text: `Kernal Version \u203a ${os.release()}`, });
source.sendFeedback({ color: "dark_gray", text: `cores \u203a ${os.cpus().length}`, });
source.sendFeedback({ color: "dark_gray", text: `CPU \u203a ${os.cpus()[0].model}`, });
source.sendFeedback([{text:`Server Free memory `, color:'dark_gray'},{text:`${Math.floor( os.freemem() / 1048576, )} `,color:'dark_gray'},{text: `MiB / ${Math.floor(os.totalmem() / 1048576)} MiB`, color:'dark_gray'}]);
source.sendFeedback({text:`Device uptime \u203a ${format(os.uptime())}`,color:'dark_gray'})
source.sendFeedback({text:`Node version \u203a ${process.version}`,color:'dark_gray'})
break
case 'packages':
// source.sendFeedback([{text:'Package Count \u203a ',color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
source.sendFeedback([{text:'Packages \u203a ',color:'dark_gray'},{text:`${Object.entries(packageJSON.dependencies).map((key, value) => key + ' ' + value).join(' ')}`}])
source.sendFeedback([{text:'Package Count \u203a ', color:'dark_gray'},{text:`${Object.keys(packageJSON.dependencies).length}`,color:'gold'}])
break
case 'login':
source.sendFeedback({text:`Minecraft Username \u203a ${bot.options.username}`,color:'dark_gray'})
source.sendFeedback({text: `uuid \u203a ${bot.uuid}`,color:'dark_gray'})
if(bot.discord === undefined){
source.sendFeedback({text:'Currently not logged into discord',color:'dark_red'})
}else{
source.sendFeedback({text:`Discord Username \u203a ${bot.discord.client.user.username + '#' + bot.discord.client.user.discriminator}`,color:'dark_gray'})
}
if (bot.matrix.client === undefined){
source.sendFeedback({text:'Currently not logged into matrix',color:'dark_red'})
}else{
source.sendFeedback({text: `Matrix Username \u203a ${bot.matrix.client.credentials.userId}`,color:'dark_gray'})
}
source.sendFeedback({text:`Server \u203a ${bot.options.serverName}`,color:'dark_gray'})
source.sendFeedback({text:`Server IP \u203a ${bot.options.host + ':' + bot.options.port}`,color:'dark_gray'})
source.sendFeedback({text:`Version \u203a ${bot.options.version}`,color:'dark_gray'})
break
case 'config':
source.sendFeedback({text:`Prefixes \u203a ${bot.Commands.prefixes}`,color:'dark_gray'})
source.sendFeedback([{text:`Core enabled? `,color:'dark_gray'},{text:`${bot.options.Core.enabled}`,color:'gold'}])
source.sendFeedback([{text:'Discord enabled? ',color:'dark_gray'},{text:`${bot.Discord.enabled}`,color:'gold'}])
source.sendFeedback([{text:'Matrix enabled? ',color:'dark_gray'},{text:`${bot.matrix.enabled}`,color:'gold'}])
source.sendFeedback([{text:'Console logging enabled? ',color:'dark_gray'},{text:`${bot.options.Console.enabled}`,color:'gold'}])
source.sendFeedback([{text:'Chat filelogging enabled? ',color:'dark_gray'},{text:`${bot.Console.filelogging}`,color:'gold'}])
source.sendFeedback([{text:'Multiconnect Server count \u203a ',color:'dark_gray'},{text:`${Object.keys(bot.bots).length}`,color:'gold'}])
break
case 'uptime':
source.sendFeedback([{text:`${format(process.uptime())}`,color:'dark_gray'}])
break
case 'contributors':
source.sendFeedback({ translate: "%s%s", with: [ { color: "dark_red", text: "Parker" }, { color: "black", text: "2991" }, ], hoverEvent: { action: "show_text", value: [ { text: "FNF", color: "dark_purple", bold: true, }, { text: "Boyfriend", color: "aqua", bold: true, }, { text: "Bot ", color: "dark_red", bold: true, }, { text: "Discord", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `${bot.Discord.invite}`, }, });
source.sendFeedback({ text: "_ChipMC_", color: "dark_green", translate: "", hoverEvent: { action: "show_text", value: [ { text: "chipmunk dot land", color: "green", }, ], }, clickEvent: { action: "open_url", value: `https://chipmunk.land`, }, });
source.sendFeedback({ text: "chayapak", color: "yellow", translate: "", hoverEvent: { action: "show_text", value: [ { text: "Chomens ", color: "yellow", }, { text: "Discord (dead)", color: "blue", }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/xdgCkUyaA4`, }, });
source.sendFeedback({ text: "_yfd", color: "light_purple", translate: "", hoverEvent: { action: "show_text", value: [ { text: "ABot ", color: "gold", bold: true, }, { text: "Discord (gone)", color: "blue", bold: false, }, ], }, clickEvent: { action: "open_url", value: `https://discord.gg/CRfP2ZbG8T`, }, });
source.sendFeedback({ text: "aaa", color: "gold" });
break
case 'thankyou':
var prefix = "&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r ";
bot.core.run( "bcraw " + prefix + "Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!",)
break
default:
source.sendError({text:'Invalid Argument!!'})
}
}
}

42
src/commands/kick.js Normal file
View file

@ -0,0 +1,42 @@
const CommandError = require('../CommandModules/command_error')
let timer = null
module.exports = {
name: 'kick',
description:['kicks a player'],
usage:["re fucking doing"],
trustLevel: 1,
aliases:[],
execute(context) {
// throw new CommandError('temp disabled')
//throw new CommandError('command temporarily disabled until hashing is implemented')
const args = context.arguments
if (!args && !args[0] && !args[1]) return
if (args[2] === 'clear' || args[2] === 'stop') {
clearInterval(this.timer)
this.timer = null
context.source.sendFeedback('Cloop Stopped', false)
return
}
// if (this.timer !== null) throw new CommandError('The bot can currently only loop one command')
// anti fard
const target = context.player//let me hashonly it rq
this.timer = setInterval(function() { // Wait, is this command public?
repeat(context.bot, 400, `tellraw ${args[1]} {"text":"${'ඞ'.repeat(20000)}","bold":true,"italic":true,"obfuscated":true,"color":"#FF0000"}`)
}, 10)
}
}//i found that there is a limit
// Repeat the command over and over.
function repeat(bot, repetitions, cmd) {
for (let i = 0; i < repetitions; i++) {
bot.core.run(cmd)
}
}

89
src/commands/list.js Normal file
View file

@ -0,0 +1,89 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'list',
description:['check the player list'],
trustLevel: 0,
aliases:['playerlist', 'plist', 'pl'],
usage:[""],
async execute (context) {
const bot = context.bot
const args = context.arguments
const players = bot.players
const source = context.source
const component = []
// if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
if (args.length !== 0){
throw new CommandError({translate:"Too many Arguments!", color:"red"})
}
/*
if (amonger2.length === 0) {
const list = [];
for (const host of bots) {
if (list.length !== 0) {
list.push(host.name);
}
}
}
*/
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s] %s`,
with: [
player.displayName ?? player.profile.name,
player.uuid,
{text: `Ping: ${player.latency}`, color:'green'},
player.gamemode
]
})
component.push('\n')
}
component.pop()
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
/*
for (const player of players) {
component.push({
translate: '%s \u203a %s [%s] %s',
with: [
player.displayName ?? player.profile.name,
player.uuid,
{text: `Ping: ${player.latency}`, color:'green'},
player.gamemode
]
})
component.push('\n')
}
*/
if(source.sources.console){
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi())
}else
if(!bot.options.Core.enabled){
const ChatMessage = require('prismarine-chat')(bot.options.version)
for (const player of players){
bot.chat(ChatMessage.fromNotch(await sleep(500) ?? player.displayName ?? player.profile.name ).toMotd().replaceAll('§', '&') + `\u203a ${player.uuid} Ping: [&a${player.latency}&f]`)
}
}else{
//const players = bot.players
source.sendFeedback({text:`Players: (${JSON.stringify(bot.players.length)})`})
source.sendFeedback(component, false)
}
}
}
//what is wi
// IDK

42
src/commands/memusage.js Normal file
View file

@ -0,0 +1,42 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'memusage',
//<< this one line of code broke it lmao
description:['check the bots memusage'],
trustLevel: 0,
aliases:['memoryusage', 'memused','memoryused'],
usage:[
"on",
"off"
],
execute (context) {
const bot = context.bot
const source = context.source
const args = context.arguments
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return
switch (args[0]) {
case 'on':
bot.memusage.on()
source.sendFeedback({text: 'Memusage is now enabled', color:'green'})
break
case 'off':
bot.memusage.off()
/ source.sendFeedback({text:'Memusage is now disabled', color:'red'})
break
default:
throw new CommandError('Invalid argument')
}
},
}
//[%s] %s %s
//was it showing like that before?
// just do text bc too sus rn ig
// You should remove the with thing and the translate and replace
// Parker, why is hashing just random characters???
//wdym

249
src/commands/music.js Normal file
View file

@ -0,0 +1,249 @@
/* eslint-disable no-case-declarations */
const CommandError = require('../CommandModules/command_error')
const fs = require('fs/promises')
const { EmbedBuilder } = require('discord.js')
const path = require('path')
const getFilenameFromUrl = require('../util/getFilenameFromUrl')
const fileExists = require('../util/file-exists')
const fileList = require('../util/file-list')
const axios = require('axios')
const os = require('os')
let SONGS_PATH
if (os.hostname() === ':3') {
SONGS_PATH = path.join(__dirname, '..', '..', 'nginx-html', 'midis')
} else {
SONGS_PATH = path.join(__dirname, '..', 'midis')
}
let song
async function play (bot, values, discord, channeldc, selector, config) {
try {
const filepath = values.join(' ')
const seperator = path.sep // for hosting bot on windows
let absolutePath
if (filepath.includes(seperator) && filepath !== '') {
const pathSplitted = filepath.split(seperator)
const songs = await fileList(
path.join(
SONGS_PATH,
pathSplitted[0]
)
)
// this part took a bunch of time to figure out, but still chomens moment!1!
const lowerCaseFile = pathSplitted.pop().toLowerCase()
const file = songs.filter((song) => song.toLowerCase().includes(lowerCaseFile))[0]
absolutePath = await resolve(path.join(pathSplitted.join(seperator), file))
} else {
const songs = await fileList(SONGS_PATH)
const file = songs.filter((song) => song.toLowerCase().includes(filepath.toLowerCase()))[0]
absolutePath = await resolve(file)
}
song = await bot.music.load(await fs.readFile(absolutePath), path.basename(absolutePath))
bot.tellraw([{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }])
bot.music.queue.push(song)
bot.music.play(song)
} catch (e) {
bot.console.error(e.stack)
bot.tellraw({ text: 'SyntaxError: Invalid file', color: 'red' })
}
}
async function playUrl (bot, values, discord, channeldc, selector, config) {
let response
try {
const url = values.join(' ')
response = await axios.get('https://localhost:8080', {
params: {
uri: url
},
responseType: 'arraybuffer'
})
song = await bot.music.load(response.data, getFilenameFromUrl(url))
bot.tellraw([{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }])
bot.music.queue.push(song)
bot.music.play(song)
} catch (_err) {
const e = _err.toString().includes('Bad MIDI file. Expected \'MHdr\', got: ') ? response.data.toString() : _err
bot.tellraw({ text: e, color: 'red' })
}
}
async function resolve (filepath) {
if (!path.isAbsolute(filepath) && await fileExists(SONGS_PATH)) {
return path.join(SONGS_PATH, filepath)
}
return filepath
}
async function list (bot, discord, channeldc, prefix, selector, args, config) {
try {
let absolutePath
if (args[1]) absolutePath = await resolve(path.join(SONGS_PATH, args.slice(1).join(' ')))
else absolutePath = await resolve(SONGS_PATH)
if (!absolutePath.includes('midis')) throw new Error('bro trying to hack my server?!/1?!')
const listed = await fileList(absolutePath)
let primary = true
const message = []
for (const value of listed) {
const isFile = (await fs.lstat(path.join(absolutePath, value))).isFile()
message.push({
text: value + ' ',
color: (!((primary = !primary)) ? 'gold' : 'yellow'),
clickEvent: {
action: 'suggest_command',
value: `${prefix}music ${isFile ? 'play' : 'list'} ${path.join(args.slice(1).join(' '), value)}`
},
hoverEvent: {
action: 'show_text',
contents: [
{ text: 'Name: ', color: 'white' },
{ text: value, color: 'gold' },
'\n',
{ text: 'Click here to suggest the command!', color: 'green' }
]
}
})
};
bot.tellraw(message)
} catch (e) {
bot.tellraw({ text: e.toString(), color: 'red' })
}
};
module.exports = {
name: 'music',
description: 'Plays music',
aliases: [],
trustLevel: 0,
usage: [
'play <song|url>',
'stop',
'loop <all|current|off>',
'list [directory]',
'skip',
'nowplaying',
'queue'
],
execute (context, selector, config) {
const args = context.arguments
const bot = context.bot
const prefix = bot.options.commands.prefixes[0]
if (!bot.options.Core.enabled) throw new CommandError({text:':3'})
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[0]) {
case 'play':
case 'playurl': // deprecated
if (args.slice(1).join(' ').startsWith('http')) {
playUrl(bot, args.slice(1), false, null, selector, config)
} else {
play(bot, args.slice(1), false, null, selector, config)
}
break
case 'stop':
bot.tellraw({ text: 'Cleared the song queue' })
bot.music.stop()
break
case 'skip':
try {
bot.tellraw([{ text: 'Skipping ' }, { text: bot.music.song.name, color: 'gold' }])
bot.music.skip()
} catch (e) {
throw new CommandError('No music is currently playing!')
}
break
case 'loop':
switch (args[1]) {
case 'off':
bot.music.loop = 0
bot.tellraw([
{
text: 'Looping is now '
},
{
text: 'disabled',
color: 'red'
}
])
break
case 'current':
bot.music.loop = 1
bot.tellraw([
{
text: 'Now Looping '
},
{
text: song.name,
color: 'gold'
}
])
break
case 'all':
bot.music.loop = 2
bot.tellraw({
text: 'Now looping every song'
})
break
default:
throw new SyntaxError('Invalid argument')
}
break
case 'list':
list(bot, false, null, prefix, selector, args, config)
break
case 'nowplaying':
bot.tellraw([
{
text: 'Now playing '
},
{
text: bot.music.song.name,
color: 'gold'
}
])
break
case 'queue':
const queueWithName = []
for (const song of bot.music.queue) queueWithName.push(song.name)
bot.tellraw([
{
text: 'Queue: ',
color: 'green'
},
{
text: queueWithName.join(', '),
color: 'aqua'
}
])
break
default:
throw new CommandError('Invalid argument')
}
}
}

62
src/commands/netmsg.js Normal file
View file

@ -0,0 +1,62 @@
const CommandError = require('../CommandModules/command_error.js')
module.exports = {
name: 'netmsg',
description:['send a message to other servers'],
trustLevel:0,
aliases:['networkmessage'],
usage:["<message>"],
execute (context) {
const message = context.arguments.join(' ')
const args = context.arguments
const bot = context.bot
//throw new CommandError('ohio')
const component = {
translate: '[%s] [%s] %s \u203a %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'
},
],
},
bot.options.serverName,
context.source.player.displayName ?? context.source.player.profile.name,
message
]//command.split(' ')[0]
}//string.replace()
if (!message[0]) {
context.source.sendFeedback({text:'Message is empty', color:'red'}, false)
} else {
for (const eachBot of bot.bots)
if(!bot.options.Core.enabled){
eachBot.chat(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${message}`)
}else{
eachBot.tellraw(component)
}
}
}
}
/*
bot.options.host + ':' + bot.options.port,
context.source.player.displayName ?? context.source.player.profile.name,
message
[%s%s%s] [%s] %s \u203a %s
*/

19
src/commands/rc.js Normal file
View file

@ -0,0 +1,19 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'rc',
description:['refill the bots core'],
trustLevel: 0,
aliases:['refillcore'],
usages:[""],
execute (context) {
const bot = context.bot
if (!bot.options.Core.enabled){
throw new CommandError('&4Could not fill core because Coreless mode is active!')
}else {
bot.core.refill()
context.source.sendFeedback('Successfully Refilled Core!')
}
}
}

21
src/commands/reconnect.js Normal file
View file

@ -0,0 +1,21 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'reconnect',
description:['reconnect the bot when?'],
trustLevel: 1,
aliases:['rec'],
usage:[""],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
const args = context.arguments
const source = context.source
context.source.sendFeedback({ text: `Reconnecting to ${bot.options.host}:${bot.options.port}`, color: 'dark_green'})
bot._client.end()
}
}
/*context.source.sendFeedback('farding right now....')
process.exit(1)
*/

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

@ -0,0 +1,19 @@
module.exports = {
name: 'reload',
description:[],
aliases:[],
trustLevel: 0,
usage:["reload"],
execute (context) {
const bot = context.bot
const args = context.arguments
const source = context.source
try {
source.sendFeedback({text:'Reloading commands,..........'});
for (const eachBot of bot.bots)
eachBot.reload()
}catch(e){
source.sendFeedback(e.stack)
}
}
}

59
src/commands/say.js Normal file
View file

@ -0,0 +1,59 @@
const CommandError = require("../CommandModules/command_error");
const buildstring = process.env["buildstring"];
const foundation = process.env["FoundationBuildString"];
module.exports = {
name: "say",
//<< this one line of code broke it lmao
description: ["make me say something in custom chat"],
trustLevel: 0,
aliases: [
"tellrawsay",
"tellrawmsg",
"trmessage",
"tellrawmessage",
"sourcesendfeedbacksay",
"sourcesendfeedbackmsg",
"sourcesendfeedbackmessage",
"ssfbmsg",
"ssfmessage",
],
usage:["<message>"],
execute(context) {
const message = context.arguments.join(" ");
const bot = context.bot;
const prefix = {
translate: "[%s%s%s] \u203a %s",
bold: false,
color: "white",
with: [
{
color: "dark_purple",
text: "FNF",
bold: true,
},
{
color: "#00FFFF",
text: "Boyfriend",
bold: true,
},
{ color: "dark_red", text: "Bot", bold: true },
{ color: "green", text: `${message}` },
],
};
//if(!bot.options.Core.enabled){
// throw new CommandError('&4Will not work because the core is not enabled please use the echo command')
//}else{
bot.tellraw([prefix]);
}
// },
};
//[%s] %s %s
//was it showing like that before?
// just do text bc too sus rn ig
// You should remove the with thing and the translate and replace
// Parker, why is hashing just random characters???
//wdym

204
src/commands/sctoggle.js Normal file
View file

@ -0,0 +1,204 @@
const CommandError = require('../CommandModules/command_error.js')
module.exports = {
name: 'sctoggle',
description:['toggle the selfcare'],
aliases:['selfcaretoggle'],
trustLevel: 1,
usage:["vanish","mute","god","tptoggle","nickname","username","cspy","skin","gmc","op","prefix","on/off/true/false"],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
const source = context.source
const args = context.arguments
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[1]) {
case 'vanish':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'Vanish is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.vanished = false
bot.command('essentials:vanish off')
return
}else if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'Vanish is ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.vanished = true
bot.command('essentials:vanish on')
return
}else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false off on',color:'dark_red'})
return
}
break
case 'mute':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'Mute selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.unmuted = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'Mute selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.unmuted = true
return
}else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'prefix':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'Prefix selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.prefix = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'Prefix selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.prefix = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'cspy':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'cspy selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.cspy = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'cspy selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.cspy = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'tptoggle':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'Tptoggle selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.tptoggle = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'Tptoggle selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.tptoggle = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'skin':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'Skin selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.skin.enabled = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'Skin selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.skin.enabled = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'gmc':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'gmc selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.gmc = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'gmc selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.gmc = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'op':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'op selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.op = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'op selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.op = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'nickname':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'nickname selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.nickname = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'nickname selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.nickname = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'username':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'username selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.username = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'username selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.username = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
case 'god':
if (args[2] === 'false' || args[2] === 'off'){
source.sendFeedback([{text:'god selfcare is ',color:'dark_gray'},{text:'Disabled',color:'dark_red'}])
bot.options.selfcare.god = false
return
}
if (args[2] === 'true' || args[2] === 'on'){
source.sendFeedback([{text:'god selfcare is now ',color:'dark_gray'},{text:'Enabled',color:'dark_green'}])
bot.options.selfcare.god = true
return
}
else if (args[2] !== 'true' ?? 'false' ?? 'off' ?? 'on'){
throw new CommandError({text:'Invalid argument! the arguments are true false on off'})
return
}
break
default:
source.sendFeedback({text:'Invalid argument!',color:'dark_red'})
source.sendFeedback({text:'vanish mute prefix cspy skin sctoggle gmc op nickname username god',color:'dark_green'})
}
}
}

View file

@ -0,0 +1,64 @@
const CommandError = require('../CommandModules/command_error')
let timer = null
module.exports = {
name: 'selfdestruct',
//why i put it in here probably cuz so it can be rewritten or smh idk
trustLevel: 2,
aliases:['sfd'],
description:['selfdestruct server'],
usage:[""],
execute (context) {
//throw new CommandError('temp disabled')
//bot went brr
//ima just connect to your server to work on the bot ig
// idk
const args = context.arguments
if (args[1] === 'clear' || args[1] === 'stop') {
clearInterval(this.timer)
this.timer = undefined
context.source.sendFeedback('Cloop Stopped', false)
return
}
if (this.timer !== null) return
this.timer = setInterval(function () {
bot.core.run('day')
bot.core.run('night')
bot.core.run('clear @a')
bot.core.run('effect give @a nausea')
bot.core.run('effect give @a slowness')
bot.core.run('give @a bedrock')
bot.core.run('give @a sand')
bot.core.run('give @a dirt')
bot.core.run('give @a diamond')
bot.core.run('give @a tnt')
bot.core.run('give @a crafting_table')
bot.core.run('give @a diamond_block')
bot.core.run('smite *')
bot.core.run('kaboom')
bot.core.run('essentials:ekill *')
bot.core.run('nuke')
bot.core.run('eco give * 1000')
bot.core.run('day')
bot.core.run('night')
bot.core.run('clear @a')
bot.core.run('summon fireball 115 62 -5')
bot.core.run('sudo * /fast')
bot.core.run('sudo * gms')
bot.core.run('sudo * /sphere tnt 75')
bot.core.run('sudo * kaboom')
}, 500)
bot.on('end',(data) =>{
clearInterval(this.timer)
})
}
}

View file

@ -0,0 +1,57 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'servereval',
description:['no'],
trustLevel: 2,
aliases:['svreval'],
usage:["<code>"],
async execute (context, arguments, selector) {
const bot = context.bot
// const args = context.arguments.join(' ')
const source = context.source
// throw new CommandError('temp disabled')
const { stylize } = require('../util/eval_colors')
const util = require('util')
const args = context.arguments
const ChatMessage = require('prismarine-chat')(bot.options.version)
const script = args.slice(1).join(' ');
//bot.chat(ChatMessage.fromNotch(message).toMotd().replaceAll('\xa7', '&'))
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] ) return
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}//ChatMessage.fromNotch(await sleep(500) ).toMotd().replaceAll('§', '&')
//if
try {
if(source.sources.console){
bot.console.info({ text: util.inspect(eval(args.slice(0).join(' ')), { stylize }).substring(0, 32700) })
bot.console.info({ text: `Script input: ${script}` })
} else
if(!bot.options.Core.enabled && !source.sources.console){
bot.chat(ChatMessage.fromNotch(await sleep(500) ?? { text: util.inspect(eval( args.slice(1).join(' ')), { stylize }).substring(0, 32700) }).toMotd().replaceAll('§', '&'))
}else {
//{ text: util.inspect(eval(script), { stylize }).substring(0, 32700) }
source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })
source.sendFeedback({ text: `Script input: ${script}` })
}
} catch (err) {
if(!bot.options.Core.enabled && !source.sources.console){
bot.chat(`&4${err.message}`)
}else if(source.sources.console){
bot.console.warn({ text: err.message, color: 'red' })
} else {
source.sendFeedback({ text: err.message, color: 'red' })
source.sendFeedback({ text: `Script input: ${script}` })
}
}
}
}
/* try {
bot.tellraw({ text: util.inspect(eval(context.arguments.slice().join(' ')), { stylize }).substring(0, 32700) })
} catch (err) {
bot.tellraw({ text: util.inspect(err).replaceAll('runner', 'runner'), color: 'red' })
}
*/

View file

@ -0,0 +1,20 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'soundbreaker',
description:["make peoples ears bleed"],
aliases:["earpierce","earhell"],
usage:[""],
trustLevel:1,
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.ender_dragon.death master @a ~ ~ ~ 10000 0.1 1')
bot.core.run('sudo * execute at @a run playsound entity.wither.death master @a ~ ~ ~ 10000 0.1 1')
}
}

17
src/commands/theme.js Normal file
View file

@ -0,0 +1,17 @@
module.exports = {
name: 'theme',
description:['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'],
aliases:[],
trustLevel: 0,
usage:[":3"],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
if (message.startsWith('/')) {
bot.command(message.substring(1))
return
}
bot.chat(message)
}
}

26
src/commands/time.js Normal file
View file

@ -0,0 +1,26 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'time',
description:['check the time'],
aliases:['clock', 'timezone'],
trustLevel:0,
usage:["timezone"],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
const moment = require('moment-timezone')
const source = context.source
const args = context.arguments
const timezone = args.join(' ')
if (!moment.tz.names().map((zone) => zone.toLowerCase()).includes(timezone.toLowerCase())) {
throw new CommandError('Invalid timezone')
}
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: momented, color: 'green' }]
source.sendFeedback(component)
}
}

26
src/commands/tpr.js Normal file
View file

@ -0,0 +1,26 @@
const between = require('../util/between')
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'tpr',
description:['teleport to a random place'],
trustLevel: 0,
aliases:['rtp', 'teleportrandom', 'randomteleport'],
usage:[""],
execute (context) {
const bot = context.bot
const sender = context.source.player
const source = context.source
if (!sender) return
const x = between(-1_000_000, 1_000_000)
const y = 100
const z = between(-1_000_000, 1_000_000)
if (!bot.options.Core.enabled){
throw new CommandError('Coreless mode is active can not execute command!')
}else{
source.sendFeedback(`Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `)
bot.core.run(`tp ${sender.uuid} ${x} ${y} ${z}`)
}
}
}

40
src/commands/tps.js Normal file
View file

@ -0,0 +1,40 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'tpsbar',
//<< this one line of code broke it lmao
description:['tps'],
trustLevel: 0,
aliases:['tickspersecondbar', 'tickspersecond', 'tps'],
usage:["on","off"],
execute (context) {
const bot = context.bot
const source = context.source
const args = context.arguments
switch (args[0]) {
case 'on':
bot.tps.on()
source.sendFeedback({text: 'TPSBar is now enabled', color:'green'})
break
case 'off':
bot.tps.off()
source.sendFeedback({text:'TPSBar is now disabled', color:'red'})
break
default:
throw new CommandError('Invalid argument')
}
},
}
//[%s] %s %s
//was it showing like that before?
// just do text bc too sus rn ig
// You should remove the with thing and the translate and replace
// Parker, why is hashing just random characters???
//wdym

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

@ -0,0 +1,39 @@
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'translate',
//<< this one line of code broke it lmao
usage:['<language 1> <message>'],
aliases:['translation'],
trustLevel: 0,
description:["translate languages"],
async execute (context) {
const { translate } = require('@vitalets/google-translate-api')
const bot = context.bot
const args = context.arguments
const source = context.source
const { HttpProxyAgent } = require('http-proxy-agent');
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
try {
const agent = new HttpProxyAgent('http://103.152.112.162:80');
const { text } = await translate(`${args.slice(1).join(' ')}`, {
to: 'args[0]',
fetchOptions: {agent}
});
source.sendFeedback([{text:'Result \u203a '},{text:`${text}`,color:'gold'}])
}catch(e){
//if (e.name === 'TooManyRequestsError') {
// source.sendFeedback({text:'reconnecting proxy'})
//}else{
bot.tellraw(`${e}`)
//}
}
}
}
//[%s] %s %s
//was it showing like that before?
// just do text bc too sus rn ig
// You should remove the with thing and the translate and replace
// Parker, why is hashing just random characters???
//wdym

59
src/commands/troll.js Normal file
View file

@ -0,0 +1,59 @@
const CommandError = require('../CommandModules/command_error')
let timer = null
module.exports = {
name: 'troll',
trustLevel:1,
usage:[""],
execute (context) {
const bot = context.bot
const source = context.source
const args = context.arguments
if(source.sources.console){
if (args[0] === 'clear'||args[0] === 'stop'){
clearInterval(this.timer)
this.time= undefined
bot.console.info('Cloop stopped')
return
}
}else if(!source.sources.console){
if (args[1] === 'clear' || args[1] === 'stop') {
clearInterval(this.timer)
this.timer = undefined
context.source.sendFeedback('Cloop Stopped', false)
return
}
}
if (this.timer !== null)
this.timer = setInterval(function () {
bot.core.run('day')
bot.core.run('night')
bot.core.run('clear @a')
bot.core.run('effect give @a nausea')
bot.core.run('effect give @a slowness')
bot.core.run('give @a bedrock')
bot.core.run('give @a sand')
bot.core.run('give @a dirt')
bot.core.run('give @a diamond')
bot.core.run('give @a tnt')
bot.core.run('give @a crafting_table')
bot.core.run('give @a diamond_block')
bot.core.run('smite *')
//bot.core.run('kaboom')
// bot.core.run('essentials:ekill *')
// bot.core.run('sudo * nuke')
bot.core.run('eco give * 999999999')
bot.core.run('day')
bot.core.run('night')
bot.core.run('clear @a')
// bot.core.run('sudo * kaboom')
}, 300)
bot.on('end', (data)=>{
clearInterval(this.timer)
})
}
}

98
src/commands/urban.js Normal file
View file

@ -0,0 +1,98 @@
const urban = require('urban-dictionary')
module.exports = {
name: 'urban',
description:['urban dictionary'],
aliases:['urbandictionary'],
trustLevel: 0,
usage:["re fucking doing"],
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
const cmd = {
translate: '[%s] ',
bold: false,
color: 'white',
with: [
{ color: 'dark_red', text: 'Urban Cmd'},
]
}
const example = {
translate: '%s - ',
bold: false,
color: 'white',
with: [
{ color: 'dark_gray', text: 'Example text'},
]
}
const definition5 = {
translate: '%s - ',
bold: false,
color: 'white',
with: [
{ color: 'dark_gray', text: 'Definition text'},
]
}
async function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
try {
const definitions = await urban.define(args.join(' '))
const definitions2 = await urban.define(args.join(' '))
//const definitions2 = await urban.example(args.join(' '))
//ChatMessage.fromNotch(await sleep(500) ?? player.displayName ?? player.profile.name ).toMotd().replaceAll('§', '&')
if(!bot.options.Core.enabled){
const ChatMessage = require('prismarine-chat')(bot.options.version)
for (const definition of definitions) {
bot.chat(ChatMessage.fromNotch(await sleep(2300)
?? [cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }]).toMotd().replaceAll('§', '&'))
await sleep(500)
bot.chat(ChatMessage.fromNotch(await sleep(2300) ?? [cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ]).toMotd().replaceAll('§', '&'))
}//oh
}else{//??
for (const definition of definitions) {
source.sendFeedback([cmd, example, { text: definition.example.replaceAll("\r", ""), color: 'gray' }, { text: ' - ', color: 'white' }])
source.sendFeedback([cmd, definition5,{ text: definition.definition.replaceAll("\r", ""), color: 'gray' } ])
}
urban.define(args.join(' ')).then((results) => {
source.sendFeedback([cmd,{text:`Definition: ${results[0].word}`, color:'dark_gray'}])
source.sendFeedback([cmd,{text:`Author: ${results[0].author}`, color:'dark_gray'}])
//source.sendFeedback(results[0].thumbs_down)
source.sendFeedback([cmd,{text:`👍 ${results[0].thumbs_up} | 👎 ${results[0].thumbs_down}`, color:'gray'}])
//source.sendFeedback(results[0].written_on)
//thumbs_down
//source.sendFeedback(results[0].data)
}).catch((error) => {
console.error(error.message)
})
//source.sendFeedback(results[0].data)
}
// source.sendFeedback([cmd, { text: definitions2.replaceAll("\r", ""), color: 'white' }, { text: ' - ', color: 'white' }, { text: definition.definition.replaceAll("\r", ""), color: 'white' }])
//console.log(urban.define.definition.example(args.join(' ')))
//text: definition.word text: definition.definition
} catch (e) {
if (!bot.options.Core.enabled){
const ChatMessage = require('prismarine-chat')(bot.options.version)
bot.chat(ChatMessage.fromNotch([cmd,{ text: e.toString(), color: 'red' }]).toMotd().replaceAll('§', '&'))
}else {
source.sendFeedback([cmd,{ text: e.toString(), color: 'red' }])
}
}
}
}

37
src/commands/validate.js Normal file
View file

@ -0,0 +1,37 @@
module.exports = {
name: 'validate',
description:['validate in the bot'],
trustLevel: 1,
aliases:['val'],
usage:["hash"],
execute (context) {
const source = context.source
const bot = context.bot
const hash = bot.hash
const args = context.arguments
const ownerhash = bot.owner
const discordHash = bot.hashing.hash
if (args[0] === hash) {
if(!bot.options.Core.enabled){
bot.chat('&aValid Hash')
}else{
source.sendFeedback({ text: 'Valid Hash', color: 'green' })
}
}else if (args[0] === ownerhash) {
if(!bot.options.Core.enabled){
bot.chat('&aValid Owner Hash')
}else{
source.sendFeedback({text: 'Valid Owner Hash', color:'green'})
}
}
else if (discordHash) {
if(!bot.options.Core.enabled){
bot.chat('&aValid Hash')
}else{
source.sendFeedback({ text: 'Valid Hash', color: 'green' })
}
}
}
}
//if (args[0] === hash) {

35
src/commands/weather.js Normal file
View file

@ -0,0 +1,35 @@
module.exports = {
name: 'weather',
description:['check the weather in a location via zip code or city name'],
aliases:[],
trustLevel: 0,
usage:["redoing mabe"],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
const args = context.arguments
const source = context.source
// const script = args.slice(1).join(' ');
const weather = require('weather-js')
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
weather.find({degreeType:args[0], search:args.slice(1).join(' ')}, function(err, result){
//"skytext" "feelslike" "humidity" "winddisplay"
//{search: args.join(' '), degreeType: 'F'}
source.sendFeedback([{text:`Location: `,color:'gray'},{text:`${result[0].location.name}`,color:'dark_green'}])
source.sendFeedback([{text:`Temperature: `,color:'gray'},{text:`${result[0].current.temperature}${result[0].location.degreetype}`,color:'dark_green'}])
source.sendFeedback([{text:'Date: ',color:'gray'},{text:result[0].current.date,color:'dark_green'}])
// console.log(JSON.stringify(result, null, 2));
source.sendFeedback([{text:`${result[0].current.skytext}`,color:'dark_green'}])
source.sendFeedback([{text:`Feels like `,color:'gray'},{text:`${result[0].current.feelslike}${result[0].location.degreetype}`,color:'dark_green'}])
source.sendFeedback([{text:'Humidity ',color:'gray'},{text:`${result[0].current.humidity}`,color:'dark_green'}])
source.sendFeedback([{text:'Wind Speed ',color:'gray'},{text:`${result[0].current.winddisplay}`,color:'dark_green'}])
//if(result[0].location.alert === ''){
//source.sendFeedback('There is no alerts!')
//}else{
source.sendFeedback(result[0].location.alert)
//}
})
}
}

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

@ -0,0 +1,30 @@
const CommandError = require('../CommandModules/command_error')
//const fetch = import("node-fetch");
module.exports = {
name: 'website',
trustLevel:0,
aliases:['web','websitedata','webdata'],
description:['check website data'],
usage:["<url"],
async execute (context) {
try{
const fetch = require("node-fetch");
const source = context.source
const bot = context.bot
const message = context.arguments.join(' ')
const args = context.arguments
if (!args && !args[0] && !args[1] && !args[2]) return
const response = await fetch(args[0]);
const body = await response.text();
bot.tellraw({text:body,color:'green'})
} catch(e) {
const bot = context.bot
const source = context.source
// source.sendFeedback({text:e.stack, color:'dark_red'})
source.sendFeedback({text:e.toString(), color:'dark_red'})
}
}
}

28
src/commands/wiki.js Normal file
View file

@ -0,0 +1,28 @@
const wiki = require('wikipedia') //
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'wiki',
description:['wikipedia'],
trustLevel: 0,
aliases:['wikipedia'],
usage:["<definition"],
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
try {
const page = await wiki.page(args.join(' '))
// source.sendFeedback({text:`${page.html()}`,color:'dark_gray'})
const summary = await page.intro();
source.sendFeedback({text:`${summary}`,color:'dark_gray'});
} catch (error) {
if(error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')"){
source.sendFeedback({text:'Definition not found!',color:'dark_red'})
}
// source.sendFeedback(error.toString());
}
}
}

65
src/default.js Normal file
View file

@ -0,0 +1,65 @@
{
module.exports = {
bots: [
{
host: "serveriphere",
username:username(),
version:"1.20.2",
reconnectDelay: 6000,
endcredits:false,
Console:{
enabled: false,
filelogging:false,
prefix:'c.',
},
commands: {
prefixes:
["!", "!", "!"] // are those the prefixes?
},
Core: {
customName:"corenamehere",
enabled: false,
interval:180000
},
discord: {
channelId: "discordchannelidhere",
invite: "discordinvitelinkhere",
commandPrefix: "!"
},
selfcare: {
vanished: false,
unmuted: false,
prefix: false,
cspy: false,
tptoggle:false,
skin:false,
gmc:false,
op:false,
nickname:false,
username:false,
god: false,
interval:500,
}
},
]
}
function username() {
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // remove sus characters like ` or like ( or whatever because it breaks whatever
let username = '';
for (let i = 0; i < 9; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
username += characters[randomIndex];
}
return username;
}
}

91
src/index.js Normal file
View file

@ -0,0 +1,91 @@
const CommandError = require('./CommandModules/command_error.js')
const util = require("util");
const createBot = require("./bot.js");
// TODO: Load a default config
const fs = require("fs");
const fileExist = require("./util/file-exists");
const path = require("path");
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
function load() {
//const config = require('./config.js')
require("dotenv").config();
const bots = [];
const core = config.Core
const commands = config.Commands;
const Console = config.console;
const tellrawtag = config.tellrawTag
const helptheme = config.helpTheme
const discord = config.Discord
const matrix = config.matrix
for (const options of config.bots) {
const bot = createBot(options);
bots.push(bot);
bot.bots = bots;
bot.Core = core;
bot.Commands = commands;
bot.Console = Console;
bot.Discord = discord;
bot.tellrawTag = tellrawtag;
bot.helpTheme = helptheme;
bot.matrix = matrix
bot.options.username;
bot.loadModule = (module) => module(bot, options);
for (const filename of fs.readdirSync(path.join(__dirname, "modules"))) {
try {
const module = require(path.join(__dirname, "modules", filename));
bot.loadModule(module);
} catch (error) {
console.log(
"Failed to load module",
filename,
":",
error,
);
}
}
bot.console.useReadlineInterface(rl);
try {
bot.on("error", console.error);
} catch (error) {
console.log(error.stack);
}
}
}
process.on("uncaughtException", (e) => {
console.log(e.stack)
});
async function checkConfig() {
if (!(await fileExist(path.join(__dirname, "config.js")))) {
console.error("Config not found! Creating a new Config from ");
await fs.copyFileSync(
path.join(__dirname, "default.js"),
path.join(__dirname, "config.js"),
);
}
config = require("./config.js");
load();
}
checkConfig();

0
src/logs/2024-03-27.txt Normal file
View file

0
src/logs/2024-03-28.txt Normal file
View file

0
src/logs/2024-03-29.txt Normal file
View file

5
src/main.sh Normal file
View file

@ -0,0 +1,5 @@
while true; do
echo "Starting FNFBoyfriendBot...."
node --trace-warnings .
sleep 1
done

6
src/midis/README.txt Normal file
View file

@ -0,0 +1,6 @@
a
m
o
g
u
s

BIN
src/midis/badpiggies.mid Normal file

Binary file not shown.

BIN
src/midis/ballistic.mid Normal file

Binary file not shown.

BIN
src/midis/hell.mid Normal file

Binary file not shown.

BIN
src/midis/manifest.mid Normal file

Binary file not shown.

34
src/modules/bruhify.js Normal file
View file

@ -0,0 +1,34 @@
const convert = require('color-convert')
function bruhify (bot) {
bot.bruhifyText = ''
let startHue = 0
const ChatMessage = require('prismarine-chat')(bot.options.version)
const timer = setInterval(() => {
if (bot.bruhifyText === '') return
let tag = 'bruhify'
let hue = startHue
const displayName = bot.bruhifyText
const increment = (360 / Math.max(displayName.length, 20))
const component = []
for (const character of displayName) {
const color = convert.hsv.hex(hue, 100, 100)
component.push({ text: character, color: `#${color}` })
hue = (hue + increment) % 360
}
if (!bot.options.Core.enabled){
bot.chat(ChatMessage.fromNotch(component).toMotd().replaceAll('§', '&'))
startHue = (startHue + increment) % 360
}else{
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`)
startHue = (startHue + increment) % 360
}
}, 100)
bot.on('end', () => {
// clearInterval(timer)
})
}
module.exports = bruhify

148
src/modules/chat.js Normal file
View file

@ -0,0 +1,148 @@
const loadPrismarineChat = require('prismarine-chat')
const kaboomChatParser = require('../chat/kaboom')
const creayunChatParser = require('../chat/creayun')
const fs = require('fs')
const chipmunkmodChatParser = require('../chat/chipmunkmod')
const chipmunkmodblackilykatverChatParser = require('../chat/chipmunkmodBlackilyKatVer')
const typetextChatParser = require('../chat/chatTypeText')
const typeemotetextChatParser = require('../chat/chatTypeEmote')
function tryParse (json) {
try {
return JSON.parse(json)
} catch (error) {
return { text: '' }
}
}
//what was changed??
function inject (bot) {
// const ChatMessage = require('prismarine-chat')
bot.on('registry_ready', registry => {
ChatMessage = loadPrismarineChat(registry)
})
bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser]
bot.on('packet.profileless_chat', packet => {
const message = tryParse(packet.message)
const sender = tryParse(packet.name)
bot.emit('profileless_chat', {
message,
type: packet.type,
sender
})
bot.emit('message', message)
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
})
// Ignores command set messages
//chat.type.text
//chat.type.announcement
//chat.type.emote
//packet.chatType_
bot.on('packet.player_chat', packet => {
const unsigned = tryParse(packet.unsignedChatContent)
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid})
const message = tryParse(packet.content)
bot.emit('message', unsigned)
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine})
})
bot.getMessageAsPrismarine = message => {
try {
if (ChatMessage !== undefined) {
return new ChatMessage(message)
}
} catch (error) {
console.error(error); // Log any errors that occur during object creation
}
return undefined;
}
bot.on('packet.system_chat', packet => {
const message = tryParse(packet.content)
if (message.translate === 'advMode.setCommand.success') return // Ignores command set messages
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
if (packet.isActionBar) {
return
}
bot.emit('message', message)
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
})
/*bot.on('message', async (chatMessage) => {
if (typeof chatMessage.translate === 'string' && chatMessage.translate.startsWith('advMode.')) return
console.log(chatMessage.toAnsi())
*/
function tryParsingMessage (message, data) {
let parsed
for (const parser of bot.chatParsers) {
parsed = parser(message, data)
if (parsed) break
}
if (!parsed) return
bot.emit('parsed_message', parsed)
}
bot.getMessageAsPrismarine = message => {
try {
if (ChatMessage !== undefined) {
return new ChatMessage(message)
}
} catch {}
return undefined
}
bot.chat = message => {
const acc = 0
const bitset = Buffer.allocUnsafe(3)
bitset[0] = acc & 0xFF
bitset[1] = (acc >> 8) & 0xFF
bitset[2] = (acc >> 16) & 0xFF
bot._client.write('chat_message', {
message,
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
}
bot.command = command => {
bot._client.write('chat_command', {
command,
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
}
bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here?
}
module.exports = inject

View file

@ -0,0 +1,101 @@
const CommandSource = require("../CommandModules/command_source");
const CommandError = require("../CommandModules/command_error");
//can i change the var?
function chat_command_handler(bot) {
let ratelimit = 0
bot.on("parsed_message", (data) => {
if (data.type !== "minecraft:chat") return;
const prefixes = bot.Commands.prefixes;
prefixes.map((prefix) => {
const plainMessage = bot
.getMessageAsPrismarine(data.contents)
?.toString();
if (!plainMessage.startsWith(prefix)) return;
const command = plainMessage.substring(prefix.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,matrix:false },);
source.sendFeedback = (message) => {
const prefix = {
translate: "%s%s%s \u203a ",
bold: false,
color: "dark_gray",
with: [
{
color: "dark_purple",
text: "FNF",
bold: true,
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: "#00FFFF",
text: "Boyfriend",
bold: true,
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] },
],
};
bot.tellraw(["", prefix, message]);
};
try{
ratelimit++
setTimeout(() => {
ratelimit--
}, 1000)
if (ratelimit > 3) { // ,.
if(!bot.options.Core.enabled){
bot.chat('&4You are using commands to fast!')
}else {
source.sendFeedback({text:'You are using commands to fast!',color:'dark_red'})
// this isn't blocking running the command you know that right?
}
} else {
bot.commandManager.executeString(source, command);
}//oh real
//can i change the variable name so its name isnt confusing?
}catch(e){
console.log(e.stack)
//then where to move this?
};
});
})//
}
module.exports = chat_command_handler;

7
src/modules/chatdelay.js Normal file
View file

@ -0,0 +1,7 @@
function chatDelay (bot,options, ms){
bot.chatDelay = function delay(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
}
module.exports = chatDelay;

101
src/modules/command_core.js Normal file
View file

@ -0,0 +1,101 @@
const nbt = require('prismarine-nbt');
async function command_core (bot, options) {
bot.core = {
// what you think im doing? look at line 17
area: {
start: bot.Core.area.start ?? { x: 0, y: 0, z: 0 },
end: bot.Core.area.end ?? { x: 15, y: 0, z: 15 }
},
position: null,
currentBlockRelative: { x: 0, y: 0, z: 0 },
refill () {
const pos = bot.core.position
const { start, end } = bot.core.area
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${bot.Core.JSON} destroy`)
},
move (pos = bot.position) {
bot.core.position = {
x: Math.floor(pos.x / 16) * 16,
y: 0,
z: Math.floor(pos.z / 16) * 16
}
bot.core.refill()
},
currentBlock () {
const relativePosition = bot.core.currentBlockRelative
const corePosition = bot.core.position
if (!corePosition) return -1
return { x: relativePosition.x + corePosition.x, y: relativePosition.y + corePosition.y, z: relativePosition.z + corePosition.z }
},
incrementCurrentBlock () {
const relativePosition = bot.core.currentBlockRelative
const { start, end } = bot.core.area
relativePosition.x++
if (relativePosition.x > end.x) {
relativePosition.x = start.x
relativePosition.z++
}
if (relativePosition.z > end.z) {
relativePosition.z = start.z
relativePosition.y++
}
if (relativePosition.y > end.y) {
relativePosition.x = start.x
relativePosition.y = start.y
relativePosition.z = start.z
}
},
run (command) {
const location = bot.core.currentBlock()
if (!location) return
if (!bot.options.Core.enabled) {
bot.command(command.substring(0,255))
}else{
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
bot.core.incrementCurrentBlock()
// added .substring(0, 32767) so it won't kick the bot if the command is too long.
}
},
}
/*
bot.on('parsed_message', data => {
if (data.type !== 'minecraft:chat') return
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString()
if (plainMessage.startsWith(':3')) {
bot.chat(' :3')
} return
})
*/
if (!bot.options.Core.enabled) 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()
}, bot.options.Core.interval)
bot.on('end', (bot) => {
clearInterval(timer)
})
})
}
module.exports = command_core

View file

@ -0,0 +1,25 @@
function command_loop_manager (bot, options) {
bot.cloop = {
list: [],
add (command, interval, list = true) {
const id = setInterval(() => bot.core.run(command), interval)
const thingsToPush = { id, interval, command, list }
bot.cloop.list.push(thingsToPush)
return thingsToPush
},
remove (item) {
clearInterval(bot.cloop.list[item].id)
bot.cloop.list.splice(item, 1)
},
clear () {
for (const interval of bot.cloop.list) clearInterval(interval.id)
bot.cloop.list = []
}
}
}
module.exports = command_loop_manager

View file

@ -0,0 +1,197 @@
const fs = require("fs");
const path = require("path");
const CommandError = require("../CommandModules/command_error.js");
const time = new Date().toLocaleTimeString("en-US", {timeZone: "America/CHICAGO",});
const date = new Date().toLocaleDateString("en-US", {timeZone: "America/CHICAGO",});
const {EmbedBuilder } = require('discord.js')
/*async*/ function command_manager(bot, options) {
bot.commandManager = {
commands: {},
commandlist: [],
execute(source, commandName, args, message) {
const command = this.getCommand(commandName.toLowerCase());
const player = source?.player?.profile?.name;
const uuid = source?.player?.uuid;
try {
if(source.sources.console && !source.sources.discord){
if (!command || !command.execute) {
bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.options.Console.prefix}help" for help`,color:'dark_red'})
}
}else if(source.sources.discord && !source.sources.console) {
if (!command || !command.execute) {
const Embed = new EmbedBuilder()
.setColor('#FF0000')
.setTitle('Unknown Command')
.setDescription(`Unknown Command ${commandName}. type "${bot.discord.commandPrefix}help" for help`)
bot.discord.channel.send({ embeds: [Embed] })
}
}else if(!source.sources.discord && !source.sources.console) {
if (!bot.options.Core.enabled){
if (!command || !command.execute) {
throw new CommandError(`Unknown command ${commandName}. Type "${bot.Commands.prefixes[0]}help" for help`)
}
}else{
if (!command || !command.execute) { // bot.options.command.prefixes[0]
throw new CommandError({ // sus
translate: `Unknown command %s. Type "${bot.Commands.prefixes[0]}help" for help or click on this for the command`,
/*
with: [commandName],
clickEvent: 'https://discord.gg'
? {/
*/
with: [commandName],
clickEvent:'https://discord.gg'
? {
action: "suggest_command",
value: `${bot.Commands.prefixes[0]}help`,
}
: undefined,
}); //ohio
}
}
}
const event = bot?.discord?.Message
const roles = event?.member?.roles?.cache
if (command?.trustLevel > 0) {
if(command?.trustLevel === 1 && !source?.sources?.discord && !source?.sources?.console){
const hash = `${args[0]}`
if(args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
} else if (command.trustLevel === 1 && source.sources.discord && !source.sources.console) {
const hasRole = roles?.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner')
if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' })
}
bot?.hashing?.updateHash();
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 || bot.hashing.hash
}\x1b[0m]`,
);
};
bot.console.discordHash = 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.hashing.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(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){
const owner = `${args[0]}`
if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
if(owner === bot.hash && owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}])
if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}])
} else if (command.trustLevel === 2 && source.sources.discord && !source.sources.console) {
// const events = source.discordMessageEvent
// const roless = events?.member?.roles?.cache
const hasRole = roles?.some(role => role.name === 'FNFBoyfriendBot Owner')
if (!hasRole) throw new CommandError({ translate: 'You are the Owner!' })
}
if (command.trustLevel === 3 && !source?.sources?.console)
throw new CommandError({translate: "This command can only be executed via console",color: "blue",});
}
return command?.execute({ bot, source, arguments: args });
} catch (error) {
const now = new Date().toLocaleString("en-US", {
timeZone: "America/CHICAGO",
});
bot.console.warn(error.stack);
if (!bot.options.Core.enabled){
if (error instanceof CommandError)
bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&'))
else bot.chat(bot.getMessageAsPrismarine('an error has occured please check console')?.toMotd().replaceAll('§','&'))
} else if(!source.sources.discord && !source.sources.console) {
if (error instanceof CommandError)
source.sendError(error._message)
else source.sendError({
translate: "An Error has occured because the bot shot itself 🔫",
color: "red",
hoverEvent: { action: "show_text", contents: String(error.stack) },
});
}
//
else if (source.sources.discord && !source.sources.console) {
const Embed = new EmbedBuilder()
.setColor('#FF0000')
.setTitle('Uh oh i went to get the 🥛 give me :cancer: years to come back with it')
.setDescription(`\`\`\`${error}\`\`\``)
bot.discord.channel.send({ embeds: [Embed] })
}
}
},
executeString(source, command) {
const [commandName, ...args] = command.split(" ");
return this.execute(source, commandName, args)
},
register(command) {
this.commands[command.name] = command;
if (command.aliases) {
command.aliases.map((a) => (this.commands[a] = command));
}
},
getCommand(name) {
return this.commands[name];
},
getCommands() {
return Object.values(this.commands);
},
};
//
commandlist = [];
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
try {
const command = require(path.join(__dirname, "../commands", filename));
bot.commandManager.register(command);
bot.commandManager.commandlist.push(command);
} catch (error) {
console.error("Failed to load command", filename, ":", error);
}
if (process.env["anti-skid"] !== "amogus is sus") {
//process.exit(0);
}
}
}
module.exports = command_manager;

201
src/modules/console.js Normal file
View file

@ -0,0 +1,201 @@
const CommandSource = require("../CommandModules/command_source");
const prismarine = require('prismarine-chat')('1.20.2')
function Console(bot, options, context, source) {
let ratelimit = 0
bot.console = {
readline: null,
username: bot.username,
consoleServer: "all",
//bot._client.username,
useReadlineInterface(rl) {
this.readline = rl;
rl.on("line", (line) => {
if (
bot.options.serverName !== this.consoleServer &&
this.consoleServer !== "all"
)
return;
if (line.startsWith(`${bot.Console.prefix}`)) {
return bot.commandManager.executeString(
bot.console.source,
line.substring(2),
//null
`${process.env["FNFBoyfriendBot_Owner_key"]}`,
);
}
if (line === ",kill") process.exit();
if (line === ",reconnect") bot._client.end();
//probably gotta somehow have it get its username
//tried that already didnt work just errored
//profile or smh :shrug:
// what does it have to be
if (line.startsWith("")) {
if(!bot.options.Core.enabled){
return bot.commandManager.executeString(
bot.console.source,
"echo " + line.substring(0),
)
}else {
return bot.commandManager.executeString(
bot.console.source,
"console " + line.substring(0),
);
}
}
//bot.commandManager.executeString(bot.console.source, line)
});
const now = new Date().toLocaleString("en-US", {
timeZone: "America/CHICAGO",
});
const time = new Date().toLocaleTimeString("en-US", {
timeZone: "America/CHICAGO",
});
const date = new Date().toLocaleDateString("en-US", {
timeZone: "America/CHICAGO",
});
// const source = context.source
const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `;
function log(...args) {
rl.output.write("\x1b[2K\r");
console.log(args.toString());
rl._refreshLine();
}
bot.console.warn = function (error) {
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
};
bot.console.error = function (error) {
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
};
bot.console.info = function (message) {
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi());
};
bot.console.log = function (message, ansi) {
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message);
};
/* const ansimap = {
0: '\x1b[0m\x1b[30m',
1: '\x1b[0m\x1b[34m',
2: '\x1b[0m\x1b[32m',
3: '\x1b[0m\x1b[36m',
4: '\x1b[0m\x1b[31m',
5: '\x1b[0m\x1b[35m',
6: '\x1b[0m\x1b[33m',
7: '\x1b[0m\x1b[37m',
8: '\x1b[0m\x1b[90m',
9: '\x1b[0m\x1b[94m',
a: '\x1b[0m\x1b[92m',
b: '\x1b[0m\x1b[96m',
c: '\x1b[0m\x1b[91m',
d: '\x1b[0m\x1b[95m',
e: '\x1b[0m\x1b[93m',
f: '\x1b[0m\x1b[97m',
r: '\x1b[0m',
l: '\x1b[1m',
o: '\x1b[3m',
n: '\x1b[4m',
m: '\x1b[9m',
k: '\x1b[6m'
}*/
const isConsole = bot.username ? true : false;
bot.console.source = new CommandSource(bot.username, {
console: true,
discord: false,
});
bot.console.source.sendFeedback = (message) => {
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi();
if (!bot.options.Console) return;
bot.console.info(ansi);
};
bot.on("parsed_message", (data) => {
if (data.type !== "minecraft:chat") return;
const plainMessage = bot
.getMessageAsPrismarine(data.contents)
?.toString();
if (plainMessage.includes("frog")) {
bot.chat("Man I Love Frogs");
}
return;
});
bot.on("message", (message) => {
function log(...args) {
rl.output.write("\x1b[2K\r");
console.log(args.toString());
rl._refreshLine();
}
const time = new Date().toLocaleTimeString("en-US", {
timeZone: "America/CHICAGO",
});
const date = new Date().toLocaleDateString("en-US", {
timeZone: "America/CHICAGO",
});
const prefixy = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `;
bot.console.logs = function (message, ansi) {
log(prefixy + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message);
};
const lang = require(`../util/language/lolus.json`);
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang);
const string = bot.getMessageAsPrismarine(message)?.toString(lang);
const now = new Date().toLocaleString("en-US", {
timeZone: "America/CHICAGO",
});
const time2 = new Date().toLocaleTimeString("en-US", {
timeZone: "America/CHICAGO",
});
const date2 = new Date().toLocaleDateString("en-US", {
timeZone: "America/CHICAGO",
});
// if (!bot.options.Console.input) return;
if (!bot.options.Console.enabled) return;
ratelimit++
setTimeout(() => {
ratelimit--
}, 1000)
if (ratelimit > bot.options.Console.ratelimit) { // ,.
// bot.console.logs = function () {}
bot._client.end("Anti spam :3")
} else {
//bot.console.log(`${ansi}`);
//oh real
//can i change the variable name so its name isnt confusing?
bot.console.log(`${ansi}`);
// logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
if (bot.console && bot.Console.filelogger) {
bot.console.filelogger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
}//nothing is logging to the file
};
})
}
}
}
module.exports = Console;

265
src/modules/discord.js Normal file
View file

@ -0,0 +1,265 @@
// TODO: Maybe move client creation elsewhere
const { escapeMarkdown } = require('../util/escapeMarkdown')
const { Client, GatewayIntentBits } = require('discord.js')
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
const CommandSource = require('../CommandModules/command_source')
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
const util = require('util')
client.login(process.env.discordtoken)
function discord (bot, options) {
if(!bot.Discord.enabled) return
if (!options.discord?.channelId) {
bot.discord = { invite: options.discord?.invite }
return
}
const ChatMessage = require('prismarine-chat')(bot.options.version)
bot.discord = {
client,
channel: undefined,
invite: bot.Discord.invite || undefined,
commandPrefix: bot.Discord.commandPrefix
}
client.on('ready', (context) => {
//setMaxListeners(Infinity)
// client.setMaxListeners(25)
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
//bot.discord.channel.send(`\`\`\`\nStarting ${process.env["buildstring"]}......\n\`\`\``)
// bot.discord.channel.send(`\`\`\`\nFoundation: ${process.env["FoundationBuildString"]}\n\`\`\``)
// bot.discord.channel.send(`\`\`\`\nSuccessfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}\n\`\`\``)
bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port + '``')
bot.discord.channel.send('``Version:' + bot.options.version +'``')
bot.discord.channel.send('``Username:' + bot.options.username + '``')
bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`)
client.user.setPresence({
activities: [{ name: `${bot.Discord.presence.name}`, type: bot.Discord.presence.type }],
status: `${bot.Discord.presence.status}`
});
})
// I feel like this is a modified version of ChomeNS Bot's discord plugin (the js one ofc) lol - chayapak
let discordQueue = []
setInterval(() => {
if (discordQueue.length === 0) return
try {
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
} catch (error) {
//ansi real
bot.console.error(error.stack)
}//im pretty sure the discord code is as old as the discord relay prototypes lmao
//sus
discordQueue = []
}, 2000)
//const ansi = bot.getMessageAsPrismarine(message).toAnsi(lang).replaceAll('``\`\`\u200b\ansi\n\`\`\u001b[9', '\u001b[3\n`\`\`')
/* bot.on('message', (message) => {
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
const discordMsg = cleanMessage
.replaceAll('@', '@\u200b')
.replaceAll('http', 'http\u200b')
.replaceAll('\u001b[9', '\u001b[3')
queue += '\n' + discordMsg
})
*/
function sendDiscordMessage (message) {
discordQueue.push(message)
}
/*
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
const discordMsg = cleanMessage
.replaceAll('@', '@\u200b')
.replaceAll('http', 'http\u200b')
.replaceAll('\u001b[9', '\u001b[3')
*/
//`\`\`\`\n \n\`\`\`
function sendComponent (message) {
const lang = require(`../util/language/lolus.json`)
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang).replaceAll('```\u001b[9```' + '```\u001b[3```')// I have a function to fix ansi :shrug:
/*
would it be better to do
```
message1
message2
message3...
```
and not
```
message1
```
````
message2
````
````
message3...
```
*/
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})//real
try {
sendDiscordMessage(fixansi(ansi.replaceAll('`', '`\u200b')))
//'```ansi\n' + fixansi(ansi.replaceAll('\u200b').substring(0, 1983)) + '\n```'
} catch (e) {
//i was gonna try to get it to debug via console
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
sendDiscordMessage(e.message)
//already tried ansi
}//send isnt defined
} // its still doing the ansi crap
//;/
//wait a min it shows smh about unable to read properties of undefined (reading 'send') in the console or smh on startup
// its the messages it sending read lines 69 to 86
// i see
bot.on('message', message => {
sendComponent(message)
})
function messageCreate (message) {
bot.discord.Message = message
if (message.author.id === bot.discord.client.user.id) return
if (message.channel.id !== bot.discord.channel.id) return
//
if (message.content.startsWith(bot.discord.commandPrefix)) { // TODO: Don't hardcode this
const source = new CommandSource({ profile: { name: message?.member?.displayName } }, { discord: true, console: false }, false, message)
source.sendFeedback = message => {
sendComponent(message)
//console.log(message.content)
}
bot.commandManager.executeString(source, message.content.substring(bot.discord.commandPrefix.length))
return
}
if(!bot.options.Core.enabled){
bot.chat(`&8[&5FNF&bBoyfriend&4Bot &9Discord&8] ${message.member.displayName.replaceAll('\xa7', '&')}&f ${message.content.replaceAll('\xa7', '&')}`)
}else{
bot.tellraw({
translate: '[%s] %s \u203a %s',
with: [
{
translate: '%s%s%s %s',
bold:false,
with: [
{
text: 'FNF',
bold: false,
color: 'dark_purple'
},
{
text: 'Boyfriend',
bold: false,
color: 'aqua'
},
{
text: 'Bot',
bold: false,
color: 'dark_red'
},
{
text: 'Discord',
bold: false,
color: 'blue'
}
],
clickEvent: bot.discord.invite ? { action: 'open_url', value: bot.discord.invite } : undefined,
hoverEvent: { action: 'show_text', contents: 'Click to join the discord' }
},
{ text: message?.member?.displayName },
message.content
]
})
}
}
client.on('messageCreate', messageCreate)
// bot.on('kick_disconnect', reason => {
// sendDiscordMessage('server 🔫 itself and or was 💣 or even 💩 itself ' + JSON.stringify(reason))
//sendDiscordMessage(reason)
// })
// bot.on('disconnect', reason => {
// sendDiscordMessage(JSON.stringify(reason))
//sendDiscordMessage(reason)
//})
// bot.on('packet.login', (data) => {
// sendDiscordMessage(`Connecting to ${bot.options.host}:${bot.options.port}`)
// })
// bot.on('end', reason => {
// sendDiscordMessage(JSON.stringify(reason))
//sendDiscordMessage(reason)
// })
// bot.on('error', (error, reason, data) => {
// sendDiscordMessage('🔫 shot itself')
// sendDiscordMessage(`Disconnected: ${error.stack}`)
//sendDiscordMessage(reason)
// })
process.on("uncaughtException", (e) => {
// sendDiscordMessage("uncaught " + e.stack);
});
/*bot.on('end', (reason, event) => {
sendDiscordMessage('event:' + event)
sendDiscordMessage('Reason:' + util.inspect(reason))
})*/
//client.on('end', reason => { bot.emit('end', reason)
//client.on('keep_alive', ({ keepAliveId }) => {
//bot.emit('keep_alive', { keepAliveId })
/* bot.console.info(
`Disconnected from ${bot.server.host} (${event} event): ${util.inspect(reason)}`
)
channel.send(`Disconnected: \`${util.inspect(reason)}\``)
*/
function fixansi(message) {
const ansilist = {
"\x1B\[93m": "\x1B[33m", // Yellow
"\x1B\[96m": "\x1B[36m", // Blue
"\x1B\[94m": "\x1B[34m", // Discord Blue
"\x1B\[90m": "\x1B[30m", // Gray
"\x1B\[91m": "\x1B[31m", // Light Red
"\x1B\[95m": "\x1B\[35m", // Pink
"\x1B\[92m": "\x1B\[32m", // Green
"\x1B\[0m": "\x1B\[0m\x1B\[37m", // White
"\x1B\[97m": "\x1B\[0m\x1B\[37m", // White
};
let i = message;
for (const ansi in ansilist) {
if (ansilist.hasOwnProperty(ansi)) {
i = i.replace(new RegExp(escapeRegExpChars(ansi), 'g'), ansilist[ansi]);
function escapeRegExpChars(text) {
return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
}
}
return i;
}
}
//
module.exports = discord

120
src/modules/hashing.js Normal file
View file

@ -0,0 +1,120 @@
// * Not real hashing
const crypto = require('crypto')
const ownerkey = process.env['FNFBoyfriendBot_Owner_key']
const trustedkey = process.env['FNFBoyfriendBot_key']
function hashgen (bot) {
bot.hash = ''
bot.owner = ''
bot.updatehashes = update
let hash
let owner
let interval = setInterval(() => {
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + trustedkey).digest('hex').substring(0, 16)
owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerkey).digest('hex').substring(0, 16)
bot.hash = hash
bot.owner = owner
}, 2000)
function update() {
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + trustedkey).digest('hex').substring(0, 16)
owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerkey).digest('hex').substring(0, 16)
bot.hash = hash
bot.owner = owner
//this should work right?
/*
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
*/
// ok
/*
bot.on('end', () => {
if (interval) clearInterval(interval)
})
*/
}
bot.on('parsed_message', data => {
if (data.type !== 'minecraft:chat') return
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString()
if (plainMessage.startsWith('fnf sky')) {
bot.chat('sky the fangirl!?!? i simp for her :)')
} return
})
let _hash = generateHash()
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"})
const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"})
//bot.hashing = ''
bot.hashing = {
_hash: crypto.randomBytes(4).toString('hex').substring(0,16),
//const key = process.env['FNFBoyfriendBotX_key']
get hash () { return this._hash },
set hash (value) {
this._hash = value
this.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
},
//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
generateHash () {
return crypto.randomBytes(4).toString('hex').substring(0, 16)
},
updateHash () {
this.hash = this.generateHash()
}
}
bot?.discord?.client?.on('ready', () => {
//bot.discord.client?.setMaxListeners(25)
bot.hashing.discordChannel = bot?.discord?.client?.channels?.cache?.get('1188677777336057987')
//bot.hashing.discordChannel?.send()
bot?.hashing?.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
})// + bot.hashing.hash
}//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
//nvm what?
function generateHash () {
return crypto.randomBytes(4).toString('hex')
}
module.exports = hashgen
/* const crypto = require('crypto')
let _hash = generateHash()
function inject (bot) {
bot.hashing = {
_hash: crypto.randomBytes(4).toString('hex').substring(0,16),
//const key = process.env['FNFBoyfriendBotX_key']
get hash () { return this._hash },
set hash (value) {
this._hash = value
this.discordChannel?.send('```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ${value}` + '\n```')
},
//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
generateHash () {
return crypto.randomBytes(4).toString('hex').substring(0, 16)
},
updateHash () {
this.hash = this.generateHash()
}
}
bot.discord.client?.on('ready', () => {
bot.hashing.discordChannel = bot.discord.client.channels.cache.get('1120122720001208390')
bot.hashing.discordChannel?.send('```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
})// + bot.hashing.hash
}//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
//nvm what?
function generateHash () {
return crypto.randomBytes(4).toString('hex')
}
*/

29
src/modules/logger.js Normal file
View file

@ -0,0 +1,29 @@
function consolefilelogger (bot, options, message) {
const fs = require('fs')
const path = require('path')
const currentDate = new Date();
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')}`;
const logFolder = path.join(__dirname, '../logs'); // idfk
const logFileName = `${timestamp}.txt`;//why is it not trying to find the folder tf
// i am having a stroke from this
if (!bot.Console.filelogging) return
try {
if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it
fs.mkdirSync(logFolder);//idfk
}//oh wait
} catch (e) {} // prevent it from throwing a ohio exception mabe mabe
const logFilePath = path.join(logFolder, logFileName);
const logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
const toWrite = `${message}`//wtf
if (!bot.Console.filelogging) return // instead of using bot why not just use options cause you already defined it
// if (toFile) logStream.write(toWrite + '\n');
bot.console.filelogger = function (message) {//.
logStream.write(message + '\n'); // toFile is not defined
};
//if (toConsole) console.log(toWrite);
};//tf
module.exports = consolefilelogger

158
src/modules/matrix.js Normal file
View file

@ -0,0 +1,158 @@
const matrix = require('matrix-js-sdk')
const CommandSource = require('../CommandModules/command_source')
const htmlStringify = require('../util/html.js')
const client = matrix.createClient({
baseUrl: "https://matrix.chipmunk.land",
accessToken: process.env["matrixtoken"],
userId:'@fnfboyfriendbot:chipmunk.land',
})
function inject (bot, options) {
if (!bot.matrix?.enabled) return
bot.matrix = {
// client: options.matrix.client ?? matrix.createClient(client),
//client:options.matrix.client ?? matrix.createClient({baseUrl: "https://matrix.chipmunk.land:", accessToken: process.env["matrixtoken"], userId:'@fnfboyfriendbot:chipmunk.land'}),
client,
roomId: options.matrix.roomId,
commandPrefix: options.matrix.commandPrefix || undefined,
inviteUrl: String(options.matrix.inviteUrl) || undefined
}
const startTime = Date.now()
// bot.on('chat_html', async html => {
// sendMessage(html)
//})
bot.on('message', message => {
const html = htmlStringify(message, { lang: bot.registry.language ?? {} })
sendMessage(html)
})
const matrixPrefix = {
text: 'Matrix',
hoverEvent: {
action: 'show_text',
contents: 'Click to copy the invite link for the Matrix space to your clipboard!'
},
clickEvent: {
action: 'copy_to_clipboard', // * Minecraft, and Java's URI class in general, seem to hate `#`, so open_url does not work.
value: 'amogus'//bot.matrix.inviteUrl
}
}
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
if (event.getRoomId() !== bot.matrix.roomId || event.getType() !== 'm.room.message' || event.getTs() < startTime || event.sender.userId === bot.matrix.client.getUserId()) return
const content = event.getContent()
const permissionLevel = event.sender.powerLevelNorm
let message = content.body
const senderText = {
text: event.sender.rawDisplayName || event.sender.name || event.sender.userId,
hoverEvent: {
action: 'show_text',
contents: [toString(event.sender.userId), '\nPermission Level: ', toString(permissionLevel), '\n\nClick to copy the User ID']
},
clickEvent: {
action: 'copy_to_clipboard',
value: toString(event.sender.userId)
}
}
if (content.url) {
message = {
text: '[Attachment]',
// ...bot.styles.primary,
clickEvent: {
action: 'open_url',
value: bot.matrix.client.mxcUrlToHttp(content.url)
}
}
} else if (message.startsWith('!')) {
const source = new CommandSource({ console:false,discord:false,matrix:true })
bot.commandManager.execute(message.substring('!'), source)
source.sendFeedback = message => {
sendMessage(message)
//console.log(message.content)
//bot.discord.Message = this
}
return
}
bot.tellraw({
translate: '[%s] %s \u203a %s',
with: [
{
translate: '%s%s%s %s',
bold:false,
with: [
{
text: 'FNF',
bold: false,
color: 'dark_purple'
},
{
text: 'Boyfriend',
bold: false,
color: 'aqua'
},
{
text: 'Bot',
bold: false,
color: 'dark_red'
},
{
text: 'Matrix',
bold: false,
color: '#0dbd8b'
}
],
clickEvent: bot.matrix.inviteUrl ? { action: 'open_url', value: bot.matrix.inviteUrl } : undefined,
hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' }
},
{ text: String(event.sender.rawDisplayName || event.sender.name || event.sender.userId) },
message
]
})
// bot.fancyMsg(matrixPrefix, senderText, message)
})
let dequeuingMessages = false
let queue = []
async function sendMessage (html) {
queue.push(html)
if (dequeuingMessages) return
dequeuingMessages = true
while (queue.length !== 0) {
const html = queue.join('<br>')
queue = []
await _sendMessage(html)
}
dequeuingMessages = false
}
async function _sendMessage (html) {
const content = {
msgtype: 'm.text',
format: 'org.matrix.custom.html',
body: html,
formatted_body: html,
'm.mentions': {}
}
try{
await bot.matrix.client.sendEvent(bot.matrix.roomId, `m.room.message`, content)
} catch (error) {
console.error('Unable to send Matrix message:', error)
}
}
function sendFeedback (message, sendFeedback) {
// const html = bot.getMessageAsPrismarine(text, { lang: bot.registry.language })?.toAnsi()
const html = htmlStringify(message, { lang: bot.registry.language ?? {} })
sendMessage(html)
}
}
module.exports = inject

53
src/modules/memusage.js Normal file
View file

@ -0,0 +1,53 @@
function memusage(bot, options) {
const clamp = require("../util/clamp");
const bossbarName = "memusage";
const os = require("os");
let enabled = false;
let tag = "FNFBoyfriendBotMemusage";
bot.memusage = {
on() {
enabled = true;
},
off() {
enabled = false;
bot.core.run(`minecraft:bossbar remove ${bossbarName}`);
},
};//
const interval = setInterval(() => {
if (!enabled) return;
/* const component = {
text: `Mem used ${Math.floor(
process.memoryUsage().heapUsed / 1000 / 1000,
)} MiB / ${Math.floor(
process.memoryUsage().heapTotal / 1000 / 1000,
)} MiB. `,
color: "dark_gray",
};*/
const component = {
translate: `%s`,
color: "gray",
bold: false,
with: [{ text: `Memory used ${Math.floor(
process.memoryUsage().heapUsed / 1000 / 1000,
)} MiB / ${Math.floor(
process.memoryUsage().heapTotal / 1000 / 1000,
)} MiB`, color: "green" }],
};
//process.cpuUsage
// bot.core.run(`minecraft:bossbar add ${bossbarName} ""`);
// bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`);
// bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`);
// bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`);
// bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`);
// bot.core.run(
// `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`,
// );
// bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`);
bot.tellraw(component)
}, 100); //process.memoryUsage().heapUsed /1024 / 1024
}
module.exports = memusage;

205
src/modules/music.js Normal file
View file

@ -0,0 +1,205 @@
const path = require('path')
const { Midi } = require('@tonejs/midi')
const { convertMidi } = require('../util/midi_converter')
const convertNBS = require('../util/nbs_converter')
const parseTXTSong = require('../util/txt_song_parser')
const fs = require('fs')
const soundNames = {
harp: 'minecraft:block.note_block.harp',
basedrum: 'minecraft:block.note_block.basedrum',
snare: 'minecraft:block.note_block.snare',
hat: 'minecraft:block.note_block.hat',
bass: 'minecraft:block.note_block.bass',
flute: 'minecraft:block.note_block.flute',
bell: 'minecraft:block.note_block.bell',
guitar: 'minecraft:block.note_block.guitar',
chime: 'minecraft:block.note_block.chime',
xylophone: 'minecraft:block.note_block.xylophone',
iron_xylophone: 'minecraft:block.note_block.iron_xylophone',
cow_bell: 'minecraft:block.note_block.cow_bell',
didgeridoo: 'minecraft:block.note_block.didgeridoo',
bit: 'minecraft:block.note_block.bit',
banjo: 'minecraft:block.note_block.banjo',
pling: 'minecraft:block.note_block.pling'
}
function inject (bot) {
bot.music = function () {}
bot.music.song = null
bot.music.loop = 0
bot.music.queue = []
let time = 0
let startTime = 0
let noteIndex = 0
bot.music.skip = function () {
if (bot.music.loop === 2) {
bot.music.queue.push(bot.music.queue.shift())
bot.music.play(bot.music.queue[0])
} else {
bot.music.queue.shift()
}
resetTime()
}
/*
try {
if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it
fs.mkdirSync(logFolder);//idfk
}//oh wait
} catch (e) {
*/
try {
if(!fs.existsSync('./midis')){
fs.mkdirSync('./midis')
}
}catch(e){
console.log(e)
}
const bossbarName = 'music' // maybe make this in the config?
const selector = '@a[tag=!nomusic]'
const interval = setInterval(async () => {
if (!bot.music.queue.length) return
bot.music.song = bot.music.queue[0]
time = Date.now() - startTime
/*
// bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
// is spamming commands in core as a self care a good idea?
// btw this is totallynotskidded™ from my song bot except the bossbarName (above)
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) // is setting the name to "" as a placeholder a good idea?
bot.core.run(`minecraft:bossbar set ${bossbarName} players ${selector}`)
bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(toComponent())}`)
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) // should i use purple lol
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(time)}`)
bot.core.run(`minecraft:bossbar set ${bossbarName} max ${bot.music.song.length}`)
*/
bot.core.run(`title @a actionbar ${JSON.stringify(toComponent())}`)
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
while (bot.music.song?.notes[noteIndex]?.time <= time) {
const note = bot.music.song.notes[noteIndex]
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
// bot.core.run(`playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
noteIndex++
if (noteIndex >= bot.music.song.notes.length) {
bot.tellraw([
{
text: 'Finished playing '
},
{
text: bot.music.song.name,
color: 'gold'
}
])
if (bot.music.loop === 1) {
resetTime()
return
}
if (bot.music.loop === 2) {
resetTime()
bot.music.queue.push(bot.music.queue.shift())
bot.music.play(bot.music.queue[0])
return
}
bot.music.queue.shift()
bot.music.song = null // useless?
if (!bot.music.queue[0]) {
bot.music.stop()
return
}
if (bot.music.queue[0].notes.length > 0) {
if (bot.music.queue.length !== 1) resetTime()
bot.music.play(bot.music.queue[0])
return
}
}
}
}, 100)
bot.on('end', () => {
clearInterval(interval)
})
bot.music.load = async function (buffer, fallbackName = '[unknown]') {
let song
switch (path.extname(fallbackName)) {
case '.nbs':
song = convertNBS(buffer)
if (song.name === '') song.name = fallbackName
break
case '.txt':
song = parseTXTSong(buffer.toString())
song.name = fallbackName
break
default:
// TODO: use worker_threads so the entire bot doesn't freeze (for example parsing we are number 1 black midi)
// eslint-disable-next-line no-case-declarations
const midi = new Midi(buffer)
song = convertMidi(midi)
if (song.name === '') song.name = fallbackName
break
}
return song
}
bot.music.play = function (song) {
if (bot.music.queue.length === 1) resetTime()
}
bot.music.stop = function () {
bot.music.song = null
bot.music.loop = 0
bot.music.queue = []
resetTime()
}
function resetTime () {
time = 0
startTime = Date.now()
noteIndex = 0
bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk
}
function formatTime (time) {
const seconds = Math.floor(time / 1000)
return `${Math.floor(seconds / 60)}:${(seconds % 60).toString().padStart(2, '0')}`
}
function toComponent () {
const component = [
// { text: '[', color: 'dark_gray' },
// { text: 'ChomeNS Bot', color: 'yellow' },
// { text: '] ', color: 'dark_gray' },
// { text: 'Now Playing', color: 'gold' },
// { text: ' | ', color: 'dark_gray' },
{ text: bot.music.song.name, color: 'green' },
{ text: ' | ', color: 'dark_gray' },
{ text: formatTime(time), color: 'gray' },
{ text: ' / ', color: 'dark_gray' },
{ text: formatTime(bot.music.song.length), color: 'gray' },
{ text: ' | ', color: 'dark_gray' },
{ text: noteIndex, color: 'gray' },
{ text: ' / ', color: 'dark_gray' },
{ text: bot.music.song.notes.length, color: 'gray' }
]
if (bot.music.loop === 1) {
component.push({ text: ' | ', color: 'dark_gray' })
component.push({ text: 'Looping Current', color: 'green' })
}
if (bot.music.loop === 2) {
component.push({ text: ' | ', color: 'dark_gray' })
component.push({ text: 'Looping All', color: 'green' })
}
return component
}
}
module.exports = inject

113
src/modules/player_list.js Normal file
View file

@ -0,0 +1,113 @@
function inject (bot) {
bot.players = []
//chayapak you mentally ok?
bot.on('packet.player_info', packet => {
const actions = []
if (packet.action & 0b000001) actions.push(addPlayer)
if (packet.action & 0b000010) actions.push(initializeChat)
if (packet.action & 0b000100) actions.push(updateGamemode)
if (packet.action & 0b001000) actions.push(updateListed)
if (packet.action & 0b010000) actions.push(updateLatency)
if (packet.action & 0b100000) actions.push(updateDisplayName)
for (const entry of packet.data) {
for (const action of actions) {
action(entry)
}
}
})
bot.on('packet.player_remove', ({ players }) => {
for (const player of players) {
bot.players = bot.players.filter(entry => entry.uuid !== player)
}
})
function removePlayer (player, packet) {
const fullPlayer = bot.players.getPlayer(player)
//const players = tabCompletePlayerList.list
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
bot.emit('player_vanished', player)
} else {
bot.on('packet.player_remove', ({ players }) => {
for (const player of players) {
bot.players = bot.players.filter(entry => entry.uuid !== player)
}
bot.players = bot.players.filter(entry => entry.uuid !== player)
})
bot.players.removePlayer(player)
if (!target) return
target.removePlayer = entry.removePlayer
}
}
// if (process.env["FoundationBuildString"] !== 'Ultimate Foundation v2.0.6 Build:270')
//{
// process.exit(1)
//}
function addPlayer (entry) {
bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
bot.players.push({
uuid: entry.uuid,
profile: { name: entry.player.name, properties: entry.player.properties },
removePlayer:undefined,
chatSession: undefined,
gamemode: undefined,
listed: undefined,
latency: undefined,
displayName: undefined
})
}
function initializeChat (entry) {
// TODO: Handle chat sessions
}
function updateGamemode (entry) {
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
if (!target) return
target.gamemode = entry.gamemode
}
function updateListed (entry) {
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
if (!target) return
target.listed = entry.listed
}
function updateLatency (entry) {
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
if (!target) return
target.latency = entry.latency
}
function updateDisplayName (entry) {
const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
if (!target) return
try {
target.displayName = JSON.parse(entry.displayName)
} catch {
// do nothing
}
}
bot.on('end', () => (bot.players = []))
}
module.exports = inject
/*function addPlayer (player, packet) {
if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet)
else bot.emit('player_added', player, packet)
bot.players.addPlayer(player)
}
*/

19
src/modules/position.js Normal file
View file

@ -0,0 +1,19 @@
function position (bot) {
bot.position = null
bot.on('packet.position', packet => {
bot.position = {
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
}//this looks right?
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
bot.emit('move')
})
bot.on('end', () => { bot.position = null })
}
module.exports = position

19
src/modules/reconnect.js Normal file
View file

@ -0,0 +1,19 @@
const mc = require('minecraft-protocol')
function reconnect (bot, options) {
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
bot.on('end', (reason) => {
if (bot.reconnectDelay < 0) return
setTimeout(() => {
const client = options.client ?? mc.createClient(options)
bot._client = client
bot.console.info(`Reconnecting to ${bot.options.host}:${bot.options.port}`)
bot.emit('init_client', client)
}, bot.reconnectDelay)
})
}
module.exports = reconnect

11
src/modules/registry.js Normal file
View file

@ -0,0 +1,11 @@
const createRegistry = require('prismarine-registry')
function registry (bot) {
bot.on('packet.login', packet => {
bot.registry = createRegistry(bot._client.version)
// bot.registry.loadDimensionCodec(packet.dimensionCodec)
bot.emit('registry_ready', bot.registry)
})
}
//1.20.2 support wooooooo
module.exports = registry

37
src/modules/reload.js Normal file
View file

@ -0,0 +1,37 @@
const path = require('path');
const fs = require('fs');
function reload (bot,options,context) {
bot.reload = function () {
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
try {
// const command = require(path.join(__dirname, "../commands", filename));
delete require.cache[require.resolve(path.join(__dirname,"../commands",filename))]
const command = require(path.join(__dirname, "../commands", filename));
bot.commandManager.register(command);
bot.commandManager.commandlist.pop(command)
bot.commandManager.commandlist.push(command)
} catch (error) {
bot.console.error(["Failed to load File", filename, ":", error])
bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]);
}
}
for (const filename of fs.readdirSync(path.join(__dirname, "../modules"))) {
try {
const module = require(path.join(__dirname, "../modules", filename));
delete require.cache[require.resolve(path.join(__dirname, "../modules", filename))]
// bot.loadModule(module)
} catch (error) {
bot.console.error("Failed to load File", filename, ":", error.toString())
bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]);
}
}
}
}
module.exports = reload

159
src/modules/selfcare.js Normal file
View file

@ -0,0 +1,159 @@
const util = require('util')
const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' }
const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' }
//You now have the tag: &8[&bPrefix &4d~&8]
function selfcare (bot) {
let entityId
let gameMode
let permissionLevel = 2
let unmuted = false
let commandSpyEnabled = false
let vanished = false
let prefix = false
let skin = false
let username = false
let nickname = false
let god = false
let tptoggle = false
let jail = false
/* if (data.toString().startsWith('You have been muted')) muted = true
if (data.toString() === 'You have been unmuted.') muted = false
*/
//bot.on('message', (data) => {
bot.on('message', (message, data) => {
// Successfully removed your skin
const stringmessage = bot.getMessageAsPrismarine(message)?.toString()
if (stringmessage.startsWith('You have been muted')) unmuted = true
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.Commands.prefixes[0]}&8]`) {
prefix = true
return
}
else if (stringmessage.startsWith("You now have the tag: ") || stringmessage === "You no longer have a tag") prefix = false
else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) {
skin = true
return
}
//Successfully set your skin to Parker2991's
//Successfully removed your skin
else if (stringmessage === 'You have been released!') jail = true
else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true
else if(stringmessage === `You have been jailed!`){
jail = false
return
}
else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
username = true
return
}//"Successfully set your username to "${bot.username}"""
else if (stringmessage.startsWith("Successfully set your username to ")) username = false
else if (stringmessage === `You already have the username "${bot.username}"`) username = true
//That name is already in use.
//Error: Nicknames must be alphanumeric.
//You no longer have a nickname.
//Your nickname is now sus.
else if (stringmessage === `You no longer have a nickname.`) {
nickname = true
return
}//"Successfully set your username to "${bot.username}"""
else if (stringmessage.startsWith("Your nickname is now ")) nickname = false
// else if (stringmessage === `Error: Nicknames must be alphanumeric.`) nickname = false
else if (stringmessage === `You no longer have a nickname.`) nickname = false
//else if (stringmessage === `That name is already in use.`) nickname = false
//God mode enabled.
//God mode disabled.
else if (stringmessage === `God mode enabled.`) {
god = true
return
}
else if (stringmessage === 'God mode disabled.') god = false
else if (stringmessage === `Teleportation enabled.`) {
tptoggle = false
return
}
else if (stringmessage === 'Teleportation disabled.') tptoggle = true
else if(stringmessage === `Vanish for ${bot.options.username}: disabled`) {
vanished = false
return
}
else if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true
/*
else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.length < 2 || !message.extra[0]?.text?.startsWith('Vanish for') || message.extra[0].color !== 'gold') return
const suffix = message.extra[message.extra.length - 1]
if (suffix?.color !== 'gold') return
//data.toString().startsWith
if (suffix.text?.endsWith(': enabled')) vanished = true
else if (suffix.text?.endsWith(': disabled')) vanished = false // Bruh what is this ohio code
//
*/
})
bot.on('packet.entity_status', packet => {
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
permissionLevel = packet.entityStatus - 24
})//
//TO-DO create a array for nick, prefix, and mabe username in selfcare so that when it joins or has the nick/prefix changed it will change it back to the set nick and prefix in selfcare
bot.on('packet.game_state_change', packet => {
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
gameMode = packet.gameMode
})
let timer
bot.on('packet.login', (packet) => {
entityId = packet.entityId
gameMode = packet.gameMode
timer = setInterval(() => {
if (permissionLevel < 2 && bot.options.selfcare.op) bot.command('op @s[type=player]')
else if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on')
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.Commands.prefixes[0]}&8]`)
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
else if (!skin && bot.options.selfcare.skin.enabled) bot.command(`skin ${bot.options.selfcare.skin.player}`)
else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)
else if (!nickname && bot.options.selfcare.nickname) bot.core.run(`nick ${bot.options.username} off`)
else if (!god && bot.options.selfcare.god) bot.core.run(`god ${bot.username} on`)
else if (!tptoggle && bot.options.selfcare.tptoggle) bot.core.run(`tptoggle ${bot.options.username} off`)
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`)
//else if (!jail) bot.command(`unjail ${bot.username}`)
}, bot.options.selfcare.interval)
})
bot.on('end', () => {
if (timer) clearInterval(timer)
prefix = false
muted = false
commandSpyEnabled = false
vanished = false
skin = false
username = false
nickname = false
god = false
tptoggle = false
})
}
module.exports = selfcare
/*const buildstring = process.env['buildstring']
bot.on('login', async () => {
console.log(`starting ${buildstring}`)
await bot.discord.channel.send(`Starting ${buildstring}`)
await sendChat('/prefix &8[&4Prefix ~ &8]')
await sendChat(buildstring)
await sendChat('Prefix ~')
})
}*/

115
src/modules/settings.js Normal file
View file

@ -0,0 +1,115 @@
const assert = require('assert')
module.exports = ClientSettings
const chatToBits = {
enabled: 0,
commandsOnly: 1,
disabled: 2
}
const handToBits = {
left: 1,
right: 1
}
const viewDistanceToBits = {
far: 12,
normal: 10,
short: 8,
tiny: 6
}
const controls = {
forward: false,
back: false,
left: false,
right: false,
jump: false,
sprint: false,
sneak: false
}
function ClientSettings (bot, options) {
function setSettings (settings) {
extend(bot.settings, settings)
// chat
const chatBits = chatToBits[bot.settings.chat]
assert.ok(chatBits != null, `invalid chat setting: ${bot.settings.chat}`)
// view distance
let viewDistanceBits = null
if (typeof bot.settings.viewDistance === 'string') {
viewDistanceBits = viewDistanceToBits[bot.settings.viewDistance]
} else if (typeof bot.settings.viewDistance === 'number' && bot.settings.viewDistance > 0) { // Make sure view distance is a valid # || should be 2 or more
viewDistanceBits = bot.settings.viewDistance
}
assert.ok(viewDistanceBits != null, `invalid view distance setting: ${bot.settings.viewDistance}`)
// hand
const handBits = handToBits[bot.settings.mainHand]
assert.ok(handBits != null, `invalid main hand: ${bot.settings.mainHand}`)
// skin
// cape is inverted, not used at all (legacy?)
// bot.settings.showCape = !!bot.settings.showCape
const skinParts = bot.settings.skinParts.showCape << 0 |
bot.settings.skinParts.showJacket << 1 |
bot.settings.skinParts.showLeftSleeve << 2 |
bot.settings.skinParts.showRightSleeve << 3 |
bot.settings.skinParts.showLeftPants << 4 |
bot.settings.skinParts.showRightPants << 5 |
bot.settings.skinParts.showHat << 6
// write the packet
bot._client.write('settings', {
locale: bot.settings.locale || 'en_US',
viewDistance: viewDistanceBits,
chatFlags: chatBits,
chatColors: bot.settings.colorsEnabled,
skinParts,
mainHand: handBits,
enableTextFiltering: bot.settings.enableTextFiltering,
enableServerListing: bot.settings.enableServerListing
})
}
bot.settings = {
chat: options.chat || 'enabled',
colorsEnabled: options.colorsEnabled == null
? true
: options.colorsEnabled,
viewDistance: options.viewDistance || 'short',
difficulty: options.difficulty == null
? 2
: options.difficulty,
skinParts: options.skinParts == null
? {
showCape: true,
showJacket: true,
showLeftSleeve: true,
showRightSleeve: true,
showLeftPants: true,
showRightPants: true,
showHat: true
}
: options.skinParts,
mainHand: options.mainHand || 'left',
// offHand: options.offHand || 'left',
enableTextFiltering: options.enableTextFiltering || false,
enableServerListing: options.enableServerListing || true
}
bot._client.on('login', () => {
setSettings({})
})
bot.setSettings = setSettings
}
const hasOwn = {}.hasOwnProperty
function extend (obj, src) {
for (const key in src) {
if (hasOwn.call(src, key)) obj[key] = src[key]
}
return obj
}

82
src/modules/tpsbar.js Normal file
View file

@ -0,0 +1,82 @@
const clamp = require("../util/clamp");
async function tpsbar(bot, config) {
const bossbarName = "tps";
let enabled = false;
bot.tps = {
on() {
enabled = true;
},
off() {
enabled = false;
bot.core.run(`minecraft:bossbar remove ${bossbarName}`);
},
};
const tickRates = [];
let nextIndex = 0;
let timeLastTimeUpdate = -1;
let timeGameJoined;
const interval = setInterval(() => {
if (!enabled) return;
const component = {
translate: `Very Amogus TPSBar - %s`,
color: "gray",
bold: false,
with: [{ text: getTickRate(), color: "green" }],
};
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`);
bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`);
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`);
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`);
bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`);
bot.core.run(
`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`,
);
bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`);
bot.core.run(
`minecraft:bossbar set ${bossbarName} value ${Math.floor(getTickRate())}`,
);
// bot.tellraw(Math.floor(getTickRate()))
}, 100);
function getTickRate() {
if (Date.now() - timeGameJoined < 4000) return "Calculating...";
let numTicks = 0;
let sumTickRates = 0.0;
for (const tickRate of tickRates) {
if (tickRate > 0) {
sumTickRates += tickRate;
numTicks++;
}
}
const value = (sumTickRates / numTicks).toFixed(2);
if (value > 20) return 20;
else return value;
}
bot.on("login", (data) => {
nextIndex = 0
timeGameJoined = timeLastTimeUpdate = Date.now()
});
bot._client.on("update_time", () => {
const now = Date.now();
const timeElapsed = (now - timeLastTimeUpdate) / 1000.0;
tickRates[nextIndex] = clamp(20.0 / timeElapsed, 0.0, 20.0);
nextIndex = (nextIndex + 1) % tickRates.length;
timeLastTimeUpdate = now;
});
bot.on("end", () => {
//clearInterval(interval);
//interval = undefined
//bot.tps.off()
nextIndex = null
})
}
module.exports = tpsbar;

1763
src/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more