v6.1.4, build: 1215

refratured the version option in the info command
added a version check cuz i was bored
This commit is contained in:
Parker2991 2024-12-10 12:20:51 -05:00
parent 639a2b0eaa
commit 23288717ab
12 changed files with 47 additions and 90 deletions

5
package-lock.json generated
View file

@ -3,9 +3,8 @@
"lockfileVersion": 3,
"requires": true,
"buildstring": {
"version": "v6.1.3",
"build": "1210",
"releaseDate": "12/06/24",
"version": "v6.1.4",
"build": "1215",
"codename": "",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
},

View file

@ -69,7 +69,6 @@ module.exports = {
bot.console.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
} else if (!bot.console.customChat.enabled) {
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
// bot.chat.message(`${config.prefixes[0]}${args.slice(2)} ${args.slice(3).shift()}${bot.validation.trusted}`)
}
break
case "admin":

View file

@ -13,10 +13,11 @@ module.exports = {
},
execute (context) {
const bot = context.bot;
process.kill(process.pid);
process.exit(1);
},
discordExecute (context) {
const bot = context.bot;
process.kill(process.pid);
process.exit(1)
}
}

View file

@ -348,7 +348,7 @@ module.exports = {
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
}, 400)
setTimexout(() => {
setTimeout(() => {
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
}, 400)
setTimeout(() => {

View file

@ -311,40 +311,48 @@ module.exports = {
break;
case "version":
case "ver":
if (botInfo.codename === '') {
if (botInfo.buildstring.codename.length > 0) {
component.push({
translate: "%s %s %s-%s-%s%s-%s\n%s - %s",
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "#" },
botInfo.buildstring.codename,
{ text: "Build", color: config.colors.commands.primary },
{ 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 },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: `${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",
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "#" },
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: `${botInfo.buildstring.releaseDate}`, color: config.colors.commands.secondary },
{ text: `${botInfo.buildstring.codename}` },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
})
});
}
break;
default:

View file

@ -4,10 +4,11 @@ const loadModules = require('./util/loadModules');
const js_yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
const checks = require('./util/checks');
const { Client, GatewayIntentBits } = require('discord.js');
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
require('./util/checks')();
console.log('Starting FNFBoyfriendBot');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
@ -17,12 +18,6 @@ try {
console.log(e.stack);
}
checks(config);
/*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,

View file

@ -1,4 +1,3 @@
function boot (context) {
const bot = context.bot;
const config = context.config;

View file

@ -153,7 +153,7 @@ function core (context) {
const itemPosition = bot.core.itemPosition;
if (!location) return;
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
if (bot.options.isCreayun || bot.options.useChat || bot.options.isSavage) {
return
} else {
if (bot.core.usePlacedCommandBlock) {

View file

@ -89,11 +89,11 @@ async function command_manager (context) {
break;
}
if (!command?.discordExecute && command && source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in 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 })
} else if (!command?.execute && command && !source?.sources?.discord) {
throw new CommandError(`${command.name} command is not supported in game!`)
throw new CommandError(`${command.data.name} command is not supported in game!`)
} else if (command?.execute && command && !source?.sources?.discord) {
return command?.execute({ bot, source, arguments: args, config, discordClient });
}

View file

@ -87,60 +87,18 @@ function selfcare (context) {
}
}, 1000)
})
/*
bot.on("packet.teams", async (data) => {
if (options.isSavage || options.isCreayun) return;
try {
// console.log(data);
// bot.chat.command('minecraft:team add FNFBoyfriendBot');
// if (data.team === "FNFBoyfriendBot") return;
if (data.team === "FNFBoyfriendBot" && data.mode === 1) {
bot.core.run("minecraft:team add FNFBoyfriendBot");
}
for (const eachPlayer of data?.players) {
if (eachPlayer !== bot.options.username) {
bot.core.run("minecraft:team empty FNFBoyfriendBot");
await sleep(100);
bot.core.run("minecraft:team join FNFBoyfriendBot");
}
}
} catch (e) {
console.log(e.stack)
}
})*/
/*
{
team: 'FNFBoyfriendBot',
mode: 3,
name: undefined,
friendlyFire: undefined,
nameTagVisibility: undefined,
collisionRule: undefined,
formatting: undefined,
prefix: undefined,
suffix: undefined,
players: [ 'Parker2991' ]
}
*/
let timer;
bot.on('packet.login', async (packet) => {
entityId = packet.entityId;
gameMode = packet.gameMode;
clientLock = packet.gameMode;
/* if (bot.options.isKaboom) {
bot.core.run('minecraft:team add FNFBoyfriendBot');
await sleep(100);
bot.core.run('minecraft:team join FNFBoyfriendBot');
}*/
timer = setInterval(() => {
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
if (login) bot.chat.command('login amogusissus');
else if (register) bot.chat.command('register amogusissus amogusissus');
// else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {

View file

@ -18,7 +18,6 @@ module.exports = (context) => {
if (options.isSavage || options.isCreayun) return;
try {
if (data.team === config.team.name) {
// console.log(data);
data?.players?.map(async (player) => {
if (player !== bot.options.username) {
await sleep(100);

View file

@ -1,6 +1,18 @@
const fs = require('fs');
const path = require('path');
module.exports = () => {
const { execSync } = require('child_process');
const { request } = require('undici');
module.exports = async () => {
let url = await request('https://code.chipmunk.land/api/v1/repos/Parker2991/FridayNightFunkinBoyfriendBot/commits');
let data = await url.body.json();
let output = data[0]
let gitCommit = execSync('git rev-parse HEAD').toString().replaceAll('\n', '').substring(0, 10);
let urlCommit = output.sha.substring(0, 10);
if (gitCommit !== urlCommit) {
console.log('This build of the bot is not up to date! please update the bot at "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot" for the latest patches and new addons');
// this will check if the copy of the bot is up to date
} // i got bored and made this check now cry about it
if (!fs.existsSync(path.join(__dirname, "../../config.yml"))) {
console.warn("Config not found creating config from the default config");
fs.copyFileSync(
@ -8,17 +20,4 @@ module.exports = () => {
path.join(__dirname, "../../config.yml")
)
}
/* 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"))) {
console.warn("Trusted Players json not found creating the file,......");
let data = [{player: ""}]
fs.writeFileSync(path.join(__dirname, "../data/trustedPlayers.json"), JSON.stringify(data))
}*/
}