Compare commits

...

No commits in common. "main" and "v0.3" have entirely different histories.
main ... v0.3

106 changed files with 453 additions and 14674 deletions

7
.gitignore vendored
View file

@ -1,8 +1 @@
node_modules
config.yml
.git .git
src/modules/exploits.js
logs
src/modules/custom_chat.js
src/util/core_util.js
src/data/filter.json

View file

@ -1,3 +0,0 @@
# FNFBoyfriendBot
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them

453
index.js Normal file
View file

@ -0,0 +1,453 @@
const mineflayer = require('mineflayer')
var server = 'sus.shhnowisnottheti.me'
const randomstring = require('randomstring');
const bot = mineflayer.createBot({
host: server,
port: 25565,
username: randomstring.generate(8),
version: 1.17,
})
var sleep=t=>new Promise(a=>setTimeout(a,t)),
sendChat=async function(m){bot.chat(m.slice(0,256));await sleep(300);}
function between(min, max) {
return Math.floor(
Math.random() * (max - min) + min
)
}
//variables
var prefix = '&8&l&m[&b&l&mWoomyBot&8&l&m] ';
var consoleprefix = 'bcraw &8&l&m[&b&l&mWoomyBot&8&l&m] &8[&4&lCONSOLE&8] ';
function randomchar() {
const crypto = require("crypto");
var hash = crypto.createHash("md5");
var randomBytes = crypto.randomBytes(16);
hash.update(randomBytes);
var hashi = hash.digest(Math.round(Math.random()) ? "hex" : "Base64");
return hashi.substring(0, 16);
}
function runInCore(cmd) {
bot._client.write('update_command_block', {location: {x:between(Math.floor(bot.entity.position.x) + 1, Math.floor(bot.entity.position.x) - 15), y:between(0, 3), z:between(Math.floor(bot.entity.position.z) + 1, Math.floor(bot.entity.position.z) - 15)}, command: cmd, mode: 1, flags: 0b100});
}
bot.on('login', async () => { // time in ms
console.log(`logged in as ${bot.username}`)
await sendChat('/tp 6954 100 69642')
await sendChat('/tptoggle')
await sendChat('/online')
await sendChat('/vanish')
await sendChat(`/fill ${Math.floor(bot.entity.position.x)} 0 ${Math.floor(bot.entity.position.z)} ${Math.floor(bot.entity.position.x) - 15} 2 ${Math.floor(bot.entity.position.z - 15)} command_block replace`);
runInCore ('bcraw ' + prefix + 'just went looking around on replit and found this my old bot before i named it the FNFBoyfriendBot but alot of names were considered for it like ParkerBot, DemonBot, WoomyBot, and boyfriendBot but at the end i just named it FNFBoyfriendBot for full release')
//CHANGE COMMAND HERE VVVVVVVVVVVVVVVVVVVV
})
const cmd = require('mineflayer-cmd').plugin
cmd.allowConsoleInput = true // Optional config argument
bot.loadPlugin(cmd)
//kill command function
function killCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + 'Kill Cloop Executed')
setInterval(function() { runInCore('ekill ' + message), 1})
resolve()
}
})
}
function freezeCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + + ' ' + message + ' Is Frozen')
setInterval(function() { runInCore('tp ' + message + ' ' + message), 1})
resolve()
}
})
}
function deopCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + 'Deop Cloop Executed')
setInterval(function() { runInCore('execute run deop ' + message), 1})
resolve()
}
})
}
function deopallCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + 'Deop Cloop Executed')
setInterval(function() { runInCore('execute at @a run deop @a'), 1})
setInterval(function() { runInCore('op @s[type=player]'), 1})
resolve()
}
})
}
function survivalCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + 'Gamemode Survival For All')
runInCore('execute at @a run gamemode survival @a')
resolve()
}
})
}
function helpCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + ' !ckill <player> to spam kill any player ')
runInCore('bcraw ' + prefix + ' !trol <player> to abuse a player ingame')
runInCore('bcraw ' + prefix + ' !deop <player> to deop a player forever')
runInCore('bcraw ' + prefix + ' !icu <player> spam tp a player to you(control them)')
runInCore('bcraw ' + prefix + ' !say <message> make the bot say a message')
runInCore('bcraw ' + prefix + ' !cloop <message> to spam any message')
runInCore('bcraw ' + prefix + ' !troll TROLL THE ENTIRE SERVER')
resolve()
}
})
}
function opCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + 'Op Cloop Executed XD')
setInterval(function() { runInCore('execute run op ' + message), 1})
resolve()
}
})
}
function icuCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
runInCore('bcraw ' + prefix + 'ICU CONTROL HAS STARTED')
setInterval(function() { runInCore('tp ' + message + ' ' + sender), 200})
setInterval(function() { runInCore('deop ' + message), 200})
resolve()
}
})
}
function sayCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
runInCore(consoleprefix + message)
resolve()
})
}
function sudoCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
runInCore('sudo ' + message)
resolve()
})
}
function cloopCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
setInterval(function() { runInCore(message), 1})
runInCore('bcraw ' + prefix + ' Cloop Has Started')
resolve()
}
})
}
function lagCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
setInterval(function() { runInCore('day'), 1})
setInterval(function() { runInCore('night'), 1})
setInterval(function() { runInCore('clear @a'), 1})
setInterval(function() { runInCore('effect give @a nausea'), 1})
setInterval(function() { runInCore('effect give @a slowness'), 1})
setInterval(function() { runInCore('give @a bedrock'), 1})
setInterval(function() { runInCore('give @a sand'), 1})
setInterval(function() { runInCore('give @a dirt'), 1})
setInterval(function() { runInCore('give @a diamond'), 1})
setInterval(function() { runInCore('give @a tnt'), 1})
setInterval(function() { runInCore('give @a crafting_table'), 1})
setInterval(function() { runInCore('give @a diamond_block'), 1})
setInterval(function() { runInCore('execute run op ' + randomchar), 1})
resolve()
}
resolve()
})
}
function trollCommand (sender, flags, args) {
return new Promise((resolve, reject) => {
let message = ''
if (flags.showsender) message += sender + ': '
if (flags.color) message += '&' + flags.color[0]
message += args.join(' ')
if(sender == 'Parker2991'){
setInterval(function() { runInCore('clear ' + message), 1})
setInterval(function() { runInCore('effect give '+ message + ' nausea'), 1})
setInterval(function() { runInCore('effect give '+ message + ' nausea'), 1})
setInterval(function() { runInCore('give ' + message + ' bedrock'), 1})
setInterval(function() { runInCore('give ' + message + ' diamond'), 1})
setInterval(function() { runInCore('give ' + message + 'tnt'), 1})
setInterval(function() { runInCore('give ' + message + ' diamond_block'), 1})
setInterval(function() { runInCore('give ' + message + ' sand'), 1})
setInterval(function() { runInCore('give ' + message + ' bedrock'), 1})
setInterval(function() { runInCore('execute run deop '+ message), 1})
setInterval(function() { runInCore('gms '+ message), 1})
runInCore('bcraw ' + prefix + ' ' + message + ' Is Getting Trolled')
resolve()
}
})
}
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('troll', lagCommand, // Create a new command called 'say' and set the executor function
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('icu', icuCommand, // Create a new command called 'say' and set the executor function
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('sudo', sudoCommand, // Create a new command called 'say' and set the executor function
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('trol', trollCommand, // Create a new command called 'say' and set the executor function
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('ckill', killCommand,
'ckill player', // help text
'ckill <player>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('deop', deopCommand,
'deop player', // help text
'deop <player>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('op', opCommand,
'op player', // help text
'op <player>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('say', sayCommand,
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('cloop', cloopCommand,
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('freeze', freezeCommand,
'make me say something', // help text
'say <message>') // usage text
// Add a flag called 'color' that expects 1 input
.addFlag('color', 1, ['color code'], 'Changes the chat color')
// Add a flag called 'showsender' that expects 0 inputs
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('deopall', deopallCommand,
'stop the server',
'stop')
.addFlag('color', 1, ['color code'], 'Changes the chat color')
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.once('cmd_ready', () => {
bot.cmd.registerCommand('gms', survivalCommand,
'stop the server',
'stop')
.addFlag('color', 1, ['color code'], 'Changes the chat color')
.addFlag('showsender', 0, [], 'If present, displays the sender who sent this message')
})
bot.on('chat', (username, message) => {
if (message.startsWith('!')) {
const command = message.substring(1)
bot.cmd.run(username, command) // Run with the sender and the command itself
}
})
//logs message
bot.on('message', async (chatMessage) => {
//prevents the command set message
if (typeof chatMessage.translate === 'string' && chatMessage.translate.startsWith('advMode.')) return
console.log(chatMessage.toAnsi())
})
https://replit.com/@LigmaSMP/ParkerBot?from=notifications#index.js

1840
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,16 +0,0 @@
{
"dependencies": {
"@tonejs/midi": "^2.0.28",
"axios": "^1.8.2",
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"matrix-js-sdk": "^36.2.0",
"minecraft-data": "^3.83.1",
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.11.0",
"request": "^2.88.2",
"undici": "^7.3.0",
"wikipedia": "^2.1.2"
}
}

View file

@ -1,2 +0,0 @@
this folder is for removed / scrapped concepts just in case people want to reimplement them

View file

@ -1,5 +0,0 @@
const nbt = require('prismarine-nbt');
async function aaa () {
console.log(await nbt.stringify("e"));
}
aaa()

View file

@ -1,64 +0,0 @@
const bots = require('../../data/bots.json');
const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: "bots",
description: "shows a list of known bots",
aliases: [
"knownbots"
],
trustLevel: 0,
usages: [
""
],
},
async 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);
}
bot.tellraw("@a",
["Known bots (", { text: JSON.stringify(bots.length), color: 'gold' }, { text: ") - ", color: 'gray' }, ...list],
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("@a", [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

@ -1,65 +0,0 @@
const bots = require('../data/changelog.json');
module.exports = {
name: 'changelog',
description: ['check the bots changelog'],
trustLevel: 0,
aliases: ['clv', '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: 'gray',
with: [
{ color: 'aqua', text: 'Alpha Release' },
{ color: 'gray', text: ' | ' },
{ color: 'blue', text: 'Beta Release' },
{ color: 'gray', text: ' | ' },
{ color: 'green', text: 'Minor release' },
{ color: 'gray', text: ' | ' },
{ color: 'gold', text: 'Revision Release' },
{ color: 'gray', text: ' | ' },
{ color: 'dark_red', text: 'Major Release' }
]
}
bot.tellraw("@a", [{ text: 'Changelogs (', color: 'gray' }, { text: JSON.stringify(bots.length), color: 'gold' }, { text: ')', color: 'gray' }, category, ' - ', ...list])
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('@a', [component])
}
}

View file

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

View file

@ -1,70 +0,0 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This is a general purpose Gradle build.
* To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.5/samples
*/
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
group = 'land.chipmunk.parker2991'
version = 'v6.0.0-alpha(ff08479)'
description = 'FNFBoyfriendBot'
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenLocal()
mavenCentral()
maven {
url = uri('https://repo.opencollab.dev/maven-snapshots/')
}
maven {
url = uri('https://repo.opencollab.dev/maven-releases/')
}
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
maven {
url = uri("https://jitpack.io")
}
maven {
url = uri('https://maven.maxhenkel.de/repository/public')
}
}
dependencies {
implementation 'com.github.steveice10:mcprotocollib:1.20.2-1-SNAPSHOT'
implementation 'net.kyori:adventure-text-serializer-ansi:4.14.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.guava:guava:31.1-jre'
implementation 'org.jline:jline:3.23.0'
implementation 'org.yaml:snakeyaml:2.0'
}
jar {
manifest {
attributes 'Main-Class': 'land.chipmunk.parker2991.fnfboyfriendbot.Main'
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc).configureEach {
options.encoding = 'UTF-8'
}

View file

@ -1,3 +0,0 @@
voiding interger will return a number
public static void functionName() {} has the funcion return nothing

View file

@ -1,2 +0,0 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

View file

@ -1,7 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -1,249 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View file

@ -1,92 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -1,8 +0,0 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.5/userguide/building_swift_projects.html in the Gradle documentation.
*/
rootProject.name = 'fnfboyfriendbot'

View file

@ -1,47 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot;
import land.chipmunk.parker2991.fnfboyfriendbot.*;
import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference;
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
import com.github.steveice10.mc.protocol.data.game.setting.SkinPart;
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.session.*;
import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpClientSession;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class Bot {
private final ArrayList<ClientListener> listeners = new ArrayList<>();
public final String host;
public final int port;
public final List<Bot> bots;
public final Options.bots options;
public Bot (Options.bots options, List<Bot> bots) {
this.host = options.host;
this.port = options.port;
this.options = options;
}
public static void main(String[] args) {
}
public class ClientListener {
}
}

View file

@ -1,36 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import org.yaml.snakeyaml.Yaml;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.io.*;
import java.util.List;
import java.util.Set;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
Bot config = null;
Path configPath = Paths.get("config.yml");
try {
Yaml yaml = new Yaml();
config = yaml.load(Files.readString(configPath));
System.out.println(config);
} catch (IOException e) {
System.out.println(e.toString());
}
List<Bots> bots = new ArrayList<>();
for (Options options : config.bots) {
final Bot client = new Bot(options, bots);
bots.add(client);
}
}
private static class Options {
}
}

View file

@ -1,9 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot;
public class Options {
public static class bots {
public String host = "127.0.0.1";
public int port = 25565;
public long reconnectDelay;
}
}

View file

@ -1,6 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.commands;
public class SayCommand {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class BruhifyModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class ChatCommandHandlerModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class ChatModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class CommandCoreModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class CommandLoopManagerModule {
}

View file

@ -1,7 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class CommandManagerModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class ConsoleModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class DiscordModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class PlayerListModule {
}

View file

@ -1,7 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class SelfcareModule {
}

View file

@ -1,8 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
public class ValidationModule {
}

View file

@ -1,35 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class servershit {
public static void main(String[] args) {
try {
InetAddress inetAddress = InetAddress.getLocalHost();
System.out.println("Hostname \u203a " + inetAddress.getHostName());
} catch (UnknownHostException e) {
e.printStackTrace();
}
System.out.println("Working Directory \u203a " + System.getProperty("user.dir"));
System.out.println(System.getProperty("os.arch"));
System.out.println("OS \u203a " + System.getProperty("os.name"));
System.out.println("OS Version/distro \u203a " + System.getProperty("os.version"));
System.out.println("Kernel Version \u203a " + System.getProperty("os.kernel.version"));
System.out.println("Cores \u203a " + Runtime.getRuntime().availableProcessors());
System.out.println("CPU \u203a " + System.getProperty("sun.cpu.isalist"));
System.out.println("Server Free memory " + (Runtime.getRuntime().freeMemory() / 1048576) + " MiB " +
Runtime.getRuntime().totalMemory() / 1048576 + " MiB");
System.out.println("Device uptime \u203a " + formatUptime(System.currentTimeMillis() / 1000L));
System.out.println("Java version \u203a " + System.getProperty("java.version"));
}
private static String formatUptime(long uptime) {
long days = uptime / 86400;
long hours = (uptime % 86400) / 3600;
long minutes = ((uptime % 86400) % 3600) / 60;
long seconds = ((uptime % 86400) % 3600) % 60;
return days + "d " + hours + "h " + minutes + "m " + seconds + "s";
}
}

View file

@ -1,27 +0,0 @@
package land.chipmunk.parker2991.fnfboyfriendbot;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
public class serverterminal {
public static void main(String[] args) {
try {
ProcessBuilder processBuilder = new ProcessBuilder(Arrays.asList("ash", "-c", "ls"));
Process process = processBuilder.start();
InputStream inputStream = process.getInputStream();
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
System.out.println(new String(buffer, 0, bytesRead));
}
int exitCode = process.waitFor();
System.out.println("Child process close all stdio with code " + exitCode);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}

View file

@ -1,8 +0,0 @@
Commands:
prefixes:
- "~"
- "fnfbfbot "
- "&"
- "\ufffc"
- "\u202e"
- "\u2588"

View file

@ -1,26 +0,0 @@
const CommandError = require('../util/command_error.js');
module.exports = {
name: 'json',
trustLevel: 0,
aliases: [
],
description: 'placeholder text here',
usages: [
],
execute (context) {
const bot = context.bot;
const args = context.arguments;
try {
// bot.tellraw("@a", [
// { text: `Result \u203a` },
//JSON.parse(args.join(' ')),
// ])
// bot.tellraw("@a", `Result ${JSON.stringify(JSON.parse(args.join(' ')))}` )
bot.tellraw("@a", JSON.parse(JSON.stringify(args.join(' '))))
// console.log([ { text: `Result \u203a` }, { text: JSON.parse(args.join(' ')) } ])
} catch (e) {
bot.tellraw("@a", { text: e.toString(), color: "dark_red" })
}
}
}

View file

@ -1,87 +0,0 @@
const sdk = require("matrix-js-sdk");
const { logger } = require('matrix-js-sdk/lib/logger');
async function matrix (bot, options, config, discordClient) {
if (!options.roomId) return
if (!config.matrix.enabled) return
const client = sdk.createClient({
baseUrl: `${config.matrix.hostUrl}`,
accessToken: `${config.matrix.token}`,
userId: `${config.matrix.userId}`,
})
bot.matrix = {
client,
roomId: options.roomId,
prefix: config.matrix.prefix || undefined,
inviteUrl: config.matrix.invite || undefined
}
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
bot.tellraw("@a", [
{
translate: "[%s] %s \u203a %s",
color: "gray",
with: [
{
translate: "%s%s%s %s",
with: [
{
text: "FNF",
color: "blue",
},
{
text: "Boyfriend",
color: "dark_aqua",
},
{
text: "Bot",
color: "dark_blue",
},
{
text: "Matrix",
color: "#0dbd8b"
}
],
// clickEvent: config.matrix.invite ? { action: 'open_url', value: config.matrix.invite } : undefined,
// hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' }
},
{
// text: event.sender.rawDisplayName || event.sender.name || event.sender.userId
},
// content.body
event.getContent().body,
]
}
])
console.log(
// the room name will update with m.room.name events automatically
"(%s) %s :: %s",
room.name,
event.getSender(),
event.getContent().body,
)
})
bot.on('message', (message) => {
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
const content = {
body: '```ansi' + stringMessage + '```',
msgtype: "m.text",
}
let queue = [];
setInterval(() => {
// if (queue.length === 0) return
try {
bot.matrix.client.sendEvent(bot.options.roomId, 'm.room.message', content);
} catch (e) {
bot.console.logs(error.toString());
}
queue = [];
}, 5000)
})
await client.startClient()
}
module.exports = matrix;

View file

@ -1,114 +0,0 @@
const trustedPlayers = require('../data/trustedPlayers.json');
module.exports = (bot, options, config) => {
let component;
trustedPlayers.map((trusted) => {
/*component.push({
translate: "%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ea" }
]
})*/
bot.on('message', (data) => {
try {
let stringMessage = bot.getMessageAsPrismarine(data)?.toString();
// console.log(JSON.stringify(data))
// console.log(data?.with[0]?.clickEvent);
// console.log(data.color);
// for (const players of bot.players) {
if (
/*
stringMessage.startsWith(`${trusted.player}`) &&
data.translate === "multiplayer.player.joined" &&
data.color === "yellow" &&
data.with.insertion === `${trusted.player}` &&
data?.with[0]?.clickEvent === `{action:'suggest_command',value:'/tell ${trusted.player} '}` &&*/
JSON.stringify(data) ===
JSON.stringify({
color:'yellow',
translate:'multiplayer.player.joined',
with:[{insertion:`${trusted.player}`,
clickEvent:{
action:'suggest_command',
value:`/tell ${trusted.player} `
},
hoverEvent:{
action:'show_entity',
contents:{
type:'minecraft:player',
id:`${bot.players.find((player) => player.profile.name === trusted.player)?.uuid}`,
name:{
text:`${trusted.player}`
}
}
},
text:`${trusted.player}`
}]
})
) {
if (bot.players.map((e) => { e.profile.name === trusted.player })) {
bot.tellraw(`@a[name="${trusted.player}"]`, "e");
component = "e";
}
}
// bot.tellraw(`@a[name="${bot.players.find((player) => player.profile.name === trusted.player).profile.name}"]`, component);
/* for (const players of bot.players) {
// console.log(players);
if (players.profile.name === trusted.player) {
let e = players.profile.name === trusted.player;
for (const eachBot of bot.bots) {
eachBot.tellraw(`@a[name="${trusted.player}"]`, "e");
}
}*/
// }
//if (bot.players.find((player) => player.profile.name !== trusted.player)) return
//for (const eachBot of bot.bots) {
// if (bot.players.find((player) => player.profile.name === trusted.player)) {
// bot.tellraw(`@a[name="${bot.players.find((player) => player.profile.name === trusted.player).profile.name}"]`, "e");
// }
//}
// bot.chat.message(`${trusted.player} joined the game`);
// }
// }
} catch (e) {
console.log(e.stack);
}
})
})
/* bot.on('packet.login', (data) => {
console.log(bot.players.find((players) => players.profile.name === trusted.player))
console.log(bot.players)
if (bot.players.find((player) => player.profile.name === trusted.player)) {
bot.chat.message('player joined the game')
}
})
multiplayer.player.joined
[{"insertion":"Parker2991","clickEvent":{"action":"suggest_command",
"value":"/tell Parker2991 "},"hoverEvent":{"action":"show_entity",
"contents":{"type":"minecraft:player",
"id":"85f5b68d-a567-3877-9701-3cd7404bc9d9",
"name":{"text":"Parker2991"}}},"text":"Parker2991"}]
[
{
insertion: 'Parker2991',
clickEvent: { action: 'suggest_command', value: '/tell Parker2991 ' },
hoverEvent: { action: 'show_entity', contents: [Object] },
text: 'Parker2991'
}
]
yellow
*/
/*for (const trusted in trustedPlayers) {
component.push({
translate: '%s',
color: config.colors.commands.tertiary,
with: [
{ text: 'e' }
]
})
// console.log(component)
}*/
// bot.tellraw("@a", component)
}

View file

@ -1,9 +0,0 @@
const { request } = require("undici");
// https://en.wikipedia.org/w/api.php
async function sus () {
const query = new URLSearchParams("sus");
const wikiResult = await request(`https://en.wikipedia.org/wiki/sus`);
const result = await wikiResult.body;
console.log((await result.json()))
}
sus()

View file

@ -1,78 +0,0 @@
const mc = require('minecraft-protocol');
const { EventEmitter } = require('events');
EventEmitter.defaultMaxListeners = 5e6;
const util = require('util');
const ChatMessage = require('prismarine-chat');
function createBot(options = {}, config) {
let endCount = 0;
const bot = new EventEmitter();
bot.options = {
// Set some default values in options
host: options.host ??= 'localhost',
username: options.username ??= 'Player',
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
};
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)
bot.emit('packet.' + meta.name, data);
})
client.on('login', (data) => {
bot.uuid = client.uuid;
bot.username = client.username;
})
client.on('disconnect', data => {
bot.emit("disconnect", data);
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
})
client.on('end', reason => {
bot.emit('end', reason);
if (reason === "socketClosed") return;
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi());
})
client.on('error', error => {
endCount++
if (endCount === 10) {
bot.console.info('stopped logging disconnect messages for now...');
bot?.discord?.channel?.send('stopped logging disconnect messages for now...');
return;
} else if (endCount > 10) {
return;
} else {
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
bot?.discord?.channel?.send(error.toString());
}
})
client.on("keep_alive", ({ keepAliveId }) => {
bot.emit("keep_alive", { keepAliveId })
})
client.on('kick_disconnect', (data) => {
bot.emit("kick_disconnect", data.reason)
bot.console?.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
bot?.discord?.channel?.send(util.inspect(data.reason))
})
client.on('success', (data) => {
endCount = 0;
})
process.on("uncaughtException", (e) => {
// console?.warn(e.stack)
});
})
const client = options.client ?? new mc.createClient(bot.options)
bot._client = client
bot.emit('init_client', client)
bot.bots = options.bots ?? [bot]
return bot
}
module.exports = createBot;

