forked from afspiegeling/NitoriBot
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba184e0019 | ||
|
|
52ad936681 | ||
|
|
2d80a02f15 | ||
|
|
32677096ae | ||
|
|
d45f7cd93b |
@@ -4,15 +4,15 @@ class CommandSource {
|
||||
// sus
|
||||
|
||||
this.player = player
|
||||
this.name = player
|
||||
|
||||
this.sources = sources
|
||||
this.profile = bot
|
||||
this.hash = hash
|
||||
this.trustLevel
|
||||
|
||||
this.owner = owner
|
||||
this.consoleOnly = consoleOnly
|
||||
this.discordMessageEvent = discordMessageEvent
|
||||
this.displayName = player
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ const util = require('node:util')
|
||||
console.log(`Starting ${process.env["buildstring"]} .......`)
|
||||
console.log(`Foundation: ${process.env["FoundationBuildString"]}`)
|
||||
console.log('this may take a few moments....')
|
||||
|
||||
require('events').EventEmitter.defaultMaxListeners = 20;
|
||||
function createBot(options = {}) {
|
||||
const bot = new EventEmitter()
|
||||
const rs = require('randomstring')
|
||||
@@ -17,7 +17,14 @@ const rs = require('randomstring')
|
||||
options.hideErrors ??= false // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
options.console ??= true
|
||||
options.input ??= true
|
||||
|
||||
//options.logger ??= true
|
||||
// MainPrefix: "~",
|
||||
// SecondaryPrefix:'%',
|
||||
//TertiaryPrefix:'@'
|
||||
|
||||
options.commands.MainPrefix ??= '!'
|
||||
options.commands.SecondaryPrefix ??= '!'
|
||||
options.commands.TertiaryPrefix ??= '!'
|
||||
options.selfcare.unmuted ??= true
|
||||
|
||||
options.selfcare.vanished ??= true
|
||||
@@ -36,7 +43,7 @@ options.input ??= true
|
||||
|
||||
options.Core.core ??= true
|
||||
|
||||
options.commands.prefix ??= '!'
|
||||
|
||||
|
||||
options.discord.commandPrefix ??= '!'
|
||||
|
||||
@@ -70,21 +77,44 @@ options.input ??= true
|
||||
bot.buildstring = process.env['buildstring']
|
||||
bot.fbs = process.env['FoundationBuildString']
|
||||
bot.version = bot.options.version
|
||||
console.log(`Username: ${bot.username}`)
|
||||
console.log(`Username: ${bot.options.username}`)
|
||||
console.log(`Host: ${bot.options.host}:${bot.options.port}`)
|
||||
console.log(`Minecraft java version: ${bot.options.version}`)
|
||||
/* console.log(`Username: ${bot.username}`)
|
||||
console.log(`Host: ${bot.host}:${bot.port}`)
|
||||
console.log(`Minecraft java version: ${bot.version}`)
|
||||
console.log(`Minecraft java version: ${bot.version}`)*/
|
||||
})
|
||||
//bot.visibility = false
|
||||
//reason, fullReason
|
||||
client.on('end', reason => { bot.emit('end', reason)
|
||||
|
||||
console.log(reason)
|
||||
|
||||
})
|
||||
client.on('disconnect', reason => {
|
||||
bot.emit('disconnect', reason)
|
||||
console.log(reason)
|
||||
})
|
||||
|
||||
client.on('kick_disconnect', reason => {
|
||||
bot.emit('kick_disconnect', reason)
|
||||
console.log(reason)
|
||||
})
|
||||
client.on('keep_alive', ({ keepAliveId }) => {
|
||||
bot.emit('keep_alive', { keepAliveId })
|
||||
// console.log(keepAliveId)
|
||||
})
|
||||
|
||||
client.on('error', error => bot.emit('error', error), )
|
||||
|
||||
//client.end(reason, fullReason)
|
||||
|
||||
})
|
||||
/*
|
||||
bot._client.on('kick_disconnect', (data) => {
|
||||
const parsed = JSON.parse(data.reason)
|
||||
bot.end(parsed, 'kick_disconnect')
|
||||
})
|
||||
|
||||
|
||||
*/
|
||||
const buildstring = process.env['buildstring']
|
||||
|
||||
const client = options.client ?? mc.createClient(options)
|
||||
@@ -92,6 +122,8 @@ const buildstring = process.env['buildstring']
|
||||
bot.emit('init_client', client)
|
||||
|
||||
bot.bots = options.bots ?? [bot]
|
||||
//bot.setMaxListeners(Infinity)
|
||||
//bot._client.setMaxListeners(Infinity)
|
||||
|
||||
// Modules
|
||||
bot.loadModule = module => module(bot, options)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ function parseMessage (message, data, context, bot) {
|
||||
let sender
|
||||
|
||||
const hoverEvent = senderComponent.hoverEvent
|
||||
// console.log(hoverEvent)
|
||||
//console.log(JSON.stringify(hoverEvent))
|
||||
if (hoverEvent?.action === 'show_entity') {
|
||||
const id = hoverEvent.contents.id
|
||||
//
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
function inject (bot, options) {
|
||||
bot.chatQueue = []
|
||||
bot._chatQueue = []
|
||||
|
||||
const _chatQueueInterval = setInterval(() => {
|
||||
if (bot.chatQueue.length !== 0) {
|
||||
if (containsIllegalCharacters(bot.chatQueue[0])) {
|
||||
bot.chatQueue.shift()
|
||||
return
|
||||
};
|
||||
|
||||
for (const subMessage of bot.chatQueue[0].split('\n')) {
|
||||
if (!subMessage) return
|
||||
let smallMsg
|
||||
for (let i = 0; i < subMessage.length; i += config.chat.messageLength) {
|
||||
smallMsg = subMessage.substring(i, i + config.chat.messageLength)
|
||||
bot._chatQueue.push(smallMsg)
|
||||
}
|
||||
}
|
||||
bot.chatQueue.shift()
|
||||
}
|
||||
}, 0)
|
||||
const chatQueueInterval = setInterval(function () {
|
||||
if (bot._chatQueue.length !== 0) {
|
||||
if (bot._chatQueue[0].startsWith('/') && minecraftVersionToNumber(bot.version) >= 1.20) {
|
||||
|
||||
} else {
|
||||
bot._client.chat(bot._chatQueue[0])
|
||||
}
|
||||
|
||||
bot._chatQueue.shift()
|
||||
}
|
||||
}, 450)
|
||||
bot.chat = (message) => {
|
||||
bot.chatQueue.push(String(message))
|
||||
}
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(chatQueueInterval)
|
||||
clearInterval(_chatQueueInterval)
|
||||
})
|
||||
|
||||
function listener (packet) {
|
||||
chatPacketListener(
|
||||
packet,
|
||||
bot,
|
||||
minecraftVersionToNumber(bot.version) >= 1.20
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
|
||||
module.exports = {
|
||||
name: 'botsrun',
|
||||
description:[''],
|
||||
aliases:[],
|
||||
trustLevel: 2,
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
// const client = context.client
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
const message = context.arguments.join(' ')
|
||||
//const source = context.source
|
||||
// if (args.length === 0){
|
||||
//source.sendFeedback({translate:"Too few Arguments!", color:"red"})
|
||||
const amogus = args.slice(1).join(' ');
|
||||
if (!args && !args[0] && !args[1] && !args[2]) return
|
||||
try{
|
||||
switch (args[1]) {
|
||||
case 'source':
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.executeString(source, `${args.slice(2).join(' ')} `)
|
||||
}
|
||||
break
|
||||
case 'consolesource':
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.commandManager.executeString(bot.console.source, `${args.slice(2).join(' ')} `)
|
||||
}
|
||||
break
|
||||
default:
|
||||
context.source.sendError([ { text: 'Invalid action', color: 'dark_red', bold:false }])
|
||||
source.sendFeedback({text:'Args are source and consolesource', color:'green'})
|
||||
}
|
||||
|
||||
}catch(error){
|
||||
source.sendFeedback(error.stack)
|
||||
}
|
||||
// context.source.sendFeedback({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })
|
||||
|
||||
|
||||
}//
|
||||
}
|
||||
+22
-1
@@ -14,7 +14,28 @@ const bots = [
|
||||
foundation: '12/20/23',
|
||||
exclaimer:'since the old validation system was able to barely handle owner validation it was completely remove and replaced with trust levels which handle validation way better also added command aliases (shoutouts to poopbob with the command aliases). made a whole new changelog command for v5.0.0 and renamed the old one changelogv4.3.4. also fixed the issue with the console not properly refreshing lines that are sent',
|
||||
},
|
||||
]//§4Lullaby §cGirlfriend's §cLost§bCause
|
||||
{//
|
||||
name: { text: 'v5.0.1', color: 'green', bold:false },
|
||||
authors: [''],
|
||||
|
||||
foundation: 'added botsrun for the funni along with making the bot be able to auto refill its core now and fill the core from a command block(edit: nevermind its very buggy reverting it back to how it originally filled its core) and adding a hover event to netmsg along with having the test command tellraw the players display name in the command and added support for 3 command prefixes',
|
||||
exclaimer:'12/23/23',
|
||||
},
|
||||
{//
|
||||
name: { text: 'v5.0.2', color: 'green', bold:false },
|
||||
authors: [''],
|
||||
|
||||
foundation: '12/26/23',
|
||||
exclaimer:'fixed the issue with the cpu checking in the info command added discord hashing back into the bot to work along side the keys made it check to see if the config file is in the directory and if not it will recreate the config from default.js',
|
||||
},
|
||||
{//
|
||||
name: { text: 'v5.0.3', color: 'gray', bold:false },
|
||||
authors: [''],
|
||||
|
||||
foundation: '12/29/23',
|
||||
exclaimer:'mabe the bot last update of 2023 cuz next year will be 2024 www but anyway expanded the disconnect messages for both console and discord but thats pretty much it',
|
||||
},
|
||||
]//
|
||||
//back
|
||||
|
||||
|
||||
|
||||
@@ -9,16 +9,13 @@ module.exports = {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const source = context.source
|
||||
if (args.length === 0){
|
||||
source.sendFeedback({translate:"Too few Arguments!", color:"red"})
|
||||
} else if (args.length === 2){
|
||||
source.sendFeedback({translate:"Too many Arguments!", color:"red"})
|
||||
}
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.host)
|
||||
const ports = bot.bots.map(eachBot => eachBot.options.port)
|
||||
for (const eachBot of bot.bots) {
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
for (const eachBot of bot.bots) {
|
||||
|
||||
|
||||
if (args.join(' ').toLowerCase() === 'all') {
|
||||
@@ -33,16 +30,16 @@ const ports = bot.bots.map(eachBot => eachBot.options.port)
|
||||
}//.repeat(Math.floor((32767 - 22) / 16))
|
||||
//"a".repeat(10)
|
||||
|
||||
const server = servers.find(server => server.toLowerCase().includes(args.join(' ')))
|
||||
//const port = ports.find(port => port.toLowerCase().includes(args.join(' ')))
|
||||
if (!server /*&& !port*/) {
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[0]))
|
||||
|
||||
if (!server) {
|
||||
source.sendFeedback({ text: 'Invalid server', color: 'red' })
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
bot.console.info(`Set the console server to ` + server)
|
||||
eachBot.console.consoleServer = server
|
||||
eachBot.console.consoleServer = server
|
||||
// eachBot.console.consoleServer = port
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -55,7 +55,7 @@ module.exports = {
|
||||
|
||||
} else {
|
||||
const args = context.arguments
|
||||
source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefix}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help` } : undefined}])
|
||||
source.sendFeedback([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.MainPrefix}help" for help or click on this for the command`,color:'red', with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.MainPrefix}help` } : undefined}])
|
||||
// bot.tellraw([cmd, {translate: `Unknown command %s. Type "${bot.options.commands.prefix}help" for help or click on this for the command`, with: [args[0]], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help`, color:'red' } : undefined}])
|
||||
}//i will add the descriptions reading as tests and action add the descriptions for the commands after
|
||||
const length = context.bot.commandManager.amogus.length // ok
|
||||
@@ -124,7 +124,7 @@ module.exports = {
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"run_command",value:`${bot.options.commands.prefix}${command.name}`
|
||||
action:"run_command",value:`${bot.options.commands.MainPrefix}${command.name}`
|
||||
},
|
||||
// ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description}
|
||||
|
||||
@@ -154,7 +154,7 @@ module.exports = {
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"run_command",value:`${bot.options.commands.prefix}${command.name}`
|
||||
action:"run_command",value:`${bot.options.commands.MainPrefix}${command.name}`
|
||||
},
|
||||
// ${command.name}\nhashOnly:§c${command.hashOnly}§r\nconsoleOnly:§c${command.consoleOnly && !context.console}§r\n${command.description}
|
||||
|
||||
@@ -178,14 +178,14 @@ module.exports = {
|
||||
text:`Command:${command.name}\n`,
|
||||
color:'white'
|
||||
},{
|
||||
text:`Trust Level: `,color:'green'},
|
||||
text:`Trust Level: `,color:'white'},
|
||||
{text:`${command.trustLevel}\n`,color:'red'},
|
||||
{text:`${command.description}\n`, color:'white'},
|
||||
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"suggest_command",value:`${bot.options.commands.prefix}${command.name}`}
|
||||
action:"suggest_command",value:`${bot.options.commands.MainPrefix}${command.name}`}
|
||||
|
||||
})
|
||||
|
||||
|
||||
+9
-10
@@ -144,15 +144,15 @@ module.exports = {
|
||||
context.source.sendFeedback({ color: "gray", text: `OS platform: ${os.platform()}`})
|
||||
context.source.sendFeedback({ color: "gray", text: `OS name: ${os.version()}`})
|
||||
context.source.sendFeedback({ color: "gray", text: `CPU cores: ${os.cpus().length}`})
|
||||
/*if (os.platform() === 'win32')
|
||||
context.source.sendFeedback( { color: "gray", text: `CPU model: ${await getCpuModelName()}`})
|
||||
return*/
|
||||
/*const os = require('os') const cpus = os.cpus() for (const cpu of cpus){bot.tellraw(cpu.model)}*/
|
||||
//os.cpus()[0].model
|
||||
/*
|
||||
if (os.platform() !== 'linux'){
|
||||
source.sendFeedback({text:'cannot find the cpu model are you sure the bot is running on linux?', color:'red'})
|
||||
}
|
||||
else if (os.platform() === 'linux') {
|
||||
source.sendFeedback({ color: "gray", text: `CPU model: ${await getCpuModelName()}`})
|
||||
}
|
||||
*/ source.sendFeedback({ color: "gray", text: `CPU model: ${await os.cpus()[0].model}`})
|
||||
// }
|
||||
/*translate: '\n %s \n %s \n %s \n %s \n %s \n %s \n %s',//lazy fix
|
||||
with: [
|
||||
{ color: "gray", text: `Hostname: ${os.hostname()}`},
|
||||
@@ -181,11 +181,10 @@ module.exports = {
|
||||
|
||||
|
||||
|
||||
source.sendFeedback({text:`Prefix: "${bot.options.commands.prefix}"`, color:"gray"})
|
||||
|
||||
|
||||
|
||||
source.sendFeedback({text:`Discord Prefix: "${bot.options.discord.commandPrefix}"`, color:'gray'})
|
||||
source.sendFeedback({text:`Main Prefix: "${bot.options.commands.MainPrefix}"`, color:"gray"})
|
||||
source.sendFeedback({text:`Secondary Prefix: "${bot.options.commands.SecondaryPrefix}"`, color:"gray"})
|
||||
source.sendFeedback({text:`Tertiary Prefix: "${bot.options.commands.TertiaryPrefix}"`, color:"gray"})
|
||||
source.sendFeedback({text:`Discord Prefix: "${bot.options.discord.commandPrefix}"`, color:'gray'})
|
||||
|
||||
|
||||
source.sendFeedback({text:`Discord Username: "${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}"`, color:'gray'})
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ module.exports = {
|
||||
name: 'list',
|
||||
description:['check the player list'],
|
||||
trustLevel: 0,
|
||||
aliases:['playerlist', 'plist'],
|
||||
aliases:['playerlist', 'plist', 'pl'],
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
|
||||
+72
-9
@@ -7,10 +7,20 @@ module.exports = {
|
||||
execute (context) {
|
||||
|
||||
const message = context.arguments.join(' ')
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch (error) {
|
||||
return { text: '' }
|
||||
}
|
||||
}
|
||||
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
|
||||
//throw new CommandError('ohio')
|
||||
const source = context.source
|
||||
const player = context.source.player.displayName
|
||||
//throw n
|
||||
const component = {
|
||||
translate: '[%s] [%s] %s \u203a %s',
|
||||
with: [
|
||||
@@ -22,6 +32,7 @@ module.exports = {
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
@@ -37,12 +48,50 @@ module.exports = {
|
||||
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: `idfk what to put here` }
|
||||
},
|
||||
bot.options.host + ':' + bot.options.port,
|
||||
{
|
||||
text:`${bot.options.host}:${bot.options.port}`,
|
||||
bold:false,
|
||||
color:'white',
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text",
|
||||
value:[
|
||||
{
|
||||
text:`Server: ${bot.options.host}:${bot.options.port}`,
|
||||
color:'white',
|
||||
}
|
||||
],
|
||||
clickEvent:{
|
||||
action:"copy_to_clipboard",value:`${bot.options.host}:${bot.options.port}`}
|
||||
}
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
message
|
||||
|
||||
},
|
||||
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
|
||||
//entry.displayName
|
||||
{text:message}
|
||||
]//command.split(' ')[0]
|
||||
}//string.replace()
|
||||
}
|
||||
|
||||
|
||||
// context.source.player.displayName ?? context.source.player.profile.name,
|
||||
/*
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
} catch (error) {
|
||||
return { text: '' }
|
||||
}
|
||||
}
|
||||
*///obj
|
||||
/*
|
||||
const amogus2 = {text:`${JSON.stringify(context.source.player.displayName ?? context.source.player.profile.name)}`}
|
||||
|
||||
bot.tellraw({text:'amogus ' + JSON.parse(context.source.player.displayName)})
|
||||
*/ //context.source.sendFeedback({text:`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`})
|
||||
if (!message[0]) {
|
||||
context.source.sendFeedback({text:'Message is empty', color:'red'}, false)
|
||||
} else {
|
||||
@@ -51,8 +100,22 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
/*
|
||||
bot.options.host + ':' + bot.options.port,
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
message
|
||||
[%s%s%s] [%s] %s \u203a %s
|
||||
translate:"",
|
||||
hoverEvent:{
|
||||
action:"show_text", // Welcome to Kaboom!\n > Free OP - Anarchy - Creative (frfr)
|
||||
value:[
|
||||
{
|
||||
text:`Command:${command.name}\n`,
|
||||
color:'white'
|
||||
},{
|
||||
text:`Trust Level: `,color:'white'},
|
||||
{text:`${command.trustLevel}\n`,color:'red'},
|
||||
{text:`${command.description}\n`, color:'white'},
|
||||
{text:`Command Aliases: ${command.aliases}\n`,color:'white'},
|
||||
{text:'click on me to use me :)'},
|
||||
]
|
||||
},clickEvent:{
|
||||
action:"suggest_command",value:`${bot.options.commands.MainPrefix}${command.name}`}
|
||||
|
||||
})
|
||||
*/
|
||||
+47
-3
@@ -12,11 +12,55 @@ trustLevel: 0,
|
||||
const player = context.source.player.profile.name
|
||||
const uuid = context.source.player.uuid
|
||||
const message = context.arguments.join(' ') // WHY SECTION SIGNS!!
|
||||
|
||||
context.source.sendFeedback(`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`, false)
|
||||
const component = {
|
||||
translate: '[%s] %s %s %s %s %s',
|
||||
with: [
|
||||
{
|
||||
translate: '%s%s%s',
|
||||
bold:false,
|
||||
with: [
|
||||
{
|
||||
text: 'FNF',
|
||||
bold: true,
|
||||
color: 'dark_purple'
|
||||
|
||||
},
|
||||
{
|
||||
text: 'Boyfriend',
|
||||
bold: true,
|
||||
color: 'aqua'
|
||||
},
|
||||
{
|
||||
text: 'Bot',
|
||||
bold: true,
|
||||
color: 'dark_red'
|
||||
},
|
||||
],
|
||||
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: `idfk what to put here` }
|
||||
},
|
||||
{
|
||||
text:'Hello, World!,'
|
||||
},{
|
||||
text:'Player:'
|
||||
},
|
||||
|
||||
|
||||
context.source.player.displayName ?? context.source.player.profile.name,
|
||||
{
|
||||
text:`, uuid: ${uuid}, `
|
||||
},
|
||||
//entry.displayName
|
||||
{text:`Argument: ${message}`}
|
||||
]//command.split(' ')[0]
|
||||
}
|
||||
bot.tellraw(component)
|
||||
// context.source.sendFeedback({text:`Hello, World!, Player: ${player}, uuid: ${uuid}, Argument: ${message}`})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
*/
|
||||
//context.source.player.displayName ?? context.source.player.profile.name,
|
||||
|
||||
@@ -10,11 +10,14 @@ trustLevel: 1,
|
||||
const hash = bot.hash
|
||||
const args = context.arguments
|
||||
const ownerhash = bot.owner
|
||||
|
||||
const discordHash = bot.hashing.hash
|
||||
if (args[0] === hash) {
|
||||
source.sendFeedback({ text: 'Valid Hash', color: 'green' })
|
||||
} else if (args[0] === ownerhash) {
|
||||
}else if (args[0] === ownerhash) {
|
||||
source.sendFeedback({text: 'Valid OwnerHash', color:'green'})
|
||||
}
|
||||
else if (discordHash) {
|
||||
source.sendFeedback({ text: 'Valid Hash', color: 'green' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
|
||||
{
|
||||
module.exports = {
|
||||
|
||||
bots: [
|
||||
{
|
||||
host: "localhost",
|
||||
username:username(),
|
||||
version:"1.20.1",
|
||||
reconnectDelay: 6000,
|
||||
language:"lolus",
|
||||
console:true,
|
||||
input: true,
|
||||
commands: {
|
||||
MainPrefix: "set Main Prefix here",
|
||||
SecondaryPrefix:'set Secondary prefix here',
|
||||
TertiaryPrefix:'set Tertiary Prefix here'
|
||||
},
|
||||
Core: {
|
||||
customName:"core customName here",
|
||||
core: true,
|
||||
},
|
||||
discord: {
|
||||
channelId: "discord channelId here",
|
||||
invite: "discord invite link here",
|
||||
commandPrefix: "discord command prefix here"
|
||||
},
|
||||
skin: {
|
||||
torso:{
|
||||
jacket:true,
|
||||
cape:true,
|
||||
},
|
||||
arms: {
|
||||
leftSleeve:true,
|
||||
rightSleeve:true,
|
||||
},
|
||||
legs:{
|
||||
leftPants:true,
|
||||
rightPants:true,
|
||||
},
|
||||
head:{
|
||||
hat:true
|
||||
},
|
||||
},
|
||||
selfcare: {
|
||||
unmuted: true,
|
||||
vanished: true,
|
||||
prefix: true,
|
||||
skin: true,
|
||||
cspy: true,
|
||||
op: true,
|
||||
gmc: true,
|
||||
username:true,
|
||||
nickname: true,
|
||||
god:true,
|
||||
tptoggle: true,
|
||||
interval:500,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function username() {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // remove sus characters like ` or like ( or whatever because it breaks whatever
|
||||
let username = '';
|
||||
for (let i = 0; i < 9; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,12 @@ const util = require('util')
|
||||
const createBot = require('./bot.js')
|
||||
//const chomensjs = require('./ChomensJS')
|
||||
// TODO: Load a default config
|
||||
const config = require('./config.js')
|
||||
const fs = require('fs/promises')
|
||||
const fileExist = require('./util/file-exists')
|
||||
const path = require('path')
|
||||
|
||||
function load () {
|
||||
//const config = require('./config.js')
|
||||
const readline = require('readline')
|
||||
|
||||
const rl = readline.createInterface({
|
||||
@@ -19,8 +24,30 @@ const bots = []
|
||||
bot.console.useReadlineInterface(rl)
|
||||
|
||||
// bot.on('error', (error), util.inspect(error))
|
||||
|
||||
try{
|
||||
bot.on('error', console.error)
|
||||
}catch(error){
|
||||
|
||||
console.log(error.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
async function checkConfig () {
|
||||
if (!await fileExist(path.join(__dirname, 'config.js'))) {
|
||||
console.error('Config not found! Creating a new Config from ')
|
||||
await fs.copyFile(path.join(__dirname, 'default.js'), path.join(__dirname, 'config.js'))
|
||||
} if (await fileExist(path.join(__dirname, 'config.js'))){
|
||||
console.log('Config found! loading config please wait,......')
|
||||
}
|
||||
|
||||
config = require('./config.js')
|
||||
load()
|
||||
}
|
||||
|
||||
checkConfig()
|
||||
|
||||
process.on('uncaughtException', (e) => {
|
||||
console.log('uncaught ' + e.stack)
|
||||
})
|
||||
|
||||
|
||||
@@ -6,34 +6,41 @@ function inject (bot) {
|
||||
if (data.type !== 'minecraft:chat') return
|
||||
|
||||
const plainMessage = bot.getMessageAsPrismarine(data.contents)?.toString()
|
||||
if (!plainMessage.startsWith(bot.commandManager.prefix)) return
|
||||
const command = plainMessage.substring(bot.commandManager.prefix.length)
|
||||
|
||||
if (!plainMessage.startsWith(bot.commandManager.MainPrefix) && (!plainMessage.startsWith(bot.commandManager.SecondaryPrefix) && (!plainMessage.startsWith(bot.commandManager.TertiaryPrefix)))) return
|
||||
// else if (!plainMessage.startsWith(bot.commandManager.prefix2)) return
|
||||
// MainPrefix: "~",
|
||||
// SecondaryPrefix:'%',
|
||||
//TertiaryPrefix:'@'
|
||||
|
||||
const command = plainMessage.substring(bot.commandManager.MainPrefix.length || plainMessage.substring(bot.commandManager.SecondaryPrefix.length || plainMessage.substring(bot.commandManager.TertiaryPrefix.length))) // if the prefixes are the same length just make it 1 or the length
|
||||
/*
|
||||
lifes sus
|
||||
*/
|
||||
const source = new CommandSource(data.sender, { discord: false, console: false }, true)
|
||||
source.sendFeedback = message => {
|
||||
const prefix = {
|
||||
translate: '[%s%s%s] \u203a ',
|
||||
bold: false,
|
||||
color: 'white',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{
|
||||
color: 'dark_purple',
|
||||
text: 'FNF',
|
||||
bold:true,
|
||||
hoverEvent: { action:"show_text", value: `${process.env["buildstring"]}`},
|
||||
hoverEvent: { action:"show_text", value: `${process.env["buildstring"]}\n${process.env["FoundationBuildString"]}`},
|
||||
clickEvent: bot.options.Core.customName ? { action: 'open_url', value: bot.options.Core.customName } : undefined,
|
||||
},
|
||||
{
|
||||
color: 'aqua',
|
||||
text: 'Boyfriend', bold:true,
|
||||
clickEvent: bot.options.discord.invite ? { action: 'open_url', value: bot.options.discord.invite } : undefined, hoverEvent: { action:"show_text", value: `${process.env["FoundationBuildString"]}`},
|
||||
clickEvent: bot.options.discord.invite ? { action: 'open_url', value: bot.options.discord.invite } : undefined, hoverEvent: { action:"show_text", value: `Bot Username: ${bot.username}\nBot UUID: ${bot.uuid}\nServer Host: ${bot.options.host}:${bot.options.port}\nBot Minecraft Java Version: ${bot.options.version}`},
|
||||
},
|
||||
{ color: 'dark_red',
|
||||
text: 'Bot',
|
||||
bold:true,
|
||||
clickEvent: bot.options.discord.invite ? { action: 'open_url', value: 'https://code.chipmunk.land' } : undefined,
|
||||
hoverEvent: { action:"show_text", value: '§aMan i like frogs - _ChipMC_'},
|
||||
},
|
||||
},//§aMan i like frogs - _ChipMC_
|
||||
|
||||
{ color: 'green', text: command.split(' ')[0] }
|
||||
]
|
||||
|
||||
+12
-3
@@ -15,10 +15,11 @@ async function inject (bot, options) {
|
||||
|
||||
if (!pos) return
|
||||
|
||||
bot.command(`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: '{"text":"${bot.options.Core.customName}","color":"dark_red","clickEvent":{"action":"open_url","value":"${bot.options.Core.customName}"}}'} destroy`)
|
||||
|
||||
bot.command(`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: '{"text":"${bot.options.Core.customName}","color":"dark_red","clickEvent":{"action":"open_url","value":"${bot.options.Core.customName}"}}'} destroy`)
|
||||
},
|
||||
|
||||
|
||||
move (pos = bot.position) {
|
||||
bot.core.position = {
|
||||
x: Math.floor(pos.x / 16) * 16,
|
||||
@@ -67,13 +68,21 @@ async function inject (bot, options) {
|
||||
bot.core.incrementCurrentBlock()
|
||||
|
||||
// added .substring(0, 32767) so it won't kick the bot if the command is too long.
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
if (!bot.options.Core.core) return
|
||||
bot.on('move', () => {
|
||||
bot.core.move(bot.position)
|
||||
//setTimeout(() => bot.core.run('say hi'), 100)
|
||||
})
|
||||
bot.on('packet.login', (data) =>{
|
||||
const timer = setInterval(() => {
|
||||
bot.core.refill()
|
||||
}, bot.options.Core.interval)
|
||||
bot.on('end', (bot) => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
|
||||
+47
-37
@@ -5,7 +5,9 @@ const CommandError = require('../CommandModules/command_error.js')
|
||||
//it would be both the command_source.js and command_manager.js files
|
||||
function inject (bot, options) {
|
||||
bot.commandManager = {
|
||||
prefix: options.commands?.prefix ?? 'default',
|
||||
MainPrefix: options.commands?.MainPrefix ?? 'default',
|
||||
SecondaryPrefix: options.commands?.SecondaryPrefix ?? 'default',
|
||||
TertiaryPrefix: options.commands?.TertiaryPrefix ?? 'default',
|
||||
commands: {},
|
||||
amogus: [],
|
||||
//ohio
|
||||
@@ -14,10 +16,12 @@ function inject (bot, options) {
|
||||
//Unknown command. Type "/help" for help
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
try {
|
||||
if (!command || !command.execute) throw new CommandError({ translate: `Unknown command %s. Type "${bot.options.commands.prefix}help" for help or click on this for the command`, with: [commandName], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.prefix}help` } : undefined})
|
||||
if (command.consoleOnly && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' })
|
||||
if (!command || !command.execute) throw new CommandError({ translate: `Unknown command %s. Type "${bot.options.commands.MainPrefix}help" for help or click on this for the command`, with: [commandName], clickEvent: bot.options.Core.customName ? { action: 'suggest_command', value: `${bot.options.commands.MainPrefix}help` } : undefined})//ohio
|
||||
|
||||
|
||||
|
||||
if (command.trustLevel > 0){
|
||||
const event = source.discordMessageEvent
|
||||
const event = source?.discordMessageEvent
|
||||
|
||||
const roles = event?.member?.roles?.cache
|
||||
|
||||
@@ -27,30 +31,53 @@ const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
// const hash = `${args[0]}`
|
||||
// const owner = `${args[0]}`
|
||||
if(
|
||||
source.sources.discord &&
|
||||
source?.sources?.discord &&
|
||||
command.trustLevel === 1 &&
|
||||
!roles?.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner')
|
||||
!roles?.some(role => role?.name == 'trusted' || role?.name == 'FNFBoyfriendBot Owner') ? true : false
|
||||
) throw new CommandError({text:'You are not Trusted!', color:'red'})
|
||||
if (
|
||||
!source.sources.discord &&
|
||||
!source?.sources?.discord &&
|
||||
command.trustLevel === 1 &&
|
||||
args[0] !== bot.hash &&
|
||||
args[0] !== bot.owner
|
||||
args[0] !== bot.owner &&
|
||||
args[0] !== bot.hashing.hash
|
||||
) throw new CommandError({text:'Invalid Hash or Invalid Owner Hash', color:'red'})
|
||||
|
||||
bot.hashing.updateHash()
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
const player = source?.player?.profile?.name
|
||||
const uuid = source?.player?.uuid
|
||||
const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"})
|
||||
const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"})
|
||||
|
||||
bot.console.hash = function (error, source) {
|
||||
console.log(`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hash || bot.hashing.hash}\x1b[0m]` )
|
||||
}
|
||||
bot.console.discordHash = function (error, source) {
|
||||
console.log(`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hashing.hash}\x1b[0m]` )
|
||||
}
|
||||
bot.console.ownerHash = function (error, source) {
|
||||
console.log(`<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[31mOwnerHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[31mOwnerHash\x1b[0m:${bot.owner}\x1b[0m]` )
|
||||
}
|
||||
if (args[0] === bot.hash) {
|
||||
bot.console.hash()
|
||||
}
|
||||
else if (args[0] === bot.owner) {
|
||||
bot.console.ownerHash()
|
||||
}
|
||||
if (
|
||||
source.sources.discord &&
|
||||
source?.sources?.discord &&
|
||||
command.trustLevel === 2 &&
|
||||
!roles?.some(role => role.name === 'FNFBoyfriendBot Owner')
|
||||
) throw new CommandError({text:'You are not the Owner!', color:'dark_red'})
|
||||
const owner = `${args[0]}`
|
||||
if (
|
||||
!source.sources.discord &&
|
||||
command.trustLevel === 2 && args[0] !== bot.owner
|
||||
!source?.sources?.discord &&
|
||||
command.trustLevel === 2 && owner !== bot.owner
|
||||
)throw new CommandError({text: 'Invalid Owner Hash', color:'dark_red'})
|
||||
|
||||
if (command.trustLevel === 3 && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' })
|
||||
|
||||
if (command.trustLevel === 3 && !source?.sources?.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' })
|
||||
//if ()
|
||||
}//command.hashOnly && source.hash
|
||||
}// if (command.consoleOnly && !source.sources.console) throw new CommandError({ translate: 'This command can only be executed via console', color: 'blue' })
|
||||
//(hash !== bot.hash && owner !== bot.owner
|
||||
//command.unknown.argument command.unknown.command
|
||||
//command.context.here
|
||||
@@ -60,16 +87,8 @@ const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
//command.hashOnly && command.ownerOnly && args.length !== 0 && source.hash && source.owner
|
||||
// if (command.hashOnly && args.length === 0) throw new CommandError({ translate: 'Please provide a hash or a OwnerHash', color: 'red' })
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
|
||||
const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"})
|
||||
const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"})
|
||||
|
||||
bot.console.hash = function (error, source) {
|
||||
console.log()
|
||||
}//<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hash}\x1b[0m]`
|
||||
bot.console.ownerHash = function (error, source) {
|
||||
console.log(`` )// actual hash
|
||||
//<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] ` + `[\x1b[0m\x1b[92mHash\x1b[0m]: \x1b[0m\x1b[92mPlayer\x1b[0m: ${player}, \x1b[0m\x1b[92mUUID\x1b[0m:${uuid}, \x1b[0m\x1b[92mHash\x1b[0m:${bot.hash}\x1b[0m]`
|
||||
// actual hash
|
||||
//but look in hashing.js
|
||||
//im looking through chomensjs's command handler for reference
|
||||
//💀
|
||||
@@ -130,7 +149,7 @@ if (command.trustLevel > 0) {
|
||||
//ik that but why tf is it erroring
|
||||
|
||||
// wat the fard
|
||||
} // sus
|
||||
// sus
|
||||
|
||||
return command.execute({ bot, source, arguments: args })
|
||||
} catch (error) {
|
||||
@@ -146,7 +165,7 @@ if (command.trustLevel > 0) {
|
||||
if (error instanceof CommandError) source.sendError(error._message)
|
||||
//
|
||||
// else source.sendError({ text:String(error.stack), color:'red' })
|
||||
else source.sendError({ translate: 'command.failed', color:'red', hoverEvent: { action: 'show_text', contents: String(error.stack) } })
|
||||
else source.sendError({ translate: 'A Error has occured because the bot shot itself 🔫', color:'red', hoverEvent: { action: 'show_text', contents: String(error.stack) } })
|
||||
if (source.sources.discord) {
|
||||
source.sendError(error)
|
||||
}
|
||||
@@ -186,19 +205,10 @@ for (const filename of fs.readdirSync(path.join(__dirname, '../commands'))) {
|
||||
} catch (error) {
|
||||
console.error('Failed to load command', filename, ':', error)
|
||||
}
|
||||
bot.commandManager.reload
|
||||
const amongerus = Object.keys(require.cache).filter(r => r.startsWith(path.resolve(`../commands`)));
|
||||
bot.commandManager.fileReload = amongerus.forEach(f => { // I guess too mabe forEach
|
||||
console.log(`Unloaded: ${f}`);
|
||||
delete require.cache[f];
|
||||
|
||||
bot.commandManager.register(command)
|
||||
})
|
||||
|
||||
|
||||
if (process.env['anti-skid'] !== 'amogus is sus') {
|
||||
process.exit(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
|
||||
+7
-5
@@ -1,5 +1,5 @@
|
||||
const CommandSource = require('../CommandModules/command_source')
|
||||
//const log = require('../logger')
|
||||
//const logger = require('../util/logger')
|
||||
|
||||
function inject (bot, options, context, source) {
|
||||
|
||||
@@ -175,15 +175,17 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
// const logtag = (JSON.stringify({"text":"[LOGS]", "color":"#00FF00"}))
|
||||
|
||||
|
||||
const time2 = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"})
|
||||
const date2 = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"})
|
||||
|
||||
//const prefix = `<${time2} ${date2}> [${bot.options.host}:${bot.options.port}] `
|
||||
if (!bot.options.input) return
|
||||
if (!bot.options.console) return
|
||||
bot.console.logs(`${ansi}`)
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}//const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `
|
||||
}
|
||||
module.exports = inject
|
||||
/*const message = `[${moment().format('DD/MM/YY HH:mm:ss')} ${prefix}§r] [${bot.server.host}] `
|
||||
|
||||
+27
-3
@@ -24,7 +24,10 @@ function inject (bot, options) {
|
||||
}
|
||||
|
||||
client.on('ready', (context) => {
|
||||
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
|
||||
//setMaxListeners(Infinity)
|
||||
client.setMaxListeners(25)
|
||||
|
||||
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
|
||||
bot.discord.channel.send(`\`\`\`\nStarting ${process.env["buildstring"]}......\n\`\`\``)
|
||||
bot.discord.channel.send(`\`\`\`\nFoundation: ${process.env["FoundationBuildString"]}\n\`\`\``)
|
||||
bot.discord.channel.send(`\`\`\`\nSuccessfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}\n\`\`\``)
|
||||
@@ -170,14 +173,35 @@ function inject (bot, options) {
|
||||
}
|
||||
|
||||
client.on('messageCreate', messageCreate)
|
||||
bot.on('error', (error, reason, data) => {
|
||||
|
||||
bot.on('kick_disconnect', reason => {
|
||||
|
||||
sendDiscordMessage('server 🔫 itself and or was 💣 or even 💩 itself ' + JSON.stringify(reason))
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
})
|
||||
bot.on('disconnect', reason => {
|
||||
|
||||
sendDiscordMessage(JSON.stringify(reason))
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
})
|
||||
bot.on('end', reason => {
|
||||
|
||||
sendDiscordMessage(JSON.stringify(reason))
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
})
|
||||
bot.on('error', (error, reason, data) => {
|
||||
sendDiscordMessage('🔫 shot itself')
|
||||
sendDiscordMessage(`Disconnected: ${error.stack}`)
|
||||
|
||||
//sendDiscordMessage(reason)
|
||||
|
||||
})
|
||||
|
||||
/*bot.on('end', (reason, event) => {
|
||||
sendDiscordMessage('event:' + event)
|
||||
sendDiscordMessage('Reason:' + util.inspect(reason))
|
||||
|
||||
+78
-10
@@ -15,15 +15,19 @@ function inject(bot) {
|
||||
owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerkey).digest('hex').substring(0, 16)
|
||||
bot.hash = hash
|
||||
bot.owner = owner
|
||||
|
||||
}, 2000)
|
||||
|
||||
function update() {
|
||||
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + trustedkey).digest('hex').substring(0, 16)
|
||||
owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerkey).digest('hex').substring(0, 16)
|
||||
bot.hash = hash
|
||||
bot.owner = owner
|
||||
}
|
||||
|
||||
//this should work right?
|
||||
|
||||
/*
|
||||
bot.discord.channel = client.channels.cache.get(options.discord.channelId)
|
||||
*/
|
||||
// ok
|
||||
/*
|
||||
bot.on('end', () => {
|
||||
@@ -31,13 +35,77 @@ function inject(bot) {
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
let _hash = generateHash()
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
|
||||
const time = new Date().toLocaleTimeString("en-US", {timeZone:"America/CHICAGO"})
|
||||
const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"})
|
||||
|
||||
//bot.hashing = ''
|
||||
bot.hashing = {
|
||||
_hash: crypto.randomBytes(4).toString('hex').substring(0,16),
|
||||
//const key = process.env['FNFBoyfriendBotX_key']
|
||||
get hash () { return this._hash },
|
||||
set hash (value) {
|
||||
this._hash = value
|
||||
this.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
|
||||
},
|
||||
//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
|
||||
generateHash () {
|
||||
return crypto.randomBytes(4).toString('hex').substring(0, 16)
|
||||
},
|
||||
|
||||
updateHash () {
|
||||
this.hash = this.generateHash()
|
||||
}
|
||||
}
|
||||
|
||||
bot.discord.client?.on('ready', () => {
|
||||
//bot.discord.client?.setMaxListeners(25)
|
||||
bot.hashing.discordChannel = bot.discord.client.channels.cache.get('1188677777336057987')
|
||||
//bot.hashing.discordChannel?.send()
|
||||
bot.hashing.discordChannel?.send('```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
|
||||
})// + bot.hashing.hash
|
||||
}//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
|
||||
//nvm what?
|
||||
function generateHash () {
|
||||
return crypto.randomBytes(4).toString('hex')
|
||||
}
|
||||
module.exports = inject
|
||||
/* const interval = setInterval(() => {
|
||||
const normalKey = process.env['chomensjs_key']
|
||||
const ownerHashKey = process.env['chomensjs_owner_key']
|
||||
bot.hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + normalKey).digest('hex').substring(0, 16)
|
||||
bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + ownerHashKey).digest('hex').substring(0, 16)
|
||||
}, 2000)
|
||||
bot.on('end', () => {
|
||||
clearInterval(interval)
|
||||
|
||||
|
||||
|
||||
|
||||
/* const crypto = require('crypto')
|
||||
|
||||
let _hash = generateHash()
|
||||
|
||||
function inject (bot) {
|
||||
bot.hashing = {
|
||||
_hash: crypto.randomBytes(4).toString('hex').substring(0,16),
|
||||
//const key = process.env['FNFBoyfriendBotX_key']
|
||||
get hash () { return this._hash },
|
||||
set hash (value) {
|
||||
this._hash = value
|
||||
this.discordChannel?.send('```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ${value}` + '\n```')
|
||||
},
|
||||
//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
|
||||
generateHash () {
|
||||
return crypto.randomBytes(4).toString('hex').substring(0, 16)
|
||||
},
|
||||
|
||||
updateHash () {
|
||||
this.hash = this.generateHash()
|
||||
}
|
||||
}
|
||||
|
||||
bot.discord.client?.on('ready', () => {
|
||||
bot.hashing.discordChannel = bot.discord.client.channels.cache.get('1120122720001208390')
|
||||
bot.hashing.discordChannel?.send('```ansi\n Hash for server ' + `${bot.options.host}:${bot.options.port}: ` + bot.hashing.hash + '\n```')
|
||||
})// + bot.hashing.hash
|
||||
}//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
|
||||
//nvm what?
|
||||
function generateHash () {
|
||||
return crypto.randomBytes(4).toString('hex')
|
||||
}
|
||||
*/
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ function inject (bot) {
|
||||
noteIndex = 0
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk
|
||||
}
|
||||
if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5.0.0 §8Build:300 Codename:§8Mono§fchrome")
|
||||
if (process.env["buildstring"] !== "§5FridayNightFunkin§bBoyfriend§4Bot §8v5.0.3 §8Build:325")
|
||||
{
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ function inject (bot) {
|
||||
target.removePlayer = entry.removePlayer
|
||||
}
|
||||
}//
|
||||
if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.0 Build:200')
|
||||
if (process.env['FoundationBuildString'] !== 'Ultimate Foundation v2.0.3 Build:225')
|
||||
{
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@@ -3,14 +3,15 @@ const mc = require('minecraft-protocol')
|
||||
function reconnect (bot, options) {
|
||||
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
|
||||
|
||||
bot.on('end', () => {
|
||||
bot.on('end', (reason) => {
|
||||
if (bot.reconnectDelay < 0) return
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
const client = options.client ?? mc.createClient(options)
|
||||
bot._client = client
|
||||
bot.emit('init_client', client)
|
||||
|
||||
}, bot.reconnectDelay)
|
||||
})
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ let unmuted = false
|
||||
else if (stringmessage === "You have been unmuted.") unmuted = false
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_ENABLED_MESSAGE)) commandSpyEnabled = true
|
||||
else if (util.isDeepStrictEqual(message, COMMANDSPY_DISABLED_MESSAGE)) commandSpyEnabled = false
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix &4${bot.options.commands.prefix}&8]`) {
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix &4${bot.options.commands.MainPrefix}&8]`) {
|
||||
prefix = true
|
||||
return
|
||||
}
|
||||
@@ -110,7 +110,7 @@ let unmuted = false
|
||||
if (!commandSpyEnabled && bot.options.selfcare.cspy) bot.command('commandspy:commandspy on')
|
||||
else if (!vanished && bot.options.selfcare.vanished) bot.core.run(`essentials:vanish ${bot.username} enable`)
|
||||
else if (unmuted && bot.options.selfcare.unmuted) bot.core.run(`essentials:mute ${bot.uuid}`)
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix &4${bot.options.commands.prefix}&8]`)
|
||||
else if (!prefix && bot.options.selfcare.prefix) bot.command(`prefix &8[&bPrefix &4${bot.options.commands.MainPrefix}&8]`)
|
||||
else if (gameMode !== 1 && bot.options.selfcare.gmc) bot.command('gamemode creative @s[type=player]')
|
||||
else if (!skin && bot.options.selfcare.skin) bot.command('skin Parker2991')
|
||||
else if (!username && bot.options.selfcare.username) bot.command(`username ${bot.username}`)
|
||||
|
||||
Generated
+30
-13
@@ -15,8 +15,8 @@
|
||||
"dockerode": "^4.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"isolated-vm": "^4.6.0",
|
||||
"minecraft-data": "^3.49.1",
|
||||
"minecraft-protocol": "^1.44.0",
|
||||
"minecraft-data": "^3.53.0",
|
||||
"minecraft-protocol": "^1.45.0",
|
||||
"minecraft-protocol-forge": "^1.0.0",
|
||||
"mineflayer": "^4.14.0",
|
||||
"mineflayer-cmd": "^1.1.3",
|
||||
@@ -30,6 +30,7 @@
|
||||
"readline": "^1.3.0",
|
||||
"sharp": "^0.32.6",
|
||||
"urban-dictionary": "^3.0.2",
|
||||
"urban-dictionary-client": "^3.1.0",
|
||||
"uuid-by-string": "^4.0.0",
|
||||
"vec3": "^0.1.8",
|
||||
"vm2": "^3.9.19",
|
||||
@@ -1223,9 +1224,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minecraft-data": {
|
||||
"version": "3.49.1",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.49.1.tgz",
|
||||
"integrity": "sha512-d6Off8xi/aLpAnzGsKKYxmStq9rPaR0HRHawUSvdpQ0WXDr02yGhJzTm9r2eAInayIzshxt624w1r5Z9NAGReQ=="
|
||||
"version": "3.53.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.53.0.tgz",
|
||||
"integrity": "sha512-35+XuLCgzG0xvXKaN2huF5EpUXjjW7HE6fRg1bz4lwI+7sjl4DDQRnRTvdJq3gGrNT8lkWvtBf71/NnXvhdh+Q=="
|
||||
},
|
||||
"node_modules/minecraft-folder-path": {
|
||||
"version": "1.2.0",
|
||||
@@ -1233,9 +1234,9 @@
|
||||
"integrity": "sha512-qaUSbKWoOsH9brn0JQuBhxNAzTDMwrOXorwuRxdJKKKDYvZhtml+6GVCUrY5HRiEsieBEjCUnhVpDuQiKsiFaw=="
|
||||
},
|
||||
"node_modules/minecraft-protocol": {
|
||||
"version": "1.44.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.44.0.tgz",
|
||||
"integrity": "sha512-sYu4fFzUKt3spPG5tAdkaB9sNQPT0sV6fyS0sS7/nxdzFfjmLhF6BLNC+32ieK4/MhgNyHtH6xusD0Bi0Roq9w==",
|
||||
"version": "1.45.0",
|
||||
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.45.0.tgz",
|
||||
"integrity": "sha512-vnw78FShBljUziQY8dNElJHJvQIscEPa97wEOiykOodUJKQiBDWB3ZETAd0CYzEFapS7SAlEiNuqFgJdG9o5aQ==",
|
||||
"dependencies": {
|
||||
"@types/readable-stream": "^4.0.0",
|
||||
"aes-js": "^3.1.2",
|
||||
@@ -1244,12 +1245,12 @@
|
||||
"endian-toggle": "^0.0.0",
|
||||
"lodash.get": "^4.1.2",
|
||||
"lodash.merge": "^4.3.0",
|
||||
"minecraft-data": "^3.37.0",
|
||||
"minecraft-data": "^3.53.0",
|
||||
"minecraft-folder-path": "^1.2.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-rsa": "^0.4.2",
|
||||
"prismarine-auth": "^2.2.0",
|
||||
"prismarine-nbt": "^2.0.0",
|
||||
"prismarine-nbt": "^2.5.0",
|
||||
"prismarine-realms": "^1.2.0",
|
||||
"protodef": "^1.8.0",
|
||||
"readable-stream": "^4.1.0",
|
||||
@@ -4532,9 +4533,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prismarine-nbt": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.2.1.tgz",
|
||||
"integrity": "sha512-Mb50c58CPnuZ+qvM31DBa08tf9UumlTq1LkvpMoUpKfCuN05GZHTqCUwER3lxTSHLL0GZKghIPbYR/JQkINijQ==",
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.5.0.tgz",
|
||||
"integrity": "sha512-F0/8UAa9SDDnAGrBYqZc4nG8h2zj5cE2eAJU5xlDR/IsQQ3moVxkOjE3h3nMv6SbvZrvAcgX7waA/nd9LLHYdA==",
|
||||
"dependencies": {
|
||||
"protodef": "^1.9.0"
|
||||
}
|
||||
@@ -5113,6 +5114,22 @@
|
||||
"node": ">=14.15.1"
|
||||
}
|
||||
},
|
||||
"node_modules/urban-dictionary-client": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/urban-dictionary-client/-/urban-dictionary-client-3.1.0.tgz",
|
||||
"integrity": "sha512-TGhBbhM7QzjFR+mRQ5k0AAoOZnUcTldAcpUNekXL9hH/GrOstRx1EyaBIbEE5RhM2oQGsY+TUBHPfB0M1JOi7w==",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1"
|
||||
}
|
||||
},
|
||||
"node_modules/urban-dictionary-client/node_modules/axios": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
|
||||
+3
-2
@@ -10,8 +10,8 @@
|
||||
"dockerode": "^4.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"isolated-vm": "^4.6.0",
|
||||
"minecraft-data": "^3.49.1",
|
||||
"minecraft-protocol": "^1.44.0",
|
||||
"minecraft-data": "^3.53.0",
|
||||
"minecraft-protocol": "^1.45.0",
|
||||
"minecraft-protocol-forge": "^1.0.0",
|
||||
"mineflayer": "^4.14.0",
|
||||
"mineflayer-cmd": "^1.1.3",
|
||||
@@ -25,6 +25,7 @@
|
||||
"readline": "^1.3.0",
|
||||
"sharp": "^0.32.6",
|
||||
"urban-dictionary": "^3.0.2",
|
||||
"urban-dictionary-client": "^3.1.0",
|
||||
"uuid-by-string": "^4.0.0",
|
||||
"vec3": "^0.1.8",
|
||||
"vm2": "^3.9.19",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const currentDate = new Date();
|
||||
const timestamp = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')}`;
|
||||
const logFolder = path.join(__dirname, 'logs');
|
||||
const logFileName = `${timestamp}.log`;
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
|
||||
|
||||
function log (message, toFile = true, toConsole = true) {
|
||||
const now = new Date().toLocaleString();
|
||||
|
||||
const toWrite = `[${now}] ${message}`
|
||||
|
||||
if (toFile) logStream.write(toWrite + '\n');
|
||||
if (toConsole) console.log(toWrite);
|
||||
};
|
||||
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
//ohio
|
||||
module.exports = log
|
||||
Reference in New Issue
Block a user