From 5d0a0b299b4c630c7f46262c9ea6e6730a49f3d2 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Sat, 22 Oct 2022 13:55:31 +0700 Subject: [PATCH] reeeeeeeeeeeeeaaaaaaaaaaaal --- index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 9d6ed41..eb6ae58 100644 --- a/index.js +++ b/index.js @@ -256,7 +256,7 @@ function main() { bot.entityId = data.entityId; bot.uuid = bot._client.uuid; bot.username = bot._client.username; - const chatMessage = require('prismarine-chat')(bot.version); + chatMessage = require('prismarine-chat')(bot.version); const mcData = require('minecraft-data')(bot.version); console.log(`Successfully logged in to: ${bot.options.host}:${bot.options.port}`); // fs.appendFileSync('./logs.txt', `\r\nSuccessfully logged in to: ${bot.options.host}:${bot.options.port}\r\n`); @@ -441,7 +441,6 @@ dcclient.on('ready', async () => { // Console COMMANDS rl.on('line', function(line) { try { - const {MessageBuilder} = require('prismarine-chat')(bot.version); if (line.toLowerCase()==='' || line.toLowerCase().startsWith(' ')) return; if (line.toLowerCase()==='.exit' || line.toLowerCase()==='.end') { bot.emit('end', 'end command'); @@ -472,7 +471,7 @@ dcclient.on('ready', async () => { if (line==='.kill') process.exit(); // if (line.startsWith("."))return console.log('command not found') if (line.startsWith('.')) return bot.command_handler.run('Console', '§a§lConsole§r', '*' + line.substring(1), 'c0ns0le-uuid'); - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': '› ', 'color': 'dark_gray'}, MessageBuilder.fromString('&7' + line)])); + bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': '› ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)])); } catch (e) { console.log(e); } @@ -483,7 +482,6 @@ dcclient.on('ready', async () => { dcclient.on('messageCreate', async (message) => { // Ignore messages from the bot itself if (message.author.id === dcclient.user.id) return; - const {MessageBuilder} = require('prismarine-chat')(bot.version); const channelid = message.channel.id; // if (message.content.toLowerCase().startsWith('!chomensmsg ')) { // bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":" (ChomeNS Channel)","color":"gray"},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}§7#${message.author.discriminator}"} }},{"text":" ","color":"white"},` + MessageBuilder.fromString('&7' + message.content.substring(12)) + ']'); @@ -653,10 +651,10 @@ dcclient.on('messageCreate', async (message) => { if (message.content.toLowerCase()==='') { bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}§7#${message.author.discriminator}"} }},{"text":" › ","color":"dark_gray"},` + `{"text":"[Attachment]","clickEvent":{"action":"open_url","value":"${attachment.proxyURL}"},"color":"green"}` + ']'); } else { - bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}§7#${message.author.discriminator}"} }},{"text":" › ","color":"dark_gray"},` + MessageBuilder.fromString('&7' + message.content) + `,{"text":" [Attachment]","clickEvent":{"action":"open_url","value":"${attachment.proxyURL}"},"color":"green"}` + ']'); + bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}§7#${message.author.discriminator}"} }},{"text":" › ","color":"dark_gray"},` + chatMessage.MessageBuilder.fromString('&7' + message.content) + `,{"text":" [Attachment]","clickEvent":{"action":"open_url","value":"${attachment.proxyURL}"},"color":"green"}` + ']'); } } else { - bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}§7#${message.author.discriminator}"} }},{"text":" › ","color":"dark_gray"},` + MessageBuilder.fromString('&7' + message.content) + ']'); + bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}§7#${message.author.discriminator}"} }},{"text":" › ","color":"dark_gray"},` + chatMessage.MessageBuilder.fromString('&7' + message.content) + ']'); } } catch (e) { return;