View file

@ -1,102 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'coresettings',
trustLevel: 2,
aliases: [
"cbsettings"
],
description: 'change the bots core settings',
usages: [
"useplacedcommandblock <on/off/true/false/enable/disable>",
"area start <positions>",
"area end <positions>",
"refillmethod/rcmethod <item/chat>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
const config = context.config;
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
switch (args[1]?.toLowerCase()) {
case "useplacedcommandblock":
switch (args[2]?.toLowerCase()) {
case "on":
case "true":
case "enable":
bot.core.usePlacedCommandBlock = true;
bot.chat.message('now using the placed command block');
break;
case "off":
case "false":
case "disable":
bot.core.usePlacedCommandBlock = false;
bot.chat.message('no longer using the placed command block');
break;
default:
if (bot.core.usePlacedCommandBlock) {
bot.chat.message("the bot is currently using the placed command block to run its commands");
} else {
bot.chat.message("the bot is currently using its command block core to run its commands");
}
}
break;
case "area":
switch (args[2]?.toLowerCase()) {
case "start":
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
bot.core.area.start = config.core.area.start;
bot.chat.message("arguments were NaN, defaulting to config core start coords");
} else {
bot.core.area.start = {
x: Number(args[3]),
y: Number(args[4]),
z: Number(args[5])
};
bot.chat.message(`setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
}
break;
case "end":
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
bot.core.area.end = config.core.area.end;
bot.chat.message("arguments were NaN, defaulting to config core end coords");
} else {
bot.core.area.end = {
x: Number(args[3]),
y: Number(args[4]),
z: Number(args[5])
};
bot.chat.message(`setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
}
break;
default:
bot.chat.message(`core start pos: x: ${bot.core.area.start.x}, y: ${bot.core.area.start.y}, z: ${bot.core.area.start.z}, and end pos: x: ${bot.core.area.end.x}, y: ${bot.core.area.end.y}, z: ${bot.core.area.end.z} `)
}
break;
case "refillmethod":
case "rcmethod":
switch (args[2]?.toLowerCase()) {
case "item":
config.core.itemRefill = true;
bot.chat.message('now refilling via item');
break;
case "chat":
config.core.itemRefill = false;
bot.chat.message('now refilling via chat');
break;
default:
if (config.core.itemRefill) {
bot.chat.message("currently filling core via item");
} else {
bot.chat.message("currently filling core via chat");
}
}
break;
default:
throw new CommandError('invalid argument');
}
},
}

