v6.1.1-1 build: 1150 added a new core refill method to where the bot refills its core via a command block but made the method configurable, this was supposed to be in v6.1.1 originally

This commit is contained in:
Parker2991 2024-11-14 09:25:22 -05:00
parent 8f61177250
commit a140a2d12e
9 changed files with 75 additions and 14 deletions

4
package-lock.json generated
View file

@ -1,9 +1,9 @@
{
"name": "FridayNightFunkinBoyfriendBot",
"version": "v6.1.1",
"version": "v6.1.1-1",
"lockfileVersion": 3,
"requires": true,
"build": "1145",
"build": "1150",
"codename": "",
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot",
"packages": {

View file

@ -10,7 +10,7 @@ module.exports = {
'wikipedia'
],
usages:[
"<definition>"
"<article>"
],
},
async execute (context) {
@ -23,7 +23,7 @@ module.exports = {
bot.tellraw(`@a`, { text: `${summary}`, color: 'gray' });
} catch (error) {
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.tellraw(`@a`, { text: 'Definition not found!', color: 'dark_red' })
bot.tellraw(`@a`, { text: 'Article not found!', color: 'dark_red' })
} else {
bot.tellraw(`@a`, `${error.toString()}`)
}

View file

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

View file

@ -1,17 +1,21 @@
prefixes:
- "!"
discord:
token: "discord token here"
prefix: "!"
invite: "discord invite here"
enabled: true
roles:
trusted: "trusted"
admin: "admin"
owner: "FNFBoyfriendBot Owner"
core:
# core refill methods:
# chat: refill core in chat
# item refill core in a command block placed by the bot
name: {"translate":"outOfMemory.message"}
method: 'item'
area:
start:
x: 0

View file

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

View file

@ -16,6 +16,10 @@ try {
} catch (e) {
console.log(e.stack);
}
if (config.core.method !== 'item' && config.core.method !== 'chat') {
config.core.method = 'item';
console.warn('invalid core method type defaulting to item');
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,

View file

@ -1,3 +1,4 @@
const mcData = require('minecraft-data')('1.20.2');
function core (bot, options, config) {
let number = 0;
bot.core = {
@ -25,7 +26,51 @@ function core (bot, options, config) {
it will not refill core until the pos is not NaN
instead of tping to a set cords cuz fuck you im not doing that
*/
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
if (config.core.method === 'chat') {
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
} else if (config.core.method === 'item') {
bot._client.write('set_creative_slot', {
slot: 36,
item: {
present: true,
itemId: mcData.itemsByName.command_block.id,
itemCount: 1,
nbtData: {
}
}
});
bot._client.write('block_dig', {
status: 0,
location: {
x: bot.position.x,
y: bot.position.y,
z: bot.position.z
},
face: 0
});
bot._client.write('block_place', {
hand: 0,
location: {
x: bot.position.x,
y: bot.position.y,
z: bot.position.z
},
direction: 0,
cursorX: 0.1,
cursorY: 0,
cursorZ: 0.1,
insideBlock: false
});
bot._client.write('update_command_block', {
location: bot.position,
command: `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`,
flags: 5,
mode: 1
})
}
},
move (pos = bot.position) {
@ -76,7 +121,7 @@ function core (bot, options, config) {
} else {
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 });
bot._client.write('query_block_nbt', ({ location: location, transactionId: eee}));
bot.core.incrementCurrentBlock()
bot.core.incrementCurrentBlock();
}
},
}
@ -85,6 +130,15 @@ function core (bot, options, config) {
bot.on('move', () => {
bot.core.move(bot.position)
})
}
bot.on('packet.block_change', (data) => {
// console.log('data pos ' + JSON.stringify(data.location))
// console.log('core pos ' +JSON.stringify(bot.core.position));
if (data.type === 0) {
// console.log('data pos ' + JSON.stringify(data.location));
// console.log('core position ' + JSON.stringify(bot.core.position));
// bot.core.refill();
}
})
}
module.exports = core;

View file

@ -47,8 +47,8 @@ async function command_manager (bot, options, config, discordClient) {
const event = bot.discord.message;
const roles = event?.member?.roles?.cache;
if (command?.data?.trustLevel === 1 && !source?.sources?.discord) {
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide an trusted or an admin or an owner hash", color: "dark_red" })
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted or admin or owner hash', color: 'dark_red' });
if (args.length === 0 && bot.validation.trusted && bot.validation.admin && bot.validation.owner && !source?.sources?.console) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" })
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner && !source.sources.console) throw new CommandError({ translate: 'Invalid trusted, admin or owner hash', color: 'dark_red' });
} else if (command?.data?.trustLevel === 1 && source?.sources.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })

View file

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