mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
remove hi %
This commit is contained in:
parent
d6a8133c2b
commit
0fdc93574a
1 changed files with 3 additions and 13 deletions
16
util/chat.js
16
util/chat.js
|
@ -6,13 +6,9 @@
|
|||
* @param {object} bot bot
|
||||
*/
|
||||
function chatPacketListener (packet, ChatMessage, bot) {
|
||||
// try catch prevents hi % exploit (it uses prismarine-chat)
|
||||
// and try catch also prevents json parse error
|
||||
// try catch prevents json parse error (which prob never happens but still..)
|
||||
try {
|
||||
const parsedMessage = JSON.parse(packet.message)
|
||||
if (parsedMessage.translate === 'translation.test.invalid' ||
|
||||
parsedMessage.translate === 'translation.test.invalid2') return
|
||||
|
||||
// down here it prevents command set message
|
||||
|
||||
// for ayunboom cuz its 1.17.1
|
||||
|
@ -27,9 +23,7 @@ function chatPacketListener (packet, ChatMessage, bot) {
|
|||
const message = ChatMessage.fromNotch(packet.message)
|
||||
|
||||
bot.emit('parsed_chat', message, packet)
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -40,11 +34,7 @@ function chatPacketListener (packet, ChatMessage, bot) {
|
|||
*/
|
||||
function parsePlayerMessages (message, packet, bot) {
|
||||
try {
|
||||
// prevent braille cuz it CRASHES THE ENTIRE LAPTOP
|
||||
// but sometimes this may not work
|
||||
if (message.toString().includes('⣿')) return
|
||||
|
||||
// then here is all the player message parsing thing
|
||||
// here is all the player message parsing thing
|
||||
const raw = message.toMotd().substring(0, 32767)
|
||||
if (raw.match(/.* .*: .*/g)) {
|
||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '')
|
||||
|
|
Loading…
Reference in a new issue