View file

@ -1,155 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: 'filter',
trustLevel: 2,
aliases: [
"blacklist",
],
description: 'filter players',
usages: [
"add <player>",
"list",
"-ignorecase add <player> / -regex add <player>",
"-regex add <player>",
"clear",
"remove <index>",
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let component = [];
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5] && !args[6]) return;
switch (args[1]) {
case "add":
if (bot.filter.list().find((e) => e.name === args[2])) throw new CommandError('this player is already in the filter!');
bot.filter.add(`${args[2]}`, false, false);
bot.chat.message(`added ${args[2]} to the filter`);
break;
case "list":
if (bot.filter.list().length === 0) {
component.push({
translate: "%s: (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: "Filtered", color: config.colors.commands.primary },
{ text: `${bot.filter.list().length}`, color: config.colors.integer }
]
});
} else {
let index = 0;
let filterList = [];
for (const players of bot.filter.list()) {
if (players.regex) {
if (players.ignorecase) {
filterList.push({
translate: "%s: %s (%s %s)",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary },
{ text: "regexed", color: config.colors.commands.primary },
{ text: "ignorecased", color: config.colors.commands.primary },
]
});
} else {
filterList.push({
translate: "%s: %s (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary },
{ text: "regexed", color: config.colors.commands.primary },
]
});
}
} else if (players.ignorecase) {
filterList.push({
translate: "%s: %s (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary },
{ text: "ignorecase", color: config.colors.commands.primary },
]
});
} else {
filterList.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${index}`, color: config.colors.integer },
{ text: `${players.name}`, color: config.colors.commands.primary }
]
});
}
filterList.push('\n');
index++;
}
filterList.pop();
component.push({
translate: "%s: (%s)",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.filter.list().length}`, color: config.colors.integer }
]
});
component.push('\n');
component.push(filterList);
}
bot.tellraw("@a", component);
break;
case "remove":
bot.filter.remove(args[2]);
bot.chat.message(`removed the index ${args[2]} from the filter`);
break;
case "-ignorecase":
switch (args[2]) {
case "-regex":
switch (args[3]) {
case "add":
if (bot.filter.list().find((e) => e.name === args[4])) throw new CommandError('this player is already in the filter!');
bot.filter.add(`${args[4]}`, true, true);
bot.chat.message(`added ${args[4]} to the filter`);
break;
}
break;
case "add":
if (bot.filter.list().find((e) => e.name === args[3])) throw new CommandError('this player is already in the filter!');
bot.filter.add(`${args[3]}`, true, false);
bot.chat.message(`added ${args[3]} to the filter`);
break;
}
break;
case "-regex":
switch (args[2]) {
case "add":
if (bot.filter.list().find((e) => e.name === args[3])) throw new CommandError('this player is already in the filter!');
bot.filter.add(`${args[3]}`, false, true);
bot.chat.message(`added ${args[3]} to the filter`);
break;
}
break;
case "clear":
bot.filter.clear();
bot.chat.message('cleared the filter');
break;
default:
throw new CommandError('invalid argument');
}
},
}

View file

@ -1,55 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: "kick",
description: "kick a player from the server",
aliases: [
],
trustLevel: 2,
usages: [
"invalidstring",
"item"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
if (!args && !args[0] && !args[1] && !args[2]) return;
switch (args[1]?.toLowerCase()) {
case "invalidstring":
bot.exploits.crashes.invalidString(args[2]);
bot.chat.message(`crashing ${args[2]}`)
break;
case "item":
bot.exploits.kicks.item(args[2]);
bot.chat.message(`kicking ${args[2]}`)
break;
default:
throw new CommandError('invalid argument')
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
if (!args && !args[0] && !args[1] && !args[2]) return;
switch (args[0]?.toLowerCase()) {
case "invalidstring":
bot.exploits.crashes.invalidString(args[1]);
bot?.discord?.message?.reply(`crashing ${args[1]}`)
break;
case "item":
bot.exploits.kicks.item(args[1]);
bot?.discord?.message?.reply(`kicking ${args[1]}`)
break;
default:
throw new CommandError('invalid argument')
}
}
}

View file

@ -1,24 +0,0 @@
module.exports = {
data: {
name: "reconnect",
aliases: [
"end"
],
description: "reconnects the bot",
usages: [
""
],
trustLevel: 2,
},
execute (context) {
const bot = context.bot;
bot._client.end();
bot.chat.message('reconnecting')
},
discordExecute (context) {
const bot = context.bot;
bot._client.end();
bot?.discord?.message?.reply('reconnecting');
}
}

View file

@ -1,127 +0,0 @@
module.exports = {
data: {
name: 'console',
trustLevel: 4,
description: "runs commands made for the bots console",
aliases: [
"c"
],
usages: [
'server/srv <all/servername>',
'customchat <on/true/enable/off/false/disable>',
'say <message>',
'validate/validation/val <owner/o/admin/a/trusted/t>',
'logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>'
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
const source = context.source;
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
switch (args[0]?.toLowerCase()) {
case "server":
case "svr":
const servers = bot.bots.map(eachBot => eachBot.options.serverName);
for (const eachBot of bot.bots) {
if (args.slice(1).join(' ').toLowerCase() === 'all') {
eachBot.console.server = 'all'
bot.console.info("Set the console server to all");
continue
}
const server = servers.find(server => server.toLowerCase().includes(args[1]))
if (!server) {
bot.console.info("Invalid server");
return
}
bot.console.info(`Set the console server to ` + server);
eachBot.console.server = server;
}
break
case 'customchat':
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
bot.customChat.enabled = false
bot.console.info('Custom Chat disabled');
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
bot.customChat.enabled = true;
bot.console.info('Custom Chat enabled');
}
break
case 'say':
if (bot.customChat.enabled === false) {
bot.chat.send(args.slice(1).join(' '))
// bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
} else if (bot.customChat.enabled === true) {
if (args.slice(1).join(' ').startsWith('/')) {
bot.chat.command(`${args.slice(1).join(' ').substring(1)}`)
return;
}
bot.customChat.chat(args.slice(1).join(' '));
}
break
case "validate":
case "validation":
case "val":
switch (args[1]?.toLowerCase()) {
case "owner":
case "o":
if (bot.customChat.enabled === true) {
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
} else if (bot.customChat.enabled === false) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
}
break
case "admin":
case "a":
if (bot.customChat.enabled === true) {
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
} else if (bot.customChat.enabled === false) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
}
break
case "trusted":
case "t":
if (bot.customChat.enabled === true) {
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
} else if (bot.customChat.enabled === false) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
}
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
break
case 'logging':
case 'togglelogging':
case 'logtoconsole':
switch (args[1]?.toLowerCase()) {
case 'on':
case 'enable':
case 'enabled':
case 'true':
if (bot.options.logging === true) {
bot.console.info(`logging for ${bot.options.serverName} is already enabled!`);
} else {
bot.console.info(`logging for ${bot.options.serverName} is now enabled`);
bot.options.logging = true;
}
break
case 'off':
case 'disable':
case 'disabled':
case 'false':
if (bot.options.logging === false) {
bot.console.info(`logging for ${bot.options.serverName} is already disabled!`);
} else {
bot.console.info(`logging for ${bot.options.serverName} is now disabled`);
bot.options.logging = false;
}
break
}
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
}
}

View file

@ -1,23 +0,0 @@
module.exports = {
data: {
name: 'kill',
trustLevel: 3,
aliases: [
"suicide",
"quit",
],
description: 'kill the bots process',
usages: [
""
],
},
execute (context) {
const bot = context.bot;
process.exit(1);
},
discordExecute (context) {
const bot = context.bot;
process.exit(1)
}
}

View file

@ -1,49 +0,0 @@
const CommandError = require('../../util/command_error.js');
const { stylize } = require('../../util/stylizeEval');
const util = require('util');
module.exports = {
data: {
name: 'servereval',
trustLevel: 3,
aliases: [
"se"
],
description: 'run code unisolated',
usages: [
"<code>",
],
},
execute (context) {
const bot = context.bot;
const source = context.source;
const config = context.config;
const discordClient = context.discordClient;
const args = context.arguments;
const script = args.slice(1).join(' ');
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
try {
if (source.sources.console) {
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
} else if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`)
// bot.tellraw('@a', `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`);
// bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`
});
}
} catch (e) {
throw new CommandError(e.toString())
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
try {
bot?.discord?.message?.reply(`\`\`\`js\n${util.inspect(eval(args.join(' '))).toString().substring(0, 1980)}\`\`\``);
} catch (e) {
throw new CommandError(e.toString());
}
}
}

View file

