mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 01:25:33 -05:00
remove previousMessage check cuz USELESS
This commit is contained in:
parent
13c7c5fd1e
commit
9fc6f69140
2 changed files with 2 additions and 8 deletions
|
@ -31,10 +31,9 @@ function inject(bot) {
|
|||
clearInterval(chatQueue);
|
||||
});
|
||||
|
||||
let previousMessage;
|
||||
const ChatMessage = require('prismarine-chat')(bot.version);
|
||||
|
||||
bot._client.on('chat', (packet) => chatPacketListener(packet, ChatMessage, previousMessage, bot));
|
||||
bot._client.on('chat', (packet) => chatPacketListener(packet, ChatMessage, bot));
|
||||
|
||||
bot.on('parsed_chat', (message, packet) => parsePlayerMessages(message, packet, bot));
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
* for the chat packet listener (in util cuz proxy + bot)
|
||||
* @param {object} packet chat packet
|
||||
* @param {object} ChatMessage basically just require prismarine-chat
|
||||
* @param {string} previousMessage previous message.
|
||||
* @param {object} bot bot
|
||||
*/
|
||||
function chatPacketListener(packet, ChatMessage, previousMessage, bot) {
|
||||
function chatPacketListener(packet, ChatMessage, bot) {
|
||||
// try catch prevents hi % exploit (it uses prismarine-chat)
|
||||
// and try catch also prevents json parse error
|
||||
try {
|
||||
|
@ -27,10 +26,6 @@ function chatPacketListener(packet, ChatMessage, previousMessage, bot) {
|
|||
|
||||
const message = ChatMessage.fromNotch(packet.message);
|
||||
|
||||
// before emitting, prevent spam first!!!
|
||||
if (previousMessage === message.toString()) return;
|
||||
previousMessage = message.toString();
|
||||
|
||||
bot.emit('parsed_chat', message, packet);
|
||||
} catch (e) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue