Compare commits

..

3 commits
main ... main

69 changed files with 640 additions and 428 deletions

11
package-lock.json generated
View file

@ -1,11 +1,14 @@
{
"name": "FridayNightFunkinBoyfriendBot",
"version": "v6.1.1",
"lockfileVersion": 3,
"requires": true,
"build": "1145",
"codename": "",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot",
"buildstring": {
"version": "v6.1.2",
"build": "1200",
"releaseDate": "11/22/24",
"codename": "§eHazardous §4Massacre",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
},
"packages": {
"": {
"dependencies": {

View file

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

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

View file

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

View file

@ -1,8 +1,9 @@
const CommandError = require('../util/command_error');
const sleep = require('../util/sleep.js');
const fixansi = require('../util/ansi');
const CommandError = require('../../util/command_error');
const sleep = require('../../util/sleep.js');
const fixansi = require('../../util/ansi');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'help',
trustLevel: 0,
aliases: [
@ -14,13 +15,13 @@ module.exports = {
"helo",
"commands",
"commandshelp",
],
description: 'a list of the bots commands',
usages: [
"",
"<command>",
],
},
execute (context) {
const commandList = [];
const bot = context.bot;
@ -31,13 +32,13 @@ module.exports = {
bold: false,
color: 'gray',
with: [
{ color: "#f5c9ce", text: 'Public'},
{ color: "aqua", text: 'Public'},
{ color: "gray", text: ' | '},
{ color: "#e25c6c", text: 'Trusted'},
{ color: "dark_aqua", text: 'Trusted'},
{ color: 'gray', text: ' | '},
{ color: "#a31d2c", text: "Admin" },
{ color: "blue", text: "Admin" },
{ color: "gray", text: " | " },
{ color: "#360a0f", text: 'Owner'},
{ color: "dark_blue", text: 'Owner'},
]
}
let public = [];
@ -47,41 +48,41 @@ module.exports = {
for (const command of bot.commandManager.commandlist) {
let usagesComponent = [];
let commandComponent = [];
for (const usages of command.usages) {
if (command?.trustLevel === 1) {
for (const usages of command.data.usages) {
if (command?.data?.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: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.trustLevel === 2) {
} else if (command?.data.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: `${command.data.name} <admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.trustLevel === 3) {
} else if (command?.data.trustLevel === 3) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.name} <owner hash>`, color: "blue" },
{ text: `${command.data.name} <owner hash>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.trustLevel === 0 || command.trustLevel === 4) {
} else if (command?.data.trustLevel === 0 || command.data.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" },
{ text: `${command.data.name}`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
}
@ -94,16 +95,16 @@ module.exports = {
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.name}`, color: "blue" },
{ text: `${command.data.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.description}`, color: "blue" },
{ text: `${command.data.description}`, color: "blue" },
{ text: "Trust Level", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.trustLevel}`, color: "gold" },
{ text: `${command.data.trustLevel}`, color: "gold" },
{ text: "Usages", color: "dark_blue" },
{ text: "\u203a" }
]
@ -111,7 +112,7 @@ module.exports = {
commandComponent.push("\n");
commandComponent.push(usagesComponent);
// for (const aliases of command.aliases) {
if (args[0]?.toLowerCase() === command.name) {
if (args[0]?.toLowerCase() === command.data.name) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
} else {
@ -129,173 +130,174 @@ module.exports = {
}
console.log(aliases)*/
// }
if (command.trustLevel === 0) {
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
if (command.data.trustLevel === 0) {
public.push([
{
text: command.name + ' ',
color: "#f5c9ce",
text: command.data.name + ' ',
color: "aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'gray'
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'gray',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.trustLevel === 1) {
} else if (command.data.trustLevel === 1) {
trusted.push([
{
text: command.name + ' ',
color: "#e25c6c",
text: command.data.name + ' ',
color: "dark_aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'gray'
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'gray',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.trustLevel === 2) {
} else if (command.data.trustLevel === 2) {
admin.push([
{
text: command.name + ' ',
color: "#a31d2c",
text: command.data.name + ' ',
color: "blue",
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'gray'
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'gray',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.trustLevel === 3) {
} else if (command.data.trustLevel === 3) {
owner.push([
{
text: command.name + ' ',
color: "#360a0f",
text: command.data.name + ' ',
color: "dark_blue",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
color: 'gray'
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
text: `Trust Level: `,
color: 'gray'
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
color: 'gray'
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
color: 'gray'
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
text: 'click on me to use me :)',
color: 'gray',
color: 'dark_blue',
},
],
},
clickEvent: {
action: 'run_command',
value: `${config.prefixes[0]}${command?.name}`
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 4).length
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
if (bot.options.useChat) {
bot.chat.message(bot.getMessageAsPrismarine([
{
@ -399,52 +401,52 @@ module.exports = {
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```')
if (args[0] === command.data.name) {
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.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`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
return
}
if (command?.trustLevel === 0 && command.discordExecute) {
if (command?.data.trustLevel === 0 && command.discordExecute) {
public.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "aqua",
}
])
} else if (command?.trustLevel === 1 && command.discordExecute) {
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
trusted.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "dark_aqua"
}
])
} else if (command?.trustLevel === 2 && command.discordExecute) {
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
admin.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: 'blue'
}
])
} else if (command?.trustLevel === 3 && command.discordExecute) {
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
owner.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "dark_blue",
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.trustLevel !== 3 && c.discordExecute).length
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).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`)
.setTitle(`${this.data.name} Command`)
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
bot?.discord?.message.react('♋')

View file

@ -46,7 +46,7 @@ module.exports = {
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.url}`,
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: {
@ -57,7 +57,7 @@ module.exports = {
},
clickEvent: {
action: "open_url",
value: `${botInfo.url}`
value: `${botInfo.buildstring.url}`
}
})
break;
@ -153,7 +153,7 @@ module.exports = {
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",
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" },
@ -166,7 +166,8 @@ module.exports = {
{ text: "aaa", color: "gold" },
{ text: "Morgan", color: "green" },
{ text: "Ankan", color: "dark_green" },
{ text: "TurtleKid", color: "green" }
{ text: "TurtleKid", color: "green" },
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
]
})
break;
@ -191,6 +192,7 @@ module.exports = {
})
break;
case "usages":
case "usage":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
@ -310,26 +312,7 @@ module.exports = {
case "version":
case "ver":
if (botInfo.codename === '') {
component.push({
translate: "%s %s %s-%s-%s%s\n%s - %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.version}`, color: config.colors.integer },
{ text: "#" },
{ text: `${botInfo.build}`, color: config.colors.integer },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
]
})
/*
`§9Friday §9Night §9Funkin §3Boyfriend §1Bot§8§r-
${botInfo.version}-#${botInfo.build}-${botInfo.codename}\n11/22/22 -
${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}
*/
} else {
component.push({
translate: "%s %s %s-%s-%s%s-%s\n%s - %s",
color: config.colors.commands.tertiary,
@ -337,10 +320,27 @@ ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.version}`, color: config.colors.integer },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "#" },
{ text: `${botInfo.build}`, color: config.colors.integer },
{ text: `${botInfo.codename}` },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: `${botInfo.buildstring.releaseDate}`, 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-%s%s-%s-%s\n%s - %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "#" },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: `${botInfo.buildstring.releaseDate}`, color: config.colors.commands.secondary },
{ text: `${botInfo.buildstring.codename}` },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
]

View file

@ -0,0 +1,32 @@
module.exports = {
data: {
name: 'memusage',
trustLevel: 0,
aliases: [
],
description: 'check the bots and the servers ram usage',
usages: [
"on/enable/true",
"off/disable/false",
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
switch (args[0]?.toLowerCase()) {
case "on":
case "enable":
case "true":
bot.memUsage.enabled = true;
bot.chat.message('enabled memusage');
break;
case "off":
case "enable":
case "false":
bot.memUsage.enabled = false;
bot.chat.message('disabled memusage');
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
},
}

View file

@ -1,6 +1,6 @@
const wiki = require('wikipedia')
const CommandError = require('../../util/command_error')
const { EmbedBuilder } = require('discord.js')
const wiki = require('wikipedia');
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'wiki',
@ -10,20 +10,20 @@ module.exports = {
'wikipedia'
],
usages:[
"<definition>"
"<article>"
],
},
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
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' })
bot.tellraw(`@a`, { text: 'Article not found!', color: 'dark_red' })
} else {
bot.tellraw(`@a`, `${error.toString()}`)
}

View file

@ -3,7 +3,7 @@ const CommandError = require('../../util/command_error')
module.exports = {
data: {
name: 'tpr',
description: 'teleport to a random place',
description: 'teleport to very fucked up coords',
trustLevel: 1,
aliases: [
'rtp',

View file

@ -1,18 +1,21 @@
prefixes:
- "m~"
- "m|"
- "!"
discord:
token: "discord token here"
prefix: "!"
invite: "discord invite here"
enabled: true
roles:
trusted: "trusted"
admin: "admin"
owner: "FNFGirlfriendBot Owner"
owner: "FNFBoyfriendBot Owner"
core:
name: {"text": "FNFGirlfriendBot Core", "color": "red"}
# core refill methods:
# chat: refill core in chat
# item refill core in a command block placed by the bot
name: {"translate":"outOfMemory.message"}
method: 'item'
area:
start:
x: 0
@ -47,103 +50,17 @@ console:
filelogger: false
bots:
- host: "play.kaboom.pw"
username: "FNFGirlfriendBot"
- host: "localhost"
username: "FNFBoyfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "kaboom"
serverName: "localhost"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
logging: false
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
- host: "chipmunk.land"
username: "FNFGirlfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "chipmunk"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
- host: "168.100.225.224"
username: "FNFGirlfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "neko"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
- host: "fatihboom.fr.to"
port: 20015
username: "FNFGirlfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "fatih"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
- host: "chayapak.chipmunk.land"
username: "FNFGirlfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "chayapakboom"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
- host: "qilk.de"
port: 25569
username: "FNFGirlfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "denisthekiddytoucherboom"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
useChat: false
isKaboom: true
isSavage: false
isCreayun: false
- host: "70.129.58.17"
port: 25565
username: "FNFGirlfriendBot"
usernameGen: true
version: "1.20.2"
serverName: "minecraftplayerboom,"
private: false
reconnectDelay: 6000
channelId: "discord channel id here"
logging: true
useChat: false
isKaboom: true
isSavage: false
isCreayun: false

View file

@ -0,0 +1,19 @@
module.exports = {
data: {
name: '<command name>',
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
aliases: [
""
],
description: '',
usages: [
""
],
},
execute (context) {
},
discordExecute (context) {
}
}

View file

@ -0,0 +1,19 @@
export default {
data: {
name: '<command name>',
trustLevel: 0, // trust levels: 0, 1, 2, 3, 4
aliases: [
],
description: '',
usages: [
""
],
},
execute (context) {
},
discordExecute (context) {
}
}

View file

@ -0,0 +1,4 @@
function whatevername (bot, options, config, discordClient) {
}
module.exports = whatevername

View file

@ -0,0 +1,3 @@
module.exports = (bot, options, config, discordClient) => {
}

View file

@ -0,0 +1,3 @@
export default function () {
}

View file

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

View file

@ -8,7 +8,8 @@ const checks = require('./util/checks');
const { Client, GatewayIntentBits } = require('discord.js');
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
console.log('Starting FNFGirlfriendBot');
console.log('Starting FNFBoyfriendBot');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c')
checks();
try {
@ -16,10 +17,15 @@ try {
} catch (e) {
console.log(e.stack);
}
if (config.core.method !== 'item' && config.core.method !== 'chat') {
config.core.method = 'item';
console.warn('invalid core method type defaulting to item');
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
//console.log(completion);
if (config.discord.enabled) discordClient.login(config.discord.token);
const bots = [];
for (const options of config.bots) {

View file

@ -1,13 +1,18 @@
const readline = require('readline');
function boot (bot, options, discordClient, config) {
function boot (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.on("packet.login", (data) => {
if (bot.options.isCreayun) return
if (new Date().getDay() === 5) {
bot.tellraw('@a', 'Left right left right beep bop beep bop thats how you do it up down up down aaa doo aaa doo thats how you do it left down up right beep baa doo uuu down down up down down right doo doo aaa doo doo uuu down up right up right doo aaa uuu aaa uuu uuu uuu ooo ooo aaa aaa aaa aaa aaaaaaaaaa');
bot.chat.message('Gettin\' freaky on a friday night!');
} else {
bot.chat.message('&4FNF&cGirlfriend&4Bot &fstarted');
bot.chat.message('&9FNF&3Boyfriend&1Bot &fcreated by &4Parker&02991');
}
}) // &9 &3 &1
})
setInterval(() => {
process.stdout.write(`\x1b]2; FNFBoyfriendBot | Time: ${new Date().toLocaleString("en-US",{timeZone: "America/CHICAGO"})} | \x1b\x5c`)
}, 1000)
}
module.exports = boot;

View file

@ -12,8 +12,11 @@ function tryParse (json) {
return { text: '' }
}
}
//what was changed??
function chat (bot, options, config) {
//what was changed?
function chat (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let ChatMessage
bot.on('registry_ready', registry => {
ChatMessage = loadPrismarineChat(registry)

View file

@ -1,6 +1,9 @@
const CommandSource = require('../util/command_source');
module.exports = (bot, options, config) => {
module.exports = (context) => {
let ratelimit = 0;
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.on("parsed_message", (data) => {
if (data.type !== "minecraft:chat") return;
const prefixes = config.prefixes;

View file

@ -1,5 +1,9 @@
function core (bot, options, config) {
let number = 0;
const mcData = require('minecraft-data')('1.20.2');
function core (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 },
@ -25,7 +29,51 @@ function core (bot, options, config) {
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)}'}`)
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`
if (config.core.method === 'chat') {
bot.chat.command(`${command}`)
} else if (config.core.method === 'item') {
bot._client.write('set_creative_slot', {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.command_block.id,
itemCount: 1,
nbtData: { }
}
});
bot._client.write('block_dig', {
status: 0,
location: {
x: bot.position.x,
y: bot.position.y,
z: bot.position.z
},
face: 0
});
bot._client.write('block_place', {
hand: 0,
location: {
x: bot.position.x,
y: bot.position.y,
z: bot.position.z
},
direction: 0,
cursorX: 0.1,
cursorY: 0,
cursorZ: 0.1,
insideBlock: false
});
bot._client.write('update_command_block', {
location: bot.position,
command,
flags: 5,
mode: 1
})
}
},
move (pos = bot.position) {
@ -76,15 +124,61 @@ function core (bot, options, config) {
} else {
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 });
bot._client.write('query_block_nbt', ({ location: location, transactionId: eee}));
bot.core.incrementCurrentBlock()
bot.core.incrementCurrentBlock();
}
},
runTracked (command) {
const transactionId = Math.floor(Math.random() * 1000);
const location = bot.core.currentBlock();
if (!location) return;
if (bot.position.y !== bot.core.position.y) {
bot.chat.command(`minecraft:tp ${bot.core.position.x} ${bot.core.position.y} ${bot.core.position.z}`)
}
bot._client.write('update_command_block', {
command: command.substring(0, 32767),
location,
flags: 5,
mode: 1,
// LastOutput: true,
});
bot.core.incrementCurrentBlock();
bot._client.write('query_block_nbt', {
location,
transactionId
});
bot.on('packet.nbt_query_response', (data) => {
// transactionId,
try {
if (data.transactionId === transactionId) {
bot.tellraw("@a", require('util').inspect(data.value))
bot.tellraw("@a", JSON.stringify(data.value))
}
} catch (e) {
bot.tellraw("@a", require("util").inspect(e.stack));
}
})
}
}
if (bot.options.isSavage || bot.options.isCreayun) return
bot.on('move', () => {
bot.core.move(bot.position)
})
}
bot.on('packet.block_change', (data) => {
// console.log('data pos ' + JSON.stringify(data.location))
// console.log('core pos ' +JSON.stringify(bot.core.position));
if (data.type === 0) {
// console.log('data pos ' + JSON.stringify(data.location));
// console.log('core position ' + JSON.stringify(bot.core.position));
// bot.core.refill();
}
})
}
module.exports = core;

View file

@ -1,4 +1,5 @@
function command_loop (bot, options, config) {
function command_loop (context) {
const bot = context.bot;
bot.cloop = {
list: [],
add (command, interval) {

View file

@ -3,7 +3,12 @@ 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) {
async function command_manager (context) {
const bot = context.bot;
const config = context.config;
const discordClient = context.discordClient;
const options = context.options;
bot.commandManager = {
commands: {},
commandlist: [],
@ -43,29 +48,45 @@ async function command_manager (bot, options, config, discordClient) {
]
})?.toAnsi())
}
if (command?.data?.trustLevel > 0) {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
if (command?.data?.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?.data?.trustLevel === 1 && source?.sources.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
switch (command?.data?.trustLevel) {
case 0:
// do nothing since trust level 0 is public
break;
case 1:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
} else if (!source?.sources.console) {
if (args.length === 0) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" });
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid trusted, admin or owner hash', color: 'dark_red' });
}
if (command?.data?.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.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' });
break;
case 2:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
} else if (!source?.sources?.console) {
if (args.length === 0) throw new CommandError({ text: "Please provide an admin or owner hash", color: 'dark_red' })
if (args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid admin or owner hash', color: 'dark_red' });
}
if (command?.data?.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?.data?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
break;
case 3:
if (source?.sources?.discord) {
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?.data?.trustLevel === 4 && !source.sources.console) {
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
} else if (!source?.sources?.console) {
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
}
break;
case 4:
if (!source?.sources?.console) {
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" })
}
break;
}
if (!command?.discordExecute && command && source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in discord!`)
@ -81,7 +102,7 @@ async function command_manager (bot, options, config, discordClient) {
if (source?.sources?.discord && !source?.sources?.console) {
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`)
.setTitle(`${command?.name} command`)
.setTitle(`${command?.data?.name} command`)
.setDescription(`\`\`\`${error}\`\`\``)
bot?.discord?.message?.reply({
embeds: [

View file

@ -1,6 +1,10 @@
const CommandSource = require('../util/command_source');
const prismarineChat = require('prismarine-chat')('1.20.2');
function Console (bot, options, config) {
function Console (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let ratelimit = 0;
bot.console = {
readline: null,
@ -101,39 +105,9 @@ function Console (bot, options, config) {
bot.on('actionBar', (message) => {
if (!options.logging) return;
if (ratelimit > 10) return
// bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.log(bot.getMessageAsPrismarine(message)?.toAnsi());
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
ratelimit++
})
/*
setInterval(() => spamCount = 0, 1000 * 2)
bot.on('message', message => {
if (spamCount > 300) {
console.log('WTF spam detected not logging')
return
}
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi()
const string = bot.getMessageAsPrismarine(message)?.toString()
const now = new Date().toLocaleString()
spamCount++
*/
/* bot.on('message', (message) => {
rateLimit++
setTimeout(() => {
rateLimit--
}, 1000)
if (!options.logging) return;
if (rateLimit > 100) {
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()}`);
})*/
}
module.exports = Console;

View file

@ -6,8 +6,11 @@ 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 discord (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
@ -82,7 +85,7 @@ 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,
@ -132,7 +135,7 @@ function discord(bot, options, config, discordClient) {
}
},
{
text: message?.member?.displayName
text: `${message.member.nickname || message.author.displayName}`,
},
message.content
]

View file

@ -3,7 +3,10 @@ const path = require("path");
const { createGzip } = require("zlib");
const readline = require('readline');
const { Console } = require("console");
function fileLogger(bot, options, message) {
function fileLogger(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()

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

@ -0,0 +1,37 @@
const os = require('os');
module.exports = (context) => {
const bot = context.bot;
const config = context.config;
let timer;
bot.memUsage = {
enabled: false
}
timer = setInterval(() => {
component = {
translate: "%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |",
color: config.colors.commands.tertiary,
with: [
{ text: "FNF", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: "Memory Usage" },
{ 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 }
]
}
if (!bot.memUsage.enabled) return;
bot.core.run(`minecraft:title @a[tag=!memusage] actionbar ${JSON.stringify(component)}`)
}, 100)
bot.on('end', () => {
bot.memUsage.enabled = false;
})
}

View file

@ -1,4 +1,7 @@
function player_list (bot, options, config) {
function player_list (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.players = []
bot.on('packet.player_info', async (packet) => {

View file

@ -1,4 +1,6 @@
function position (bot, options, config) {
function position (context) {
const bot = context.bot;
bot.position = null
bot.on('packet.position', packet => {

View file

@ -1,6 +1,9 @@
const mc = require('minecraft-protocol');
const usernameGen = require("../util/usernameGen");
function reconnect (bot, options, config) {
function reconnect (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.on('end', () => {
//bot = undefined;

View file

@ -1,4 +1,7 @@
function selfcare (bot, options, config) {
function selfcare (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
let entityId;
let permissionLevel = 2;
let unmuted = false;
@ -62,7 +65,7 @@ You already have registered this username!
else if (stringMessage?.startsWith("Successfully set your username to ")) username = true
else if (stringMessage === `You already have the username "${bot.username}"`) username = false
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
else if (stringMessage.startsWith('Your nickname is now ')) nickname = true;
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
}
})

View file

@ -1,4 +1,6 @@
module.exports = (bot) => {
module.exports = (context) => {
const bot = context.bot;
// let aaa cook
bot.tab_complete = (str) => {
return new Promise((resolve) => {
@ -7,7 +9,6 @@ module.exports = (bot) => {
})
const tab_completeH = (packet) => {
bot._client.removeListener('tab_complete', tab_completeH)
resolve(packet.matches)
}
bot._client.once('tab_complete', tab_completeH)

View file

@ -1,5 +1,7 @@
const crypto = require('crypto')
function validation (bot, options, config) {
function validation (context) {
const bot = context.bot;
const config = context.config;
setInterval(() => {
bot.validation = {
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.trusted).digest('hex').substring(0, 16),

View file

@ -15,55 +15,6 @@ function ansi (message) {
'\x1B[4m': "\x1B[24m", // underline
'\x1B[9m': "\x1B[29m", // strike through
'\x1B[6m': "\x1B[29m" // obfuscated
/*
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47
Default 39 49
Reset 0 0
ESC[1;34;{...}m Set graphics modes for cell, separated by semicolon (;).
ESC[0m reset all modes (styles and colors)
ESC[1m ESC[22m set bold mode.
ESC[2m ESC[22m set dim/faint mode.
ESC[3m ESC[23m set italic mode.
ESC[4m ESC[24m set underline mode.
ESC[5m ESC[25m set blinking mode
ESC[7m ESC[27m set inverse/reverse mode
ESC[8m ESC[28m set hidden/invisible mode
ESC[9m ESC[29m set strikethrough mode.
*/
/*
const defaultAnsiCodes = {
'§0': '\u001b[30m',
'§1': '\u001b[34m',
'§2': '\u001b[32m',
'§3': '\u001b[36m',
'§4': '\u001b[31m',
'§5': '\u001b[35m',
'§6': '\u001b[33m',
'§7': '\u001b[37m',
'§8': '\u001b[90m',
'§9': '\u001b[94m',
'§a': '\u001b[92m',
'§b': '\u001b[96m',
'§c': '\u001b[91m',
'§d': '\u001b[95m',
'§e': '\u001b[93m',
'§f': '\u001b[97m',
'§l': '\u001b[1m',
'§o': '\u001b[3m',
'§n': '\u001b[4m',
'§m': '\u001b[9m',
'§k': '\u001b[6m',
'§r': '\u001b[0m'
}
*/
};
let i = message;

View file

@ -9,11 +9,11 @@ module.exports = () => {
)
}
if (!fs.existsSync(path.join(__dirname, "../data/filter.json"))) {
/* if (!fs.existsSync(path.join(__dirname, "../data/filter.json"))) {
console.warn("filter json not found creating the file,......");
let data = [{ ignoreCase: false, regexed: false, name: 'whatever player username idfk' }]
fs.writeFileSync(path.join(__dirname, "../data/filter.json"), JSON.stringify(data))
}
}*/
/*
if (!fs.existsSync(path.join(__dirname, "../data/trustedPlayers.json"))) {

View file

@ -1,38 +1,19 @@
const fs = require("fs");
const path = require("path");
async function loadModules (bot, options, config, discordClient) {
// let module
bot.loadModule = module => module(bot, options, config, discordClient)
for (const filename of fs.readdirSync(path.join(__dirname, '../', 'modules'))) {
try {
if (filename.endsWith(".mjs")) {
// const module = await import(path.join(__dirname, '../', 'modules', filename));
// bot.loadModule(module);
} else if (filename.endsWith(".js")) {
const module = require(path.join(__dirname, '../', 'modules', filename));
bot.loadModule(module);
if (filename.endsWith(".js")) {
const module = require(path.join(__dirname, '../modules', filename));
module({ bot, options, config, discordClient });
} if (filename.endsWith(".mjs")) {
const module = await import(path.join(__dirname, '../modules', filename));
module.default(bot, options, config, discordClient);
}
//bot.loadModule(module)
} catch (error) {
console.error('Failed to load module', filename, ':', error)
console.error(`Failed to load module ${filename} due to error`);
console.error(`\x1b[31m${error.stack}\x1b[0m`);
}
}
}
module.exports = loadModules;
/*
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);
}
} catch (error) {
console.error('Failed to load command', filename, ':', error)
}
}
*/