@ -1,35 +0,0 @@
module.exports = {
data: {
name: "core",
aliases: [
"cb",
"cbrun",
"corerun"
],
trustLevel: 0,
description: "run commands in core",
usages: [
"<message>"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
if (bot.options.mode === "savageFriends") {
bot.core.run(args.join(' '));
} else if (bot.options.mode === "kaboom") {
bot.core.runTracked(args.join(' '));
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (bot.options.mode === "savageFriends") {
bot.core.run(args.join(' '));
} else if (bot.options.mode === "kaboom") {
bot.core.runTracked(args.join(' '));
}
}
}

View file

@ -1,28 +0,0 @@
module.exports = {
data: {
name: 'echo',
trustLevel: 0,
aliases: [
"say",
"botsay",
],
description: 'Make me say something',
usages: [
"<message>"
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
bot.chat.send(args.join(' '));
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (args.includes("@everyone") || args.includes("@here")) {
bot.discord.message.reply("go fuck yourself");
} else {
bot.discord.message.channel.send(args.join(' '));
}
}
}

View file

@ -1,302 +0,0 @@
function commandListComponent (commands, config, public, trusted, admin, owner, Console) {
switch (commands.data.trustLevel) {
case 0:
public.push({
text: commands.data.name + ' ',
color: config.colors.help.public,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 1:
trusted.push({
text: commands.data.name + ' ',
color: config.colors.help.trusted,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 2:
admin.push({
text: commands.data.name + ' ',
color: config.colors.help.admin,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 3:
owner.push({
text: commands.data.name + ' ',
color: config.colors.help.owner,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
case 4:
Console.push({
text: commands.data.name + ' ',
color: config.colors.help.console,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Command Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases}`, color: config.colors.commands.secondary },
{ text: "Usages", color: config.colors.commands.primary },
{ text: `${commands.data.usages}`, color: config.colors.commands.secondary }
]
}
]
},
clickEvent: {
action: "suggest_command",
value: `${config.prefixes[0]}${commands.data.name}`
}
});
break;
default:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
}
function infoComponents (commands, config, infoComponent, usagesComponent) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: `${usages}`, color: config.colors.commands.secondary },
]
});
usagesComponent.push('\n');
};
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Usages", color: config.colors.commands.primary },
]
});
infoComponent.push(usagesComponent);
}
module.exports = {
data: {
name: "help",
description: "see the list of commands",
aliases: [
"heko",
"?",
"cmds",
"commands",
"hell",
],
usages: [
"<command>"
],
trustLevel: 0,
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
const source = context.source;
let component = [];
let infoComponent = [];
let usagesComponent = [];
let public = [];
let trusted = [];
let admin = [];
let owner = [];
let Console = [];
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Commands", color: config.colors.commands.secondary },
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
]
});
for (const commands of bot.commandManager.commandlist) {
commandListComponent(commands, config, public, trusted, admin, owner, Console);
if (args[0] === commands.data.name) {
infoComponents(commands, config, infoComponent, usagesComponent);
bot.tellraw(`@a`, infoComponent);
return;
}
}
component.push(public);
component.push(trusted);
component.push(admin);
component.push(owner);
if (source.sources.console) {
component.push(Console);
}
bot.tellraw("@a", component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const fixansi = context.fixansi;
const args = context.arguments;
let infoComponent = [];
let usagesComponent = [];
let public = [];
let trusted = [];
let admin = [];
let owner = [];
let Console = [];
let component = [];
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Commands", color: config.colors.commands.secondary },
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
]
});
for (const commands of bot.commandManager.commandlist) {
commandListComponent(commands, config, public, trusted, admin, owner, Console);
if (args[0] === commands.data.name) {
infoComponents(commands, config, infoComponent, usagesComponent);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
return;
}
}
component.push(public);
component.push(trusted);
component.push(admin);
component.push(owner);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
}

View file

@ -1,397 +0,0 @@
const os = require("os");
const CommandError = require('../../util/command_error');
const fs = require("fs");
const botInfo = require('../../data/info.json');
const fixansi = require('../../util/ansi.js');
const { EmbedBuilder } = require('discord.js');
const { execSync } = require('child_process')
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`))
}
function componentPush (bot, args, config, discordClient, source, component) {
switch (args[0]?.toLowerCase()) {
case "about":
component.push({
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
color: `${config.colors.commands.primary}`,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{ text: "click here to view bots source code", color: `${config.colors.commands.primary}` }
]
},
clickEvent: {
action: "open_url",
value: `${botInfo.buildstring.url}`
}
})
break;
case "config":
if (bot.options.isKaboom) {
mode = "Kaboom";
} if (bot.options.useChat && bot.options.isKaboom) {
mode = "Kaboom/Coreless";
} if (bot.options.isSavage) {
mode = "Savage";
} if (bot.options.isCreayun) {
mode = "Creayun";
}
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "client":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.integer },
]
})
break;
case "discord":
if (!config.discord.enabled || discordClient.user === null) {
throw new CommandError('Token is incorrect or discord isnt enabled!')
} else {
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
]
})
}
break;
case "options":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "contributors":
case "credits":
component.push({
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Parker", color: "dark_red" },
{ text: "2991", color: "black" },
{ text: "Owner" },
{ text: "Contributors" },
{ text: "_ChipMC_", color: "dark_blue" },
{ text: "chayapak", color: "yellow" },
{ text: "_yfd", color: "light_purple" },
{ text: "aaa", color: "gold" },
{ text: "Morgan", color: "green" },
{ text: "Ankan", color: "dark_green" },
{ text: "TurtleKid", color: "green" },
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
]
})
break;
case "discord":
component.push({
text: `the discord server invite is ${config.discord.invite}`,
color: config.colors.commands.primary,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: "click here to join the discord server!",
color: config.colors.commands.secondary,
}
]
},
clickEvent: {
action: "open_url",
value: `${config.discord.invite}`
}
})
break;
case "loaded":
component.push({
translate: "%s %s\n%s %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
{ text: "Commands", color: config.colors.commands.primary },
{ text: `${bot.modules.length}`, color: config.colors.integer },
{ text: "Modules", color: config.colors.commands.primary }
]
});
break;
case "usages":
case "usage":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
})
break;
case "server":
component.push({
translate: "%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "uptimes":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "server":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "server":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Hostname", color: config.colors.commands.primary },
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
{ text: "User", color: config.colors.commands.primary },
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
{ text: "Working Directory", color: config.colors.commands.primary },
{ text: `${require.main.path}`, color: config.colors.commands.secondary },
{ text: "Arch", color: config.colors.commands.primary },
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
{ text: "OS", color: config.colors.commands.primary },
{ text: `${os.platform}`, color: config.colors.commands.secondary },
{ text: "OS Version", color: config.colors.commands.primary },
{ text: `${os.version()}`, color: config.colors.commands.secondary },
{ text: "Kernel Version", color: config.colors.commands.primary },
{ text: `${os.release()}`, color: config.colors.commands.secondary },
{ text: "CPU", color: config.colors.commands.primary },
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
{ text: "CPU cores", color: config.colors.commands.primary },
{ text: `${os.cpus().length}`, color: config.colors.integer },
{ text: "Node Version", color: config.colors.commands.primary },
{ text: `${process.version}`, color: config.colors.commands.secondary },
{ text: "NPM Version", color: config.colors.commands.primary },
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
]
})
break;
case "version":
case "ver":
if (botInfo.buildstring.codename.length > 0) {
component.push({
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
botInfo.buildstring.codename,
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
});
} else {
component.push({
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
});
}
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
}
module.exports = {
data: {
name: 'info',
trustLevel: 0,
aliases: [
"information",
],
description: 'check the bots info',
usages: [
"about",
"config <client, discord, options, all>",
"contributors/credits",
"discord",
"loaded",
"usages <bot, server, all>",
"uptimes/uptime <bot, server, all>",
"server",
"version/ver",
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
const discordClient = context.discordClient;
const source = context.source;
let component = [];
componentPush(bot, args, config, discordClient, source, component);
bot.tellraw(`@a`, component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const EmbedBuilder = context.EmbedBuilder
const fixansi = context.fixansi;
const args = context.arguments;
const discordClient = context.discordClient;
const source = context.source;
let component = [];
componentPush(bot, args, config, discordClient, source, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
}

View file

@ -1,89 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: "list",
aliases: [
"pl",
"playerlist"
],
description: "check whos online on the server",
trustLevel: 0,
usages: [
""
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let component = [];
let infoComponent = [];
let playerCount = [];
playerCount.push({
translate: "%s: (%s)\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.players.length}`, color: config.colors.integer },
]
});
component.push(playerCount);
for (const player of bot.players) {
component.push({
translate: "%s \u203a %s [%s: %s]",
color: config.colors.commands.tertiary,
with: [
player.displayName ?? player.profile.name,
{ text: `${player.uuid}`, color: config.colors.commands.primary },
{ text: "Latency", color: config.colors.commands.primary },
{ text: `${player.latency}`, color: config.colors.integer }
]
});
component.push("\n");
}
component.pop();
bot.tellraw("@a", component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const fixansi = context.fixansi;
let component = [];
let playerCount = [];
playerCount.push({
translate: "%s: (%s)\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.players.length}`, color: config.colors.integer },
]
});
component.push(playerCount);
for (const player of bot.players) {
component.push({
translate: "%s \u203a %s [%s: %s]",
color: config.colors.commands.tertiary,
with: [
player.displayName ?? player.profile.name,
{ text: `${player.uuid}`, color: config.colors.commands.primary },
{ text: "Latency", color: config.colors.commands.primary },
{ text: `${player.latency}`, color: config.colors.integer }
]
});
component.push("\n");
};
component.pop();
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``);
}
}

View file

@ -1,69 +0,0 @@
const mc = require('minecraft-protocol');
const util = require('util');
function componentPush (config, server, host, port, component) {
component.push({
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ip", color: config.colors.commands.primary },
{ text: `${host}`, color: config.colors.commands.secondary },
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
{ text: "players", color: config.colors.commands.primary },
{ text: `${server.players.online}`, color: config.colors.integer },
{ text: `${server.players.max}`, color: config.colors.integer },
{ text: "server version", color: config.colors.commands.primary },
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
server.description
]
});
}
module.exports = {
data: {
name: "mcserver",
aliases: [
"pingserver"
],
description: "pings minecraft servers",
trustLevel: 0,
usages: [
"<ip>"
]
},
async execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
const [host, port] = args[0].split(':');
const server = await mc.ping({ host, port: Number(port ?? 25565) });
let component = [];
try {
componentPush(config, server, host, port, component);
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(`${e.toString()}`);
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
const config = context.config;
const [host, port] = args[0].split(':');
const server = await mc.ping({ host, port: Number(port ?? 25565) });
let component = [];
try {
componentPush(config, server, host, port, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(`${e.toString()}`);
}
}
}

View file

@ -1,53 +0,0 @@
module.exports = {
data: {
name: "netmsg",
aliases: [
"networkmessage",
"netmessage"
],
description: "send a message to other servers",
trustLevel: 1,
usages: [
"<message>"
]
},
execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
const source = context.source;
let component = [];
if (bot.options.private === true) {
component.push({
translate: "[%s] %s \u203a %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
source?.player?.displayName ?? source?.player?.profile?.name,
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
]
})
} else {
component.push({
translate: "[%s:%s] %s \u203a %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
{ text: `${bot.options.port}`, color: config.colors.commands.primary },
source.player.displayName ?? source.player.profile.name,
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
]
})
}
for (const eachBot of bot.bots) {
/* if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
} else {*/
eachBot.tellraw("@a", component)
// }
}
}
}

View file

@ -1,35 +0,0 @@
module.exports = {
data: {
name: 'refillcore',
trustLevel: 0,
aliases: [
"rc",
"refill",
],
description: 'refill the bots core',
usages: [
""
],
},
execute (context) {
const bot = context.bot;
const config = context.config;
if (bot.options.mode === "savageFriends") {
bot.core.chatRefill();
} else {
bot.core.move();
}
bot.tellraw("@a", "Refilling core,...")
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
if (bot.options.mode === "savageFriends") {
bot.core.chatRefill();
} else {
bot.core.move();
}
bot.tellraw("@a", "Refilling core,...");
}
}

View file

@ -1,114 +0,0 @@
const CommandError = require('../../util/command_error')
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
const { request } = require('undici');
module.exports = {
data: {
name: 'urban',
description: 'urban dictionary',
aliases: [
'urbandictionary'
],
trustLevel: 0,
usages: [
"<definition>",
],
},
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
const prefix = [
{ text: '[', color: 'dark_gray' },
{ text: 'Urban', color: '#B72A00' },
{ text: '] ', color: 'dark_gray'}
]
let component = [];
let term = `${args.join(' ')}`
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
if (bot.options.mode === "savageFriends") {
bot.chat.message('this command is disabled for this server for right now sorry!');
return;
}
if (!list.length) {
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
}
for (definitions of list) {
component.push(prefix, [
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
underlined: false,
italic: false,
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
},
{
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
color: 'gray'
}
]
},
clickEvent: {
action: 'open_url',
value: `${definitions.permalink}`
}
},
])
}
if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
} else {
bot.tellraw(`@a`, component)
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
let component = [];
let term = `${args.join(' ')}`
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
try {
for (definitions of list) {
component.push([
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77').substring(0, 1950)}\n`,
color: 'gray',
}
]);
}
bot.discord.message.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}

View file

@ -1,101 +0,0 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
function components (config, info, component) {
component.push({
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{
translate: "%s: %s, %s %s",
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
]
},
{ text: "Coords", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{
translate: "%s: %s (%s), %s (%s)",
with: [
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary }
]
},
{
translate: "%s: %s (%s, %s), %s (%s, %s)",
with: [
{ text: "Wind Speed", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.wind_kph)}`, color: config.colors.integer },
{ text: "kph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.wind_mph)}`, color: config.colors.integer },
{ text: "mph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary }
]
},
{ text: "Condition", color: config.colors.commands.primary },
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
{ text: "Humidity", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
]
});
}
module.exports = {
data: {
name: "weather",
aliases: [
],
description: "check the weather in locations",
trustLevel: 0,
usages: [
"<weather/zip code>"
]
},
async execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','%20')}`);
const info = await url.body.json();
components(config, info, component);
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(e.toString());
}
},
async discordExecute (context) {
const config = context.config;
const bot = context.bot;
const fixansi = context.fixansi;
const args = context.arguments;
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
components(config, info, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}

View file

@ -1,66 +0,0 @@
const wiki = require('wikipedia');
const CommandError = require('../../util/command_error');
async function components (config, summary, component) {
component.push({ text: summary, color: config.colors.commands.primary })
}
module.exports = {
data: {
name: 'wiki',
description: 'wikipedia',
trustLevel: 0,
aliases: [
'wikipedia'
],
usages:[
"<article>"
],
},
async execute (context) {
const source = context.source;
const args = context.arguments;
const bot = context.bot;
const config = context.config;
let component = [];
try {
const page = await wiki.page(args.join(' '));
const summary = await page.intro();
components(config, summary, component);
bot.tellraw("@a", component);
} catch (e) {
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.chat.message('&cArticle not found!');
} else {
bot.tellraw(`@a`, `${e.toString()}`)
}
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
let component = [];
try {
const page = await wiki.page(args.join(' '));
const summary = await page.intro();
components(config, summary, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot?.discord?.message?.reply('Article not found!');
} else {
bot?.discord?.message?.reply(`${e.toString()}`);
}
}
}
}

View file

@ -1,99 +0,0 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: "cloop",
aliases: [
"commandloop",
"loop"
],
description: "loops commands",
trustLevel: 1,
usages: [
"add <interval> <command>",
"remove <index>",
"list",
"clear"
]
},
execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
switch (args[1]?.toLowerCase()) {
case "add":
if (isNaN(args[2]) === true) throw new CommandError("invalid interval");
const interval = parseInt(args[2]);
const command = args.slice(3).join(' ');
bot.cloop.add(command, interval);
bot.chat.message(`added ${command} to the cloops with the interval ${interval}`);
break;
case "clear":
bot.cloop.clear();
bot.chat.message('cleared the cloops');
break;
case "remove":
if (isNaN(args[2]) === true) throw new CommandError('argument must be an integer!');
const index = parseInt(args[2]);
bot.cloop.remove(index);
bot.chat.message(`removed ${index} from cloops`);
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: config.colors.commands.primary,
with: [
{ text: `${i}`, color: config.colors.integer },
cloop.command,
{ text: `${cloop.interval}`, color: config.colors.integer },
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
color: config.colors.commands.primary,
with: [
{ text: `${bot.cloop.list.length}`, color: config.colors.integer }
]
})
component.push('\n')
if (bot.cloop.list.length > 0) {
component.push(listComponent)
}
bot.tellraw("@a", component);
/*
if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):',
color: config.colors.commands.primary,
with: [
{ text: `${bot.cloop.list.length}`, color: config.colors. }
]
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}*/
break;
default:
throw new CommandError('invalid argument')
}
}
}

