mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-12-04 16:15:43 -05:00
v6.0.0 build: 950
This commit is contained in:
+3
-8
@@ -5,6 +5,7 @@ const CreayunChatParser = require('../util/ChatParsers/Creayun');
|
||||
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
|
||||
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
|
||||
const nbt = require('prismarine-nbt');
|
||||
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat')
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
@@ -21,12 +22,11 @@ function chat (bot, options, config) {
|
||||
if (options.isSavage) {
|
||||
bot.chatParsers = [CreayunChatParser, sayConsoleChatParser]
|
||||
} else {
|
||||
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser]
|
||||
bot.chatParsers = [KaboomChatParser, ChipmunkModChatParser, VanillaChatParser, sayConsoleChatParser, yfdCustomChatParser]
|
||||
}
|
||||
bot.on('packet.profileless_chat', packet => {
|
||||
const message = tryParse(packet.message)
|
||||
const sender = tryParse(packet.name)
|
||||
// bot.tellraw("@a", `Packet type ${packet.type}`)
|
||||
bot.emit('profileless_chat', {
|
||||
message,
|
||||
type: packet.type,
|
||||
@@ -39,12 +39,6 @@ function chat (bot, options, config) {
|
||||
if (packet.type === 3) bot.emit('message', bot.getMessageAsPrismarine({"translate":"commands.message.display.outgoing","with":[`${translateUsername}`,`${translateMessage}`],"color":"gray","italic":true})?.toMotd())
|
||||
if (packet.type === 4) bot.emit('message', message);
|
||||
if (packet.type === 5) bot.emit('message', bot.getMessageAsPrismarine({translate:"chat.type.announcement",color:'white', with:[`${translateUsername}`,`${translateMessage}`]})?.toMotd())
|
||||
/* switch (packet.type) {
|
||||
case "4":
|
||||
bot.emit('message', message)
|
||||
// console.log('packet type 4');
|
||||
break
|
||||
}*/
|
||||
tryParsingMessage(message, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine })
|
||||
})
|
||||
|
||||
@@ -63,6 +57,7 @@ function chat (bot, options, config) {
|
||||
if (config.commandSetMessage) {
|
||||
if (message.translate === 'advMode.setCommand.success') return // Ignores command set message
|
||||
}
|
||||
if (message.translate === 'multiplayer.message_not_delivered') return
|
||||
bot.emit('system_chat', { message, actionbar: packet.isActionBar })
|
||||
|
||||
if (packet.isActionBar) {
|
||||
|
||||
@@ -12,8 +12,8 @@ function core (bot, options, config) {
|
||||
|
||||
if (!pos) return
|
||||
if (bot.options.useChat ?? bot.options.isCreayun ?? bot.options.isSavage) return
|
||||
// if (isNaN(pos.x + start.x)) bot.chat.command('world 3');
|
||||
// console.log(isNaN(pos.x + start.x))
|
||||
// if (isNaN(pos.x + start.x)) bot.chat.command('world 3');
|
||||
// console.log(isNaN(pos.x + start.x))
|
||||
bot.chat.command(`minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'}`)
|
||||
},
|
||||
|
||||
|
||||
@@ -2,27 +2,29 @@ function command_loop (bot, options, config) {
|
||||
bot.cloop = {
|
||||
list: [],
|
||||
add (command, interval) {
|
||||
setTimeout(() => {
|
||||
this.list.push({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
}, 10)
|
||||
let timer;
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer)
|
||||
|
||||
bot.on('end', () => {
|
||||
this.clear()
|
||||
})
|
||||
|
||||
bot.on('packet.login', () => {
|
||||
timer = ({ timer: setInterval(() => bot.core.run(command), interval), command, interval })
|
||||
this.list.push(timer);
|
||||
})
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
clearInterval(this.list[index].timer)
|
||||
bot.cloop.list.splice(index, 1)
|
||||
},
|
||||
|
||||
clear () {
|
||||
for (const cloop of this.list) clearInterval(cloop.timer)
|
||||
this.list = []
|
||||
}
|
||||
}
|
||||
/* bot.on('end', () => {
|
||||
// clearInterval(this.list);
|
||||
for (const cloop of this.list) console.log(cloop)
|
||||
console.log('e')
|
||||
})*/
|
||||
}
|
||||
module.exports = command_loop;
|
||||
|
||||
@@ -20,21 +20,21 @@ function command_manager (bot, options, config, discordClient) {
|
||||
}
|
||||
} else if (!source?.sources?.discord && !source?.sources?.console) {
|
||||
if (!command || !command.execute)
|
||||
throw new CommandError(
|
||||
bot.getMessageAsPrismarine([
|
||||
{
|
||||
translate: `command.unknown.command`
|
||||
},
|
||||
{
|
||||
text: '\n'
|
||||
},
|
||||
{
|
||||
text: `${commandName} `
|
||||
},
|
||||
{
|
||||
translate: "command.context.here"
|
||||
}])?.toMotd(bot.registry.language)
|
||||
)
|
||||
throw new CommandError([
|
||||
{
|
||||
translate: `command.unknown.command`
|
||||
},
|
||||
{
|
||||
text: '\n'
|
||||
},
|
||||
{
|
||||
text: `${commandName} `
|
||||
},
|
||||
{
|
||||
translate: "command.context.here"
|
||||
}
|
||||
])
|
||||
//}
|
||||
} else if (source?.sources?.console && !source?.sources?.discord) {
|
||||
if (!command || !command.execute)
|
||||
bot.console.warn(bot.getMessageAsPrismarine([
|
||||
@@ -90,7 +90,7 @@ function command_manager (bot, options, config, discordClient) {
|
||||
return command?.execute({ bot, source, arguments: args, config, discordClient})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
console.error(error.stack)
|
||||
bot?.console?.filelogging(error.stack);
|
||||
if (source?.sources?.discord && !source?.sources?.console) {
|
||||
const Embed = new EmbedBuilder()
|
||||
@@ -120,6 +120,7 @@ function command_manager (bot, options, config, discordClient) {
|
||||
return this.discordExecute(source, commandName, args)
|
||||
}
|
||||
},
|
||||
|
||||
register (command) {
|
||||
this.commands[command.name] = command
|
||||
if (command.aliases) {
|
||||
@@ -127,7 +128,6 @@ function command_manager (bot, options, config, discordClient) {
|
||||
}
|
||||
},
|
||||
unregister (command) {
|
||||
// commands = {};
|
||||
this.commands = {};
|
||||
},
|
||||
getCommand (name) {
|
||||
@@ -136,6 +136,21 @@ function command_manager (bot, options, config, discordClient) {
|
||||
|
||||
getCommands () {
|
||||
return Object.values(this.commands)
|
||||
},
|
||||
|
||||
reload() {
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
delete require.cache[require.resolve(path.join(__dirname, "../commands/", filename))]
|
||||
const command = require(path.join(__dirname, "../commands/", filename));
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.pop(command)
|
||||
bot.commandManager.commandlist.push(command)
|
||||
} catch (error) {
|
||||
bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" })
|
||||
bot?.console?.filelogger(error.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,33 +180,11 @@ function command_manager (bot, options, config, discordClient) {
|
||||
}, 1000)
|
||||
if (ratelimit > 2) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
}
|
||||
})
|
||||
})
|
||||
bot.commandManager.reload = function () {
|
||||
//commandlist = [];
|
||||
// bot.commandManager.unregister();
|
||||
// bot.commandManager.commandlist = [];
|
||||
for (const filename of fs.readdirSync(path.join(__dirname, "../commands"))) {
|
||||
try {
|
||||
// bot.commandManager.unregister();
|
||||
delete require.cache[require.resolve(path.join(__dirname, "../commands/", filename))]
|
||||
const command = require(path.join(__dirname, "../commands/", filename));
|
||||
// bot.commandManager.unregister();
|
||||
// delete require.cache[require.resolve(path.join(__dirname, "../commands", filename))]
|
||||
// bot.commandManager.register(command);
|
||||
// bot.commandManager.commandlist.push(command);
|
||||
bot.commandManager.register(command);
|
||||
bot.commandManager.commandlist.pop(command)
|
||||
bot.commandManager.commandlist.push(command)
|
||||
} catch (error) {
|
||||
// bot.console.error(["Failed to load File ", filename, ":", error.stack])
|
||||
bot.tellraw("@a", { text: `Failed to reload file ${filename}\n${error.stack}`, color: "red" })
|
||||
bot?.console?.filelogger(error.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = command_manager;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
function CommandConsole (bot, options, config) {
|
||||
const ChatMessage = require('prismarine-chat')(options.version);
|
||||
let ratelimit = 0;
|
||||
bot.console = {
|
||||
readline: null,
|
||||
consoleServer: 'all',
|
||||
@@ -75,8 +76,18 @@ function CommandConsole (bot, options, config) {
|
||||
const ansi = bot.getMessageAsPrismarine(message)?.toAnsi(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
|
||||
const string = bot.getMessageAsPrismarine(message)?.toString(bot.registry.language).replaceAll('BlackStone Mafia On Top!', "Fuck off you god damn cunt")
|
||||
if (!options.logging) return
|
||||
//ratelimit++
|
||||
setInterval(() => {
|
||||
// ratelimit--
|
||||
ratelimit = 0
|
||||
}, 1000)
|
||||
if (ratelimit > 300) {
|
||||
// options.logging = false
|
||||
return
|
||||
}
|
||||
bot.console.logs(`${ansi}`)
|
||||
bot.console.filelogging(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${string}`)
|
||||
ratelimit++
|
||||
})
|
||||
}
|
||||
module.exports = CommandConsole;
|
||||
|
||||
@@ -26,7 +26,7 @@ function discord(bot, options, config, discordClient) {
|
||||
bot.discord.channel = discordClient.channels.cache.get(options.channelId)
|
||||
discordClient.user.setPresence({
|
||||
activities: [{
|
||||
name: `amogus ඞ`,
|
||||
name: `your mother`,
|
||||
type: 0
|
||||
}],
|
||||
status: `dnd`
|
||||
|
||||
@@ -14,8 +14,12 @@ function selfcare (bot, options, config) {
|
||||
// You no longer have a tag
|
||||
bot.on('message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||
if (stringMessage?.startsWith("Successfully enabled CommandSpy")) commandSpy = true;
|
||||
else if (stringMessage?.startsWith("Successfully disabled CommandSpy")) commandSpy = false;
|
||||
// if (stringMessage?.startsWith("Successfully enabled CommandSpy")) commandSpy = true;
|
||||
// else if (stringMessage?.startsWith("Successfully disabled CommandSpy")) commandSpy = false;
|
||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||
else if (stringMessage === "Successfully disabled CommandSpy.") commandSpy = false;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
|
||||
else if (stringMessage === `You now have the tag: &8[&bPrefix&8: &3${config.prefixes[0]}&8]` || stringMessage === "Something went wrong while saving the prefix. Please check console.") prefix = true;
|
||||
@@ -58,7 +62,7 @@ function selfcare (bot, options, config) {
|
||||
if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (bot.options.isKaboom && !bot.options.isSavage) {
|
||||
if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
|
||||
else if (gameMode !== 1) bot.chat.command('gamemode creative @s[type=player]');
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (!commandSpy) bot.chat.command('commandspy on');
|
||||
else if (username) bot.chat.command(`username ${bot.options.username}`)
|
||||
else if (nickname) bot.chat.command(`nick off`)
|
||||
|
||||
Reference in New Issue
Block a user