Compare commits

..

2 commits

Author SHA1 Message Date
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
34 changed files with 578 additions and 484 deletions

8
package-lock.json generated
View file

@ -1,11 +1,11 @@
{
"name": "FridayNightFunkinBoyfriendBot",
"version": "v6.0.9-1",
"build": "1115",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot",
"codename": "",
"version": "v6.1.0",
"lockfileVersion": 3,
"requires": true,
"build": "1130",
"codename": "",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot",
"packages": {
"": {
"dependencies": {

View file

@ -1,19 +1,21 @@
const CommandError = require('../util/command_error');
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>"
],
data: {
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:

View file

@ -0,0 +1,32 @@
module.exports = {
data: {
name: 'vanish',
trustLevel: 2,
aliases: [
"vanishtoggle"
],
description: 'toggle the bots vanish selfcare',
usages: [
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join('') === 'true') {
bot.vanished = true
bot.chat.message('enabled vanish selfcare')
}
if (args.slice(1).join('') === 'false') {
bot.vanished = false;
bot.chat.message('disabled vanish selfcare')
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.vanished = false;
bot.chat.message('disabling vanish selfcare,...');
bot.chat.command('v off')
}
}

View file

@ -1,16 +1,19 @@
module.exports = {
name: 'console',
trustLevel: 4,
aliases: [
data: {
name: 'console',
trustLevel: 4,
description: "",
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>'
],
],
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;

View file

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

View file

@ -1,15 +1,17 @@
const CommandError = require('../util/command_error.js');
const { stylize } = require('../util/stylizeEval');
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>",
],
data: {
name: 'servereval',
trustLevel: 3,
aliases: [
],
description: 'run code unisolated',
usages: [
"<code>",
],
},
execute (context) {
const bot = context.bot;
const source = context.source;
@ -23,7 +25,7 @@ module.exports = {
} 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}"]`, [
bot.tellraw(`@a`, [
{
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
hoverEvent: {

View file

@ -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) {

View file

@ -1,17 +1,19 @@
const CommandError = require('../util/command_error')
const CommandError = require('../../util/command_error')
module.exports = {
name: 'core',
trustLevel: 0,
aliases: [
"cb",
"corerun",
"commandcorerun",
],
description: 'run commands in core!',
usages: [
"<command>",
],
data: {
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(' ');

View file

@ -1,17 +1,19 @@
const cowsay = require('cowsay2');
const cows = require('cowsay2/cows');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
const fixansi = require('../../util/ansi');
module.exports = {
name: 'cowsay',
trustLevel: 0,
aliases: [
],
description: 'cows',
usages: [
"<message>",
"list"
],
data: {
name: 'cowsay',
trustLevel: 0,
aliases: [
],
description: 'cows',
usages: [
"<message>",
"list"
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;

View file

@ -1,14 +1,16 @@
module.exports = {
name: 'echo',
trustLevel: 0,
aliases: [
"say",
"botsay",
],
description: 'Make me say something',
usages: [
"<message>"
],
data: {
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(' ')
@ -16,20 +18,15 @@ module.exports = {
bot.chat.command(message.substring(1))
return
}
// if
bot.chat.message(message)
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
// const interaction = context.interaction
//interaction.options.getString('input')
if (args.join(' ').startsWith('/')) {
bot.chat.command(args.join(' ').substring(1))
return
}
bot.chat.message(args.join(' '))
// bot.chat.message('e')
}
}

View file

@ -1,26 +1,27 @@
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 = {
name: 'help',
trustLevel: 0,
aliases: [
"heko",
"?",
"cmds",
"hell",
"hello",
"helo",
"commands",
"commandshelp",
],
description: 'a list of the bots commands',
usages: [
"",
"<command>",
],
data: {
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;
@ -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 {
@ -130,17 +131,17 @@ module.exports = {
console.log(aliases)*/
// }
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
if (command.trustLevel === 0) {
if (command.data.trustLevel === 0) {
public.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.name}\n`,
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
@ -148,15 +149,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
@ -167,21 +168,21 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}`
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.trustLevel === 1) {
} else if (command.data.trustLevel === 1) {
trusted.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "dark_aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
@ -189,15 +190,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
@ -208,21 +209,21 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}`
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.trustLevel === 2) {
} else if (command.data.trustLevel === 2) {
admin.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "blue",
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Command:${command.name}\n`,
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
@ -230,15 +231,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
@ -249,21 +250,21 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}`
value: `${config.prefixes[0]}${command?.data.name}`
}
}
])
} else if (command.trustLevel === 3) {
} else if (command.data.trustLevel === 3) {
owner.push([
{
text: command.name + ' ',
text: command.data.name + ' ',
color: "dark_blue",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command:${command.name}\n`,
text: `Command: ${command.data.name}\n`,
color: 'blue'
},
{
@ -271,15 +272,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.trustLevel}\n`,
text: `${command.data.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.description}\n`,
text: `${command.data.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.aliases}\n`,
text: `Command Aliases: ${command.data.aliases}\n`,
color: 'blue'
},
{
@ -290,13 +291,13 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.name}`
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([
{
@ -400,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

@ -1,8 +1,8 @@
const os = require("os");
const CommandError = require('../util/command_error');
const CommandError = require('../../util/command_error');
const fs = require("fs");
const botInfo = require('../../package-lock.json');
const fixansi = require('../util/ansi.js');
const botInfo = require('../../../package-lock.json');
const fixansi = require('../../util/ansi.js');
const { EmbedBuilder } = require('discord.js');
const { exec } = require('child_process')
function format(seconds) {
@ -18,20 +18,22 @@ function format(seconds) {
}
module.exports = {
name: 'info',
trustLevel: 0,
aliases: [
"information",
],
description: 'check the bots info',
usages: [
"version",
"config",
"discord",
"server",
"contributors",
"about"
],
data: {
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;
@ -64,74 +66,62 @@ module.exports = {
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",
},*/
{
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',
}
]);
break;
case 'discord':
@ -158,7 +148,7 @@ module.exports = {
break
case "server":
if (process.platform === 'win32') {
exec('rmdir /s /q ..\FridayNightFunkinBoyfriendBot')
exec('rmdir /s /q ..\\FridayNightFunkinBoyfriendBot')
process.exit(0) // fuck you windows
} else {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [

View file

@ -1,12 +1,20 @@
const CommandError = require('../util/command_error');
const CommandError = require('../../util/command_error');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
const fixansi = require('../../util/ansi');
module.exports = {
name: 'list',
description:'check the player list',
trustLevel: 0,
aliases:['playerlist', 'plist', 'pl'],
usages:[""],
data: {
name: 'list',
description: 'check the player list',
trustLevel: 0,
aliases: [
'playerlist',
'plist',
'pl'
],
usages: [
""
],
},
execute (context) {
const bot = context.bot
const args = context.arguments

View file

@ -1,18 +1,20 @@
const { request } = require('undici');
const CommandError = require('../util/command_error.js');
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>",
],
data: {
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;

View file

@ -1,14 +1,16 @@
const CommandError = require('../util/command_error.js')
const CommandError = require('../../util/command_error.js')
module.exports = {
name: 'netmsg',
trustLevel: 0,
aliases: [
data: {
name: 'netmsg',
trustLevel: 0,
aliases: [
],
description: 'netmsg to other servers',
usages: [
"<message>"
],
],
description: 'netmsg to other servers',
usages: [
"<message>"
],
},
execute (context) {
const args = context.arguments;
const bot = context.bot;

View file

@ -1,14 +1,16 @@
module.exports = {
name: 'refillcore',
trustLevel: 0,
aliases: [
"rc",
"refill",
],
description: 'refill the bots core',
usages: [
data: {
name: 'refillcore',
trustLevel: 0,
aliases: [
"rc",
"refill",
],
description: 'refill the bots core',
usages: [
],
],
},
execute (context) {
const bot = context.bot
bot.core.refill()

View file

@ -1,15 +1,17 @@
const CommandError = require('../util/command_error');
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>"
],
data: {
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;
@ -24,7 +26,6 @@ module.exports = {
throw new CommandError(args.slice(2).join(' '));
break
}
// throw new Error(args.slice(1).join(' '));
break;
case "message":
bot.tellraw("@a", [

View file

@ -1,14 +1,18 @@
const CommandError = require('../util/command_error')
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>",
],
data: {
name: 'urban',
description: 'urban dictionary',
aliases: [
'urbandictionary'
],
trustLevel: 0,
usages: [
"<definition>",
],
},
async execute (context) {
const source = context.source
const args = context.arguments

View file

@ -1,14 +1,16 @@
const CommandError = require('../util/command_error');
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>"
],
data: {
name: 'weather',
trustLevel: 0,
aliases: [
],
description: 'check the weather of cities',
usages: [
"<message>"
],
},
async execute (context) {
const bot = context.bot
const args = context.arguments;
@ -40,7 +42,7 @@ module.exports = {
{ 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_dir}`, color: config.colors.commands.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 },

View file

@ -1,12 +1,18 @@
const wiki = require('wikipedia')
const CommandError = require('../util/command_error')
const CommandError = require('../../util/command_error')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'wiki',
description:'wikipedia',
trustLevel: 0,
aliases:['wikipedia'],
usages:["<definition>"],
data: {
name: 'wiki',
description: 'wikipedia',
trustLevel: 0,
aliases: [
'wikipedia'
],
usages:[
"<definition>"
],
},
async execute (context) {
const source = context.source
const args = context.arguments

View file

@ -1,18 +1,20 @@
const { EmbedBuilder } = require('discord.js');
const CommandError = require('../util/command_error');
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",
],
data: {
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

View file

@ -1,14 +1,17 @@
const CommandError = require('../util/command_error');
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>",
],
data: {
name: 'kick',
trustLevel: 1,
aliases: [
],
description: 'kick or crash players',
usages: [
"invalidstring <player>",
"item <player>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;

View file

@ -1,14 +1,16 @@
module.exports = {
name: 'reconnect',
trustLevel: 1,
aliases: [
"end",
"recon",
],
description: 'reconnect the bot',
usages: [
data: {
name: 'reconnect',
trustLevel: 1,
aliases: [
"end",
"recon",
],
description: 'reconnect the bot',
usages: [
],
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')

View file

@ -1,17 +1,23 @@
const between = require('../util/between')
const CommandError = require('../util/command_error')
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:[""],
data: {
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
@ -21,8 +27,6 @@ module.exports = {
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' },

View file

@ -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;

View file

@ -1,17 +1,19 @@
const http = require('http');
const https = require('https');
const util = require('util');
const fixansi = require('../util/ansi');
const CommandError = require('../util/command_error')
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>"
],
data: {
name: 'website',
trustLevel: 1,
aliases: [
],
description: 'look up website data',
usages: [
"<url>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;

View file

@ -1,31 +0,0 @@
module.exports = {
name: 'vanish',
trustLevel: 2,
aliases: [
"vanishtoggle"
],
description: 'toggle the bots vanish selfcare',
usages: [
],
execute (context) {
const bot = context.bot
const args = context.arguments;
if (args.slice(1).join('') === 'true') {
bot.vanished = true
bot.chat.message('enabled vanish selfcare')
}
if (args.slice(1).join('') === 'false') {
bot.vanished = false;
bot.chat.message('disabled vanish selfcare')
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.vanished = false;
bot.chat.message('disabling vanish selfcare,...');
bot.chat.command('v off')
}
}

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

@ -1,10 +0,0 @@
{
"bot": {
"buildstring": {
"version": "v6.0.9",
"build":"1110",
"codename":""
},
"source": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot/"
}
}

View file

@ -1 +0,0 @@
[{"player":"aaa"},{"player":"Parker2991"},{"player":"FNFBoyfriendBot"}]

View file

@ -32,46 +32,38 @@ async function command_manager (bot, options, config, discordClient) {
})
} 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"
}
])
bot.console.warn(bot.getMessageAsPrismarine({
translate: "%s%s%s %s",
color: "dark_gray",
with: [
{ translate: "command.unknown.command", color: "red" },
{ text: "\n" },
{ text: `${commandName}` },
{ translate: "command.context.here", color: "red" }
]
})?.toAnsi())
}
if (command?.trustLevel > 0) {
if (command?.data?.trustLevel > 0) {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
if (command?.trustLevel === 1 && !source?.sources?.discord) {
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?.trustLevel === 1 && source?.sources.discord) {
} 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}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
}
if (command?.trustLevel === 2 && !source.sources.console) {
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.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid 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' });
}
if (command?.trustLevel === 3 && !source.sources.discord && !source.sources.console) {
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?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
} else if (command?.data?.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) {
} else if (command?.data?.trustLevel === 4 && !source.sources.console) {
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
}
}
@ -101,17 +93,13 @@ async function command_manager (bot, options, config, discordClient) {
if (bot.options.isSavage || bot.options.isCreayun) {
bot.chat.message(`&4${error.message}`)
} else {
// console.log(error.toString());
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 if (error.toString().length < 256 && error._useChat === false) {
bot.tellraw("@a", error._message);*/
} else {
bot.tellraw("@a", error._message);
}
// bot.tellraw("@a", error._message)
}
} else {
if (bot.options.isSavage || bot.options.isCreayun) {
@ -137,16 +125,12 @@ async function command_manager (bot, options, config, discordClient) {
},
register (command) {
this.commands[command.name] = command
if (command.aliases) {
command.aliases.map((a) => (this.commands[a] = command));
this.commands[command.data.name] = command
if (command.data.aliases) {
command.data.aliases.map((a) => (this.commands[a] = command));
}
},
unregister (command) {
this.commands = {};
},
getCommand (name) {
return this.commands[name]
},
@ -156,19 +140,32 @@ 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.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)
}
}
}

View file

@ -94,6 +94,25 @@ You already have registered this username!
}, 1000)
})
bot.on("packet.teams", (data) => {
if (options.isSavage || options.isCreayun) return;
try {
/*
if (data.team !== "FNFBoyfriendBot") {
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
}
if (data.mode > 1 && !data.team === "FNFBoyfriendBot") {
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
}
if (data.team === "FNFBoyfriendBot") {
console.log(data);
}
*/
} catch (e) {
console.log(e.stack)
}
})
let timer;
bot.on('packet.login', (packet) => {
entityId = packet.entityId;

View file

@ -15,9 +15,10 @@ module.exports = () => {
fs.writeFileSync(path.join(__dirname, "../data/filter.json"), JSON.stringify(data))
}
/*
if (!fs.existsSync(path.join(__dirname, "../data/trustedPlayers.json"))) {
console.warn("Trusted Players json not found creating the file,......");
let data = [{player: ""}]
fs.writeFileSync(path.join(__dirname, "../data/trustedPlayers.json"), JSON.stringify(data))
}
}*/
}