View file

@ -1,41 +0,0 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'validate',
trustLevel: 1,
aliases: [
"val"
],
description: 'validate through the bot',
usages: [
""
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
if (args[0] === bot.validation.trusted) {
bot.chat.message('&2Valid Trusted hash');
}
if (args[0] === bot.validation.admin) {
bot.chat.message('&2Valid Admin hash');
}
if (args[0] === bot.validation.owner) {
bot.chat.message('&2Valid Owner hash');
}
},
discordExecute (context) {
const bot = context.bot;
const event = bot?.discord?.message
const roles = event?.member?.roles?.cache
const source = context.source;
if (roles?.some(role => role.name === `${config.discord.roles.trusted}`)) {
bot.discord.message.reply('Valid trusted user')
bot.chat.message(`Valid trusted user [${bot.discord.message.member.user.username}]`)
} else if (roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)) {
bot.discord.message.reply('Valid Owner user')
bot.chat.message(`Valid Owner User [${bot.discord.message.member.user.username}]`);
}
}
}

View file

@ -1,81 +0,0 @@
prefixes:
- "!"
discord:
token: "discord token here"
prefix: "!"
invite: "discord invite here"
enabled: false
presence:
name: "amogus"
status: "dnd"
roles:
trusted: "trusted"
admin: "admin"
fullAccess: "full access"
owner: "FNFBoyfriendBot Owner"
core:
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" }
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" }
itemRefill: true
# refilling core via item is buggy rn i recommend setting itemRefill to false for now
area:
start:
x: 0
y: 0
z: 0
end:
x: 15
y: 0
z: 15
keys:
trusted: "trusted key here"
admin: "admin key here"
owner: "owner key here"
weatherApiKey: ""
colors:
integer: "gold"
discord:
embed: "#000000"
error: "#FF0000"
commands:
primary: "dark_blue"
secondary: "blue"
tertiary: "gray"
help:
public: "dark_blue"
trusted: "blue"
admin: "aqua"
owner: "light_purple"
console: "dark_purple"
console:
prefix: "c."
logsFolder:
path: "../../"
# this is being loaded from the modules so make sure it starts with ../../
name: "logs"
bots:
# modes: kaboom, savageFriends, creayun
# private is for hiding the server ip in netmsg
# reconnectDelay is for reconnecting the bot to the server on a delay
# serverName is whatever you set the name as for the server
# usernameGen is for generating random usernames
# channelId is for the discord channel
- host: "localhost"
username: "FNFBoyfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "localhost"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: false
mode: "kaboom"

View file

@ -1,8 +0,0 @@
{
"buildstring": {
"build": "2150",
"codename": "",
"version": "v7.0.4",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,71 +0,0 @@
const createBot = require('./bot.js');
const readline = require('readline');
const js_yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
const { Client, GatewayIntentBits } = require('discord.js');
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
const CommandSource = require('./util/command_source');
console.log('Starting FNFBoyfriendBot');
if (fs.existsSync(path.join(__dirname, "../config.yml")) === false) {
console.warn("Config not found creating config from the default config");
fs.copyFileSync(
path.join(__dirname, "./data/default_config.yml"),
path.join(__dirname, "../config.yml")
)
}
try {
config = require('js-yaml').load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
} catch (e) {
console.log(e.stack);
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
if (config.discord.enabled) discordClient.login(config.discord.token);
const bots = [];
let bot;
for (const options of config.bots) {
bot = new createBot(options, config);
bots.push(bot);
bot.bots = bots;
require('./util/loadModules')(bot, options, config, discordClient);
bot.console.readlineInterface(rl);
}
discordClient.on('messageCreate', (message) => {
try {
if (message.author.id === bot.discord.client.user.id) return;
const ChatMessage = require('prismarine-chat')('1.20.2');
bot.getMessageAsPrismarine = (message) => {
return new ChatMessage(message);
}
config.prefixes.map((prefix) => {
if (message.content.startsWith(prefix)) {
const source = new CommandSource({
profile: {
name: `${message?.member.nickname || message?.author.displayName}`
}
}, {
discord: true,
console: false,
}, false, message);
bot.commandManager.executeString(source, message.content.substring(prefix.length));
return;
}
});
} catch (e) {
console.log(e.stack);
}
});

View file

@ -1,28 +0,0 @@
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
const info = require('../data/info.json');
bot.on("packet.login", (data) => {
if (bot.options.mode === "creayun") return
if (new Date().getDay() === 5) {
bot.chat.message('Gettin\' freaky on a friday night!');
} else {
bot.chat.message(`&9FNF&3Boyfriend&1Bot &b${info.buildstring.version} &fcreated by &4Parker&02991`);
}
})
process.on('SIGINT', (data) => {
bot.chat.message('Killing bot.....');
process.exit(5);
});
}
module.exports = {
data: {
enabled: true,
name: "boot",
type: "start up"
},
inject
};

View file

@ -1,371 +0,0 @@
const loadPrismarineChat = require('prismarine-chat');
const KaboomChatParser = require('../util/ChatParsers/Kaboom');
const ChipmunkModChatParser = require('../util/ChatParsers/ChipmunkMod');
const CreayunChatParser = require('../util/ChatParsers/Creayun');
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
function tryParse (json) {
try {
return JSON.parse(json)
} catch (error) {
return { text: '' }
}
}
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let ChatMessage
bot.on('registry_ready', registry => {
ChatMessage = loadPrismarineChat(registry)
})
if (options.mode === "savageFriends" || options.mode === "creayun") {
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
} else {
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
}
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
})
switch (packet.type) {
case 1:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "1", color: "gold" },
{ translate: "chat.type.emote", with: [ sender, message ]}
]
});
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "1", color: "gold" },
JSON.stringify({
translate: "chat.type.emote", with: [ sender, message ]
})
]
})
} else {
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
}
break
case 2:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "2", color: "gold" },
{ translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "2", color: "gold" },
JSON.stringify({
translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true
})
]
})
} else {
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message ], color: "gray", italic: true })
}
break
case 3:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "3", color: "gold" },
{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "3", color: "gold" },
JSON.stringify({
translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true
})
]
})
} else {
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
}
break
case 4:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "4", color: "gold" },
message
]
})
} if (config?.debug?.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "4", color: "gold" },
JSON.stringify(message)
]
})
} else {
bot.emit('message', [message]);
}
break
case 5:
if (config?.debug?.chat?.profileless?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "5", color: "gold" },
{ translate: 'chat.type.announcement', with: [ sender, message ]}
]
})
} if (config?.debug.chat?.profileless?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PR Chat", color: "blue" },
{ text: "type", color: "light_purple" },
{ text: "5", color: "gold" },
JSON.stringify({ translate: 'chat.type.announcement', with: [ sender, message ]})
]
})
} else {
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
}
break
}
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
})
bot.on('packet.player_chat', (packet, data) => {
const unsigned = tryParse(packet.unsignedChatContent)
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
switch (packet.type) {
case 5:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "5", color: "gold" },
{ translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]}
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "5", color: "gold" },
JSON.stringify({ translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
]
})
} else {
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
}
break
case 4:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "4", color: "gold" },
unsigned
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "4", color: "gold" },
JSON.stringify(unsigned)
]
})
} else {
bot.emit('message', unsigned);
}
break
case 3:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "3", color: "gold" },
{ translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "3", color: "gold" },
JSON.stringify({ translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
]
})
} else {
bot.emit('message', { translate: "commands.message.display.outgoing", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
}
break
case 2:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "2", color: "gold" },
{ translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true }
]
})
} if (config?.debug?.chat?.player?.json === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "2", color: "gold" },
JSON.stringify({ translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
]
})
} else {
bot.emit('message', { translate: "commands.message.display.incoming", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ], color: "gray", italic: true })
}
break
case 1:
if (config?.debug?.chat?.player?.packetType === true) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "1", color: "gold" },
{ translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]}
]
})
} if (config?.debug?.chat?.player?.json) {
bot.emit('message', {
translate: "[%s | %s: %s] %s",
with: [
{ text: "PL Chat", color: "green" },
{ text: "type", color: "dark_green"},
{ text: "1", color: "gold" },
JSON.stringify({ translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
]
})
} else {
bot.emit('message', { translate: "chat.type.emote", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
}
break
}
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
})
bot.on('packet.system_chat', packet => {
const message = tryParse(packet.content)
if (message.translate === "advMode.setCommand.success" && config?.debug?.commandSetMessage === false) return;
if (message.translate === 'multiplayer.message_not_delivered') return
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
if (packet.isActionBar) {
return
}
if (message.translate === "advMode.notAllowed" || message?.translate?.startsWith("قيادة المجموعة")) return;
if (config?.debug?.chat?.system?.packetType === true) {
bot.emit('message', {
translate: "[%s] %s",
with: [
{ text: "System Chat", color: "dark_blue"},
message
]
})
} if (config?.debug?.chat?.system?.json === true) {
bot.emit('message', {
translate: "[%s] %s",
with: [
{ text: "System Chat", color: "dark_blue"},
JSON.stringify(message)
]
})
} else {
bot.emit('message', message);
}
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine });
})
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
}
require('../util/chat_util')(bot);
}
module.exports = {
data: {
enabled: true,
name: "chat",
type: "logging"
},
inject
};

View file

