mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-12-03 15:45:38 -05:00
FNFBoyfriendBot v5.0.7b
This commit is contained in:
@@ -21,7 +21,7 @@ let tag = 'bruhify'
|
||||
bot.chat(ChatMessage.fromNotch(component).toMotd().replaceAll('§', '&'))
|
||||
startHue = (startHue + increment) % 360
|
||||
}else{
|
||||
bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(component)}`)
|
||||
bot.core.run(`minecraft:title @a title ${JSON.stringify(component)}`)
|
||||
|
||||
startHue = (startHue + increment) % 360
|
||||
}
|
||||
|
||||
+5
-6
@@ -22,7 +22,7 @@ function inject (bot) {
|
||||
ChatMessage = loadPrismarineChat(registry)
|
||||
})
|
||||
|
||||
bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser]
|
||||
bot.chatParsers = [kaboomChatParser, chipmunkmodChatParser, chipmunkmodblackilykatverChatParser, typetextChatParser, typeemotetextChatParser, creayunChatParser]
|
||||
|
||||
bot.on('packet.profileless_chat', packet => {
|
||||
const message = tryParse(packet.message)
|
||||
@@ -117,9 +117,8 @@ function inject (bot) {
|
||||
bitset[2] = (acc >> 16) & 0xFF
|
||||
|
||||
bot._client.write('chat_message', {
|
||||
message,
|
||||
timestamp: BigInt(Date.now()),
|
||||
|
||||
message: message.substring(0, 256),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: bitset
|
||||
@@ -131,7 +130,7 @@ function inject (bot) {
|
||||
|
||||
bot.command = command => {
|
||||
bot._client.write('chat_command', {
|
||||
command,
|
||||
command: command.substring(0, 256),
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
argumentSignatures: [],
|
||||
@@ -145,4 +144,4 @@ function inject (bot) {
|
||||
bot.tellraw = (message, selector = '@a') => bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message)) // ? Should this be here?
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
module.exports = inject
|
||||
@@ -19,16 +19,16 @@ function chat_command_handler(bot) {
|
||||
lifes sus
|
||||
*/
|
||||
const source = new CommandSource(data.sender,{ discord: false, console: false,matrix:false },);
|
||||
source.sendFeedback = (message) => {
|
||||
bot.sendFeedback = (message) => {
|
||||
const prefix = {
|
||||
translate: "%s%s%s \u203a ",
|
||||
translate: "%s%s%s ",
|
||||
bold: false,
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{
|
||||
color: "dark_purple",
|
||||
text: "FNF",
|
||||
bold: true,
|
||||
bold: false,
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: `${process.env["buildstring"]}\n${process.env["FoundationBuildString"]}`,
|
||||
@@ -38,9 +38,9 @@ function chat_command_handler(bot) {
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
color: "#00FFFF",
|
||||
color: "#2FE0E0",
|
||||
text: "Boyfriend",
|
||||
bold: true,
|
||||
bold: false,
|
||||
clickEvent: bot.options.discord.invite
|
||||
? { action: "open_url", value: bot.options.discord.invite }
|
||||
: undefined,
|
||||
@@ -50,9 +50,9 @@ function chat_command_handler(bot) {
|
||||
},
|
||||
},
|
||||
{
|
||||
color: "dark_red",
|
||||
color: "#D90003",
|
||||
text: "Bot",
|
||||
bold: true,
|
||||
bold: false,
|
||||
clickEvent: bot.options.discord.invite
|
||||
? { action: "open_url", value: "https://code.chipmunk.land" }
|
||||
: undefined,
|
||||
@@ -64,10 +64,17 @@ function chat_command_handler(bot) {
|
||||
|
||||
{ color: "green", text: command.split(" ")[0] },
|
||||
],
|
||||
};
|
||||
};
|
||||
if (bot.options.useChat) {
|
||||
bot.tellraw([message]);
|
||||
} else {
|
||||
bot.tellraw(["", prefix, message]);
|
||||
}
|
||||
|
||||
bot.tellraw(["", prefix, message]);
|
||||
};
|
||||
};
|
||||
bot.sendError = (message) => {
|
||||
bot.sendFeedback([{ text: '', color: `red` }, message], false)
|
||||
}
|
||||
try{
|
||||
|
||||
ratelimit++
|
||||
@@ -75,27 +82,18 @@ try{
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 3) { // ,.
|
||||
if(!bot.options.Core.enabled){
|
||||
bot.chat('&4You are using commands to fast!')
|
||||
}else {
|
||||
source.sendFeedback({text:'You are using commands to fast!',color:'dark_red'})
|
||||
bot.sendFeedback({text:'You are using commands to fast!',color:'dark_red'})
|
||||
// this isn't blocking running the command you know that right?
|
||||
}
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command);
|
||||
}//oh real
|
||||
|
||||
//can i change the variable name so its name isnt confusing?
|
||||
}catch(e){
|
||||
}catch(e){
|
||||
console.log(e.stack)
|
||||
|
||||
|
||||
|
||||
//then where to move this?
|
||||
|
||||
|
||||
};
|
||||
});
|
||||
})//
|
||||
}
|
||||
module.exports = chat_command_handler;
|
||||
module.exports = chat_command_handler;
|
||||
@@ -3,8 +3,8 @@ async function command_core (bot, options) {
|
||||
bot.core = {
|
||||
// what you think im doing? look at line 17
|
||||
area: {
|
||||
start: bot.Core.area.start ?? { x: 0, y: 0, z: 0 },
|
||||
end: bot.Core.area.end ?? { x: 15, y: 0, z: 15 }
|
||||
start: /*bot.Core.area.start, ??*/ { x: 0, y: 0, z: 0 },
|
||||
end: /*bot.Core.area.end, ??*/ { x: 15, y: 0, z: 15 }
|
||||
},
|
||||
position: null,
|
||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||
@@ -62,16 +62,16 @@ async function command_core (bot, options) {
|
||||
run (command) {
|
||||
const location = bot.core.currentBlock()
|
||||
if (!location) return
|
||||
if (!bot.options.Core.enabled) {
|
||||
bot.command(command.substring(0,255))
|
||||
}else{
|
||||
if (bot.options.useChat) {
|
||||
bot.command(command)
|
||||
}else{
|
||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 })
|
||||
|
||||
bot.core.incrementCurrentBlock()
|
||||
|
||||
// added .substring(0, 32767) so it won't kick the bot if the command is too long.
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
/*
|
||||
bot.on('parsed_message', data => {
|
||||
@@ -83,7 +83,7 @@ bot.command(command.substring(0,255))
|
||||
} return
|
||||
})
|
||||
*/
|
||||
if (!bot.options.Core.enabled) return
|
||||
if (bot.options.useChat) return
|
||||
bot.on('move', () => {
|
||||
bot.core.move(bot.position)
|
||||
//setTimeout(() => bot.core.run('say hi'), 100)
|
||||
|
||||
@@ -13,47 +13,32 @@ const {EmbedBuilder } = require('discord.js')
|
||||
const player = source?.player?.profile?.name;
|
||||
const uuid = source?.player?.uuid;
|
||||
try {
|
||||
if(source.sources.console && !source.sources.discord){
|
||||
if(source.sources.console && !source?.sources?.discord){
|
||||
if (!command || !command.execute) {
|
||||
bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.options.Console.prefix}help" for help`,color:'dark_red'})
|
||||
bot.console.warn({text:`Unknown Command ${commandName}. type "${bot.Console.prefix}help" for help`,color:'dark_red'})
|
||||
}
|
||||
}else if(source.sources.discord && !source.sources.console) {
|
||||
}else if (source?.sources?.discord && !source.sources.console) {
|
||||
if (!command || !command.execute) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#FF0000')
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${bot.Commands.colors.discord.error}`)
|
||||
.setTitle('Unknown Command')
|
||||
.setDescription(`Unknown Command ${commandName}. type "${bot.discord.commandPrefix}help" for help`)
|
||||
bot.discord.channel.send({ embeds: [Embed] })
|
||||
.setDescription(`Unknown Command ${commandName}. type "${bot.Discord.commandPrefix}help" for help`)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}else if(!source.sources.discord && !source.sources.console) {
|
||||
if (!bot.options.Core.enabled){
|
||||
if (!command || !command.execute) {
|
||||
throw new CommandError(`Unknown command ${commandName}. Type "${bot.Commands.prefixes[0]}help" for help`)
|
||||
}
|
||||
}else{
|
||||
}else if(!source?.sources?.discord && !source.sources.console) {
|
||||
|
||||
if (!command || !command.execute) { // bot.options.command.prefixes[0]
|
||||
throw new CommandError({ // sus
|
||||
translate: `Unknown command %s. Type "${bot.Commands.prefixes[0]}help" for help or click on this for the command`,
|
||||
/*
|
||||
with: [commandName],
|
||||
clickEvent: 'https://discord.gg'
|
||||
|
||||
? {/
|
||||
*/
|
||||
with: [commandName],
|
||||
clickEvent:'https://discord.gg'
|
||||
? {
|
||||
action: "suggest_command",
|
||||
value: `${bot.Commands.prefixes[0]}help`,
|
||||
}
|
||||
: undefined,
|
||||
}); //ohio
|
||||
throw new CommandError(bot.getMessageAsPrismarine([{ // sus
|
||||
translate: `command.unknown.command`},{text:'\n'},{text:`${commandName} `},{translate:"command.context.here"}])?.toMotd(require('../util/language/lolus.json')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const event = bot?.discord?.Message
|
||||
|
||||
const roles = event?.member?.roles?.cache
|
||||
if (command?.trustLevel === -1) {
|
||||
throw new CommandError('this command has been disabled!')
|
||||
}
|
||||
if (command?.trustLevel > 0) {
|
||||
|
||||
|
||||
@@ -63,104 +48,102 @@ const hash = `${args[0]}`
|
||||
if(args.length === 0 && bot.hash && bot.owner && bot.hashing.hash) throw new CommandError([{text:'Please provide an ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or an ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if (hash !== bot.hash && hash !== bot.owner && hash !== bot.hashing.hash) throw new CommandError([{text:'Invalid ',color:'gray'},{text:'Trusted ',color:'dark_purple'},{text:'hash or Invalid ',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
|
||||
} else if (command.trustLevel === 1 && source.sources.discord && !source.sources.console) {
|
||||
} else if (command.trustLevel === 1 && source?.sources?.discord && !source.sources.console) {
|
||||
|
||||
|
||||
const hasRole = roles?.some(role => role.name === 'trusted' || role.name === 'FNFBoyfriendBot Owner')
|
||||
const hasRole = roles?.some(role => role.name === `${bot.validation.discord.roles.trusted}` || role.name === `${bot.validation.discord.roles.owner}`)
|
||||
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted!' })
|
||||
}
|
||||
bot?.hashing?.updateHash();
|
||||
|
||||
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();
|
||||
if (args[0] === bot.hash) {
|
||||
bot.console.info({ text: `Player ${player} UUID: ${uuid} Hash:${bot.hash}`, color: 'white' })
|
||||
} else if (args[0] === bot.owner) {
|
||||
bot.console.ownerHash();
|
||||
}
|
||||
bot.console.info({ text: `Player ${player} UUID: ${uuid} Hash:${bot.owner}`, color: 'white' })
|
||||
}
|
||||
if(command?.trustLevel === 2 && !source?.sources?.discord && !source?.sources?.console){
|
||||
const owner = `${args[0]}`
|
||||
|
||||
if(args.length === 0 && bot.owner) throw new CommandError([{text:'Please provide a ',color:'red',color:'gray'},{text:'Owner ',color:'dark_red'},{text:'hash',color:'gray'}])
|
||||
if(owner === bot.hash && owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}])
|
||||
if(owner === bot.hash || owner === bot.hashing.hash) throw new CommandError([{text:"THATS A ",color:'gray'},{text:'TRUSTED ',color:'dark_purple'},{text:'HASH AFAIK',color:'gray'}])
|
||||
if (owner !== bot.owner) throw new CommandError([{text:"Invalid ",color:'gray'},{text:'Owner ',color:'dark_red'},{text:'Hash',color:'gray'}])
|
||||
|
||||
} else if (command.trustLevel === 2 && source.sources.discord && !source.sources.console) {
|
||||
} else if (command?.trustLevel === 2 && source?.sources?.discord && !source?.sources?.console) {
|
||||
// const events = source.discordMessageEvent
|
||||
|
||||
// const roless = events?.member?.roles?.cache
|
||||
|
||||
const hasRole = roles?.some(role => role.name === 'FNFBoyfriendBot Owner')
|
||||
const hasRole = roles?.some(role => role.name === `${bot.validation.discord.roles.owner}`)
|
||||
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are the Owner!' })
|
||||
if (!hasRole) throw new CommandError({ translate: 'You are not the Owner!' })
|
||||
}
|
||||
if (command.trustLevel === 3 && !source?.sources?.console)
|
||||
|
||||
throw new CommandError({translate: "This command can only be executed via console",color: "blue",});
|
||||
}
|
||||
|
||||
if(source?.sources?.discord && !source?.sources?.matrix && !source.sources.console){
|
||||
if (!command?.discordExecute && command) {
|
||||
bot.discord.Message.reply('This command is not supported in discord!')
|
||||
}else{
|
||||
return command?.discordExecute({bot, source,arguments: args})
|
||||
}
|
||||
}else{
|
||||
return command?.execute({ bot, source, arguments: args });
|
||||
} catch (error) {
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
bot.console.warn(error.stack);
|
||||
if (!bot.options.Core.enabled){
|
||||
if (error instanceof CommandError)
|
||||
bot.chat(bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&'))
|
||||
else bot.chat(bot.getMessageAsPrismarine('an error has occured please check console')?.toMotd().replaceAll('§','&'))
|
||||
} else if(!source.sources.discord && !source.sources.console) {
|
||||
if (error instanceof CommandError)
|
||||
source.sendError(error._message)
|
||||
else source.sendError({
|
||||
translate: "An Error has occured because the bot shot itself 🔫",
|
||||
color: "red",
|
||||
hoverEvent: { action: "show_text", contents: String(error.stack) },
|
||||
});
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
|
||||
else if (source.sources.discord && !source.sources.console) {
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
/* if (source.sources.discord) {
|
||||
//if (error instanceof CommandError)
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor('#FF0000')
|
||||
.setTitle('Uh oh i went to get the 🥛 give me :cancer: years to come back with it')
|
||||
.setDescription(`\`\`\`${error}\`\`\``)
|
||||
bot.discord.channel.send({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
if (error instanceof CommandError)
|
||||
Embed
|
||||
.setColor(`${bot.Commands.colors.discord.error}`)
|
||||
.setTitle(`${command?.name} Command`)
|
||||
.setDescription(`\`\`\`${error._message}\`\`\``)
|
||||
bot?.discord?.Message?.reply({ embeds: [Embed] })
|
||||
} else {
|
||||
if (error instanceof CommandError)
|
||||
bot.sendError(error._message)
|
||||
else bot.sendError({
|
||||
translate: "An Error has occured because the bot shot itself 🔫",
|
||||
color: `${bot.Commands.colors.error}`,
|
||||
hoverEvent: { action: "show_text", contents: String(error.stack) },
|
||||
|
||||
});
|
||||
console.warn(error.stack)
|
||||
}*/
|
||||
if (!source.sources.discord && !source.sources.console) {
|
||||
if (error instanceof CommandError)
|
||||
bot.sendError(error._message)
|
||||
else bot.sendError({
|
||||
translate: "An Error has occured because the bot shot itself 🔫",
|
||||
color: `${bot.Commands.colors.error}`,
|
||||
hoverEvent: { action: "show_text", contents: String(error.stack) },
|
||||
|
||||
});
|
||||
bot.console.warn(error.stack)
|
||||
} else if (source.source.discord && !source.sources.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${bot.Commands.colors.discord.error}`)
|
||||
.setTitle(`${command.name} Command`)
|
||||
.setDescription(`\`\`\`${error._message}\`\`\``)
|
||||
bot.discord.Message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
},
|
||||
executeString(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
|
||||
return this.execute(source, commandName, args)
|
||||
return this.execute(source, commandName, args)
|
||||
|
||||
},
|
||||
|
||||
|
||||
discordExecute(source, command) {
|
||||
const [commandName, ...args] = command.split(" ");
|
||||
|
||||
if (source?.sources?.discord && !source?.sources?.matrix && !source?.sources?.console) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
},
|
||||
register(command) {
|
||||
this.commands[command.name] = command;
|
||||
|
||||
@@ -168,6 +151,7 @@ return this.execute(source, commandName, args)
|
||||
command.aliases.map((a) => (this.commands[a] = command));
|
||||
}
|
||||
},
|
||||
|
||||
getCommand(name) {
|
||||
return this.commands[name];
|
||||
},
|
||||
|
||||
+25
-54
@@ -1,7 +1,11 @@
|
||||
const CommandSource = require("../CommandModules/command_source");
|
||||
const prismarine = require('prismarine-chat')('1.20.2')
|
||||
const moment = require('moment-timezone');
|
||||
//const time = moment().tz('america/chicago').format('hh:mm:ss a');
|
||||
//const date = moment().tz('america/chicago').format('MM/DD/YY')
|
||||
function Console(bot, options, context, source) {
|
||||
let ratelimit = 0
|
||||
|
||||
let ratelimit = 0
|
||||
bot.console = {
|
||||
readline: null,
|
||||
username: bot.username,
|
||||
@@ -30,41 +34,26 @@ function Console(bot, options, context, source) {
|
||||
if (line === ",kill") process.exit();
|
||||
if (line === ",reconnect") bot._client.end();
|
||||
|
||||
//probably gotta somehow have it get its username
|
||||
//tried that already didnt work just errored
|
||||
//profile or smh :shrug:
|
||||
// what does it have to be
|
||||
|
||||
|
||||
if (line.startsWith("")) {
|
||||
if(!bot.options.Core.enabled){
|
||||
if(bot.options.useChat){
|
||||
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
"echo " + line.substring(0),
|
||||
)
|
||||
}else {
|
||||
)
|
||||
} else {
|
||||
return bot.commandManager.executeString(
|
||||
bot.console.source,
|
||||
"console " + line.substring(0),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
//bot.commandManager.executeString(bot.console.source, line)
|
||||
});
|
||||
|
||||
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",
|
||||
});
|
||||
|
||||
})
|
||||
// const source = context.source
|
||||
|
||||
const prefix = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `;
|
||||
|
||||
function log(...args) {
|
||||
rl.output.write("\x1b[2K\r");
|
||||
@@ -73,17 +62,17 @@ function Console(bot, options, context, source) {
|
||||
}
|
||||
|
||||
bot.console.warn = function (error) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' WARN',color:'yellow'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
bot.console.error = function (error) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' ERROR',color:'dark_red'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(error)?.toAnsi());
|
||||
};
|
||||
|
||||
bot.console.info = function (message) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi());
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' INFO',color:'green'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + prismarine.fromNotch(message)?.toAnsi());
|
||||
};
|
||||
bot.console.log = function (message, ansi) {
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'dark_purple'},{text:`${date}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message);
|
||||
log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${ moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toAnsi() + message);
|
||||
};
|
||||
|
||||
|
||||
@@ -119,7 +108,7 @@ log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'d
|
||||
bot.console.source.sendFeedback = (message) => {
|
||||
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi();
|
||||
if (!bot.options.Console) return;
|
||||
// if (!bot.options.Console) return;
|
||||
bot.console.info(ansi);
|
||||
};
|
||||
|
||||
@@ -130,43 +119,25 @@ log(prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${time} `,color:'d
|
||||
.getMessageAsPrismarine(data.contents)
|
||||
?.toString();
|
||||
if (plainMessage.includes("frog")) {
|
||||
bot.chat("Man I Love Frogs");
|
||||
bot.chat("frok :3");
|
||||
}
|
||||
return;
|
||||
});
|
||||
|
||||
bot.on("message", (message) => {
|
||||
function log(...args) {
|
||||
/*function log(...args) {
|
||||
rl.output.write("\x1b[2K\r");
|
||||
console.log(args.toString());
|
||||
rl._refreshLine();
|
||||
}
|
||||
const time = new Date().toLocaleTimeString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const prefixy = `<\x1b[0m\x1b[35m${time} \x1b[0m\x1b[96m${date}\x1b[0m> [${bot.options.host}:${bot.options.port}\x1b[0m] `;
|
||||
}*/
|
||||
|
||||
|
||||
bot.console.logs = function (message, ansi) {
|
||||
log(prefixy + `[\x1b[0m\x1b[33mLOGS\x1b[0m]: ` + message);
|
||||
};
|
||||
|
||||
|
||||
const lang = require(`../util/language/lolus.json`);
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang);
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString(lang);
|
||||
|
||||
const now = new Date().toLocaleString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const time2 = new Date().toLocaleTimeString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
const date2 = new Date().toLocaleDateString("en-US", {
|
||||
timeZone: "America/CHICAGO",
|
||||
});
|
||||
|
||||
|
||||
// if (!bot.options.Console.input) return;
|
||||
if (!bot.options.Console.enabled) return;
|
||||
|
||||
@@ -187,8 +158,8 @@ bot._client.end("Anti spam :3")
|
||||
bot.console.log(`${ansi}`);
|
||||
|
||||
// logger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
if (bot.console && bot.Console.filelogger) {
|
||||
bot.console.filelogger(`<${time} ${date}> [${bot.options.host}:${bot.options.port}] [LOGS]: ${string}`)
|
||||
if (bot.console && bot.Console.filelogging) {
|
||||
bot.console.filelogger(`${prismarine.fromNotch([{text:'<',color:'dark_gray'},{text:`${moment().tz('america/chicago').format('hh:mm:ss a')} `,color:'dark_purple'},{text:`${moment().tz('america/chicago').format('MM/DD/YY')}`,color:'#00FFFF'},{text:' LOGS',color:'gold'},{text:'>',color:'dark_gray'},{text:' [',color:'dark_gray'},{text:`${bot.options.serverName}`,color:'dark_gray'},{text:'] ',color:'dark_gray'}])?.toString()} ${string}`)
|
||||
|
||||
}//nothing is logging to the file
|
||||
|
||||
|
||||
+35
-79
@@ -1,6 +1,6 @@
|
||||
// TODO: Maybe move client creation elsewhere
|
||||
const { escapeMarkdown } = require('../util/escapeMarkdown')
|
||||
const { Client, GatewayIntentBits } = require('discord.js')
|
||||
const { Client, GatewayIntentBits,interaction } = require('discord.js')
|
||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
|
||||
|
||||
const CommandSource = require('../CommandModules/command_source')
|
||||
@@ -32,10 +32,11 @@ const ChatMessage = require('prismarine-chat')(bot.options.version)
|
||||
//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\`\`\``)
|
||||
bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port + '``')
|
||||
bot.discord.channel.send('``Version:' + bot.options.version +'``')
|
||||
bot.discord.channel.send('``Username:' + bot.options.username + '``')
|
||||
bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`)
|
||||
|
||||
//bot.discord.channel.send('``Server: '+ bot.options.host + ':'+ bot.options.port + '``')
|
||||
//bot.discord.channel.send('``Version:' + bot.options.version +'``')
|
||||
//bot.discord.channel.send('``Username:' + bot.options.username + '``')
|
||||
// bot.console.info(`Successfully logged into discord as ${bot.discord.client.user.username}#${bot.discord.client.user.discriminator}`)
|
||||
client.user.setPresence({
|
||||
activities: [{ name: `${bot.Discord.presence.name}`, type: bot.Discord.presence.type }],
|
||||
status: `${bot.Discord.presence.status}`
|
||||
@@ -58,29 +59,13 @@ status: `${bot.Discord.presence.status}`
|
||||
discordQueue = []
|
||||
}, 2000)
|
||||
//const ansi = bot.getMessageAsPrismarine(message).toAnsi(lang).replaceAll('``\`\`\u200b\ansi\n\`\`\u001b[9', '\u001b[3\n`\`\`')
|
||||
/* bot.on('message', (message) => {
|
||||
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
|
||||
const discordMsg = cleanMessage
|
||||
.replaceAll('@', '@\u200b')
|
||||
.replaceAll('http', 'http\u200b')
|
||||
.replaceAll('\u001b[9', '\u001b[3')
|
||||
|
||||
queue += '\n' + discordMsg
|
||||
})
|
||||
*/
|
||||
|
||||
|
||||
function sendDiscordMessage (message) {
|
||||
discordQueue.push(message)
|
||||
//bot.core.run(`minecraft:title @a actionbar ${JSON.stringify(message)}`)
|
||||
}
|
||||
|
||||
/*
|
||||
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
|
||||
const discordMsg = cleanMessage
|
||||
.replaceAll('@', '@\u200b')
|
||||
.replaceAll('http', 'http\u200b')
|
||||
.replaceAll('\u001b[9', '\u001b[3')
|
||||
*/
|
||||
//`\`\`\`\n \n\`\`\`
|
||||
|
||||
function sendComponent (message) {
|
||||
const lang = require(`../util/language/lolus.json`)
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(lang).replaceAll('```\u001b[9```' + '```\u001b[3```')// I have a function to fix ansi :shrug:
|
||||
@@ -107,6 +92,7 @@ status: `${bot.Discord.presence.status}`
|
||||
|
||||
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})//real
|
||||
try {
|
||||
if(!bot.options.discord.log) return
|
||||
sendDiscordMessage(fixansi(ansi.replaceAll('`', '`\u200b')))
|
||||
//'```ansi\n' + fixansi(ansi.replaceAll('\u200b').substring(0, 1983)) + '\n```'
|
||||
} catch (e) {
|
||||
@@ -124,16 +110,16 @@ status: `${bot.Discord.presence.status}`
|
||||
sendComponent(message)
|
||||
})
|
||||
|
||||
function messageCreate (message) {
|
||||
function messageCreate (message, source) {
|
||||
bot.discord.Message = message
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
if (message.author.id === bot.discord.client.user.id) return
|
||||
|
||||
if (message.channel.id !== bot.discord.channel.id) return
|
||||
//
|
||||
if (message.content.startsWith(bot.discord.commandPrefix)) { // TODO: Don't hardcode this
|
||||
const source = new CommandSource({ profile: { name: message?.member?.displayName } }, { discord: true, console: false }, false, message)
|
||||
|
||||
source.sendFeedback = message => {
|
||||
bot.sendFeedback = message => {
|
||||
sendComponent(message)
|
||||
//console.log(message.content)
|
||||
}
|
||||
@@ -141,10 +127,12 @@ bot.discord.Message = message
|
||||
bot.commandManager.executeString(source, message.content.substring(bot.discord.commandPrefix.length))
|
||||
return
|
||||
}
|
||||
if(!bot.options.Core.enabled){
|
||||
if(!bot.options.discord.log) return
|
||||
if(bot.options.useChat){
|
||||
bot.chat(`&8[&5FNF&bBoyfriend&4Bot &9Discord&8] ${message.member.displayName.replaceAll('\xa7', '&')}&f › ${message.content.replaceAll('\xa7', '&')}`)
|
||||
}else{
|
||||
bot.tellraw({
|
||||
|
||||
const tag = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
with: [
|
||||
{
|
||||
@@ -177,63 +165,31 @@ if(!bot.options.Core.enabled){
|
||||
hoverEvent: { action: 'show_text', contents: 'Click to join the discord' }
|
||||
},
|
||||
{ text: message?.member?.displayName },
|
||||
message.content
|
||||
]
|
||||
})
|
||||
|
||||
// AttachmentsComponent
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
if (message.attachments.size > 0) {
|
||||
message.attachments.forEach(Attachment => {
|
||||
bot.tellraw([tag,{ text:'' ? '[Attachment]' : '[Attachment]', hoverEvent: { action: 'show_text', contents: 'Click here to view attachment' }, clickEvent: { action: 'open_url', value: `${Attachment.url}` } }])
|
||||
})
|
||||
} else {
|
||||
bot.tellraw([tag,`${message.content}`]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
client.on('messageCreate', messageCreate)
|
||||
|
||||
// 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('packet.login', (data) => {
|
||||
// sendDiscordMessage(`Connecting to ${bot.options.host}:${bot.options.port}`)
|
||||
// })
|
||||
// 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)
|
||||
|
||||
// })
|
||||
|
||||
//
|
||||
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
// sendDiscordMessage("uncaught " + e.stack);
|
||||
});
|
||||
});
|
||||
|
||||
/*bot.on('end', (reason, event) => {
|
||||
sendDiscordMessage('event:' + event)
|
||||
sendDiscordMessage('Reason:' + util.inspect(reason))
|
||||
|
||||
})*/
|
||||
//client.on('end', reason => { bot.emit('end', reason)
|
||||
//client.on('keep_alive', ({ keepAliveId }) => {
|
||||
//bot.emit('keep_alive', { keepAliveId })
|
||||
|
||||
/* bot.console.info(
|
||||
`Disconnected from ${bot.server.host} (${event} event): ${util.inspect(reason)}`
|
||||
)
|
||||
channel.send(`Disconnected: \`${util.inspect(reason)}\``)
|
||||
*/
|
||||
function fixansi(message) {
|
||||
const ansilist = {
|
||||
"\x1B\[93m": "\x1B[33m", // Yellow
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
// * Not real hashing
|
||||
const crypto = require('crypto')
|
||||
const ownerkey = process.env['FNFBoyfriendBot_Owner_key']
|
||||
@@ -11,16 +10,16 @@ function hashgen (bot) {
|
||||
let hash
|
||||
let owner
|
||||
let interval = setInterval(() => {
|
||||
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)
|
||||
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.trustedKey).digest('hex').substring(0, 16)
|
||||
owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.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)
|
||||
hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.trusted).digest('hex').substring(0, 16)
|
||||
owner = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + bot.validation.keys.owner).digest('hex').substring(0, 16)
|
||||
bot.hash = hash
|
||||
bot.owner = owner
|
||||
|
||||
@@ -71,7 +70,7 @@ const date = new Date().toLocaleDateString("en-US", {timeZone:"America/CHICAGO"}
|
||||
|
||||
bot?.discord?.client?.on('ready', () => {
|
||||
//bot.discord.client?.setMaxListeners(25)
|
||||
bot.hashing.discordChannel = bot?.discord?.client?.channels?.cache?.get('1188677777336057987')
|
||||
bot.hashing.discordChannel = bot?.discord?.client?.channels?.cache?.get(`${bot.validation.discord.channel}`)
|
||||
//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
|
||||
|
||||
+70
-28
@@ -1,29 +1,71 @@
|
||||
function consolefilelogger (bot, options, message) {
|
||||
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'); // idfk
|
||||
const logFileName = `${timestamp}.txt`;//why is it not trying to find the folder tf
|
||||
// i am having a stroke from this
|
||||
if (!bot.Console.filelogging) return
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it
|
||||
fs.mkdirSync(logFolder);//idfk
|
||||
}//oh wait
|
||||
} catch (e) {} // prevent it from throwing a ohio exception mabe mabe
|
||||
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
|
||||
const toWrite = `${message}`//wtf
|
||||
if (!bot.Console.filelogging) return // instead of using bot why not just use options cause you already defined it
|
||||
|
||||
// if (toFile) logStream.write(toWrite + '\n');
|
||||
|
||||
bot.console.filelogger = function (message) {//.
|
||||
logStream.write(message + '\n'); // toFile is not defined
|
||||
};
|
||||
//if (toConsole) console.log(toWrite);
|
||||
};//tf
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createGzip } = require("zlib");
|
||||
|
||||
function consolefilelogger(bot, options, message) {
|
||||
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 = "latest.log";
|
||||
const logFilePath = path.join(logFolder, logFileName);
|
||||
const logStream = fs.createWriteStream(logFilePath, { flags: "a" });
|
||||
|
||||
if (!bot.Console.filelogging) return;
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) {
|
||||
fs.mkdirSync(logFolder);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Unable to create log folder: ${e}`);
|
||||
}
|
||||
|
||||
function compressFile(input, output) {
|
||||
const plainOutput = output.slice(0, -3);
|
||||
|
||||
fs.renameSync(input, plainOutput);
|
||||
const gzip = createGzip();
|
||||
fs.createReadStream(plainOutput)
|
||||
.pipe(gzip)
|
||||
.pipe(fs.createWriteStream(output + ".tmp"))
|
||||
.once("finish", () => {
|
||||
fs.unlinkSync(plainOutput);
|
||||
fs.renameSync(output + ".tmp", output);
|
||||
});
|
||||
}
|
||||
|
||||
if (fs.existsSync(logFilePath)) {
|
||||
const plainName = fs
|
||||
.statSync(logFilePath)
|
||||
.ctime.toISOString()
|
||||
.split("T")[0];
|
||||
let name = plainName;
|
||||
let counter = 1;
|
||||
let newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
while (fs.existsSync(newFileName)) {
|
||||
name = `${plainName}-${counter}`;
|
||||
newFileName = path.join(logFolder, `${name}.log.gz`);
|
||||
counter++;
|
||||
}
|
||||
// if (plainName !== timestamp) {
|
||||
compressFile(logFilePath, newFileName);
|
||||
// }
|
||||
}
|
||||
|
||||
console.log(
|
||||
`File logging: ${bot.Console.filelogging ? "enabled" : "disabled"}`
|
||||
);
|
||||
if (!bot.Console.filelogging) return; // instead of using bot why not just use options cause you already defined it
|
||||
|
||||
// if (toFile) logStream.write(toWrite + '\n');
|
||||
|
||||
bot.console.filelogger = function (message) {
|
||||
logStream.write(message + "\n"); // toFile is not defined
|
||||
};
|
||||
//if (toConsole) console.log(toWrite);
|
||||
}
|
||||
|
||||
module.exports = consolefilelogger;
|
||||
|
||||
module.exports = consolefilelogger
|
||||
|
||||
@@ -70,8 +70,8 @@ if (event.getRoomId() !== bot.matrix.roomId || event.getType() !== 'm.room.messa
|
||||
} else if (message.startsWith('!')) {
|
||||
const source = new CommandSource({ console:false,discord:false,matrix:true })
|
||||
bot.commandManager.execute(message.substring('!'), source)
|
||||
source.sendFeedback = message => {
|
||||
sendMessage(message)
|
||||
bot.sendFeedback = message => {
|
||||
sendCompoent(message)
|
||||
//console.log(message.content)
|
||||
//bot.discord.Message = this
|
||||
}
|
||||
@@ -110,7 +110,7 @@ if (event.getRoomId() !== bot.matrix.roomId || event.getType() !== 'm.room.messa
|
||||
clickEvent: bot.matrix.inviteUrl ? { action: 'open_url', value: bot.matrix.inviteUrl } : undefined,
|
||||
hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' }
|
||||
},
|
||||
{ text: String(event.sender.rawDisplayName || event.sender.name || event.sender.userId) },
|
||||
{ text: event.sender.rawDisplayName || event.sender.name || event.sender.userId },
|
||||
message
|
||||
]
|
||||
})
|
||||
@@ -155,4 +155,4 @@ sendMessage(html)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
module.exports = inject
|
||||
@@ -32,9 +32,9 @@ function memusage(bot, options) {
|
||||
color: "gray",
|
||||
bold: false,
|
||||
with: [{ text: `Memory used ${Math.floor(
|
||||
process.memoryUsage().heapUsed / 1000 / 1000,
|
||||
process.memoryUsage().heapUsed / 1048576,
|
||||
)} MiB / ${Math.floor(
|
||||
process.memoryUsage().heapTotal / 1000 / 1000,
|
||||
process.memoryUsage().heapTotal / 1048576,
|
||||
)} MiB`, color: "green" }],
|
||||
};
|
||||
//process.cpuUsage
|
||||
@@ -47,7 +47,8 @@ function memusage(bot, options) {
|
||||
// `minecraft:bossbar set ${bossbarName} name ${JSON.stringify(component)}`,
|
||||
// );
|
||||
// bot.core.run(`minecraft:bossbar set ${bossbarName} max 20`);
|
||||
bot.tellraw(component)
|
||||
//bot.tellraw(component)
|
||||
bot.core.run(`minecraft:title @a actionbar ${component}`)
|
||||
}, 100); //process.memoryUsage().heapUsed /1024 / 1024
|
||||
}
|
||||
module.exports = memusage;
|
||||
|
||||
+74
-46
@@ -1,9 +1,11 @@
|
||||
const path = require('path')
|
||||
const { Midi } = require('@tonejs/midi')
|
||||
const { convertMidi } = require('../util/midi_converter')
|
||||
const convertNBS = require('../util/nbs_converter')
|
||||
const parseTXTSong = require('../util/txt_song_parser')
|
||||
const fs = require('fs')
|
||||
const { Midi } = require('@tonejs/midi')
|
||||
const { convertMidi } = require('../util/music/midi_converter')
|
||||
const convertNBS = require('../util/music/nbs_converter')
|
||||
const parseTXTSong = require('../util/music/txt_song_parser')
|
||||
const midiproxy = require('../util/music/midi-proxy')
|
||||
midiproxy()
|
||||
const soundNames = {
|
||||
harp: 'minecraft:block.note_block.harp',
|
||||
basedrum: 'minecraft:block.note_block.basedrum',
|
||||
@@ -23,11 +25,12 @@ const soundNames = {
|
||||
pling: 'minecraft:block.note_block.pling'
|
||||
}
|
||||
|
||||
function inject (bot) {
|
||||
async function inject (bot) {
|
||||
bot.music = function () {}
|
||||
bot.music.song = null
|
||||
bot.music.loop = 0
|
||||
bot.music.queue = []
|
||||
bot.music.volume = 0.1
|
||||
let time = 0
|
||||
let startTime = 0
|
||||
let noteIndex = 0
|
||||
@@ -40,58 +43,58 @@ function inject (bot) {
|
||||
}
|
||||
resetTime()
|
||||
}
|
||||
/*
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(logFolder)) { // existsSync might be for files and that's why it's breaking? | make the folder if it doesn't exist before writing to it
|
||||
fs.mkdirSync(logFolder);//idfk
|
||||
}//oh wait
|
||||
} catch (e) {
|
||||
*/
|
||||
try {
|
||||
if(!fs.existsSync('./midis')){
|
||||
fs.mkdirSync('./midis')
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
const midisFolder = path.join(__dirname, '../../midis'); // idfk
|
||||
//why is it not trying to find the folder tf
|
||||
// i am having a stroke from this
|
||||
try {
|
||||
if (!fs.existsSync(midisFolder)) {
|
||||
fs.mkdirSync(midisFolder);
|
||||
}
|
||||
}catch(e) {}
|
||||
const bossbarName = 'music' // maybe make this in the config?
|
||||
|
||||
const selector = '@a[tag=!nomusic]'
|
||||
|
||||
// setTimeout
|
||||
const interval = setInterval(async () => {
|
||||
if (!bot.music.queue.length) return
|
||||
bot.music.song = bot.music.queue[0]
|
||||
time = Date.now() - startTime
|
||||
/*
|
||||
// bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
|
||||
|
||||
// is spamming commands in core as a self care a good idea?
|
||||
// btw this is totallynotskidded™️ from my song bot except the bossbarName (above)
|
||||
// bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`) // is setting the name to "" as a placeholder a good idea?
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} players ${selector}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(toComponent())}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`) // should i use purple lol
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} name ${JSON.stringify(bot.getMessageAsPrismarine(bossbarComponent()).toMotd())}`)
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color aqua`) // should i use purple lol
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} value ${Math.floor(time)}`)
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} max ${bot.music.song.length}`)
|
||||
*/
|
||||
bot.core.run(`title @a actionbar ${JSON.stringify(toComponent())}`)
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
|
||||
await bot.chatDelay(1)
|
||||
bot.core.run(`title @a actionbar ${JSON.stringify(bot.getMessageAsPrismarine(actionbarComponent()).toMotd())}`)
|
||||
// await bot.chatDelay(500)
|
||||
|
||||
while (bot.music.song?.notes[noteIndex]?.time <= time) {
|
||||
const note = bot.music.song.notes[noteIndex]
|
||||
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
|
||||
// bot.core.run(`playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
|
||||
// bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
|
||||
bot.core.run(`minecraft:execute as ${selector} at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${bot.music.volume} ${floatingPitch}`)
|
||||
|
||||
noteIndex++
|
||||
if (noteIndex >= bot.music.song.notes.length) {
|
||||
bot.tellraw([
|
||||
bot.sendFeedback([
|
||||
{
|
||||
text: 'Finished playing '
|
||||
},
|
||||
{
|
||||
text: bot.music.song.name,
|
||||
color: 'gold'
|
||||
color: '#00FFFF'
|
||||
}
|
||||
])
|
||||
|
||||
@@ -118,12 +121,17 @@ bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 100)
|
||||
},150)
|
||||
|
||||
bot.on('end', () => {
|
||||
clearInterval(interval)
|
||||
// clearInterval(interval)
|
||||
bot.music.stop()
|
||||
// interval = undefined
|
||||
})
|
||||
bot.on('packet.login', (packet) => {
|
||||
//interval
|
||||
// bot.music.stop()
|
||||
})
|
||||
|
||||
bot.music.load = async function (buffer, fallbackName = '[unknown]') {
|
||||
let song
|
||||
switch (path.extname(fallbackName)) {
|
||||
@@ -162,7 +170,7 @@ bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
time = 0
|
||||
startTime = Date.now()
|
||||
noteIndex = 0
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`) // maybe not a good place to put it here but idk
|
||||
bot.core.run(`minecraft:bossbar remove ${bossbarName}`)
|
||||
}
|
||||
|
||||
function formatTime (time) {
|
||||
@@ -171,14 +179,34 @@ bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`)
|
||||
return `${Math.floor(seconds / 60)}:${(seconds % 60).toString().padStart(2, '0')}`
|
||||
}
|
||||
|
||||
function toComponent () {
|
||||
function actionbarComponent () {
|
||||
const component = [
|
||||
// { text: '[', color: 'dark_gray' },
|
||||
// { text: 'ChomeNS Bot', color: 'yellow' },
|
||||
// { text: '] ', color: 'dark_gray' },
|
||||
// { text: 'Now Playing', color: 'gold' },
|
||||
// { text: ' | ', color: 'dark_gray' },
|
||||
{ text: bot.music.song.name, color: 'green' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: bot.music.song.name, color: 'blue' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: formatTime(time), color: 'gray' },
|
||||
{ text: ' / ', color: 'dark_gray' },
|
||||
{ text: formatTime(bot.music.song.length), color: 'gray' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: noteIndex, color: 'gray' },
|
||||
{ text: ' / ', color: 'dark_gray' },
|
||||
{ text: bot.music.song.notes.length, color: 'gray' }
|
||||
]
|
||||
|
||||
if (bot.music.loop === 1) {
|
||||
component.push({ text: ' | ', color: 'dark_gray' })
|
||||
component.push({ text: 'Looping Current', color: 'green' })
|
||||
}
|
||||
if (bot.music.loop === 2) {
|
||||
component.push({ text: ' | ', color: 'dark_gray' })
|
||||
component.push({ text: 'Looping All', color: 'green' })
|
||||
}
|
||||
|
||||
return component
|
||||
}
|
||||
function bossbarComponent () {
|
||||
const component = [
|
||||
{ text: bot.music.song.name, color: 'blue' },
|
||||
{ text: ' | ', color: 'dark_gray' },
|
||||
{ text: formatTime(time), color: 'gray' },
|
||||
{ text: ' / ', color: 'dark_gray' },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function inject (bot) {
|
||||
function playerlist (bot) {
|
||||
bot.players = []
|
||||
//chayapak you mentally ok?
|
||||
bot.on('packet.player_info', packet => {
|
||||
@@ -25,37 +25,13 @@ function inject (bot) {
|
||||
}
|
||||
})
|
||||
|
||||
function removePlayer (player, packet) {
|
||||
const fullPlayer = bot.players.getPlayer(player)
|
||||
//const players = tabCompletePlayerList.list
|
||||
|
||||
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
|
||||
bot.emit('player_vanished', player)
|
||||
} else {
|
||||
bot.on('packet.player_remove', ({ players }) => {
|
||||
for (const player of players) {
|
||||
bot.players = bot.players.filter(entry => entry.uuid !== player)
|
||||
|
||||
}
|
||||
|
||||
bot.players = bot.players.filter(entry => entry.uuid !== player)
|
||||
})
|
||||
|
||||
bot.players.removePlayer(player)
|
||||
if (!target) return
|
||||
target.removePlayer = entry.removePlayer
|
||||
}
|
||||
}
|
||||
// if (process.env["FoundationBuildString"] !== 'Ultimate Foundation v2.0.6 Build:270')
|
||||
//{
|
||||
// process.exit(1)
|
||||
//}
|
||||
function addPlayer (entry) {
|
||||
bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
|
||||
bot.players.push({
|
||||
uuid: entry.uuid,
|
||||
profile: { name: entry.player.name, properties: entry.player.properties },
|
||||
removePlayer:undefined,
|
||||
|
||||
chatSession: undefined,
|
||||
gamemode: undefined,
|
||||
listed: undefined,
|
||||
@@ -103,11 +79,4 @@ removePlayer:undefined,
|
||||
bot.on('end', () => (bot.players = []))
|
||||
}
|
||||
|
||||
module.exports = inject
|
||||
/*function addPlayer (player, packet) {
|
||||
if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet)
|
||||
else bot.emit('player_added', player, packet)
|
||||
|
||||
bot.players.addPlayer(player)
|
||||
}
|
||||
*/
|
||||
module.exports = playerlist
|
||||
|
||||
@@ -2,18 +2,33 @@ const mc = require('minecraft-protocol')
|
||||
|
||||
function reconnect (bot, options) {
|
||||
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
|
||||
|
||||
bot.usernameGen = options.usernameGen ?? false
|
||||
function username() {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\\!@#$%^*(){}[]|\;:,<.>/?&';
|
||||
let username = '';
|
||||
for (let i = 0; i < 9; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
username += characters[randomIndex];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
bot.on('end', (reason) => {
|
||||
if (bot.reconnectDelay < 0) return
|
||||
setTimeout(() => {
|
||||
|
||||
const client = options.client ?? mc.createClient(options)
|
||||
|
||||
if (bot.options.usernameGen) {
|
||||
// client = options.client ?? mc.createClient({username:username()}, options)
|
||||
// let e = bot.options.username = username()
|
||||
bot._client.end()
|
||||
bot.options.username = username()
|
||||
client = options.client ?? mc.createClient(options, bot.options.username = username())
|
||||
}else {
|
||||
client = options.client ?? mc.createClient(options)
|
||||
}
|
||||
bot._client = client
|
||||
bot.console.info(`Reconnecting to ${bot.options.host}:${bot.options.port}`)
|
||||
bot.emit('init_client', client)
|
||||
}, bot.reconnectDelay)
|
||||
})
|
||||
}
|
||||
module.exports = reconnect
|
||||
module.exports = reconnect;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ function registry (bot) {
|
||||
bot.on('packet.login', packet => {
|
||||
bot.registry = createRegistry(bot._client.version)
|
||||
// bot.registry.loadDimensionCodec(packet.dimensionCodec)
|
||||
//bot.registry.language = 'lolcats_us'
|
||||
bot.emit('registry_ready', bot.registry)
|
||||
})
|
||||
}
|
||||
|
||||
+6
-14
@@ -1,6 +1,7 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const CommandError = require('../CommandModules/command_error')
|
||||
const { EmbedBuilder } = require('discord.js')
|
||||
function reload (bot,options,context) {
|
||||
bot.reload = function () {
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
@@ -13,20 +14,11 @@ const command = require(path.join(__dirname, "../commands", filename));
|
||||
bot.commandManager.commandlist.pop(command)
|
||||
bot.commandManager.commandlist.push(command)
|
||||
} catch (error) {
|
||||
bot.console.error(["Failed to load File", filename, ":", error])
|
||||
bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]);
|
||||
}
|
||||
}
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../modules"))) {
|
||||
try {
|
||||
|
||||
const module = require(path.join(__dirname, "../modules", filename));
|
||||
delete require.cache[require.resolve(path.join(__dirname, "../modules", filename))]
|
||||
// bot.loadModule(module)
|
||||
} catch (error) {
|
||||
bot.console.error("Failed to load File", filename, ":", error.toString())
|
||||
bot.tellraw([{text:`Failed to load File ${filename} : ${error}`}]);
|
||||
}
|
||||
bot.console.error(["Failed to load File ", filename, ":", error.stack])
|
||||
bot.tellraw({text:`${error.stack}`,color:'dark_red'});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+24
-27
@@ -1,4 +1,3 @@
|
||||
|
||||
const util = require('util')
|
||||
|
||||
const COMMANDSPY_ENABLED_MESSAGE = { text: 'Successfully enabled CommandSpy' }
|
||||
@@ -6,9 +5,9 @@ const COMMANDSPY_DISABLED_MESSAGE = { text: 'Successfully disabled CommandSpy' }
|
||||
//You now have the tag: &8[&bPrefix &4d~&8]
|
||||
function selfcare (bot) {
|
||||
let entityId
|
||||
let gameMode
|
||||
let gameMode
|
||||
let permissionLevel = 2
|
||||
let unmuted = false
|
||||
let unmuted = false
|
||||
let commandSpyEnabled = false
|
||||
let vanished = false
|
||||
let prefix = false
|
||||
@@ -17,58 +16,56 @@ let unmuted = false
|
||||
let nickname = false
|
||||
let god = false
|
||||
let tptoggle = false
|
||||
let jail = false
|
||||
let jail = false
|
||||
/* if (data.toString().startsWith('You have been muted')) muted = true
|
||||
if (data.toString() === 'You have been unmuted.') muted = false
|
||||
*/
|
||||
//bot.on('message', (data) => {
|
||||
bot.on('message', (message, data) => {
|
||||
// Successfully removed your skin
|
||||
const stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
stringmessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
if (bot.options.isCreayun) {
|
||||
if (stringmessage === `Your prefix has been set to: [Prefix: ~]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.' || stringmessage === 'Unknown command. Type /help for help' || stringmessage === '[SuffEx] Your prefix has been set to: [Prefix: ~]') {
|
||||
prefix = true
|
||||
return
|
||||
} else if (stringmessage.startsWith("Your prefix has been set to: ") || stringmessage === '[SuffEx] Your prefix has been set to: ' || stringmessage === '[SuffEx] Your prefix has been reset' || stringmessage === "Your prefix has been reset.") prefix = false
|
||||
} if (bot.options.isKaboom) { //Your prefix has been reset.
|
||||
if (stringmessage.startsWith('You have been muted')) unmuted = true
|
||||
else if (stringmessage === "You have been unmuted.") unmuted = false
|
||||
else if (stringmessage.startsWith('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.Commands.prefixes[0]}&8]`) {
|
||||
else if (stringmessage === `You now have the tag: &8[&bPrefix: &4${bot.Commands.prefixes[0]}&8]` || stringmessage === 'Something went wrong while saving the prefix. Please check console.') {
|
||||
prefix = true
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("You now have the tag: ") || stringmessage === "You no longer have a tag") prefix = false
|
||||
|
||||
else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) {
|
||||
else if (stringmessage === `Successfully set your skin to ${bot.options.selfcare.skin.player}'s`) {
|
||||
skin = true
|
||||
return
|
||||
}
|
||||
//Successfully set your skin to Parker2991's
|
||||
//Successfully removed your skin
|
||||
else if (stringmessage === 'You have been released!') jail = true
|
||||
else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true
|
||||
else if(stringmessage === `You have been jailed!`){
|
||||
jail = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false
|
||||
else if (stringmessage === 'You have been released!') jail = true
|
||||
else if (stringmessage === 'Jails/Unjails a player, TPs them to the jail specified.') jail = true
|
||||
else if(stringmessage === `You have been jailed!`){
|
||||
jail = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage.startsWith("Successfully set your skin to ") || stringmessage === "Successfully removed your skin") skin = false
|
||||
|
||||
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
|
||||
else if (stringmessage === `Successfully set your username to "${bot.username}"`) {
|
||||
username = true
|
||||
return
|
||||
}//"Successfully set your username to "${bot.username}"""
|
||||
else if (stringmessage.startsWith("Successfully set your username to ")) username = false
|
||||
else if (stringmessage === `You already have the username "${bot.username}"`) username = true
|
||||
//That name is already in use.
|
||||
//Error: Nicknames must be alphanumeric.
|
||||
//You no longer have a nickname.
|
||||
//Your nickname is now sus.
|
||||
else if (stringmessage === `You no longer have a nickname.`) {
|
||||
nickname = true
|
||||
return
|
||||
}//"Successfully set your username to "${bot.username}"""
|
||||
}
|
||||
else if (stringmessage.startsWith("Your nickname is now ")) nickname = false
|
||||
// else if (stringmessage === `Error: Nicknames must be alphanumeric.`) nickname = false
|
||||
else if (stringmessage === `You no longer have a nickname.`) nickname = false
|
||||
//else if (stringmessage === `That name is already in use.`) nickname = false
|
||||
//God mode enabled.
|
||||
//God mode disabled.
|
||||
else if (stringmessage === `God mode enabled.`) {
|
||||
god = true
|
||||
return
|
||||
@@ -85,7 +82,7 @@ vanished = false
|
||||
return
|
||||
}
|
||||
else if (stringmessage === `Vanish for ${bot.options.username}: enabled`) vanished = true
|
||||
|
||||
}
|
||||
/*
|
||||
else if (message?.text !== '' || !Array.isArray(message.extra) || message.extra.length < 2 || !message.extra[0]?.text?.startsWith('Vanish for') || message.extra[0].color !== 'gold') return
|
||||
|
||||
@@ -156,4 +153,4 @@ await bot.discord.channel.send(`Starting ${buildstring}`)
|
||||
await sendChat(buildstring)
|
||||
await sendChat('Prefix ~')
|
||||
})
|
||||
}*/
|
||||
}*/
|
||||
@@ -29,7 +29,7 @@ async function tpsbar(bot, config) {
|
||||
};
|
||||
bot.core.run(`minecraft:bossbar add ${bossbarName} ""`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} players @a`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color yellow`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} color blue`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} visible true`);
|
||||
bot.core.run(`minecraft:bossbar set ${bossbarName} style progress`);
|
||||
bot.core.run(
|
||||
@@ -59,7 +59,7 @@ async function tpsbar(bot, config) {
|
||||
else return value;
|
||||
}
|
||||
|
||||
bot.on("login", (data) => {
|
||||
bot.on("packet.login", (data) => {
|
||||
nextIndex = 0
|
||||
timeGameJoined = timeLastTimeUpdate = Date.now()
|
||||
});
|
||||
@@ -79,4 +79,4 @@ async function tpsbar(bot, config) {
|
||||
nextIndex = null
|
||||
})
|
||||
}
|
||||
module.exports = tpsbar;
|
||||
module.exports = tpsbar;
|
||||
Reference in New Issue
Block a user