mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
fix chat on kitsune + filter braille
This commit is contained in:
parent
876d28ed15
commit
99e28d5360
2 changed files with 8 additions and 1 deletions
2
index.js
2
index.js
|
@ -312,6 +312,8 @@ function main() {
|
|||
if (parsedMessage.extra!==undefined) {
|
||||
if (parsedMessage.extra[0].text==='Command set: ') return;
|
||||
}
|
||||
// prevent braille cuz it CRASHES THE ENTIRE LAPTOP
|
||||
if (message.toString().includes('⣿')) return;
|
||||
|
||||
const cleanMessage = escapeMarkdown(message.toAnsi(), true);
|
||||
discordMsg = /* '_ _ ' + */cleanMessage.replaceAll('@', '@\u200b\u200b\u200b\u200b\u200b').replaceAll('http', 'http\u200b\u200b\u200b\u200b\u200b').replaceAll('\u001b[9', '\u001b[3');// .replace(/[\r\n]/gm, '\n')
|
||||
|
|
|
@ -18,7 +18,12 @@ function inject(bot) {
|
|||
bot.on('parsed_chat', (message, packet) => {
|
||||
try {
|
||||
const raw = message.toMotd().substring(0, 32767);
|
||||
if (raw.match(/.* .*: .*/g)) {
|
||||
if (raw.match(/.* .*:§r .*/g)) {
|
||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||
const username = raw.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, '');
|
||||
const message = raw.split(':§r ')[1];
|
||||
bot.emit('message', username, message, packet.sender);
|
||||
} else if (raw.match(/.* .*: .*/g)) {
|
||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||
const username = raw.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, '');
|
||||
const message = raw.split(': ')[1];
|
||||
|
|
Loading…
Reference in a new issue