@ -1,260 +0,0 @@
const mcData = require('minecraft-data')('1.20.2');
const nbt = require('prismarine-nbt');
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.core = {
area: {
start: config.core?.area.start ?? { x: 0, y: 0, z: 0 },
end: config.core?.area.end ?? { x: 15, y: 0, z: 15 }
},
position: null,
itemPosition: null,
currentBlockRelative: { x: 0, y: 0, z: 0 },
usePlacedCommandBlock: false,
chatRefill () {
const pos = bot.core.position
const { start, end } = bot.core.area
if (!pos) return
if (bot.options.mode === "creayun") return;
if (bot.options.mode === "savageFriends") {
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} command_block`
} else {
command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
}
bot.chat.command(`${command}`)
},
itemRefill () {
const pos = bot.core.position;
const { start, end } = bot.core.area;
const itemPosition = bot.core.itemPosition;
if (!pos) return;
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
bot._client.write('set_creative_slot', {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.repeating_command_block.id,
itemCount: 1,
nbtData: nbt.comp({
BlockEntityTag: nbt.comp({
CustomName: nbt.string(JSON.stringify(config.core.itemName))
})
})
}
});
bot._client.write('block_dig', {
status: 0,
location: itemPosition,
face: 0
});
bot._client.write('block_place', {
hand: 0,
location: itemPosition,
direction: 0,
cursorX: 0,
cursorY: 0,
cursorZ: 0,
insideBlock: false
});
if (bot.core.usePlacedCommandBlock) {
return
} else {
bot._client.write('update_command_block', {
location: itemPosition,
command,
flags: 5,
mode: 1
})
}
},
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.itemPosition = {
x: Math.floor(pos.x - 2),
y: Math.floor(pos.y - 2),
z: Math.floor(pos.z - 2)
}
if (config.core.itemRefill && bot.options.mode !== "savageFriends") {
bot.core.itemRefill();
} else {
bot.core.chatRefill();
}
},
currentBlock () {
const relativePosition = bot.core.currentBlockRelative
const corePosition = bot.core.position
if (!corePosition) return null
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();
const itemPosition = bot.core.itemPosition;
if (!location) return;
if (bot.options.mode === "creayun") {
return;
} else if (bot.options.mode === "savageFriends") {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: location,
mode: 2,
flags: 0b101,
});
bot.core.incrementCurrentBlock();
} else {
if (bot.core.usePlacedCommandBlock) {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: itemPosition,
mode: 1,
flags: 5,
});
bot.core.incrementCurrentBlock();
} else {
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location,
mode: 1,
flags: 5
});
bot.core.incrementCurrentBlock();
}
}
},
async runTracked (command) {
const location = bot.core.itemPosition;
let transactionId = Math.floor(Math.random() * 10000);
bot._client.write('set_creative_slot', {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.repeating_command_block.id,
itemCount: 1,
nbtData: nbt.comp({
BlockEntityTag: nbt.comp({
CustomName: nbt.string(JSON.stringify(config.core.itemName))
})
})
}
});
bot._client.write('block_dig', {
status: 0,
location: {
x: location.x,
y: location.y - 1,
z: location.z
},
face: 0
});
bot._client.write('block_place', {
hand: 0,
location,
direction: 0,
cursorX: 0,
cursorY: 0,
cursorZ: 0,
insideBlock: false
});
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location: {
x: location.x,
y: location.y,
z: location.z
},
flags: 0b101,
mode: 1
});
await sleep(100);
bot._client.write('query_block_nbt', { location, transactionId });
bot.on('packet.nbt_query_response', (data) => {
try {
if (data.transactionId == transactionId) {
if (data?.nbt?.value?.LastOutput) {
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value).extra);
bot.tellraw(`@a[name="${bot.options.username}"]`, {
translate: "fnfboyfriendbot_command_block_output",
extra: [
JSON.parse(data.nbt.value.LastOutput.value).extra
]
});
}
}
} catch (e) {
console.log(e.stack)
}
});
}
}
require('../util/core_util')(bot, config, options);
}
module.exports = {
data: {
enabled: true,
name: "core",
type: "extras"
},
inject
};

View file

@ -1,40 +0,0 @@
const CommandSource = require('../util/command_source');
function inject (context) {
let ratelimit = 0;
const bot = context.bot;
const config = context.config;
const options = context.options;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
bot.on("parsed_message", (data) => {
if (data.type !== "minecraft:chat") return;
const prefixes = config.prefixes;
prefixes.map((prefix) => {
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString();
// console.log(plainMessage);
if (!plainMessage.startsWith(prefix)) return
const command = plainMessage.substring(prefix.length)
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
ratelimit++
setTimeout(() => {
ratelimit--
}, 1000)
if (ratelimit > 2) {
bot.tellraw('@a', { text: 'You are using commands too fast!', color: 'dark_red'})
} else if (command.split(" ")[0].length === 0) {
} else {
bot.commandManager.executeString(source, command)
}
})
})
}
module.exports = {
data: {
enabled: true,
name: "command handler",
type: "commands"
},
inject
};

View file

@ -1,40 +0,0 @@
function inject (context) {
const bot = context.bot;
bot.cloop = {
list: [],
add (command, interval) {
let timer;
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
this.list.push(timer)
bot.on('end', () => {
this.clear()
})
bot.on('packet.login', () => {
if (this.list.length === 0) return
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
this.list.push(timer);
})
},
remove (index) {
clearInterval(this.list[index].timer)
bot.cloop.list.splice(index, 1)
},
clear () {
for (const cloop of this.list) clearInterval(cloop.timer)
this.list = []
}
}
}
module.exports = {
data: {
enabled: true,
name: "command loop",
type: "extras"
},
inject
};

View file

@ -1,168 +0,0 @@
const fs = require('fs');
const path = require('path');
const CommandError = require('../util/command_error.js');
const CommandSource = require('../util/command_source');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
const cmdMgrUtil = require('../util/command_manager_util');
const sleep = require('../util/sleep.js');
async function inject (context) {
const bot = context.bot;
const config = context.config;
const discordClient = context.discordClient;
const options = context.options;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
bot.commandManager = {
commands: {},
commandlist: [],
execute (source, commandName, args) {
const command = this.getCommand(commandName.toLowerCase());
try {
if (!command) {
if (source?.sources?.console) {
bot.console.warn(bot.getMessageAsPrismarine({
translate: "%s%s%s %s",
color: "dark_gray",
with: [
{ translate: "command.unknown.command", color: "red" },
{ text: "\n" },
{ text: `${commandName}` },
{ translate: "command.context.here", color: "red" }
]
})?.toAnsi());
} else {
bot.tellraw("@a", {
translate: "%s%s%s %s",
color: "dark_gray",
with: [
{ translate: "command.unknown.command", color: "red" },
{ text: "\n" },
{ text: `${commandName}` },
{ translate: "command.context.here", color: "red" }
]
});
}
}
cmdMgrUtil(bot, command, args, source);
return command?.execute({ bot, source, arguments: args, config, discordClient });
} catch (error) {
// console.error(error);
if (error instanceof CommandError) {
if (options.mode !== "kaboom") {
bot.chat.message(`&4${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
} else if (error.toString().length < 256) {
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
bot.tellraw("@a", error._message);
}
}
} else {
bot.tellraw("@a", {
translate: "command.failed",
color: "red",
hoverEvent: {
action: "show_text",
contents: String(error.stack)
}
});
bot?.console?.warn(error.stack);
}
}
},
executeString (source, command) {
const [commandName, ...args] = command.split(' ');
if (source?.sources?.discord) {
return this.discordExecute(source, commandName, args);
} else if (!source?.sources?.discord) {
return this.execute(source, commandName, args);
}
},
discordExecute(source, commandName, args) {
const command = this.getCommand(commandName.toLowerCase());
try {
if (!command) {
throw new CommandError(`Unknown Command: ${commandName}`);
}
cmdMgrUtil(bot, command, args, source);
if (!command?.discordExecute) {
throw new CommandError(`${command.data.name} command is not supported in discord!`);
} else if (source.sources.discord) {
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi });
}
} catch (error) {
if (error instanceof CommandError) {
bot?.discord?.message?.reply(`${bot.getMessageAsPrismarine(error._message)}`);
} else {
bot?.discord?.message?.reply(`\`\`\`${error}\`\`\``);
bot?.console?.warn(error.stack);
}
}
},
register (command) {
this.commands[command.data.name] = command
if (command.data.aliases) {
command.data.aliases.map((a) => (this.commands[a] = command));
}
},
getCommand (name) {
return this.commands[name]
},
getCommands () {
return Object.values(this.commands)
},
}
/*
file loader ported from my discord bot SkiBot
and edited to support mjs files and to support FNFBoyfriendBot's command format
*/
commandlist = [];
const foldersPath = path.join(__dirname, '../commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath)
for (const filename of commandFiles) {
try {
const filePath = path.join(commandsPath, filename);
if (filename.endsWith('.mjs')) {
let command = await import(filePath);
bot.commandManager.register(command.default);
bot.commandManager.commandlist.push(command.default);
}
if (filename.endsWith('.js')) {
let command = require(filePath);
bot.commandManager.register(command);
bot.commandManager.commandlist.push(command);
}
} catch (error) {
console.error('Failed to load command ', filename, ':', error);
}
}
}
}
module.exports = {
data: {
enabled: true,
name: "command manager",
type: "commands"
},
inject
};

View file

@ -1,52 +0,0 @@
function inject (context) {
const bot = context.bot
if (bot.options.mode !== "kaboom") return
bot.on('system_chat', (data) => {
try {
const message = data.message;
// console.log(message);
if (message.translate === "fnfboyfriendbot_request_command_suggestion") {
const extra = message.extra;
const uuidString = extra[0].text;
const uuidMatch = bot.players.find((e) => e.uuid === uuidString);
if (Array.isArray(extra) && extra.length > 0) {
const commandSuggestions = {
extra: [
{ text: "fnfboyfriendbot_request_command_suggestion" },
...bot.commandManager.commandlist.map((c) => {
const aliases = c.data.aliases.length > 0 ? c.data.aliases : [];
return {
extra: [
c.data.trustLevel === 0 ? "PUBLIC" :
c.data.trustLevel === 1 ? "TRUSTED" :
c.data.trustLevel === 2 ? "ADMIN" :
c.data.trustLevel === 3 ? "OWNER" :
"OWNER",
"true",
...aliases
],
text: c.data.name
};
})
],
text: ""
};
const jsonString = (commandSuggestions);
bot.tellraw(`@a[name="${uuidMatch.profile.name}"]`, jsonString);
}
}
} catch (e) {
if (e.toString() === "TypeError: Cannot read properties of undefined (reading '0')") return
else console.log(e.stack)
}
})
}
module.exports = {
data: {
enabled: true,
name: "command suggestion",
type: "commands"
},
inject
};

View file

@ -1,74 +0,0 @@
const CommandSource = require('../util/command_source');
const prismarineChat = require('prismarine-chat')('1.20.2');
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let ratelimit = 0;
bot.console = {
readline: null,
server: 'all',
readlineInterface (rl) {
this.readline = rl
rl.on('line', (args) => {
if (bot.options.serverName !== this.server && this.server !== 'all') return
if (args.startsWith(config.console.prefix)) {
return bot.commandManager.executeString(bot.console.source, args.substring(config.console.prefix.length))
} else if (args.startsWith("")) {
return bot.commandManager.executeString(bot.console.source, `console say ${args.substring(0)}`);
}
rl.on('close', () => {
this.readline = null;
})
})
},
source: new CommandSource({
profile: {
name: bot._client.username
}, uuid: bot._client.uuid },
{ console: true, discord: false
}),
refreshLine (...args) {
this.readline.output.write("\x1b[2K\r");
console.log.apply(console, arguments);
this.readline._refreshLine();
},
log (message) {
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO" })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })} §6logs§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
},
warn (error) {
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §ewarn§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
},
error (error) {
this.refreshLine(bot.getMessageAsPrismarine(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §4error§8] §8[${options.serverName}§8] `)?.toAnsi() + error)
},
info (message) {
this.refreshLine(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §2info§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
},
debug (message) {
console.log(prismarineChat.fromNotch(`§8[§1${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} §3${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} §6debug§8] §8[${options.serverName}§8] `)?.toAnsi() + message)
}
}
setInterval(() => ratelimit = 0, 1000 * 2);
bot.on('message', (message) => {
if (!options.logging) return;
if (ratelimit > 10 || message?.translate === "fnfboyfriendbot_command_block_output" || message?.translate === "fnfboyfriendbot_request_command_suggestion") return;
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
ratelimit++
});
}
module.exports = {
data: {
enabled: true,
name: "console",
type: "logging"
},
inject
};

View file

@ -1,175 +0,0 @@
const fixansi = require('../util/ansi');
const CommandSource = require('../util/command_source');
const util = require('util')
function inject (context) {
const bot = context.bot;
const config = context.config;
const discordClient = context.discordClient;
const options = context.options;
if (!options?.channelId) {
bot.discord = {
invite: config.discord?.invite
}
return
}
bot.discord = {
client: discordClient,
channel: undefined,
invite: config.discord.invite || undefined,
prefix: config.discord.prefix,
}
discordClient.once('ready', (context) => {
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
discordClient.user.setPresence({
activities: [{
name: `${config.discord.presence.name}`,
type: 0
}],
status: `${config.discord.presence.status}`
});
})
let discordQueue = []
setInterval(() => {
if (discordQueue.length === 0) return
try {
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
} catch (error) {
}
discordQueue = []
}, 2000)
function sendDiscordMessage(message) {
discordQueue.push(message)
}
function sendComponent(message) {
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('```\u001b[9```' + '```\u001b[3```').replaceAll('https://discord','https:\rdiscord')?.replaceAll('discord.gg', 'discord.\rgg').replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt");
try {
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
} catch (e) {
bot.console.warn(`Error sending a message to Discord: ${e.message}`)
sendDiscordMessage(e.message)
}
}
bot.on('message', (message) => {
if (message?.translate === "fnfboyfriendbot_command_block_output" || message?.translate === "fnfboyfriendbot_request_command_suggestion") return;
sendComponent(message);
});
function messageCreate(message, source) {
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(config.discord.prefix)) { // TODO: Don't hardcode this
const source = new CommandSource({
profile: {
name: `${message?.member.nickname || message?.author.displayName}`
}
}, {
discord: true,
console: false
}, false, message);
sendComponent(message);
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
return
}
const tag = {
translate: '[%s] %s \u203a ',
with: [{
translate: '%s%s%s %s',
bold: false,
with: [{
text: 'FNF',
bold: false,
color: 'blue'
},
{
text: 'Boyfriend',
bold: false,
color: 'dark_aqua'
},
{
text: 'Bot',
bold: false,
color: 'dark_blue'
},
{
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.nickname || message.author.displayName}`,
},
]
}
try {
if (message.attachments.size > 0) {
message.attachments.forEach(Attachment => {
let attachment = {
text: `[Attachment: ${Attachment.name}] ${message?.content}`,
color: "blue",
hoverEvent: {
action: "show_text",
contents: "click here to view attachment"
},
clickEvent: {
action: "open_url",
value: `${Attachment?.url}`
}
}
bot.tellraw("@a", [tag, attachment]);
})
} else if (message?.reference?.type === 0) {
// this is for messages that are replied to
const repliedMessage = message.channel.messages.cache.get(message.reference.messageId);
let reply = [
tag,
{ text: `[Replying to: ${repliedMessage.author.username}] `, color: "blue" },
message.content
];
bot.tellraw("@a", [ reply ]);
} else if (message?.reference?.type === 1) {
// this is for messages that are forwarded
} else {
if (options.mode === "creayun") {
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw('@a', [tag, message.content]);
}
}
} catch (e) {
console.log(e.stack);
}
}
discordClient.on('messageCreate', messageCreate)
}
module.exports = {
data: {
enabled: true,
name: "discord",
type: "logging"
},
inject
};

