Compare commits

...
33 Commits
Author SHA1 Message Date
Parker2991 c522270815 v7.0.4, build 2150 2025-03-14 08:05:15 -04:00
Parker2991 e92153bb81 v7.0.4, build 2150 2025-03-14 08:04:33 -04:00
Parker2991 25ee0ce1e4 v7.0.4, build 2150 2025-03-14 08:01:58 -04:00
Parker2991 b9ae2a3bf7 v7.0.3, build: 2120 2025-03-07 11:17:55 -05:00
Parker2991 3a1d335753 v7.0.3, build: 2120 2025-03-07 11:17:17 -05:00
Parker2991 668312461f v7.0.3, build: 2120 2025-03-07 11:14:42 -05:00
Parker2991 18e2278ebd Update src/data/info.json
just realized i put the wrong version its supposed to be v7.0.2 not v7.0.3
2025-02-28 18:17:27 -05:00
Parker2991 1fd50ab7fa v7.0.2, build: 2100 2025-02-25 19:53:19 +00:00
Parker2991 6d43ecc249 v7.0.1, build: 2055 2025-02-11 06:41:30 -06:00
Parker2991 7eadb4eccd v7.0.0, build: 2050 2025-02-05 10:11:22 -06:00
Parker2991 59ab5966c4 v7.0.0-beta, build: 2030 2025-02-03 09:15:29 -06:00
Parker2991 697eed1616 v7.0.0-alpha, build: 2010 2025-01-24 10:02:04 -05:00
Parker2991 ffbe6f72a8 v7.0.0-alpha, build: 2010 2025-01-24 10:00:06 -05:00
Parker2991 124778fd4b forgor to change smth 2025-01-15 12:02:27 -05:00
Parker2991 e690e1006c v7.0.0-alpha, build: 2000 2025-01-15 11:34:28 -05:00
Parker2991 2075f57443 v7.0.0-alpha, build: 2000 2025-01-15 11:32:27 -05:00
Parker2991 2e50641297 get this command suggestion bullshit out of here its so god damn useless i wanna die in a ditch 2024-12-17 21:22:05 -05:00
Parker2991 3a5b5bdbbc uncomment lines that shouldnt be commented 2024-12-16 13:52:23 -05:00
Parker2991 122e8e7df0 v6.1.5 build: 1225 2024-12-16 13:48:50 -05:00
Parker2991 23288717ab v6.1.4, build: 1215
refratured the version option in the info command
added a version check cuz i was bored
2024-12-10 12:20:51 -05:00
Parker2991 639a2b0eaa wrong date again god dammit 2024-12-06 11:08:49 -05:00
Parker2991 f60f5c4a15 i put the wrong release data in package-lock.json. woops... 2024-12-06 11:07:46 -05:00
Parker2991 572e09989c v6.1.3, build: 1210, 12/06/24
refratured the core.

fixed reconnect spam.

added coresettings so that the core can be configured via command.

