v7.0.0-alpha, build: 2010

This commit is contained in:
Parker2991
2025-01-24 10:00:06 -05:00
parent 124778fd4b
commit ffbe6f72a8
23 changed files with 690 additions and 2168 deletions
+3 -7
View File
@@ -2,10 +2,6 @@ node_modules
config.yml
.git
src/modules/exploits.js
logs/*
src/data/filter.json
data/filter.json
prototyping-crap
src/data/trustedPlayers.js
data/trustedPlayers.js
src/modules/custom_chat.js
logs
src/modules/custom_chat.js
src/util/core_util.js
+320 -2032
View File
File diff suppressed because it is too large Load Diff
+6 -19
View File
@@ -1,25 +1,12 @@
{
"dependencies": {
"color-convert": "^2.0.1",
"cowsay": "^1.6.0",
"cowsay2": "^2.0.4",
"discord.js": "^14.16.3",
"java-parser": "^2.3.2",
"discord.js": "^14.17.3",
"js-yaml": "^4.1.0",
"json-stringify": "^1.0.0",
"json5": "^2.2.3",
"jvm": "^0.5.3",
"man-db": "^1.0.3",
"minecraft-data": "^3.69.0",
"minecraft-protocol": "^1.47.0",
"mojangson": "^2.0.4",
"node-gyp": "^10.2.0",
"prismarine-auth": "^2.2.0",
"minecraft-data": "^3.83.1",
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
"prismarine-registry": "^1.7.0",
"proxy-agent": "^6.4.0",
"socks": "^2.8.3",
"wikipedia": "^2.1.2",
"xml2js": "^0.6.2"
"prismarine-registry": "^1.11.0",
"undici": "^7.3.0",
"wikipedia": "^2.1.2"
}
}
+18
View File
@@ -0,0 +1,18 @@
module.exports = {
data: {
name: "reconnect",
aliases: [
"end"
],
description: "reconnects the bot",
usages: [
],
trustLevel: 2,
},
execute (context) {
const bot = context.bot;
bot._client.end();
bot.chat.message('reconnecting')
},
}
+23
View File
@@ -0,0 +1,23 @@
module.exports = {
data: {
name: "core",
aliases: [
"cb",
"cbrun",
"corerun"
],
trustLevel: 0
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.core.run(args.join(' '));
}
}
+47 -27
View File
@@ -104,39 +104,59 @@ module.exports = {
}
}
/*
commandComponent.push({
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
color: "dark_gray",
with: [
{ text: "Command Name", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.name}`, color: "blue" },
{ text: "Aliases", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
{ text: "Description", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.description}`, color: "blue" },
{ text: "Trust Level", color: "dark_blue" },
{ text: "\u203a" },
{ text: `${command.data.trustLevel}`, color: "gold" },
{ text: "Usages", color: "dark_blue" },
{ text: "\u203a" }
]
})
*/
// component.push(`${public}\n${console}`);
component.push(public);
// component.push('\n');
component.push(trusted);
// component.push('\n');
component.push(admin);
// component.push('\n');
component.push(owner);
// component.push('\n');
component.push(Console);
bot.tellraw("@a", component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const EmbedBuilder = context.EmbedBuilder
const fixansi = context.fixansi;
const args = context.arguments;
let public = [];
let trusted = [];
let admin = [];
let owner = [];
let Console = [];
for (const commands of bot.commandManager.commandlist) {
switch (commands.data.trustLevel) {
case 0:
public.push(commands.data.name);
break;
case 1:
trusted.push(commands.data.name);
break;
case 2:
admin.push(commands.data.name);
break;
case 3:
owner.push(commands.data.name);
break;
case 4:
Console.push(commands.data.name);
break;
}
}
let commandsEmbed = new EmbedBuilder()
.setColor(config.colors.discord.embed)
.setTitle(`${this.data.name} Command`)
.setDescription(`Commands (${bot.commandManager.commandlist.length})`)
.addFields(
{ name: "Public", value: public.toString().replaceAll(',',' '), inline: false },
{ name: "Trusted", value: trusted.toString().replaceAll(',',' '), inline: false },
{ name: "Admin", value: admin.toString().replaceAll(',',' '), inline: false },
{ name: "Owner", value: owner.toString().replaceAll(',',' '), inline: false },
{ name: "Console", value: Console.toString().replaceAll(',',' '), inline: false },
);
bot.discord.message.reply({ embeds: [ commandsEmbed ] });
}
}
+14 -1
View File
@@ -30,6 +30,7 @@ module.exports = {
"config <client, discord, options, all>",
"contributors/credits",
"discord",
"loaded",
"usages <bot, server, all>",
"uptimes/uptime <bot, server, all>",
"server",
@@ -191,6 +192,18 @@ module.exports = {
}
})
break;
case "loaded":
component.push({
translate: "%s %s\n%s %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
{ text: "Commands", color: config.colors.commands.primary },
{ text: `${bot.modules.length}`, color: config.colors.integer },
{ text: "Modules", color: config.colors.commands.primary }
]
});
break;
case "usages":
case "usage":
switch (args.slice(1).join(' ')?.toLowerCase()) {
@@ -289,7 +302,7 @@ module.exports = {
{ text: "User", color: config.colors.commands.primary },
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
{ text: "Working Directory", color: config.colors.commands.primary },
{ text: `${process.mainModule.path}`, color: config.colors.commands.secondary },
{ text: `${require.main.path}`, color: config.colors.commands.secondary },
{ text: "Arch", color: config.colors.commands.primary },
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
{ text: "OS", color: config.colors.commands.primary },
+53
View File
@@ -0,0 +1,53 @@
module.exports = {
data: {
name: "netmsg",
aliases: [
"networkmessage",
"netmessage"
],
description: "send a message to other servers",
trustLevel: 0,
usages: [
"message"
]
},
execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
const source = context.source;
let component = [];
if (bot.options.private === true) {
component.push({
translate: "[%s] %s \u203a %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
source.player.displayName ?? source.player.profile.name,
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
]
})
} else {
component.push({
translate: "[%s:%s] %s \u203a %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
{ text: `${bot.options.port}`, color: config.colors.commands.primary },
source.player.displayName ?? source.player.profile.name,
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
]
})
}
for (const eachBot of bot.bots) {
if (eachBot.options.isSavage === true || eachBot.options.isCreayun === true) {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
} else {
eachBot.tellraw("@a", component)
}
}
}
}
+46
View File
@@ -0,0 +1,46 @@
const mc = require('minecraft-protocol');
const util = require('util');
module.exports = {
data: {
name: "mcserver",
aliases: [
"pingserver"
],
description: "pings minecraft servers",
trustLevel: 0,
usages: [
"<ip>"
]
},
async execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
const [host, port] = args[0].split(':');
const server = await mc.ping({ host, port: Number(port ?? 25565) });
let component = [];
try {
component.push({
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "ip", color: config.colors.commands.primary },
{ text: `${host}`, color: config.colors.commands.secondary },
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
{ text: "players", color: config.colors.commands.primary },
{ text: `${server.players.online}`, color: config.colors.integer },
{ text: `${server.players.max}`, color: config.colors.integer },
{ text: "server version", color: config.colors.commands.primary },
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
server.description
]
});
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(`${e.toString()}`);
}
}
}
+19
View File
@@ -0,0 +1,19 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
module.exports = {
data: {
name: "urban",
aliases: [
"urbandictionary"
],
description: "look up definitions on urban dictionary",
trustLevel: 0,
usages: [
"<definition>"
]
},
async execute (context) {
}
}
+78
View File
@@ -0,0 +1,78 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
module.exports = {
data: {
name: "weather",
aliases: [
],
description: "check the weather in locations",
trustLevel: 0,
usages: [
"<weather/zip code>"
]
},
async execute (context) {
const bot = context.bot;
const config = context.config;
const args = context.arguments;
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
component.push({
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{
translate: "%s: %s, %s %s",
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
]
},
{ text: "Coords", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{
translate: "%s: %s (%s), %s (%s)",
with: [
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary }
]
},
{
translate: "%s: %s (%s, %s), %s (%s, %s)",
with: [
{ text: "Wind Speed", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.wind_kph)}`, color: config.colors.integer },
{ text: "kph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.wind_mph)}`, color: config.colors.integer },
{ text: "mph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary }
]
},
{ text: "Condition", color: config.colors.commands.primary },
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
{ text: "Humidity", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
]
});
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(e.toString());
}
}
}
+16
View File
@@ -0,0 +1,16 @@
module.exports = {
data: {
name: "wiki",
aliases: [
"wikipedia"
],
description: "look up articles on wikipedia",
usages: [
"<article>"
],
trustLevel: 0
},
async execute (context) {
}
}
+4 -1
View File
@@ -6,6 +6,9 @@ discord:
prefix: "!"
invite: "discord invite here"
enabled: false
presence:
name: "amogus"
status: "dnd"
roles:
trusted: "trusted"
admin: "admin"
@@ -83,7 +86,7 @@ console:
logsFolder:
path: "../../"
# this is being loaded from the log folder so make sure it starts with ../../
# this is being loaded from the modules so make sure it starts with ../../
name: "logs"
bots:
-28
View File
@@ -1,28 +0,0 @@
function inject (context) {
const bot = context.bot;
const config = context.config;
const options = context.options;
bot.customChat = {
enabled: true,
chat (message) {
const prefix = {
translate: "chat.type.text",
with: [
{ selector: `${bot.username}` },
{ text: "", extra: [ message ] }
]
};
bot.tellraw("@a", prefix)
}
}
}
module.exports = {
data: {
enabled: true,
name: "custom chat",
type: "extras"
},
inject
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"buildstring": {
"build": "2000",
"build": "2010",
"codename": "§aGame §aTheory",
"version": "v7.0.0-alpha"
}
-7
View File
@@ -10,13 +10,6 @@ const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageConte
console.log('Starting FNFBoyfriendBot');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
if (fs.existsSync(path.join(__dirname, "./modules/custom_chat.js")) === false) {
console.warn("Custom chat not found creating it from default custom chat");
fs.copyFileSync(
path.join(__dirname, './data/default_custom_chat.js'),
path.join(__dirname, './modules/custom_chat.js')
)
}
if (fs.existsSync(path.join(__dirname, "../config.yml")) === false) {
console.warn("Config not found creating config from the default config");
+1 -1
View File
@@ -4,7 +4,7 @@ function inject (context) {
const options = context.options;
const info = require('../data/info.json');
bot.on("packet.login", (data) => {
if (bot.options.isCreayun) return
if (bot.options.isCreayun === true) return
if (new Date().getDay() === 5) {
bot.chat.message('Gettin\' freaky on a friday night!');
} else {
+1 -8
View File
@@ -175,14 +175,7 @@ function inject (context) {
},
}
if (bot.options.isSavage || bot.options.isCreayun) return
bot.on('move', () => {
bot.core.move(bot.position)
})
bot.on('packet.block_change', (data) => {
})
require('../util/core_util')(bot, config, options);
}
module.exports = {
data: {
+2 -14
View File
@@ -3,7 +3,7 @@ const path = require('path');
const CommandError = require('../util/command_error.js');
const CommandSource = require('../util/command_source');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
async function inject (context) {
const bot = context.bot;
const config = context.config;
@@ -67,18 +67,6 @@ async function inject (context) {
})?.toAnsi())
};
/* if (args[0]?.split(' ').length === 0 && command?.data?.args?.max !== 0 && command?.data?.args?.max !== Infinity) {
throw new CommandError('recieved 0 arguments');
}
if (args[0]?.split(' ').length > 0 && command?.data?.args?.max === 0 && command?.data?.args?.max !== Infinity) {
throw new CommandError('recieved over 0 arguments');
}
if (args[0]?.split(' ').length > command?.data?.args?.max && command?.data?.args?.max !== Infinity) {
throw new CommandError(`recieved over ${command.data.args.max} arguments`);
}*/
require('../util/command_manager_util')(bot, command, args, source);
// require('../util/command_manager_arguments')(bot, args, command);
@@ -86,7 +74,7 @@ async function inject (context) {
if (!command?.discordExecute && command && source?.sources?.discord) {
throw new CommandError(`${command.data.name} command is not supported in discord!`)
} else if (command?.discordExecute && command && source?.sources?.discord) {
return command.discordExecute({ bot, source, arguments: args, config, discordClient })
return command.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi })
} else if (!command?.execute && command && !source?.sources?.discord) {
throw new CommandError(`${command.data.name} command is not supported in game!`)
} else if (command?.execute && command && !source?.sources?.discord) {
+1
View File
@@ -49,6 +49,7 @@ function inject (context) {
bot.on('message', (message) => {
if (!options.logging) return;
//if (bot.getMessageAsPrismarine(message)?.toString().includes("https://www.innersloth.com/games/among-us/ › amogus")) return;
// if (ratelimit > 10) 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()}`);
+35 -20
View File
@@ -1,10 +1,6 @@
// TODO: Maybe move client creation elsepwhere
//const { Client, GatewayIntentBits, interaction } = require('discord.js')
//const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
const fixansi = require('../util/ansi');
const CommandSource = require('../util/command_source')
const CommandSource = require('../util/command_source');
//const client = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
const util = require('util')
function inject (context) {
const bot = context.bot;
@@ -27,10 +23,10 @@ function inject (context) {
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
discordClient.user.setPresence({
activities: [{
name: `your mother`,
name: `${config.discord.presence.name}`,
type: 0
}],
status: `dnd`
status: `${config.discord.presence.status}`
});
})
@@ -79,15 +75,15 @@ function inject (context) {
console: false
}, false, message)
bot.sendFeedback = message => {
// bot.sendFeedback = message => {
sendComponent(message)
}
// }
bot.commandManager.executeString(source, message.content.substring(config.discord.prefix.length))
return
}
const tag = {
translate: '[%s] %s \u203a %s',
translate: '[%s] %s \u203a ',
with: [{
translate: '%s%s%s %s',
bold: false,
@@ -109,7 +105,7 @@ function inject (context) {
{
text: 'Discord',
bold: false,
color: 'dark_blue'
color: 'blue'
}
],
clickEvent: bot.discord.invite ? {
@@ -124,30 +120,49 @@ function inject (context) {
{
text: `${message.member.nickname || message.author.displayName}`,
},
message.content
]
}
try {
if (message.attachments.size > 0) {
message.attachments.forEach(Attachment => {
bot.tellraw('@a', [tag, {
text: ' ' ? ' [Attachment] ' : ' [Attachment] ',
let attachment = {
text: `[Attachment: ${Attachment.name}] ${message?.content}`,
color: "blue",
hoverEvent: {
action: 'show_text',
contents: 'Click here to view attachment'
action: "show_text",
contents: "click here to view attachment"
},
clickEvent: {
action: 'open_url',
value: `${Attachment.url}`
action: "open_url",
value: `${Attachment?.url}`
}
}])
}
bot.tellraw("@a", [tag, attachment]);
})
} else if (message?.reference?.type === 0) {
// this is for messages that are replied to
const repliedMessage = message.channel.messages.cache.get(message.reference.messageId);
let reply = [
tag,
{ text: `[Replying to: ${repliedMessage.author.username}] `, color: "blue" },
message.content
];
bot.tellraw("@a", [ reply ]);
} else if (message?.reference?.type === 1) {
// this is for messages that are forwarded
} else {
if (options.useChat || options.isSavage || options.isCreayun) {
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw('@a', tag);
bot.tellraw('@a', [tag, message.content]);
}
}
} catch (e) {
console.log(e.stack);
}
}
discordClient.on('messageCreate', messageCreate)
+1 -1
View File
@@ -53,7 +53,7 @@ function inject (context) {
module.exports = {
data: {
enabled: false,
enabled: true,
name: "teams",
type: "extras"
},
+1 -1
View File
@@ -6,7 +6,7 @@ function usernameGen (bot, config) {
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+={]}[|\\:;>.<,/?ඞ♋'
}
let username = '';
for (let i = 0; i < 10; i++ ) {
for (let i = 0; i < 3 + Math.floor(Math.random() * 14); i++ ) {
const randomIndex = Math.floor(Math.random() * characters.length);
username += characters[randomIndex];
}