View file

@ -1,67 +0,0 @@
const fs = require("fs");
const path = require("path");
const { createGzip } = require("zlib");
const readline = require('readline');
const { Console } = require("console");
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
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, `${config.logsFolder.path}`, `${config.logsFolder.name}`);
const logFileName = "latest.log";
const logFilePath = path.join(logFolder, logFileName);
const logStream = fs.createWriteStream(logFilePath, { flags: "a" });
try {
if (!fs.existsSync(logFolder)) {
console.info(`logs folder not found recreating it at ${config.logsFolder.path}${config.logsFolder.name}`);
fs.mkdirSync(logFolder);
}
} catch (e) {
console.error(`Unable to create log folder: ${e}`);
}
function compressFile(input, output) {
const plainOutput = output.slice(0, -3);
fs.renameSync(input, plainOutput);
const gzip = createGzip();
fs.createReadStream(plainOutput)
.pipe(gzip)
.pipe(fs.createWriteStream(output + ".tmp"))
.once("finish", () => {
fs.unlinkSync(plainOutput);
fs.renameSync(output + ".tmp", output);
});
}
if (fs.existsSync(logFilePath)) {
const plainName = fs
.statSync(logFilePath)
.ctime.toISOString()
.split("T")[0];
let name = plainName;
let counter = 1;
let newFileName = path.join(logFolder, `${name}.log.gz`);
while (fs.existsSync(newFileName)) {
name = `${plainName}-${counter}`;
newFileName = path.join(logFolder, `${name}.log.gz`);
counter++;
}
compressFile(logFilePath, newFileName);
}
bot.console.fileLogger = function logging (message) {
logStream.write(message + "\n");
};
}
module.exports = {
data: {
enabled: true,
name: "file logger",
type: "logging"
},
inject
};

View file

@ -1,154 +0,0 @@
const fs = require('fs');
const path = require('path');
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
if (options.mode !== "kaboom") return;
bot.filter = {
list () {
try {
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
} catch (e) {
bot.console.warn(e.toString())
}
},
add (Player, ignoreCase, Regex) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
const filterAdd = { name: Player, ignorecase: ignoreCase, regex: Regex };
data.push(filterAdd);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
this.doAll();
},
remove (index) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data.splice(index, 1);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
clear () {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
data = [];
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
doAll () {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
for (const players of bot.players) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(players.profile.name.toLowerCase())) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name.toLowerCase()}"]`)
}
} else {
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(players.profile.name)) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
} else {
if (filtered.name === players.profile.name) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
}
}
}
}
}
bot.on('parsed_message', (data) => {
try {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(data.sender.profile.name.toLowerCase())) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
} else {
if (data.sender.profile.name.toLowerCase() === filtered.name.toLowerCase()) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(data.sender.profile.name)) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
} else {
if (data.sender.profile.name === filtered.name) {
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
}
}
}
} catch (e) {
console.log(e.stack);
}
});
bot.on('player_info', (data) => {
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
for (const players of bot.players) {
if (filtered.ignorecase === true) {
if (filtered.regex === true) {
let regex = new RegExp(filtered.name.toLowerCase());
if (regex.test(players.profile.name.toLowerCase())) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
} else {
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
}
} else if (filtered.regex === true) {
let regex = new RegExp(filtered.name);
if (regex.test(players.profile.name)) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
}
} else {
if (players.profile.name === filtered.name) {
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
}
}
}
}
});
}
module.exports = {
data: {
enabled: true,
name: "filter",
type: "blacklist"
},
inject
}

View file

@ -1,105 +0,0 @@
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.players = []
bot.on('packet.player_info', async (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.emit("player_info", packet);
})
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude @a, @r, @s, @e, @p -aaa
bot.players.forEach(async player => {
if (!players.includes(player.uuid)) return
const a = player_completion.filter(_ => _.match == player.profile.name)
if (a.length >= 1) {
player.vanished = true;
} else {
bot.players = bot.players.filter(_ => _.uuid != player.uuid);
bot.emit("player_left", player);
}
})
})
function addPlayer (entry) {
bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
bot.players.push({
uuid: entry.uuid,
mcUUID: "",
profile: { name: entry.player.name, properties: entry.player.properties },
chatSession: undefined,
gamemode: undefined,
listed: undefined,
latency: undefined,
displayName: undefined,
vanished: false
})
if (entry.vanished) {
bot.emit("player_vanished", entry);
} else {
bot.emit("player_joined", entry);
}
}
function initializeChat (entry) {
}
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 = {
data: {
enabled: true,
name: "player list",
type: "client"
},
inject
};

View file

@ -1,38 +0,0 @@
function inject (context) {
const bot = context.bot;
const config = context.config;
bot.position = null;
bot.on('packet.position', packet => {
bot.position = {
x: packet.x,
y: packet.y,
z: packet.z
}
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
bot.emit('move')
})
bot.on('move', () => {
if (config?.debug?.position?.bot === true) {
bot.console.debug(`Bot Position: ${JSON.stringify(bot.position)}`)
} if (config?.debug?.position?.core === true) {
bot.console.debug(`Core Position: ${JSON.stringify(bot.core.position)}`)
} if (config?.debug?.position?.coreItem === true) {
bot.console.debug(`Core Item Position: ${JSON.stringify(bot.core.itemPosition)}`)
}
});
bot.on('end', () => { bot.position = null })
}
module.exports = {
data: {
enabled: true,
name: "position",
type: "client"
},
inject
};

View file

@ -1,29 +0,0 @@
const mc = require('minecraft-protocol');
const usernameGen = require("../util/usernameGen");
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.on('end', () => {
bot._client.removeAllListeners();
if (bot.reconnectDelay < 0) return
setTimeout(() => {
if (options.usernameGen) {
client = options.client ?? mc.createClient(options, options.username = usernameGen(bot))
} else {
client = options.client ?? mc.createClient(options)
}
bot._client = client
bot.emit('init_client', bot._client)
}, options.reconnectDelay);
})
}
module.exports = {
data: {
enabled: true,
name: "reconnect",
type: "client"
},
inject
};

View file

@ -1,19 +0,0 @@
const createRegistry = require('prismarine-registry')
function inject (context) {
const bot = context.bot;
bot.on('packet.login', packet => {
bot.registry = createRegistry(bot._client.version);
bot.registry.language = require('../data/language.json');
bot.emit('registry_ready', bot.registry);
});
}
module.exports = {
data: {
enabled: true,
name: "registry",
type: "client"
},
inject
}

View file

@ -1,149 +0,0 @@
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let entityId;
let permissionLevel = 2;
let unmuted = false;
let gameMode;
let commandSpy = false;
let vanished = false;
let prefix = false;
let god = false;
let teleportToggle = false;
let username = false;
let nickname = false;
let login = false;
let register = false;
let positionCount = 0;
bot.vanished = true
bot.on('system_chat', (data) => {
try {
const stringMessage = bot.getMessageAsPrismarine(data.message)?.toString();
if (options.mode === "savageFriends") {
if (stringMessage === "Please, login with the command: /login <password>") login = true;
else if (stringMessage === "Successful login!") login = false;
else if (stringMessage === "You're already logged in!") login = false;
else if (stringMessage === "Please, register to the server with the command: /register <password> <ConfirmPassword>") register = true;
else if (stringMessage === "This user isn't registered!") register = true;
else if (stringMessage === "Successfully registered!") register = false;
else if (stringMessage === "You're already logged in!") register = false;
else if (stringMessage === "Successful login!") register = false;
else if (stringMessage === ` > Prefix for user ${bot.options.username} set to: [Prefix: ${config.prefixes[0]}]`) prefix = true;
else if (stringMessage?.startsWith(` > Prefix for user ${bot.options.username} set to: `) || stringMessage === ` > Prefix for user ${bot.options.username} removed.`) prefix = false;
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
} else if (options.mode === "kaboom") {
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
else if (stringMessage === "Successfully disabled CommandSpy.") commandSpy = false;
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
else if (stringMessage === `You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` || stringMessage === "Something went wrong while saving the prefix. Please check console.") prefix = true;
else if (stringMessage?.startsWith("You now have the tag: ") || stringMessage === "You no longer have a tag") prefix = false
else if (stringMessage?.startsWith("You have been muted")) unmuted = true;
else if (stringMessage?.startsWith("You have been unmuted")) unmuted = false;
else if (stringMessage?.startsWith("Your voice has been silenced")) unmuted = true;
else if (stringMessage === "God mode disabled.") god = false;
else if (stringMessage === "God mode enabled.") god = true;
else if (stringMessage === "Teleportation disabled.") teleportToggle = true;
else if (stringMessage === "Teleportation enabled.") teleportToggle = false;
else if (stringMessage === `Successfully set your username to "${bot.username}"`) {
username = false
return
}
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
}
} catch (e) {
console.log(e.stack);
}
})
bot.on('packet.entity_status', packet => {
if (packet.entityId !== entityId || packet.entityStatus < 24 || packet.entityStatus > 28) return
permissionLevel = packet.entityStatus - 24
})
bot.on('packet.game_state_change', packet => {
if (packet.reason !== 3) return // Reason 3 = Change Game Mode
gameMode = packet.gameMode;
});
bot.on("packet.game_state.change", packet => {
if (packet.reason !== 4) return // checks if the bot is seeing the endcredits or died
clientLock = packet.gameMode;
})
bot.on("packet.position", (packet, position) => {
if (options.mode === "savageFriends" || options.mode === "creayun") return;
positionCount++
setTimeout(() => {
positionCount--
if (positionCount > 4) {
bot.core.run('sudo * icu stop');
} if (permissionLevel < 2 || gameMode !== 1) {
bot._client.end('anti icu :3');
}
}, 1000)
})
let timer;
bot.on('packet.login', async (packet) => {
entityId = packet.entityId;
gameMode = packet.gameMode;
clientLock = packet.gameMode;
timer = setInterval(() => {
if (bot.options.mode === "savageFriends") {
if (login) bot.chat.command('login amogusissus');
else if (register) bot.chat.command('register amogusissus amogusissus');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
else if (!prefix) bot.chat.command(`rank ${bot.options.username} &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
else if (nickname) bot.chat.command('nick off');
else if (!vanished && bot.vanished) bot.chat.command('essentials:vanish on');
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
} else if (bot.options.mode === "kaboom") {
if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (!commandSpy) bot.chat.command('commandspy on');
else if (username) bot.chat.command(`username ${bot.options.username}`)
else if (nickname) bot.chat.command(`nick off`)
else if (!prefix) bot.chat.command(`prefix &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
else if (!vanished && bot.vanished) bot.chat.command(`essentials:vanish on`);
else if (unmuted) bot.core.run(`essentials:mute ${bot.uuid}`);
else if (!god) bot.core.run(`god ${bot.options.username} enable`);
else if (!teleportToggle) bot.core.run(`tptoggle ${bot.options.username} disable`);
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
}
}, 1000);
});
bot.on('end', () => {
if (timer) clearInterval(timer)
prefix = false;
commandSpy = false;
vanished = false;
prefix = false;
god = false;
unmuted = false;
username = false;
});
}
module.exports = {
data: {
enabled: true,
name: "selfcare",
type: "extras"
},
inject
};

View file

@ -1,24 +0,0 @@
function inject (context) {
const bot = context.bot;
// let aaa cook
bot.tab_complete = (str) => {
return new Promise((resolve) => {
bot._client.write('tab_complete', {
text: str, assumeCommand: false, sendBlockInSight: false
})
const tab_completeH = (packet) => {
bot._client.removeListener('tab_complete', tab_completeH)
resolve(packet.matches)
}
bot._client.once('tab_complete', tab_completeH)
})
}
}
module.exports = {
data: {
enabled: true,
name: "tab complete",
type: "extras"
},
inject
};