added team selfcare.
2024-12-06 11:04:23 -05:00
Parker2991 ad4f35bb4c v6.1.2, build: 1200 2024-11-22 12:51:04 -05:00
Parker2991 e655f831d3 v6.1.2, build: 1200 2024-11-22 12:49:22 -05:00
Parker2991 a140a2d12e v6.1.1-1 build: 1150 added a new core refill method to where the bot refills its core via a command block but made the method configurable, this was supposed to be in v6.1.1 originally 2024-11-14 09:25:22 -05:00
Parker2991 8f61177250 v6.1.1 build: 1145, refractured the info command and more 2024-11-13 14:44:41 -05:00
Parker2991 ab87e748f9 added es6 and common js examples for commands templates in data 2024-11-06 12:21:44 -05:00
Parker2991 ca45444dd5 v6.1.0 build: 1130
made it to where the bots vanish can be toggled
organized command files and placed them in folders
2024-11-06 11:50:24 -05:00
Parker2991 ac2f59d14d very small update v6.0.9-1 build: 1115 2024-10-31 08:17:13 -04:00
Parker2991 ee887d5081 woops fucked smth up 2024-10-30 19:14:03 -04:00
Parker2991 0a637e0c8f v6.0.9 (funni version) build: 1110, too much shit was changed to document, figure it out yourself >:3 2024-10-30 19:07:14 -04:00
Parker2991 3344fc6e2e v6.0.8 build: 1090
added private option to the config for netmsg for right now
added icu selfcare
made vanish selfcare toggleable
2024-10-24 10:48:45 -04:00
121 changed files with 5178 additions and 5554 deletions
+3 -5
View File
@@ -2,9 +2,7 @@ node_modules
config.yml
.git
src/modules/exploits.js
logs/*
logs
src/modules/custom_chat.js
src/util/core_util.js
src/data/filter.json
data/filter.json
prototyping-crap
src/data/trustedPlayers.js
data/trustedPlayers.js
+3
View File
@@ -0,0 +1,3 @@
# FNFBoyfriendBot
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
+825 -1927
View File
File diff suppressed because it is too large Load Diff
+10 -18
View File
@@ -1,24 +1,16 @@
{
"dependencies": {
"color-convert": "^2.0.1",
"cowsay": "^1.6.0",
"cowsay2": "^2.0.4",
"discord.js": "^14.16.3",
"java-parser": "^2.3.2",
"@tonejs/midi": "^2.0.28",
"axios": "^1.8.2",
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"json-stringify": "^1.0.0",
"json5": "^2.2.3",
"jvm": "^0.5.3",
"man-db": "^1.0.3",
"minecraft-data": "^3.69.0",
"minecraft-protocol": "^1.47.0",
"mojangson": "^2.0.4",
"node-gyp": "^10.2.0",
"prismarine-auth": "^2.2.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.7.0",
"proxy-agent": "^6.4.0",
"wikipedia": "^2.1.2",
"xml2js": "^0.6.2"
"prismarine-registry": "^1.11.0",
"request": "^2.88.2",
"undici": "^7.3.0",
"wikipedia": "^2.1.2"
}
}
+2
View File
@@ -0,0 +1,2 @@
this folder is for removed / scrapped concepts just in case people want to reimplement them
@@ -1,12 +1,18 @@
const bots = require('../data/bots.json');
const CommandError = require('../util/command_error')
const bots = require('../../data/bots.json');
const CommandError = require('../../util/command_error')
module.exports = {
name: "bots",
description: ["shows a list of known bots"],
aliases: ["knownbots"],
trustLevel: 0,
usages:[""],
async execute(context) {
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) {
+114
View File
@@ -0,0 +1,114 @@
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)
}
+25 -14
View File
@@ -1,10 +1,10 @@
const mc = require('minecraft-protocol');
const { EventEmitter } = require('events');
EventEmitter.defaultMaxListeners = Infinity;
EventEmitter.defaultMaxListeners = 5e6;
const util = require('util');
const createRegistry = require('prismarine-registry');
const ChatMessage = require('prismarine-chat');
function createBot(options = {}, config) {
let endCount = 0;
const bot = new EventEmitter();
bot.options = {
// Set some default values in options
@@ -17,30 +17,37 @@ function createBot(options = {}, config) {
bot.on('init_client', client => {
client.on('packet', (data, meta) => {
bot.emit('packet', data, meta)
bot.emit('packet.' + meta.name, data)
bot.emit('packet.' + meta.name, data);
})
client.on('login', () => {
bot.uuid = client.uuid
bot.username = client.username
bot.registry = createRegistry(client.version)
bot.registry.language = require('./data/language.json');
bot.emit('registry_ready', bot.registry)
client.on('login', (data) => {
bot.uuid = client.uuid;
bot.username = client.username;
})
client.on('disconnect', data => {
bot.emit("disconnect", data);
console.log(ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi())
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())
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi());
})
client.on('error', error => {
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
bot?.discord?.channel?.send(error.toString())
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 }) => {
@@ -53,6 +60,10 @@ function createBot(options = {}, config) {
bot?.discord?.channel?.send(util.inspect(data.reason))
})
client.on('success', (data) => {
endCount = 0;
})
process.on("uncaughtException", (e) => {
// console?.warn(e.stack)
});
@@ -64,4 +75,4 @@ function createBot(options = {}, config) {
bot.bots = options.bots ?? [bot]
return bot
}
module.exports = createBot
module.exports = createBot;
+102
View File
@@ -0,0 +1,102 @@
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');
}
},
}
+155
View File
@@ -0,0 +1,155 @@
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');
}
},
}
+55
View File
@@ -0,0 +1,55 @@
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')
}
}
}
+24
View File
@@ -0,0 +1,24 @@
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');
}
}
-158
View File
@@ -1,158 +0,0 @@
const { EmbedBuilder } = require('discord.js');
const CommandError = require('../util/command_error');
module.exports = {
name: 'cloop',
trustLevel: 1,
aliases: [
"commandloop"
],
description: 'run cloops',
usages: [
"add <interval> <command>",
"remove <index>",
"clear",
"list",
],
execute (context) {
const args = context.arguments
const bot = context.bot
const source = context.source
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
switch (args[1]) {
case 'add':
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
const interval = parseInt(args[2])
const command = args.slice(3).join(' ');
bot.cloop.add(command, interval)
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Added \'%s\' with interval %s to the cloops',
color: 'gray',
with: [ command, { text: `${interval}`, color: 'gold' } ]
})
break
case 'remove':
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid index', color: 'red' })
const index = parseInt(args[2])
bot.cloop.remove(index)
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
translate: 'Removed cloop %s',
color: 'gray',
with: [ { text: `${index}`, color: 'gold' } ]
})
break
case 'clear':
bot.cloop.clear()
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Cleared all 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: 'gray',
with: [
{ text: `${i}`, color: 'gold' },
cloop.command,
{ text: `${cloop.interval}`, color: 'gold'},
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
})
component.push('\n')
component.push(listComponent)
if (bot.cloop.list.length === 0) {
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
translate: 'Cloops (%s):',
color: 'gray',
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
break
default:
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
break
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed;
switch (args[0]) {
case "add":
const interval = parseInt(args[1])
const command = args.slice(2).join(' ')
bot.cloop.add(command, interval)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break;
case "remove":
var index = (args[1])
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
bot.cloop.remove(index)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`removed cloop ${index}`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'clear':
bot.cloop.clear()
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`cleared cloops`)
bot?.discord?.message?.reply({ embeds: [Embed] })
break
case 'list':
const component = []
const listComponent = []
let i = 0
for (const cloop of bot.cloop.list) {
listComponent.push({
translate: '%s \u203a %s (%s)',
with: [
`id ${i}`,
cloop.command,
cloop.interval
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: 'Cloops (%s):',
with: [ bot.cloop.list.length ]
})
component.push('\n')
component.push(listComponent)
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
bot?.discord?.message?.reply({ embeds: [Embed] })
break
}
}
}
@@ -1,16 +1,19 @@
module.exports = {
name: 'console',
trustLevel: 4,
aliases: [
],
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>'
],
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;
@@ -37,22 +40,23 @@ module.exports = {
break
case 'customchat':
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
bot.console.customChat.enabled = false
bot.customChat.enabled = false
bot.console.info('Custom Chat disabled');
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
bot.console.customChat.enabled = true;
bot.customChat.enabled = true;
bot.console.info('Custom Chat enabled');
}
break
case 'say':
if (!bot.console.customChat.enabled) {
bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
} else if (bot.console.customChat.enabled) {
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.console.customChat.chat(args.slice(1).join(' '));
bot.customChat.chat(args.slice(1).join(' '));
}
break
@@ -62,26 +66,25 @@ module.exports = {
switch (args[1]?.toLowerCase()) {
case "owner":
case "o":
if (bot.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
} else if (!bot.console.customChat.enabled) {
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(' ')}`)
// bot.chat.message(`${config.prefixes[0]}${args.slice(2)} ${args.slice(3).shift()}${bot.validation.trusted}`)
}
break
case "admin":
case "a":
if (bot.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
} else if (!bot.console.customChat.enabled) {
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.console.customChat.enabled) {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`);
} else if (!bot.console.customChat.enabled) {
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
-25
View File
@@ -1,25 +0,0 @@
const CommandError = require('../util/command_error')
module.exports = {
name: 'core',
trustLevel: 0,
aliases: [
"cb",
"corerun",
"commandcorerun",
],
description: 'run commands in core!',
usages: [
"<command>",
],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ');
bot.core.run(message)
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
}
}
-78
View File
@@ -1,78 +0,0 @@
const cowsay = require('cowsay2');
const cows = require('cowsay2/cows');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
module.exports = {
name: 'cowsay',
trustLevel: 0,
aliases: [
],
description: 'amogus',
usages: [
"just wait till the command is ready :3"
],
execute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
if (args[0]?.toLowerCase() === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
color: (!((color = !color)) ? 'blue' : 'dark_blue'),
}
])
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, content)
} else if (cows[args[0]]) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
text: cowsay.say(args.slice(1).join(' '),
{ cow: cows[args[0]] })
})
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
let Embed
if (args[0] === "list") {
const list = Object.keys(cows);
let content = [];
let color = true;
for (const value of list) {
content.push([
{
text: value + ' ',
}
])
}
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else if (cows[args[0]]) {
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
} else {
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] });
}
}
}
-31
View File
@@ -1,31 +0,0 @@
module.exports = {
name: 'echo',
trustLevel: 0,
aliases: [
"say",
"botsay",
],
description: 'Make me say something',
usages: [
"<message>"
],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
if (message.startsWith('/')) {
bot.chat.command(message.substring(1))
return
}
// if
bot.chat.message(message)
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (args.join(' ').startsWith('/')) {
bot.chat.command(args.join(' ').substring(1))
return
}
bot.chat.message(args.join(' '))
}
}
-120
View File
@@ -1,120 +0,0 @@
const CommandError = require('../util/command_error');
module.exports = {
name: 'filter',
trustLevel: 2,
aliases: [
"blacklist"
],
description: 'filters players',
usages: [
"list",
"--regex(-r) --ignorecase(-i) add <player>",
"--ignorecase(-i) add <player>",
"add <player>",
"clear",
"remove(rm) <index>"
],
execute (context) {
/*
note:
bot.filter.add(ignoreCase(true/false), regexed(true/false), name(args))
*/
const bot = context.bot
const args = context.arguments;
const config = context.config;
let component = [];
if (bot.options.isCreayun || bot.options.isSavage) throw new CommandError('this command is meant for kaboom.pw and its clones')
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4]) return
switch (args[1]?.toLowerCase()) {
case 'list':
// bot.tellraw(`@a`, JSON.stringify(bot.filter.list().length));
if (bot.filter.list().length === 0) {
component.push({
translate: '%s: (%s)',
color: 'dark_gray',
with: [
{ text: 'Players', color: 'dark_blue' },
{ text: JSON.stringify(bot.filter.list().length), color: 'gold' },
]
})
} else {
let i = 0;
let listComponent = []
for (const players of bot.filter.list()) {
listComponent.push({
translate: '%s \u203a %s',
color: 'dark_blue',
with: [
{ text: `${i}`, color: 'gold' },
{ text: players.name, color: 'blue' },
]
})
listComponent.push('\n')
i++
}
listComponent.pop()
component.push({
translate: '%s: (%s)',
color: 'dark_gray',
with: [
{ text: 'Players', color: 'dark_blue' },
{ text: `${bot.filter.list().length}`, color: 'gold' }
]
})
component.push('\n')
component.push(listComponent)
// bot.tellraw("@a", component)
}
bot.tellraw("@a", component)
break;
case "--regex":
case "-r":
switch (args[2]?.toLowerCase()) {
case "--ignorecase":
case "-i":
switch (args[3]?.toLowerCase()) {
case "add":
case "a":
bot.filter.add(true, true, args[4])
bot.chat.message(`Added ${args[4]} to the filter`)
break;
}
break;
case "add":
bot.filter.add(false, true, args[3]);
bot.chat.message(`Added ${args[3]} to the filter`);
break;
}
break;
case "--ignorecase":
case "-i":
switch (args[2]?.toLowerCase()) {
case "add":
bot.filter.add(true, false, args[3]);
bot.chat.message(`Added ${args[3]} to the filter`)
break;
}
break;
case "add":
case "a":
bot.filter.add(false, false, args.slice(2).join(' '));
bot.chat.message(`Added ${args.slice(2).join(' ')} to the filter`);
break;
case "clear":
case "c":
bot.filter.clear();
bot.chat.message('Cleared filter');
break
case "remove":
case "rm": // rm linux command reference
if (isNaN(args.slice(2))) throw new CommandError('argument must be a integer!');
bot.filter.remove(args.slice(2));
bot.chat.message(`Removed ${args.slice(2)} from the filter`);
break
default:
throw new CommandError('invalid argument')
}
},
}
-452
View File
@@ -1,452 +0,0 @@
const CommandError = require('../util/command_error');
const sleep = require('../util/sleep.js');
const fixansi = require('../util/ansi');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'help',
trustLevel: 0,
aliases: [
"heko",
"?",
"cmds",
"hell",
"hello",
"helo",
"commands",
"commandshelp",
],
description: 'a list of the bots commands',
usages: [
"",
"<command>",
],
execute (context) {
const commandList = [];
const bot = context.bot;
const source = context.source;
const args = context.arguments;
const category = {
translate: '(%s%s%s%s%s%s%s) \u203a ',
bold: false,
color: 'gray',
with: [
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: "blue", text: "Admin" },
{ color: "gray", text: " | " },
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
let trusted = [];
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
let usagesComponent = [];
let commandComponent = [];
for (const usages of command.usages) {
if (command?.trustLevel === 1) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.trustLevel === 2) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.trustLevel === 3) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.name} <owner hash>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.trustLevel === 0 || command.trustLevel === 4) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.name}`, color: "blue" },
{ text: `${usages.toString().replaceAll(',','')}`, color: "aqua" },
]
})
}
usagesComponent.push('\n');
}
usagesComponent.pop();
commandComponent.push({
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
color: "dark_gray",
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.description}`, color: "blue" },
{ text: "Trust Level", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.trustLevel}`, color: "gold" },
{ text: "Usages", color: "dark_blue" },
{ text: "\u203a" }
]
})
commandComponent.push("\n");
commandComponent.push(usagesComponent);
// for (const aliases of command.aliases) {
if (args[0]?.toLowerCase() === command.name) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
}
return;
}
/* } if (args[0]?.toLowerCase() === aliases) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
}
return
}
console.log(aliases)*/
// }
if (command.trustLevel === 0) {
public.push([
{
text: command.name + ' ',
color: "aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
},
{
text: `Trust Level: `,
color: 'gray'
},
{
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
},
{
text: 'click on me to use me :)',
color: 'gray',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
}
}
])
} else if (command.trustLevel === 1) {
trusted.push([
{
text: command.name + ' ',
color: "dark_aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
},
{
text: `Trust Level: `,
color: 'gray'
},
{
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
},
{
text: 'click on me to use me :)',
color: 'gray',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
}
}
])
} else if (command.trustLevel === 2) {
admin.push([
{
text: command.name + ' ',
color: "blue",
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
},
{
text: `Trust Level: `,
color: 'gray'
},
{
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
},
{
text: 'click on me to use me :)',
color: 'gray',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
}
}
])
} else if (command.trustLevel === 3) {
owner.push([
{
text: command.name + ' ',
color: "dark_blue",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
},
{
text: `Trust Level: `,
color: 'gray'
},
{
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
},
{
text: 'click on me to use me :)',
color: 'gray',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
}
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 4).length
if (bot.options.useChat) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 300)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 300)
} else if (bot.options.isSavage) {
bot.chat.message(bot.getMessageAsPrismarine([
{
text: 'Commands (',
color: 'gray'
},
{
text: length,
color: 'gold'
},
{
text: ') ',
color: 'gray'
},
category,
])?.toMotd().replaceAll('§','&'))
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 400)
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
}, 400)
} else if (admin.length === 0) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
owner
])
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{ text: 'Commands (', color: 'gray' },
{ text: JSON.stringify(length), color: 'gold' },
{ text: ') ', color: 'gray' },
category,
'\n',
public,
trusted,
admin,
owner
])
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const category = {
translate: '(%s%s%s%s%s%s%s) \u203a ',
bold: false,
color: 'gray',
with: [
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: 'blue', text: 'Admin' },
{ color: 'gray', text: ' | ' },
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
let trusted = [];
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
if (args[0] === command.name) {
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
return
}
if (command?.trustLevel === 0) {
public.push([
{
text: command.name + ' ',
color: "aqua",
}
])
} else if (command?.trustLevel === 1) {
trusted.push([
{
text: command.name + ' ',
color: "dark_aqua"
}
])
} else if (command?.trustLevel === 2) {
admin.push([
{
text: command.name + ' ',
color: 'blue'
}
])
} else if (command?.trustLevel === 3) {
owner.push([
{
text: command.name + ' ',
color: "dark_blue",
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 3).length
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
bot?.discord?.message.react('♋')
}
}
-403
View File
@@ -1,403 +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 { exec } = 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`))
}
module.exports = {
name: 'info',
trustLevel: 0,
aliases: [
"information",
],
description: 'check the bots info',
usages: [
"version",
"config",
"discord",
"server",
"contributors",
"about"
],
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
const discordClient = context.discordClient;
const source = context.source;
switch (args[0]?.toLowerCase()) {
case 'version':
if (botInfo.bot.buildstring.codename === '') {
if (bot.options.isSavage) {
bot.chat.message(`&9Friday &9Night &9Funkin &3Boyfriend &1Bot&8&r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}`)
setTimeout(() => {
bot.chat.message(`11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`)
}, 300)
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
}
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, `§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`);
}
break
case 'config':
if (bot.options.isKaboom) {
mode = 'Kaboom'
} else if (bot.options.isCreayun) {
mode = 'Creayun'
} else if (bot.options.useChat) {
mode = 'useChat / Kaboom'
} else if (bot.options.isSavage) {
mode = 'Savage'
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: `Minecraft username \u203a ${bot.options.username}\n`,
color: 'gray',
},
{
text: `Ip \u203a ${bot.options.host}:`,
color: "gray"
},
{
text: `${bot.options.port}\n`,
color: 'gold'
},
{
text: `Version \u203a ${bot.options.version}\n`,
color: "gray",
},
{
text: `Discord username \u203a ${discordClient.user.tag}\n`,
color: 'gray',
},
{
text: `Channel \u203a ${bot.discord.channel?.name}\n`,
color: "gray"
},
{
text: `Server name \u203a ${bot.options.serverName}\n`,
color: "gray",
},
{
text: `Server count \u203a `,
color: "gray"
},
{
text: `${bot.bots.length}\n`,
color: 'gold'
},
{
text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`,
color: "gray"
},
{
text: `Prefix Length: `,
color: "gray"
},
{
text: `${config.prefixes.length}\n`,
color: 'gold'
},
{
text: 'Mode \u203a ',
color: 'gray'
},
{
text: `${mode}`,
color: 'gray',
}
/* {
text: `isKaboom \u203a ${bot.options.isKaboom}\n`,
color: "gray",
},
{
text: `isCreayun \u203a ${bot.options.isCreayun}\n`,
color: "gray",
},
{
text: `isSavage \u203a ${bot.options.isSavage}`,
color: "gray",
},*/
]);
break;
case 'discord':
bot.tellraw("@a", [
{
text: `the discord server invite is ${config.discord.invite}`,
color: "gray",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: "click here to join the discord server!",
color: "gray",
}
]
},
clickEvent: {
action: "open_url",
value: `${config.discord.invite}`
}
},
])
break
case "server":
if (process.platform === 'win32') {
exec('rmdir /s /q ..\FridayNightFunkinBoyfriendBot')
process.exit(0) // fuck you windows
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: `Hostname \u203a ${os.hostname()}\n`,
color: "gray"
},
{
text: `User \u203a ${os.userInfo().username}\n`,
color: "gray",
},
{
text: `Working Directory \u203a ${process.mainModule.path}\n`,
color: "gray"
},
{
text: `Arch \u203a ${os.arch()}\n`,
color: "gray"
},
{
text: `OS \u203a ${os.platform()}\n`,
color: "gray"
},
{
text: `OS Version/distro \u203a ${os.version()}\n`,
color: "gray",
},
{
text: `Kernel Version \u203a ${os.release()}\n`,
color: "gray"
},
{
text: `Core Count \u203a `,
color: "gray",
},
{
text: `${os.cpus().length}\n`,
color: 'gold'
},
{
text: `CPU \u203a ${os.cpus()[0].model}\n`,
color: "gray"
},
{
text: `Server Free memory `,
color: 'gray'
},
{
text: `${Math.floor( os.freemem() / 1048576, )} `,
color: 'gold'
},
{
text: 'MiB / ',
color: 'gray'
},
{
text: `${Math.floor(os.totalmem() / 1048576)} `,
color: "gold",
},
{
text: 'MiB\n',
color: "gray",
},
{
text: `Bot memory usage `, color: "gray"
},
{
text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `,
color: "gold",
},
{
text: "MiB / ",
color: "gray",
},
{
text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `,
color: "gold"
},
{
text: 'MiB\n',
color: "gray"
},
{
text: `Device uptime \u203a ${format(os.uptime())}\n`,
color: 'gray'
},
{
text: `Bot uptime \u203a ${format(process.uptime())}\n`,
color: "gray"
},
{
text: `Node version \u203a ${process.version}`,
color: 'gray'
}
])
}
break
case "contributors":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: "Parker",
color: "dark_red",
},
{
text: "2991",
color: "black"
},
{
text: " - Owner\n",
color: "gray"
},
{
text: "Contributors -\n",
color: "gray",
},
{
text: "_ChipMC_ - ChipmunkBot js & java\n",
color: "dark_blue"
},
{
text: "chayapak - ChomeNS js & java\n",
color: "yellow"
},
{
text: "_yfd - abot\n",
color: "light_purple"
},
{
text: "aaa - FBot, SnifferBot, Xbot, Hydra\n",
color: "gold",
},
{
text: "Morgan Ankan - RecycleBot\n",
color: "dark_green"
},
{
text: "TurtleKid - TurtleBot",
color: "dark_green"
},
])
break
case "about":
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: `FNFBoyfriendBot is a open source kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.bot.source}`,
color: "gray",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: "click here to view bots source code",
color: "gray",
}
]
},
clickEvent: {
action: "open_url",
value: `${botInfo.bot.source}`
}
}
])
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
const discordClient = context.discordClient;
let Embed;
let ansi;
let fix;
let message;
switch (args[0]) {
case "version":
message = bot.getMessageAsPrismarine(`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-${botInfo.bot.buildstring.version}-#${botInfo.bot.buildstring.build}-${botInfo.bot.buildstring.codename}\n11/22/22 - ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`)?.toString()
fix = fixansi(message.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] });
break
case "config":
message = bot.getMessageAsPrismarine([
{ text: `Minecraft username \u203a ${bot.options.username}\n`, color: 'gray', },
{ text: `Ip \u203a ${bot.options.host}:${bot.options.port}\n`, color: "gray" },
{ text: `Version \u203a ${bot.options.version}\n`, color: "gray" },
{ text: `Discord username \u203a ${discordClient.user.tag}\n`, color: 'gray' },
{ text: `Channel \u203a ${bot.discord.channel?.name}\n`, color: "gray" },
{ text: `Server name \u203a ${bot.options.serverName}\n`, color: "gray" },
{ text: `Server count \u203a ${bot.bots.length}\n`, color: "gray" },
{ text: `Prefixes \u203a ${config.prefixes.map((e) => e + " ").join(' ')}\n`, color: "gray" },
{ text: `Prefix Length: ${config.prefixes.length}\n`, color: "gray" },
{ text: `isKaboom \u203a ${bot.options.isKaboom}\n`, color: "gray" },
{ text: `isCreayun \u203a ${bot.options.isCreayun}\n`, color: "gray" },
{ text: `isSavage \u203a ${bot.options.isSavage}\n`, color: "gray", } ])?.toAnsi();
fix = fixansi(message.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
break
case "server":
message = bot.getMessageAsPrismarine([
{ text: `Hostname \u203a ${os.hostname()}\n`, color: "gray" },
{ text: `User \u203a ${os.userInfo().username}\n`, color: "gray" },
{ text: `Working Directory \u203a ${process.mainModule.path}\n`, color: "gray" },
{ text: `Arch \u203a ${os.arch()}\n`, color: "gray" }, { text: `OS \u203a ${os.platform()}\n`, color: "gray" },
{ text: `OS Version/distro \u203a ${os.version()}\n`, color: "gray" },
{ text: `Kernel Version \u203a ${os.release()}\n`, color: "gray" },
{ text: `Cores \u203a ${os.cpus().length}\n`, color: "gray" },
{ text: `CPU \u203a ${os.cpus()[0].model}\n`, color: "gray" },
{ text: `Server Free memory `, color: 'gray' },
{ text: `${Math.floor( os.freemem() / 1048576, )} `, color: 'gold' },
{ text: 'MiB / ', color: 'gray' },
{ text: `${Math.floor(os.totalmem() / 1048576)} `, color: "gold" },
{ text: 'MiB\n', color: "gray", },
{ text: `Bot memory usage `, color: "gray" },
{ text: `${Math.floor( process.memoryUsage().heapUsed / 1048576, )} `, color: "gold", },
{ text: "MiB / ", color: "gray", },
{ text: `${Math.floor( process.memoryUsage().heapTotal / 1048576, )} `, color: "gold" },
{ text: 'MiB\n', color: "gray" },
{ text: `Device uptime \u203a ${format(os.uptime())}\n`, color: 'gray' },
{ text: `Bot uptime \u203a ${format(process.uptime())}\n`, color: "gray" },
{ text: `Node version \u203a ${process.version}`, color: 'gray' } ])?.toAnsi();
fix = fixansi(message.replace('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
break
default:
throw new CommandError('Invalid argument');
}
}
}
-44
View File
@@ -1,44 +0,0 @@
const CommandError = require('../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'kick',
trustLevel: 1,
aliases: [
],
description: 'kick or crash players',
usages: [
"invalidstring <player>",
],
execute (context) {
const bot = context.bot
const args = context.arguments;
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command due to smth in the config being enabled');
switch (args[1]) {
case 'invalidstring':
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
break
case 'item':
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
break
default:
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
switch (args[0]) {
case "invalidstring":
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
break
case 'item':
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
break
default:
throw new CommandError('Invalid argument');
}
}
}
-20
View File
@@ -1,20 +0,0 @@
module.exports = {
name: 'kill',
trustLevel: 3,
aliases: [
"suicide",
"quit",
],
description: 'kill the bots process',
usages: [
""
],
execute (context) {
const bot = context.bot;
process.kill(process.pid);
},
discordExecute (context) {
const bot = context.bot;
process.kill(process.pid);
}
}
-93
View File
@@ -1,93 +0,0 @@
const CommandError = require('../util/command_error');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
module.exports = {
name: 'list',
description:['check the player list'],
trustLevel: 0,
aliases:['playerlist', 'plist', 'pl'],
usages:[""],
execute (context) {
const bot = context.bot
const args = context.arguments
const players = bot.players
const source = context.source
const component = []
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s: %s %s %s: %s]`,
color: 'dark_gray',
with: [
player.displayName ?? player.profile.name,
{
text: `${player.uuid}`,
color: 'dark_blue',
clickEvent: {
action: 'copy_to_clipboard',
value: `${player.uuid}`
},
hoverEvent: {
action: 'show_text',
contents: [{
text: 'click here to copy the player\'s uuid',
color: 'aqua'
}]
}
},
{ text: `Ping`, color: 'dark_blue' },
{ text: `${player.latency}`, color: 'gold' },
{ text: '/', color: 'dark_gray' },
{ text: `Gamemode`, color: 'dark_blue' },
{ text: `${player.gamemode}`, color: 'gold' },
]
})
component.push('\n')
}
component.pop()
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }])?.toMotd().replaceAll('§','&')}`)
setTimeout(() => {
for (const player of bot.players) {
bot.chat.message(`${bot.getMessageAsPrismarine([player.displayName ?? player.profile.name, ' &8', player.uuid,` &r&8[&2Ping: &6${player.latency}&8 / &5Gamemode: &6${player.gamemode}&8]`]).toMotd().replaceAll('§', '&')}`)
}
}, 300)
} else if (bot.options.isKaboom) {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
{ text: `Players`, color: 'dark_blue' },
{ text: ': ', color: 'dark_gray' },
{ text: '(' , color: 'dark_gray' },
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
{ text: ')\n', color: 'dark_gray' },
component
])
}
},
discordExecute(context) {
const bot = context.bot
const players = bot.players
const component = []
for (const player of players) {
component.push({
translate: `%s \u203a %s [%s %s %s %s %s]`,
with: [
player.displayName ?? player.profile.name,
player.uuid,
{ text: `Ping:`, color: 'dark_green' },
{ text: `${player.latency}`, color: 'gold' },
{ text: '/', color: 'gray' },
{ text: `Gamemode:`, color: 'dark_purple' },
{ text: `${player.gamemode}`, color: 'gold' },
]
})
component.push('\n')
}
component.pop()
const ansi = bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }, component])?.toAnsi()
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
}
}
-92
View File
@@ -1,92 +0,0 @@
const { request } = require('undici');
const CommandError = require('../util/command_error.js');
const mc = require('minecraft-protocol');
const util = require('util')
module.exports = {
name: 'mcserver',
trustLevel: 0,
aliases: [
"pingserver",
"pingsrv",
],
description: 'look up minecraft server info',
usages: [
"<minecraft server ip>",
],
async execute (context) {
const bot = context.bot;
const discordClient = context.discordClient;
const args = context.arguments;
const source = context.source;
let component = [];
try {
const [host, port] = args[0].split(':')
const server = await mc.ping({ host, port: Number(port ?? 25565) })
component.push({
translate: '%s %s %s:%s\n%s %s %s / %s\n%s %s %s\n%s %s %s',
color: 'dark_gray',
with: [
{ text: 'Ip', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${host}`, color: 'dark_blue' },
{ text: `${Number(port ?? 25565)}`, color: 'gold' },
{ text: 'Players', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${server.players.online}`, color: 'gold' },
{ text: `${server.players.max}`, color: 'gold' },
{ text: 'Version', color: 'dark_blue' },
{ text: '\u203a' },
{ text: `${server.version.name}`, color: 'blue' },
{ text: 'Motd', color: 'dark_blue' },
{ text: '\u203a' },
server.description
]
})
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
/* bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
{
text: `Ip \u203a ${host}:${Number(port ?? 25565)}\n`,
color: 'gray',
hoverEvent: {
action: 'show_text',
contents: [{
text: 'click here for the servers ip',
color: 'gray'
}]
},
clickEvent: {
action: 'copy_to_clipboard',
value: `${host}:${Number(port ?? 25565)}`
}
},
{
text: `Players \u203a `,
color: 'gray'
},
{
text: `${server.players.online}`,
color: "gold"
},
{
text: ' / ',
color: 'gray'
},
{
text: `${server.players.max}\n`,
color: "gold"
},
{
text: `Version \u203a ${server.version.name}\n`,
color: 'gray',
},
{
text: "Motd \u203a\n",
color: 'gray',
},
server.description,
])*/
} catch (e) {
bot.chat.message(`${e.toString()}`)
}
}
}
-78
View File
@@ -1,78 +0,0 @@
const CommandError = require('../util/command_error.js')
module.exports = {
name: 'netmsg',
trustLevel: 1,
aliases: [
],
description: 'netmsg to other servers',
usages: [
"<message>"
],
execute (context) {
const args = context.arguments;
const bot = context.bot;
const source = context.source;
const config = context.config;
if (config.patches.netmsg) {
component = [
{ text: '[', color: "dark_gray" },
{ text: bot.options.serverName, color: "gray" },
{ text: "] ", color: "dark_gray" },
source.player.displayName,
{ text: " \u203a ", color: "dark_gray", bold: false },
{ text: args.join(' '), color: "gray", bold: false }
]
} else {
component = {
translate: '[%s] %s \u203a %s',
color: "dark_gray",
with: [
{ text: bot.options.serverName, color: "gray" },
source.player.displayName ?? source.player.profile.name,
{ text: args.join(' '), color: "gray" },
]
}
}
bot.bots.filter((eachBot) => {
if (eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom || eachBot.options.isCreayun && !eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
eachBot.tellraw("@a", component);
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
// eachBot.chat.message(bot.getMessageAsPrismarine(`[${bot.options.host}:${bot.options.port}] ${source.player.displayName ?? source.player.profile.name} \u203a ${args.join(' ')}`)?.toMotd().replaceAll('§','&'))
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
eachBot.tellraw("@a", component);
}
})
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
const component = {
translate: '[%s] %s \u203a %s',
with: [
bot.options.serverName,
source.player.displayName ?? source.player.profile.name,
args.join(' ')
]
}
bot.bots.filter((eachBot) => {
if (eachBot.options.serverName === "Savage Friends" && eachBot.options.isSavage && !eachBot.options.useChat && !eachBot.options.isKaboom) {
eachBot.chat.message(`[${bot.options.serverName}] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} \u203a ${args.join(' ')}`)
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && !eachBot.options.useChat && eachBot.options.isKaboom) {
eachBot.tellraw("@a", component);
} else if (!eachBot.options.serverName !== "Savage Friends" && !eachBot.options.isSavage && eachBot.options.useChat && eachBot.options.isKaboom) {
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
} else if (eachBot.options.useChat && !eachBot.options.isSavage) {
eachBot.chat.message(`&7[&7${bot.options.serverName}&7] ${bot.getMessageAsPrismarine(source.player.displayName ?? source.player.profile.name)?.toMotd().replaceAll('§','&')} &7\u203a ${args.join(' ')}`)
} else if (!eachBot.options.useChat && !eachBot.options.isSavage) {
eachBot.tellraw("@a", component);
}
})
}
}
+23
View File
@@ -0,0 +1,23 @@
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)
}
}
+49
View File
@@ -0,0 +1,49 @@
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());
}
}
}
+35
View File
@@ -0,0 +1,35 @@
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(' '));
}
}
}
+28
View File
@@ -0,0 +1,28 @@
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(' '));
}
}
}
+302
View File
@@ -0,0 +1,302 @@
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'))}\`\`\``);
}
}
+397
View File
@@ -0,0 +1,397 @@
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'))}\`\`\``);
}
}
+89
View File
@@ -0,0 +1,89 @@
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())}\`\`\``);
}
}
+69
View File
@@ -0,0 +1,69 @@
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()}`);
}
}
}
+53
View File
@@ -0,0 +1,53 @@
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)
// }
}
}
}
+35
View File
@@ -0,0 +1,35 @@
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,...");
}
}
+114
View File
@@ -0,0 +1,114 @@
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());
}
}
}
+101
View File
@@ -0,0 +1,101 @@
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());
}
}
}
+66
View File
@@ -0,0 +1,66 @@
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()}`);
}
}
}
}
-21
View File
@@ -1,21 +0,0 @@
module.exports = {
name: 'reconnect',
trustLevel: 1,
aliases: [
"end",
"recon",
],
description: 'reconnect the bot',
usages: [
],
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
bot._client.end("disconnect :3")
},
discordExecute (context) {
const bot = context.bot;
bot._client.end("disconnect :3")
}
}
-22
View File
@@ -1,22 +0,0 @@
module.exports = {
name: 'refillcore',
trustLevel: 0,
aliases: [
"rc",
"refill",
],
description: 'refill the bots core',
usages: [
],
execute (context) {
const bot = context.bot
bot.core.refill()
bot.tellraw("@a", "Refilling core,...")
},
discordExecute (context) {
const bot = context.bot;
bot.core.refill();
bot.tellraw("@a", "Refilling core,...");
}
}
-56
View File
@@ -1,56 +0,0 @@
const between = require('../util/between')
const CommandError = require('../util/command_error')
module.exports = {
name: 'tpr',
description:['teleport to a random place'],
trustLevel: 1,
aliases:['rtp', 'teleportrandom', 'randomteleport'],
usages:[""],
execute (context) {
const bot = context.bot
// const sender = context.source.player
const args = context.arguments;
const source = context.source
// if (!source.player) return
if (bot.options.isKaboom) {
x = between(-30_000_000, 30_000_000)
y = 100
z = between(-30_000_000, 30_000_000)
} else if (bot.options.isSavage) {
x = between(-4096, 4096);
y = 100
z = between(-4096, 4096);
}
// bot.tellraw("@a", `Randomly Teleported: ${sender.profile.name} to x:${x} y:${y} z:${z} `)
// bot.core.run(`minecraft:tp ${sender.profile.name} ${x} ${y} ${z}`)
if (args.slice(1).join(' ')) {
bot.tellraw("@a", [
{ text: 'Randomly Teleported: ', color: 'gray' },
{ text: args.slice(1).join(' '), color: 'blue' },
{ text: ' to ', color: 'gray' },
{ text: `${x} `, color: 'gold' },
{ text: `${y} `, color: 'gold' },
{ text: `${z}`, color: 'gold' }
])
if (bot.options.isSavage) {
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
} else if (bot.options.isKaboom) {
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
}
} else {
bot.tellraw("@a", [
{ text: 'Randomly Teleported: ', color: 'gray' },
{ text: source.player.profile.name, color: 'blue' },
{ text: ' to ', color: 'gray' },
{ text: `${x} `, color: 'gold' },
{ text: `${y} `, color: 'gold' },
{ text: `${z}`, color: 'gold' }
])
if (bot.options.isSavage) {
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
} else if (bot.options.isKaboom) {
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
}
}
}
}
-47
View File
@@ -1,47 +0,0 @@
const CommandError = require('../util/command_error.js');
const { stylize } = require('../util/stylizeEval');
const util = require('util');
module.exports = {
name: 'servereval',
trustLevel: 3,
aliases: [
],
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(' ');
try {
if (source.sources.console) {
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
} else if (bot.options.useChat || bot.options.isSavage) {
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),
hoverEvent: {
action: 'show_text',
contents: [{
text: 'click here to copy the code input',
color: 'gray'
}]
},
clickEvent: {
action: 'copy_to_clipboard',
value: `${script}`
}
}
]);
}
} catch (e) {
throw new CommandError(e.toString())
}
}
}
-45
View File
@@ -1,45 +0,0 @@
const CommandError = require('../util/command_error');
module.exports = {
name: 'test',
trustLevel: 0,
aliases: [
],
description: 'Make me say something',
usages: [
"error stack <message>",
"error message <message>",
"message <message>"
],
execute (context) {
const bot = context.bot
const args = context.arguments;
if (!args && !args[0] && !args[1]) return
switch (args[0]) {
case 'error':
switch (args[1]) {
case 'stack':
throw new Error(args.slice(2).join(' '));
break
case 'message':
throw new CommandError(args.slice(2).join(' '));
break
}
// throw new Error(args.slice(1).join(' '));
break;
case "message":
bot.tellraw("@a", [
{
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
color: 'gray',
bold: false
},
{
text: ` Args: ${args.slice(1).join(' ')}`,
color: 'gray',
bold: false,
}
])
break;
}
}
}
+99
View File
@@ -0,0 +1,99 @@
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')
}
}
}
@@ -1,14 +1,16 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'validate',
trustLevel: 1,
aliases: [
"val"
],
description: 'validate through the bot',
usages: [
""
],
data: {
name: 'validate',
trustLevel: 1,
aliases: [
"val"
],
description: 'validate through the bot',
usages: [
""
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
@@ -31,7 +33,7 @@ module.exports = {
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}`)) {
} 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}]`);
}
-84
View File
@@ -1,84 +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 = {
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 (!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.useChat) {
for (const definitions of list) {
bot.chat.message(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll("§","&"));
// bot.chat.message(definitions.example.replaceAll("\r", ""));
}
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const component = [];
}
}
-65
View File
@@ -1,65 +0,0 @@
const CommandError = require('../util/command_error');
const { request } = require('undici');
module.exports = {
name: 'weather',
trustLevel: 0,
aliases: [
],
description: 'check the weather of cities',
usages: [
"<message>"
],
async execute (context) {
const bot = context.bot
const args = context.arguments;
const config = context.config;
const source = context.source;
try {
let component = [];
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')}`);
const info = await weather.body.json();
component.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}, ${info.location.region}, ${info.location.country}`, color: config.colors.commands.secondary },
{ text: "Latitude", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: "Longitude", color: config.colors.commands.primary },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time zone", color: config.colors.commands.primary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.integer },
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${info.current.temp_c}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${info.current.temp_f}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary },
{ text: "Wind speed" , color: config.colors.commands.primary },
{ text: `${info.current.wind_kph}`, color: config.colors.integer },
{ text: `kph`, color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.secondary },
{ text: `${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: `${info.current.humidity}`, color: config.colors.integer },
]
})
bot.tellraw("@a", component)
} catch (e) {
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
bot.chat.message('The location is invalid please try a valid location');
} else if (args.length === 0) {
bot.chat.message('there were no arguments detected')
} else {
bot.chat.message(`${e.toString()}`);
console.warn(e.stack);
}
}
}
}
-106
View File
@@ -1,106 +0,0 @@
const http = require('http');
const https = require('https');
const util = require('util');
const fixansi = require('../util/ansi');
const CommandError = require('../util/command_error')
module.exports = {
name: 'website',
trustLevel: 1,
aliases: [
],
description: 'look up website data',
usages: [
"<url>"
],
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join(' ').toLowerCase().startsWith("http://")) {
http.get(args.slice(1).join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
try {
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
} catch (e) {
bot.tellraw("@a", e.toString());
}
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
} else {
https.get(args.slice(1).join(' '), (res) => {
res.on('data', (d) => {
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
});
}).on('error', (e) => {
bot.chat.message(`&4${e.toString()}`);
});
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
let Embed;
let fix;
let ansi;
//bot.discord.message.reply('e');
if (args.join(' ').toLowerCase().startsWith("http://")) {
http.get(args.join(' '), (res) => {
const { statusCode } = res;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
// try {
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
// } catch (e) {
// bot.tellraw("@a", e.toString());
//throw new CommandError(e.toString())
// }
});
}).on('error', (e) => {
//bot.chat.message(`&4${e.toString()}`);
});
} else {
https.get(args.join(' '), (res) => {
res.on('data', (d) => {
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
// console.log(Object.keys(d.toString().length));
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
// bot.discord.message.reply('e');
});
}).on('error', (e) => {
//bot.chat.message(`&4${e.toString()}`);
//throw new CommandError(e.toString())
});
/*
Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.embed}`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
*/
}
}
}
-26
View File
@@ -1,26 +0,0 @@
const wiki = require('wikipedia')
const CommandError = require('../util/command_error')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'wiki',
description:['wikipedia'],
trustLevel: 0,
aliases:['wikipedia'],
usages:["<definition>"],
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
try {
const page = await wiki.page(args.join(' '))
const summary = await page.intro();
bot.tellraw(`@a`, { text: `${summary}`, color: 'gray' });
} catch (error) {
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.tellraw(`@a`, { text: 'Definition not found!', color: 'dark_red' })
} else {
bot.tellraw(`@a`, `${error.toString()}`)
}
}
}
}
-681
View File
@@ -1,681 +0,0 @@
[
{
"name": {
"text": "HBot",
"color": "aqua",
"bold": false
},
"authors": [
"hhhzzzsss"
],
"exclaimer": "HBOT HARRYBUTT LMAOOOOOOOOOOOOOOOOO",
"foundation": "java/mcprotocollib",
"prefixes": [
"#"
]
},
{
"name": [
{
"text": "FBot",
"color": "gold"
}
],
"authors": [
"popbob/aaa"
],
"exclaimer": "",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"+"
]
},
{
"name": [
{
"text": "Hydra",
"color": "dark_red"
}
],
"authors": [
"popbob/aaa"
],
"exclaimer": "",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"+",
"$",
"h:",
"hydra:"
]
},
{
"name": [
{
"text": "JokerBot",
"color": "green"
}
],
"authors": [
"zXzy",
"12alex12"
],
"exclaimer": "",
"foundation": "nodejs/mineflayer",
"prefixes": [
"\\"
]
},
{
"name": {
"text": "CddehhBot",
"color": "red",
"bold": false
},
"authors": [
"CaydennO1",
"spyingcreeper09"
],
"exclaimer": "WHAT IS THIS GOOFY AAAH FUCKING BOT FUCKING PIECE OF RETARDED ASS SHIT BOT ITS SO FUCKING SHIT I WANNA IPFILTER IT WITH FUCKING CHOMENS",
"foundation": "nodejs/mineflayer",
"prefixes": [
","
]
},
{
"name": {
"text": "TurtleBot",
"color": "green",
"bold": false
},
"authors": [
"TurtleKid"
],
"exclaimer": "nmp when?",
"foundation": "nodejs/mineflayer",
"prefixes": [
"\\"
]
},
{
"name": {
"text": "NothingBot",
"color": "dark_red",
"bold": false
},
"authors": [
"Yaode_owo"
],
"exclaimer": "uwu",
"foundation": "nodejs/mineflayer",
"prefixes": [
"?"
]
},
{
"name": {
"text": "SC09Bot",
"color": "dark_gray",
"bold": false
},
"authors": [
"spyingcreeper09"
],
"exclaimer": ":3",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"@"
]
},
{
"name": {
"text": "HorizonBot",
"color": "gold",
"bold": false
},
"authors": [
"ZenZoya",
"Yaode_owo",
"Parker2991",
"and others"
],
"exclaimer": "originally called §5FleamBot§r",
"foundation": "nodejs/node-minecraft-protocol",
"prefixes": [
"^"
]
},
{
"name": {
"text": "64Bot",
"color": "gold",
"bold": false
},
"authors": [
"64Will64"
],
"exclaimer": "NINTENDO 64?!?!??!?! 69Bot when??????",
"foundation": "NodeJS/Mineflayer",
"prefixes": [
"w="
]
},
{
"name": {
"text": "Nebulabot",
"color": "dark_purple",
"bold": false
},
"authors": [
"IuCC"
],
"exclaimer": "the void",
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
"["
]
},
{
"name": [
{
"text": "Prism",
"color": "#00FF9C",
"bold": true
},
{
"text": "Bot",
"color": "white",
"bold": true
}
],
"authors": [
"IuCC"
],
"exclaimer": "prismarine :3",
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
"["
]
},
{
"name": {
"text": "SharpBot",
"color": "aqua",
"bold": false
},
"authors": [
"64Will64"
],
"exclaimer": "sharp as in the tv? idfk im out of jokes also the first c# bot on the list??",
"foundation": "C#/MineSharp",
"prefixes": [
"s="
]
},
{
"name": {
"text": "MoonBot",
"color": "red",
"bold": false
},
"authors": [
"64Will64"
],
"exclaimer": "stop mooning/mooing me ",
"foundation": "NodeJS/Mineflayer",
"prefixes": [
"m="
]
},
{
"name": {
"text": "TableBot",
"color": "yellow",
"bold": false
},
"authors": [
"12alex12"
],
"exclaimer": "TABLE CLOTH BOT?!?! ",
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
"t!"
]
},
{
"name": [
{
"text": "Evil",
"color": "dark_red",
"bold": false
},
{
"text": "Bot",
"color": "dark_purple"
}
],
"authors": [
"FusseligerDev"
],
"exclaimer": "",
"foundation": "Java/Custom",
"prefixes": [
"!"
]
},
{
"name": {
"text": "SBot Java",
"color": "white",
"bold": false
},
"authors": [
"evkc"
],
"foundation": "Java/MCProtocolLib",
"prefixes": [
":"
]
},
{
"name": {
"text": "SBot Rust",
"color": "white",
"bold": false
},
"authors": [
"evkc"
],
"foundation": "Rust",
"prefixes": [
"re:"
]
},
{
"name": {
"text": "Z-Boy-Bot",
"color": "dark_purple",
"bold": false
},
"exclaimer": "Most likely skidded along with kbot that the dev used",
"authors": [
"Romnci"
],
"foundation": "NodeJS/mineflayer or Java/mcprotocollib idfk",
"prefixes": [
"Z]"
]
},
{
"name": {
"text": "ABot",
"color": "gold",
"bold": true
},
"exclaimer": "not used anymore (replaced by V2)",
"authors": [
{
"text": "_yfd",
"color": "light_purple"
}
],
"foundation": "NodeJS/Node-Minecraft-Protocol",
"prefixes": [
"<"
]
},
{
"name": {
"text": "ABot-V2",
"color": "gold",
"bold": true
},
"exclaimer": "",
"authors": [
{
"text": "_yfd",
"color": "light_purple"
}
],
"foundation": "NodeJS/Node-Minecraft-Protocol",
"prefixes": [
"<"
]
},
{
"name": {
"text": "FardBot",
"color": "light_purple",
"bold": false
},
"authors": [
"_yfd"
],
"exclaimer": "bot is dead lol",
"foundation": "NodeJS/Mineflayer",
"prefixes": [
"<"
]
},
{
"name": {
"text": "ChipmunkBot Java",
"color": "green",
"bold": false
},
"authors": [
"_ChipMC_"
],
"exclaimer": "chips? also shoutout to chip and chayapak for helping in the rewrite",
"foundation": "Java/MCProtocolLib",
"prefixes": [
"'",
"/'"
]
},
{
"name": {
"text": "ChipmunkBot NodeJS",
"color": "green",
"bold": false
},
"authors": [
"_ChipMC_"
],
"foundation": "NodeJS/Node-Minecraft-Protocol"
},
{
"name": {
"text": "TestBot",
"color": "aqua",
"bold": false
},
"authors": [
"Blackilykat"
],
"foundation": "Java/MCProtocolLib",
"prefixes": [
"-"
]
},
{
"name": {
"text": "UBot",
"color": "gray",
"bold": false
},
"authors": [
"HexWoman"
],
"exclaimer": "UwU OwO",
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"\""
]
},
{
"name": {
"text": "ChomeNS Bot Java",
"color": "yellow",
"bold": false
},
"authors": [
"chayapak"
],
"exclaimer": "wow its my bot !! ! 4374621q43567%^&#%67868-- chayapak \n rip ChomeNS bot i wonder what chayapak is currently doing -- Parker2991",
"foundation": "Java/MCProtocolLib",
"prefixes": [
"*",
"cbot ",
"/cbot "
]
},
{
"name": {
"text": "ChomeNS Bot NodeJS",
"color": "yellow",
"bold": false
},
"authors": [
"chayapak"
],
"foundation": "NodeJS/Node-Minecraft-Protocol",
"prefixes": [
"*",
"cbot",
"/cbot"
]
},
{
"name": {
"text": "RecycleBot",
"color": "dark_green",
"bold": false
},
"foundation": [
"MorganAnkan"
],
"exclaimer": "nice bot",
"language": "NodeJS/node-minecraft-protocol",
"prefixes": [
"="
]
},
{
"name": {
"text": "neobot",
"color": "blue",
"bold": false
},
"exclaimer": "n e o b o t ;oslkdfj;salkdfj;ladsjf",
"authors": [
"mirkokral"
],
"foundation": "java/MCProtocolLib",
"prefixes": [
"_"
]
},
{
"name": {
"text": "ManBot",
"color": "dark_green",
"bold": false
},
"exclaimer": "(more like men bot :skull:) OH HAAAAAAAAAAAAAAIIILL LOGINTIMEDOUT",
"authors": [
"Man/LogintimedOut"
],
"foundation": "NodeJS/mineflayer",
"prefixes": [
"(Note:I dont remember!!)"
]
},
{
"name": [
{
"text": "Useless",
"color": "red",
"bold": false
},
{
"text": "Bot",
"color": "gray",
"bold": false
}
],
"exclaimer": "it isnt useless its a good bot................",
"authors": [
"IuCC"
],
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"["
]
},
{
"name": [
{
"text": "SnifferBot",
"color": "gold",
"bold": false
}
],
"exclaimer": "sniff sniff FNFBoyfriendBot simp",
"authors": [
"popbob/aaa"
],
"foundation": "NodeJS/Node-minecraft-protocol",
"prefixes": [
">"
]
},
{
"name": [
{
"text": "XBot",
"color": "dark_purple",
"bold": false
}
],
"exclaimer": "",
"authors": [
"popbob/aaa"
],
"foundation": "ts-Node/Node-minecraft-protocol",
"prefixes": [
"$"
]
},
{
"name": [
{
"text": "Kitty",
"color": "gold",
"bold": false
},
{
"text": "Corp",
"color": "aqua",
"bold": false
},
{
"text": "Bot",
"color": "yellow",
"bold": false
}
],
"exclaimer": "3 words ginlang is gay",
"authors": [
"ginlang , G6_, ArrayBuffer, and i guess more??"
],
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"^"
]
},
{
"name": [
{
"text": "FNF",
"color": "dark_purple",
"bold": false
},
{
"text": "Boyfriend",
"color": "aqua",
"bold": false
},
{
"text": "Bot",
"color": "dark_red",
"bold": false
},
{
"text": " nmp",
"color": "black",
"bold": false
}
],
"authors": [
{
"text": "Parker2991",
"color": "dark_red"
},
{
"text": " _ChipMC_",
"color": "dark_green",
"bold": false
},
{
"text": " chayapak",
"color": "yellow",
"bold": false
},
{
"text": " _yfd",
"color": "light_purple",
"bold": false
},
{
"text": "popbob/aaa",
"color": "gold"
},
{
"text": "MorganAnkan",
"color": "dark_green"
},
{
"text": "TurtleKid",
"color": "green"
}
],
"exclaimer": "v4.0x - current",
"foundation": "NodeJS/node-minecraft-protocol",
"prefixes": [
"~",
"fnfbfbot ",
"",
"‮",
"█"
]
},
{
"name": [
{
"text": "FNF",
"color": "dark_purple",
"bold": false
},
{
"text": "Boyfriend",
"color": "aqua",
"bold": false
},
{
"text": "Bot",
"color": "dark_red",
"bold": false
},
{
"text": " legacy",
"color": "green",
"bold": false
}
],
"authors": [
{
"text": "Parker2991",
"color": "dark_red"
},
{
"text": " _ChipMC_",
"color": "dark_green",
"bold": false
}
],
"exclaimer": "1037 LINES OF CODE WTFARD!??! also this version is in console commands only",
"foundation": "NodeJS/mineflayer",
"prefixes": []
}
]
+29 -9
View File
@@ -5,13 +5,21 @@ 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: {"translate":"outOfMemory.message"}
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
@@ -22,8 +30,6 @@ core:
y: 0
z: 15
commandSetMessage: false
keys:
trusted: "trusted key here"
admin: "admin key here"
@@ -39,23 +45,37 @@ colors:
commands:
primary: "dark_blue"
secondary: "blue"
tertiary: "dark_gray"
tertiary: "gray"
help:
public: "dark_blue"
trusted: "blue"
admin: "aqua"
owner: "light_purple"
console: "dark_purple"
console:
prefix: "c."
filelogger: false
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
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
mode: "kaboom"
-1
View File
@@ -1 +0,0 @@
[]
+5 -7
View File
@@ -1,10 +1,8 @@
{
"bot": {
"buildstring": {
"version": "v6.0.7",
"build":"1080",
"codename":""
},
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
"buildstring": {
"build": "2150",
"codename": "",
"version": "v7.0.4",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}
+723 -263
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1 +0,0 @@
[{"player":"aaa"},{"player":"Parker2991"},{"player":"FNFBoyfriendBot"}]
+42 -10
View File
@@ -1,39 +1,71 @@
const createBot = require('./bot.js');
const readline = require('readline');
const loadModules = require('./util/loadModules');
const js_yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
const checks = require('./util/checks');
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');
checks();
/*
if (!fs.existsSync(path.join(__dirname, "../config.yml"))) {
console.log("Config not found creating config from the default config");
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 = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
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) {
const bot = new createBot(options, config);
bot = new createBot(options, config);
bots.push(bot);
bot.bots = bots;
loadModules(bot, options, config, discordClient);
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);
}
});
+22 -7
View File
@@ -1,13 +1,28 @@
const readline = require('readline');
function boot (bot, options, discordClient, config) {
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.isCreayun) return
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 &fcreated by &4Parker&02991');
bot.chat.message(`&9FNF&3Boyfriend&1Bot &b${info.buildstring.version} &fcreated by &4Parker&02991`);
}
}) // &9 &3 &1
}
module.exports = boot;
})
process.on('SIGINT', (data) => {
bot.chat.message('Killing bot.....');
process.exit(5);
});
}
module.exports = {
data: {
enabled: true,
name: "boot",
type: "start up"
},
inject
};
+279 -50
View File
@@ -5,6 +5,7 @@ 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)
@@ -12,13 +13,16 @@ function tryParse (json) {
return { text: '' }
}
}
//what was changed??
function chat (bot, options, config) {
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.isSavage || options.isCreayun) {
if (options.mode === "savageFriends" || options.mode === "creayun") {
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
} else {
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
@@ -33,19 +37,135 @@ function chat (bot, options, config) {
})
switch (packet.type) {
case 1:
bot.emit('message', { translate: "chat.type.emote", with: [ sender, message ]})
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:
bot.emit('message', { translate: "commands.message.display.incoming", with: [ sender, message], color: "gray", italic: true })
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:
bot.emit('message', [{ translate: "commands.message.display.outgoing", with: [ sender, message ], color: "gray", italic: true }])
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:
bot.emit('message', [message]);
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:
bot.emit('message', [{ translate: 'chat.type.announcement', with: [ sender, message ]}])
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 })
@@ -56,25 +176,137 @@ function chat (bot, options, config) {
bot.emit('player_chat', { plain: packet.plainMessage, unsigned, senderUuid: packet.senderUuid })
switch (packet.type) {
case 5:
bot.emit('message', { translate: "chat.type.announcement", with: [ bot.players.find(player => player.uuid === packet.senderUuid).profile.name, packet.plainMessage ]})
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:
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 })
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:
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 })
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
default:
bot.emit('message', unsigned)
}
tryParsingMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
})
bot.on('packet.system_chat', packet => {
const message = tryParse(packet.content)
if (!config.commandSetMessage) {
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
}
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 })
@@ -82,9 +314,28 @@ function chat (bot, options, config) {
return
}
bot.emit('message', message)
if (message.translate === "advMode.notAllowed" || message?.translate?.startsWith("قيادة المجموعة")) return;
tryParsingMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
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) {
@@ -107,36 +358,14 @@ function chat (bot, options, config) {
return undefined
}
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),
timestamp: BigInt(Date.now()),
salt: 0n,
offset: 0,
acknowledged: bitset
})
},
command: command => {
bot._client.write('chat_command', {
command: command?.substring(0, 256),
timestamp: BigInt(Date.now()),
salt: 0n,
argumentSignatures: [],
signedPreview: false,
messageCount: 0,
acknowledged: Buffer.alloc(3),
previousMessages: []
})
}
}
bot.tellraw = (selector, message) => {
bot.core.run(`minecraft:tellraw ${selector} ` + JSON.stringify(message))
}
require('../util/chat_util')(bot);
}
module.exports = chat;
module.exports = {
data: {
enabled: true,
name: "chat",
type: "logging"
},
inject
};
+202 -28
View File
@@ -1,27 +1,89 @@
function core (bot, options, config) {
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 },
refill () {
usePlacedCommandBlock: false,
chatRefill () {
const pos = bot.core.position
const { start, end } = bot.core.area
if (!pos) return
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return
if (isNaN(pos.x + start.x)) {
bot.chat.command('spawn');
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
})
}
/*^^^
for checking is the core pos is null and if so
it will not refill core until the pos is not NaN
instead of tping to a set cords cuz fuck you im not doing that
*/
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
},
move (pos = bot.position) {
@@ -29,8 +91,19 @@ function core (bot, options, config) {
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();
}
bot.core.refill()
},
currentBlock () {
@@ -64,23 +137,124 @@ function core (bot, options, config) {
},
run (command) {
const location = bot.core.currentBlock()
if (!location) return
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
return
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 {
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
bot.core.incrementCurrentBlock()
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)
}
});
}
}
// if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
if (bot.options.isSavage || bot.options.isCreayun) return
bot.on('move', () => {
// if (bot.options.isSavage) return
bot.core.move(bot.position)
// setTimeout(() => bot.core.run('say Hello, world!'), 1000)
})
}
module.exports = core;
require('../util/core_util')(bot, config, options);
}
module.exports = {
data: {
enabled: true,
name: "core",
type: "extras"
},
inject
};
@@ -1,11 +1,18 @@
const CommandSource = require('../util/command_source');
module.exports = (bot, options, config) => {
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)
@@ -14,7 +21,7 @@ module.exports = (bot, options, config) => {
ratelimit--
}, 1000)
if (ratelimit > 2) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
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)
@@ -22,3 +29,12 @@ module.exports = (bot, options, config) => {
})
})
}
module.exports = {
data: {
enabled: true,
name: "command handler",
type: "commands"
},
inject
};
+11 -2
View File
@@ -1,4 +1,5 @@
function command_loop (bot, options, config) {
function inject (context) {
const bot = context.bot;
bot.cloop = {
list: [],
add (command, interval) {
@@ -28,4 +29,12 @@ function command_loop (bot, options, config) {
}
}
}
module.exports = command_loop;
module.exports = {
data: {
enabled: true,
name: "command loop",
type: "extras"
},
inject
};
+128 -125
View File
@@ -3,137 +3,120 @@ const path = require('path');
const CommandError = require('../util/command_error.js');
const CommandSource = require('../util/command_source');
const { EmbedBuilder } = require('discord.js');
async function command_manager (bot, options, config, discordClient) {
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 (source?.sources?.discord && !source?.sources?.console) {
if (!command || !command?.execute) {
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`)
.setTitle("Unknown command")
.setDescription(`Unknown command: ${commandName}`)
bot?.discord?.message?.reply({ embeds: [Embed] })
}
} else if (!source?.sources?.discord && !source?.sources?.console) {
if (!command || !command.execute)
throw new CommandError({
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" }
]
})
} else if (source?.sources?.console && !source?.sources?.discord) {
if (!command || !command.execute)
bot.console.warn([
{
translate: 'command.unknown.command',
color: "dark_red"
},
{
text: "\n",
},
{
text: `${commandName}`,
color: "dark_red"
},
{
translate: "command.context.here",
color: "dark_red"
}
])
}
if (command?.trustLevel > 0) {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
if (command?.trustLevel === 1 && !source?.sources?.discord) {
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or an admin or an owner hash", color: "dark_red" })
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' });
} else if (command?.trustLevel === 1 && source?.sources.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
}
if (command?.trustLevel === 2 && !source.sources.console) {
if (args.length === 0 && bot.validation.admin && bot.validation.owner && !source.sources.console) throw new CommandError({ text: "Please provide an trusted or owner hash", color: 'dark_red' })
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' });
}
if (command?.trustLevel === 3 && !source.sources.discord && !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' })
} else if (command?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
} else if (command?.trustLevel === 4 && !source.sources.console) {
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
}
}
if (!command?.discordExecute && command && source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in discord!`)
} else if (command?.discordExecute && command && source?.sources?.discord) {
return command.discordExecute({ bot, source, arguments: args, config, discordClient })
} else if (!command?.execute && command && !source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in game!`)
} else if (command?.execute && command && !source?.sources?.discord) {
return command?.execute({ bot, source, arguments: args, config, discordClient });
}
} catch (error) {
console.error(error.stack)
if (source?.sources?.discord && !source?.sources?.console) {
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`)
.setTitle(`${command?.name} command`)
.setDescription(`\`\`\`${error}\`\`\``)
bot?.discord?.message?.reply({
embeds: [
Embed
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" }
]
})
} else if (!source?.sources?.discord && !source?.sources?.console) {
if (error instanceof CommandError) {
if (bot.options.isSavage || bot.options.isCreayun) {
bot.chat.message(`&4${error.message}`)
} else {
bot.tellraw("@a", error._message)
}
})?.toAnsi());
} else {
if (bot.options.isSavage || bot.options.isCreayun) {
bot.chat.message(`${bot.getMessageAsPrismarine({ translate: "command.failed", color: "dark_red" })?.toMotd().replaceAll('§','&')}`)
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", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
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(' ')
return this.execute(source, commandName, args)
},
discordExecute(source, command) {
const [commandName, ...args] = command.split(" ");
if (source?.sources?.discord && !source.sources.console) {
return this.discordExecute(source, commandName, args)
}
},
register (command) {
this.commands[command.name] = command
if (command.aliases) {
command.aliases.map((a) => (this.commands[a] = 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);
}
},
unregister (command) {
this.commands = {};
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) {
@@ -145,21 +128,41 @@ async function command_manager (bot, options, config, discordClient) {
},
}
/*
file loader ported from my discord bot SkiBot
and edited to support mjs files and to support FNFBoyfriendBot's command format
*/
commandlist = [];
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
try {
if (filename.endsWith('.mjs')) {
let commands = await import(path.join(__dirname, '../commands', filename))
bot.commandManager.register(commands.command);
bot.commandManager.commandlist.push(commands.command);
} if (filename.endsWith('.js')) {
let commands = require(path.join(__dirname, '../commands', filename));
bot.commandManager.register(commands);
bot.commandManager.commandlist.push(commands);
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);
}
} catch (error) {
console.error('Failed to load command ', filename, ':', error)
}
}
}
module.exports = command_manager;
module.exports = {
data: {
enabled: true,
name: "command manager",
type: "commands"
},
inject
};
+52
View File
@@ -0,0 +1,52 @@
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
};
+31 -39
View File
@@ -1,7 +1,11 @@
const CommandSource = require('../util/command_source');
const prismarineChat = require('prismarine-chat')('1.20.2');
function Console (bot, options, config) {
let rateLimit = 0;
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let ratelimit = 0;
bot.console = {
readline: null,
server: 'all',
@@ -19,7 +23,13 @@ function Console (bot, options, config) {
})
})
},
source: new CommandSource(bot.options.username, { console: true, discord: false }),
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);
@@ -37,46 +47,28 @@ function Console (bot, options, config) {
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)
},
customChat: {
enabled: false,
chat (message) {
const prefix = {
translate: '[%s] %s \u203a %s',
color:'dark_gray',
with: [
{
text: 'FNFBoyfriendBot Console',
color:'#00FFFF'
},
{
selector: `${bot.username}`, color:'#00FFFF',
clickEvent: { action: 'suggest_command', value: `${config.prefixes[0]}help` }
},
{
text: '',
extra: [`${message}`],
color:'white'
},
],
hoverEvent: { action:"show_text", value: 'FNF Sky is a fangirl but a simp for boyfriend confirmed??'},
clickEvent: 'https://doin-your.mom' ?
{ action: 'open_url', value: 'https://doin-your.mom' } : undefined,
}
bot.tellraw('@a', prefix)
}
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) => {
rateLimit++
setTimeout(() => {
rateLimit--
}, 1000)
if (!options.logging) return;
/* if (rateLimit > 100) {
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 = Console;
module.exports = {
data: {
enabled: true,
name: "console",
type: "logging"
},
inject
};
+57 -35
View File
@@ -1,13 +1,12 @@
// TODO: Maybe move client creation elsepwhere
const { Client, GatewayIntentBits, interaction } = require('discord.js')
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
const fixansi = require('../util/ansi');
const CommandSource = require('../util/command_source')
const CommandSource = require('../util/command_source');
const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
const util = require('util')
function discord(bot, options, config, discordClient) {
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
@@ -19,17 +18,15 @@ function discord(bot, options, config, discordClient) {
channel: undefined,
invite: config.discord.invite || undefined,
prefix: config.discord.prefix,
// presence: bot.discord.presence,
// token: config.discord.token,
}
discordClient.once('ready', (context) => {
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
discordClient.user.setPresence({
activities: [{
name: `your mother`,
name: `${config.discord.presence.name}`,
type: 0
}],
status: `dnd`
status: `${config.discord.presence.status}`
});
})
@@ -39,7 +36,6 @@ function discord(bot, options, config, discordClient) {
try {
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
} catch (error) {
bot.console.warn(error.toString())
}
discordQueue = []
}, 2000)
@@ -53,13 +49,15 @@ function discord(bot, options, config, discordClient) {
try {
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
} catch (e) {
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
bot.console.warn(`Error sending a message to Discord: ${e.message}`)
sendDiscordMessage(e.message)
}
}
bot.on('message', message => {
sendComponent(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;
@@ -70,22 +68,20 @@ function discord(bot, options, config, discordClient) {
if (message.content.startsWith(config.discord.prefix)) { // TODO: Don't hardcode this
const source = new CommandSource({
profile: {
name: message?.member?.displayName
name: `${message?.member.nickname || message?.author.displayName}`
}
}, {
discord: true,
console: false
}, false, message)
}, false, message);
bot.sendFeedback = message => {
sendComponent(message)
}
sendComponent(message);
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
return
}
const tag = {
translate: '[%s] %s \u203a %s',
translate: '[%s] %s \u203a ',
with: [{
translate: '%s%s%s %s',
bold: false,
@@ -107,7 +103,7 @@ function discord(bot, options, config, discordClient) {
{
text: 'Discord',
bold: false,
color: 'dark_blue'
color: 'blue'
}
],
clickEvent: bot.discord.invite ? {
@@ -120,34 +116,60 @@ function discord(bot, options, config, discordClient) {
}
},
{
text: message?.member?.displayName
text: `${message.member.nickname || message.author.displayName}`,
},
message.content
]
}
try {
if (message.attachments.size > 0) {
message.attachments.forEach(Attachment => {
bot.tellraw('@a', [tag, {
text: ' ' ? ' [Attachment] ' : ' [Attachment] ',
let attachment = {
text: `[Attachment: ${Attachment.name}] ${message?.content}`,
color: "blue",
hoverEvent: {
action: 'show_text',
contents: 'Click here to view attachment'
action: "show_text",
contents: "click here to view attachment"
},
clickEvent: {
action: 'open_url',
value: `${Attachment.url}`
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.useChat || options.isSavage || options.isCreayun) {
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);
bot.tellraw('@a', [tag, message.content]);
}
}
} catch (e) {
console.log(e.stack);
}
}
discordClient.on('messageCreate', messageCreate)
}
module.exports = discord;
module.exports = {
data: {
enabled: true,
name: "discord",
type: "logging"
},
inject
};
+14 -7
View File
@@ -3,20 +3,21 @@ const path = require("path");
const { createGzip } = require("zlib");
const readline = require('readline');
const { Console } = require("console");
function fileLogger(bot, options, message) {
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, "../../logs");
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" });
if (!fs.existsSync(path.join(__dirname, "../../logs"))) {
fs.mkdirSync(path.join(__dirname, "../../logs"))
}
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) {
@@ -24,7 +25,6 @@ function fileLogger(bot, options, message) {
}
function compressFile(input, output) {
// if (!bot.Console.filelogging) return
const plainOutput = output.slice(0, -3);
fs.renameSync(input, plainOutput);
@@ -57,4 +57,11 @@ function fileLogger(bot, options, message) {
logStream.write(message + "\n");
};
}
module.exports = fileLogger;
module.exports = {
data: {
enabled: true,
name: "file logger",
type: "logging"
},
inject
};
+114 -43
View File
@@ -1,83 +1,154 @@
const fs = require('fs');
const path = require('path');
function filter (bot, options, config, discordClient) {
if (options.isSavage || options.isCreayun) return;
// filter v6 (not to be confused with the bot version)
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) {
console.log(e.stack)
bot.console.warn(e.toString())
}
},
add (ignoreCase, regexed, player) {
add (Player, ignoreCase, Regex) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
var arrayadd = { ignoreCase: ignoreCase, regexed: regexed, name: player }
data.push(arrayadd);
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data))
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))
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
},
doAll () {
}
}
bot.on('message', async (data) => {
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
// for (const eachBot of bot.bots) {
let player_completion = (await bot.tab_complete('deop ')).filter(_ => _.tooltip == undefined);
player_completion.forEach(async (player) => {
if (filteredPlayer.ignoreCase) {
} else {
// if (player.match !== eachBot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name) return;
if (bot.players.find((players) => players.profile.name === player.match).profile.name === filteredPlayer.name === true) {
bot.core.run(`execute run deop @a[name="${bot.players.find((players) => players.profile.name === filteredPlayer.name).profile.name}"]`);
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}"]`);
}
}
})
if (filteredPlayer.ignoreCase) {
} else {
// if (!eachBot.players.find((player) => players.profile.name === filteredPlayer.name)) return
if (bot.players.find((players) => players.profile.name === JSON.parse(filteredPlayer.name)).gamemode !== 2) {
// if (eachBot.players.find((player) => players.profile.name !== filteredPlayer.name)) return
bot.core.run(`execute run gamemode adventure @a[name="${bot.players.find((player) => player.profile.name === filteredPlayer.name).profile.name}"]`);
}
}
}
// }
})
}
}
bot.on('parsed_message', (data) => {
try {
for (const filteredPlayer of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
if (filteredPlayer.ignoreCase) {
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 (bot?.players?.find((player) => player?.profile?.name === filteredPlayer.name)?.profile?.name === data?.sender?.profile?.name) {
bot.core.run(`essentials:mute ${bot?.players?.find((player) => player?.profile?.name === filteredPlayer.name)?.uuid} 10y`);
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
}
module.exports = filter;

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