Compare commits

..

No commits in common. "ab87e748f9d26ac77cbaf6de6fbdbed8355c4ec5" and "ac2f59d14ddea69165143c06ec7c4b2afc276f10" have entirely different histories.

34 changed files with 484 additions and 578 deletions

8
package-lock.json generated
View file

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

View file

@ -1,32 +0,0 @@
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,17 +1,11 @@
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 = {
data: {
name: "bots",
description: "shows a list of known bots",
aliases: [
"knownbots"
],
aliases: ["knownbots"],
trustLevel: 0,
usages: [
""
],
},
usages:[""],
async execute(context) {
const query = context.arguments.join(" ").toLowerCase();
const bot = context.bot;

View file

@ -1,7 +1,6 @@
const { EmbedBuilder } = require('discord.js');
const CommandError = require('../../util/command_error');
const CommandError = require('../util/command_error');
module.exports = {
data: {
name: 'cloop',
trustLevel: 1,
aliases: [
@ -14,7 +13,6 @@ module.exports = {
"clear",
"list",
],
},
execute (context) {
const args = context.arguments
const bot = context.bot

View file

@ -1,8 +1,6 @@
module.exports = {
data: {
name: 'console',
trustLevel: 4,
description: "",
aliases: [
],
@ -13,7 +11,6 @@ module.exports = {
'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,7 +1,6 @@
const CommandError = require('../../util/command_error')
const CommandError = require('../util/command_error')
module.exports = {
data: {
name: 'core',
trustLevel: 0,
aliases: [
@ -13,7 +12,6 @@ module.exports = {
usages: [
"<command>",
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ');

View file

@ -1,9 +1,8 @@
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 = {
data: {
name: 'cowsay',
trustLevel: 0,
aliases: [
@ -13,7 +12,6 @@ module.exports = {
"<message>",
"list"
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;

View file

@ -1,5 +1,4 @@
module.exports = {
data: {
name: 'echo',
trustLevel: 0,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
"<message>"
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')
@ -18,15 +16,20 @@ 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,6 +1,5 @@
const CommandError = require('../../util/command_error');
const CommandError = require('../util/command_error');
module.exports = {
data: {
name: 'filter',
trustLevel: 2,
aliases: [
@ -15,7 +14,6 @@ module.exports = {
"clear",
"remove(rm) <index>"
],
},
execute (context) {
/*
note:

View file

@ -1,9 +1,8 @@
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: [
@ -15,13 +14,13 @@ module.exports = {
"helo",
"commands",
"commandshelp",
],
description: 'a list of the bots commands',
usages: [
"",
"<command>",
],
},
execute (context) {
const commandList = [];
const bot = context.bot;
@ -48,41 +47,41 @@ module.exports = {
for (const command of bot.commandManager.commandlist) {
let usagesComponent = [];
let commandComponent = [];
for (const usages of command.data.usages) {
if (command?.data?.trustLevel === 1) {
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.data.name} <trusted/admin/owner hashes>`, color: "blue" },
{ text: `${command.name} <trusted/admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 2) {
} else if (command?.trustLevel === 2) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
{ text: `${command.name} <admin/owner hashes>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 3) {
} else if (command?.trustLevel === 3) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name} <owner hash>`, color: "blue" },
{ text: `${command.name} <owner hash>`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
]
})
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
} else if (command?.trustLevel === 0 || command.trustLevel === 4) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
{ text: `${command.data.name}`, color: "blue" },
{ text: `${usages}`, color: "aqua" },
{ text: `${command.name}`, color: "blue" },
{ text: `${usages.toString().replaceAll(',','')}`, color: "aqua" },
]
})
}
@ -95,16 +94,16 @@ module.exports = {
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.name}`, color: "blue" },
{ text: `${command.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: `${command.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.description}`, color: "blue" },
{ text: `${command.description}`, color: "blue" },
{ text: "Trust Level", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.trustLevel}`, color: "gold" },
{ text: `${command.trustLevel}`, color: "gold" },
{ text: "Usages", color: "dark_blue" },
{ text: "\u203a" }
]
@ -112,7 +111,7 @@ module.exports = {
commandComponent.push("\n");
commandComponent.push(usagesComponent);
// for (const aliases of command.aliases) {
if (args[0]?.toLowerCase() === command.data.name) {
if (args[0]?.toLowerCase() === command.name) {
if (bot.options.isSavage) {
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
} else {
@ -131,17 +130,17 @@ module.exports = {
console.log(aliases)*/
// }
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
if (command.data.trustLevel === 0) {
if (command.trustLevel === 0) {
public.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
text: `Command: ${command.name}\n`,
color: 'blue'
},
{
@ -149,15 +148,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
text: `${command.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
text: `Command Aliases: ${command.aliases}\n`,
color: 'blue'
},
{
@ -168,21 +167,21 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
value: `${config.prefixes[0]}${command?.name}`
}
}
])
} else if (command.data.trustLevel === 1) {
} else if (command.trustLevel === 1) {
trusted.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "dark_aqua",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
text: `Command:${command.name}\n`,
color: 'blue'
},
{
@ -190,15 +189,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
text: `${command.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
text: `Command Aliases: ${command.aliases}\n`,
color: 'blue'
},
{
@ -209,21 +208,21 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
value: `${config.prefixes[0]}${command?.name}`
}
}
])
} else if (command.data.trustLevel === 2) {
} else if (command.trustLevel === 2) {
admin.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "blue",
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
text: `Command:${command.name}\n`,
color: 'blue'
},
{
@ -231,15 +230,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
text: `${command.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
text: `Command Aliases: ${command.aliases}\n`,
color: 'blue'
},
{
@ -250,21 +249,21 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
value: `${config.prefixes[0]}${command?.name}`
}
}
])
} else if (command.data.trustLevel === 3) {
} else if (command.trustLevel === 3) {
owner.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "dark_blue",
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: `Command: ${command.data.name}\n`,
text: `Command:${command.name}\n`,
color: 'blue'
},
{
@ -272,15 +271,15 @@ module.exports = {
color: 'blue'
},
{
text: `${command.data.trustLevel}\n`,
text: `${command.trustLevel}\n`,
color: 'gold'
},
{
text: `${command.data.description}\n`,
text: `${command.description}\n`,
color: 'blue'
},
{
text: `Command Aliases: ${command.data.aliases}\n`,
text: `Command Aliases: ${command.aliases}\n`,
color: 'blue'
},
{
@ -291,13 +290,13 @@ module.exports = {
},
clickEvent: {
action: 'suggest_command',
value: `${config.prefixes[0]}${command?.data.name}`
value: `${config.prefixes[0]}${command?.name}`
}
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
const length = bot.commandManager.commandlist.filter(c => c.trustLevel != 4).length
if (bot.options.useChat) {
bot.chat.message(bot.getMessageAsPrismarine([
{
@ -401,52 +400,52 @@ module.exports = {
let admin = [];
let owner = [];
for (const command of bot.commandManager.commandlist) {
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```')
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.data.name} Command`)
.setTitle(`${this.name} Command`)
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
bot.discord.message.reply({ embeds: [Embed] })
return
}
if (command?.data.trustLevel === 0 && command.discordExecute) {
if (command?.trustLevel === 0 && command.discordExecute) {
public.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "aqua",
}
])
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
} else if (command?.trustLevel === 1 && command.discordExecute) {
trusted.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "dark_aqua"
}
])
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
} else if (command?.trustLevel === 2 && command.discordExecute) {
admin.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: 'blue'
}
])
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
} else if (command?.trustLevel === 3 && command.discordExecute) {
owner.push([
{
text: command.data.name + ' ',
text: command.name + ' ',
color: "dark_blue",
}
])
}
}
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
const length = bot.commandManager.commandlist.filter(c => c.trustLevel !== 3 && 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.data.name} Command`)
.setTitle(`${this.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,7 +18,6 @@ function format(seconds) {
}
module.exports = {
data: {
name: 'info',
trustLevel: 0,
aliases: [
@ -33,7 +32,6 @@ module.exports = {
"contributors",
"about"
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
@ -122,6 +120,18 @@ module.exports = {
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':
@ -148,7 +158,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,7 +1,6 @@
const CommandError = require('../../util/command_error');
const CommandError = require('../util/command_error');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'kick',
trustLevel: 1,
aliases: [
@ -9,9 +8,7 @@ module.exports = {
description: 'kick or crash players',
usages: [
"invalidstring <player>",
"item <player>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;

View file

@ -1,5 +1,4 @@
module.exports = {
data: {
name: 'kill',
trustLevel: 3,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
""
],
},
execute (context) {
const bot = context.bot;
process.kill(process.pid);

View file

@ -1,20 +1,12 @@
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 = {
data: {
name: 'list',
description: 'check the player list',
description:'check the player list',
trustLevel: 0,
aliases: [
'playerlist',
'plist',
'pl'
],
usages: [
""
],
},
aliases:['playerlist', 'plist', 'pl'],
usages:[""],
execute (context) {
const bot = context.bot
const args = context.arguments

View file

@ -1,9 +1,8 @@
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 = {
data: {
name: 'mcserver',
trustLevel: 0,
aliases: [
@ -14,7 +13,6 @@ module.exports = {
usages: [
"<minecraft server ip>",
],
},
async execute (context) {
const bot = context.bot;
const discordClient = context.discordClient;

View file

@ -1,6 +1,5 @@
const CommandError = require('../../util/command_error.js')
const CommandError = require('../util/command_error.js')
module.exports = {
data: {
name: 'netmsg',
trustLevel: 0,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
"<message>"
],
},
execute (context) {
const args = context.arguments;
const bot = context.bot;

View file

@ -1,5 +1,4 @@
module.exports = {
data: {
name: 'reconnect',
trustLevel: 1,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
],
},
execute (context) {
const bot = context.bot
const message = context.arguments.join(' ')

View file

@ -1,5 +1,4 @@
module.exports = {
data: {
name: 'refillcore',
trustLevel: 0,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
],
},
execute (context) {
const bot = context.bot
bot.core.refill()

View file

@ -1,23 +1,17 @@
const between = require('../../util/between')
const CommandError = require('../../util/command_error')
const between = require('../util/between')
const CommandError = require('../util/command_error')
module.exports = {
data: {
name: 'tpr',
description: 'teleport to a random place',
description:'teleport to a random place',
trustLevel: 1,
aliases: [
'rtp',
'teleportrandom',
'randomteleport'
],
usages: [
""
],
},
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
@ -27,6 +21,8 @@ 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,8 +1,7 @@
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 = {
data: {
name: 'servereval',
trustLevel: 3,
aliases: [
@ -11,7 +10,6 @@ module.exports = {
usages: [
"<code>",
],
},
execute (context) {
const bot = context.bot;
const source = context.source;
@ -25,7 +23,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`, [
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
{
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
hoverEvent: {

View file

@ -1,6 +1,5 @@
const CommandError = require('../../util/command_error');
const CommandError = require('../util/command_error');
module.exports = {
data: {
name: 'test',
trustLevel: 0,
aliases: [
@ -11,7 +10,6 @@ module.exports = {
"error message <message>",
"message <message>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;
@ -26,6 +24,7 @@ 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,18 +1,14 @@
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 = {
data: {
name: 'urban',
description: 'urban dictionary',
aliases: [
'urbandictionary'
],
description:'urban dictionary',
aliases:['urbandictionary'],
trustLevel: 0,
usages: [
"<definition>",
],
},
async execute (context) {
const source = context.source
const args = context.arguments

View file

@ -1,6 +1,5 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: {
name: 'validate',
trustLevel: 1,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
""
],
},
execute (context) {
const bot = context.bot;
const args = context.arguments;

31
src/commands/vanish.js Normal file
View file

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

@ -1,7 +1,6 @@
const CommandError = require('../../util/command_error');
const CommandError = require('../util/command_error');
const { request } = require('undici');
module.exports = {
data: {
name: 'weather',
trustLevel: 0,
aliases: [
@ -10,7 +9,6 @@ module.exports = {
usages: [
"<message>"
],
},
async execute (context) {
const bot = context.bot
const args = context.arguments;
@ -42,7 +40,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.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 },

View file

@ -1,10 +1,9 @@
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 = {
data: {
name: 'website',
trustLevel: 1,
aliases: [
@ -13,7 +12,6 @@ module.exports = {
usages: [
"<url>"
],
},
execute (context) {
const bot = context.bot
const args = context.arguments;

View file

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

View file

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

View file

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

10
src/data/info.json Normal file
View file

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

View file

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

View file

@ -32,38 +32,46 @@ async function command_manager (bot, options, config, discordClient) {
})
} else if (source?.sources?.console && !source?.sources?.discord) {
if (!command || !command.execute)
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())
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?.data?.trustLevel > 0) {
])
}
if (command?.trustLevel > 0) {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
if (command?.data?.trustLevel === 1 && !source?.sources?.discord) {
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?.data?.trustLevel === 1 && source?.sources.discord) {
} 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?.data?.trustLevel === 2 && !source.sources.console) {
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.admin && 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.trusted && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or owner hash', color: 'dark_red' });
}
if (command?.data?.trustLevel === 3 && !source.sources.discord && !source.sources.console) {
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?.data?.trustLevel === 3 && source.sources.discord && !source.sources.console) {
} 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?.data?.trustLevel === 4 && !source.sources.console) {
} else if (command?.trustLevel === 4 && !source.sources.console) {
throw new CommandError({ text: 'This command can only be ran via console', color: "dark_red" });
}
}
@ -93,13 +101,17 @@ 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) {
@ -125,12 +137,16 @@ async function command_manager (bot, options, config, discordClient) {
},
register (command) {
this.commands[command.data.name] = command
if (command.data.aliases) {
command.data.aliases.map((a) => (this.commands[a] = command));
this.commands[command.name] = command
if (command.aliases) {
command.aliases.map((a) => (this.commands[a] = command));
}
},
unregister (command) {
this.commands = {};
},
getCommand (name) {
return this.commands[name]
},
@ -140,32 +156,19 @@ 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 = [];
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) {
for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
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);
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);
}
} catch (error) {
console.error('Failed to load command ', filename, ':', error);
}
console.error('Failed to load command ', filename, ':', error)
}
}
}

View file

@ -94,25 +94,6 @@ 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,10 +15,9 @@ 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))
}*/
}
}