View file

@ -1,60 +0,0 @@
const sleep = require('../util/sleep');
function inject (context) {
const bot = context.bot;
const options = context.options;
const config = context.config;
if (options.mode !== "kaboom" || config.team.enabled === false) return;
bot.on("packet.login", async () => {
if (options.mode === "kaboom") {
await sleep(100);
bot.chat.command(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
}
})
bot.on("packet.teams", async (data) => {
try {
if (data.team === config.team.name) {
data?.players?.map(async (player) => {
if (player !== bot.options.username) {
await sleep(100);
bot.core.run(`minecraft:team empty ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
// this removes players who are not the bot
}
});
if (data.mode == 1) {
// this is checking if the team has been deleted
bot.core.run(`minecraft:team add ${config.team.name}`);
await sleep(100);
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
} if (data.name !== JSON.stringify(config.team.displayName)) {
// this checks if the team displayName matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} displayName ${JSON.stringify(config.team.displayName)}`);
} if (data.prefix !== JSON.stringify(config.team.prefix)) {
// this checks if the team prefix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} prefix ${JSON.stringify(config.team.prefix)}`);
} if (data.suffix !== JSON.stringify(config.team.suffix)) {
// this checks if the team suffix matches the one set in the config
bot.core.run(`minecraft:team modify ${config.team.name} suffix ${JSON.stringify(config.team.suffix)}`)
}
}
} catch (e) {
console.log(e.stack)
}
})
}
module.exports = {
data: {
enabled: true,
name: "teams",
type: "extras"
},
inject
}

View file

@ -1,20 +0,0 @@
const crypto = require('crypto')
function inject (context) {
const bot = context.bot;
const config = context.config;
setInterval(() => {
bot.validation = {
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.keys.trusted).digest('hex').substring(0, 16),
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.keys.admin).digest('hex').substring(0, 16),
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.keys.owner).digest('hex').substring(0, 16),
}
}, 100)
}
module.exports = {
data: {
enabled: true,
name: "validation",
type: "extras"
},
inject
};

View file

@ -1,27 +0,0 @@
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]
const contents = message.with[2]
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 null;
return { sender, contents, type: 'minecraft:chat', senderComponent }
} catch(e) {
console.error(e)
}
}
module.exports = ChipmunkMod

View file

@ -1,29 +0,0 @@
const ChatMessage = require('prismarine-chat')('1.20.2');
const util = require('util');
function creayun (messageobj, data) {
try {
let match;
let sender;
const stringify = message => new ChatMessage(message).toString()
const message = stringify(messageobj);
const playerWithPrefix = /^(.*?) (\S*?) » (.*?)$/;
const playerWithoutPrefix = /^(\S*?) » (.*?)$/
if (playerWithPrefix.test(message)) {
match = message.match(playerWithPrefix)
// console.log(match[2])
// console.log(data.players.find(player => player.profile.name.toString().replaceAll('§','') === match[2]))
// console.log(data.players)
// console.log(match[0])
// console.log(match[2])
// console.log(data.players.find(player => player.profile.name === match[2]))
sender = data.players.find(player => player.profile.name === match[2])
// sender = data.players.find(player => util.isDeepStrictEqual(player.displayName, playerListDisplayName))
// if (!sender) return;
// console.log(sender)
return { sender, contents: match[3], type: 'minecraft:chat'};
}
} catch (e) {
console.log(e.toString())
}
}
module.exports = creayun;

View file

@ -1,41 +0,0 @@
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

View file

@ -1,23 +0,0 @@
function VanillaChat (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]
const contents = message.with[1]
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 //stringUsername
return { sender, contents, type: 'minecraft:chat', senderComponent }
} catch(e) {
console.error(`${e.stack}`)
}
}
module.exports = VanillaChat;

View file

@ -1,26 +0,0 @@
function sayConsole (message, data, context, bot) {
try {
if (message === null || typeof message !== 'object') return
if (message.with?.length < 2 || (message.translate !== 'chat.type.announcement' && message.translate !== '%s %s')) return
const senderComponent = message.with[0]
const contents = message.with[1]
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 null
return { sender, contents, type: 'minecraft:chat', senderComponent }
} catch(e) {
console.error(e);
}
}
module.exports = sayConsole

View file

@ -1,25 +0,0 @@
function yfdCustomChat (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]
const contents = message.with[2]
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 null
return { sender, contents, type: 'minecraft:chat', senderComponent }
} catch(e) {
console.error(e)
}
}
module.exports = yfdCustomChat

View file

@ -1,32 +0,0 @@
function ansi (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
"\x1B\[30m": "\x1B[30m", // black
"\x1B\[35m": "\x1B[35m", // purple
'\x1B[3m': "\x1B[23m", // italic
'\x1B[4m': "\x1B[24m", // underline
'\x1B[9m': "\x1B[29m", // strike through
'\x1B[6m': "\x1B[29m" // obfuscated
};
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 = ansi;

View file

@ -1,7 +0,0 @@
function between(min, max) {
return Math.floor(
Math.random() * (max - min) + min
)
}
module.exports = between;
// ported from FNFBoyfriendBot v3

View file

@ -1,68 +0,0 @@
const sleep = require('./sleep');
module.exports = (bot) => {
bot.chat = {
message (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: message?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
},
command (command) {
bot._client.write('chat_command', {
command: command?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
},
send (message) {
if (message.startsWith('/')) {
bot._client.write('chat_command', {
command: message?.substring(1).substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
return;
}
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: message?.substring(0, 256)?.replaceAll('§','&'),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
}
}
bot.tellraw = (selector, message) => {
if (bot.options.mode === "savageFriends") {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(bot.getMessageAsPrismarine(message)?.toMotd()))
} else {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
}
}
}

View file

@ -1,18 +0,0 @@
// 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, useChat) {
super(stringify(message), filename, lineError, useChat)
this.name = 'CommandError'
this._message = message
return this._useChat = useChat
// this._useChat = useChat
}
get message () {
return stringify(this._message)
}
}
module.exports = CommandError

View file

@ -1,42 +0,0 @@
const CommandError = require('./command_error');
module.exports = (bot, command, args, source) => {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
switch (command?.data?.trustLevel) {
case 0:
// do nothing since trust level 0 is public
break;
case 1:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You dont have the trusted, admin, or owner role!', color: "dark_red" })
} else if (!source?.sources.console) {
if (args.length === 0) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" });
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid trusted, admin or owner hash', color: 'dark_red' });
}
break;
case 2:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` ||role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You dont have the admin, or owner role!', color: "dark_red" })
} else if (!source?.sources?.console) {
if (args.length === 0) throw new CommandError({ text: "Please provide an admin or owner hash", color: 'dark_red' })
if (args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid admin or owner hash', color: 'dark_red' });
}
break;
case 3:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)
if (!hasRole) throw new CommandError({ translate: 'You do not have the owner role!', color: "dark_red" })
} else if (!source?.sources?.console) {
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
}
break;
case 4:
if (!source?.sources?.console) {
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" })
}
break;
}
}

View file

@ -1,7 +0,0 @@
class CommandSource {
constructor (player, sources) {
this.player = player;
this.sources = sources;
}
}
module.exports = CommandSource

View file

@ -1 +0,0 @@
chip told me to pull these files from chipmunkbot and add html to matrix relay chat

View file

@ -1,28 +0,0 @@
{
"colors": [
{"name": "black", "code": "§0", "ansi": "\u001b[0m\u001b[30m", "rgb": 0},
{"name": "dark_blue", "code": "§1", "ansi": "\u001b[0m\u001b[34m", "rgb": 170},
{"name": "dark_green", "code": "§2", "ansi": "\u001b[0m\u001b[32m", "rgb": 43520},
{"name": "dark_aqua", "code": "§3", "ansi": "\u001b[0m\u001b[36m", "rgb": 43690},
{"name": "dark_red", "code": "§4", "ansi": "\u001b[0m\u001b[31m", "rgb": 11141120},
{"name": "dark_purple", "code": "§5", "ansi": "\u001b[0m\u001b[35m", "rgb": 11141290},
{"name": "gold", "code": "§6", "ansi": "\u001b[0m\u001b[33m", "rgb": 16755200},
{"name": "gray", "code": "§7", "ansi": "\u001b[0m\u001b[37m", "rgb": 11184810},
{"name": "dark_gray", "code": "§8", "ansi": "\u001b[0m\u001b[90m", "rgb": 5592405},
{"name": "blue", "code": "§9", "ansi": "\u001b[0m\u001b[94m", "rgb": 5592575},
{"name": "green", "code": "§a", "ansi": "\u001b[0m\u001b[92m", "rgb": 5635925},
{"name": "aqua", "code": "§b", "ansi": "\u001b[0m\u001b[96m", "rgb": 5636095},
{"name": "red", "code": "§c", "ansi": "\u001b[0m\u001b[91m", "rgb": 16733525},
{"name": "light_purple", "code": "§d", "ansi": "\u001b[0m\u001b[95m", "rgb": 16733695},
{"name": "yellow", "code": "§e", "ansi": "\u001b[0m\u001b[93m", "rgb": 16777045},
{"name": "white", "code": "§f", "ansi": "\u001b[0m\u001b[97m", "rgb": 16777215}
],
"formatting": [
{"name": "bold", "code": "§l", "ansi": "\u001b[1m"},
{"name": "italic", "code": "§o", "ansi": "\u001b[3m"},
{"name": "underlined", "code": "§n", "ansi": "\u001b[4m"},
{"name": "strikethrough", "code": "§m", "ansi": "\u001b[9m"},
{"name": "obfuscated", "code": "§k", "ansi": "\u001b[6m"}
],
"reset": {"name": "reset", "code": "§r", "ansi": "\u001b[0m"}
}

View file

@ -1,111 +0,0 @@
const { colors } = require('./formatting.json')
const { normalize } = require('./utility')
const colormap = Object.fromEntries(colors.map(color => [color.name, color.rgb]))
const colorcodemap = Object.fromEntries(colors.map(color => [color.code, color.rgb]))
const reservedCharacters = {
'"': '&quot;',
"'": '&apos;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
}
function htmlStringify (text, { lang = {} } = {}) {
text = normalize(text)
let string = ''
if (text.text != null) string += preprocessText(text.text)
else if (text.translate != null) {
let format
if (Object.hasOwn(lang, text.translate)) format = lang[text.translate]
else if (text.fallback != null) format = text.fallback
else format = text.translate
const _with = text.with || []
let i = 0
string += preprocessText(format).replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => {
if (g0 === '%%') return '%'
const idx = g1 ? parseInt(g1) : i++
if (_with[idx]) {
return htmlStringify(_with[idx], { lang })
}
return ''
})
}
else if (text.selector != null) string += preprocessText(text.selector)
else if (text.keybind) {
// TODO
}
if (text.extra) {
for (const extra of text.extra) {
string += htmlStringify(extra, { lang })
}
}
if (text.color) {
const rgb = text.color[0] === '#' ? parseInt(text.color.substring(1), 16) : colormap[text.color]
if (rgb) string = `<font color="#${rgb.toString(16).padStart(6, '0')}">${string}</font>`
}
// formatting
if (text.bold) string = `<b>${string}</b>`
if (text.italic) string = `<i>${string}</i>`
if (text.underlined) string = `<u>${string}</u>`
if (text.strikethrough) string = `<strike>${string}</strike>`
if (text.obfuscated) string = `<blink>${string}</blink>`
return string
}
function preprocessText (input) {
let string = ''
let closing = ''
for (let i = 0; i < input.length; i++) {
const c = input[i]
// Emulate Minecraft's section sign escape sequences
if (c === '§') {
if ((i + 1) >= input.length) break // For trailing section signs, append nothing
const code = input.substring(i, i + 2)
i++
const hex = colorcodemap[code]
if (hex) {
string += closing
string += `<font color="${hex.toString(16).padStart(6, '0')}">`
closing = '</font>'
continue
}
if (code === '§r') {
string += closing
closing = ''
continue
}
if (code === '§l') { string += '<b>'; closing += '</b>' }
else if (code === '§o') { string += '<i>'; closing += '</i>' }
else if (code === '§n') { string += '<u>'; closing += '</u>' }
else if (code === '§m') { string += '<strike>'; closing += '</strike>' }
else if (code === '§k') { string += '<blink>'; closing += '</blink>' }
continue // Do not append the escape sequence itself to the string
}
else if (reservedCharacters[c]) string += reservedCharacters[c]
else if (c === '\n') string += '<br>'
else string += c
}
string += closing
return string
}
module.exports = htmlStringify

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