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
|
* @param {object} bot bot
|
||||||
*/
|
*/
|
||||||
function chatPacketListener (packet, ChatMessage, bot) {
|
function chatPacketListener (packet, ChatMessage, bot) {
|
||||||
// try catch prevents hi % exploit (it uses prismarine-chat)
|
// try catch prevents json parse error (which prob never happens but still..)
|
||||||
// and try catch also prevents json parse error
|
|
||||||
try {
|
try {
|
||||||
const parsedMessage = JSON.parse(packet.message)
|
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
|
// down here it prevents command set message
|
||||||
|
|
||||||
// for ayunboom cuz its 1.17.1
|
// for ayunboom cuz its 1.17.1
|
||||||
|
@ -27,9 +23,7 @@ function chatPacketListener (packet, ChatMessage, bot) {
|
||||||
const message = ChatMessage.fromNotch(packet.message)
|
const message = ChatMessage.fromNotch(packet.message)
|
||||||
|
|
||||||
bot.emit('parsed_chat', message, packet)
|
bot.emit('parsed_chat', message, packet)
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,11 +34,7 @@ function chatPacketListener (packet, ChatMessage, bot) {
|
||||||
*/
|
*/
|
||||||
function parsePlayerMessages (message, packet, bot) {
|
function parsePlayerMessages (message, packet, bot) {
|
||||||
try {
|
try {
|
||||||
// prevent braille cuz it CRASHES THE ENTIRE LAPTOP
|
// here is all the player message parsing thing
|
||||||
// but sometimes this may not work
|
|
||||||
if (message.toString().includes('⣿')) return
|
|
||||||
|
|
||||||
// then here is all the player message parsing thing
|
|
||||||
const raw = message.toMotd().substring(0, 32767)
|
const raw = message.toMotd().substring(0, 32767)
|
||||||
if (raw.match(/.* .*: .*/g)) {
|
if (raw.match(/.* .*: .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '')
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '')
|
||||||
|
|
Loading…
Reference in a new issue