mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
better chat.js real
This commit is contained in:
parent
58d5f0258e
commit
fc041865b5
1 changed files with 11 additions and 11 deletions
|
@ -18,7 +18,17 @@ function inject(bot) {
|
|||
bot.on('parsed_chat', (message, packet) => {
|
||||
try {
|
||||
const raw = message.toMotd().substring(0, 32767);
|
||||
if (raw.match(/<.*§r> .*/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].substr(2);
|
||||
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];
|
||||
bot.emit('message', username, message, packet.sender);
|
||||
} else if (raw.match(/<.*§r> .*/g)) {
|
||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||
|
||||
const username = raw.substr(3).split('§r>')[0];
|
||||
|
@ -31,16 +41,6 @@ function inject(bot) {
|
|||
const username = raw.substr(3).split('>')[0];
|
||||
const message = raw.split('> ')[1];
|
||||
|
||||
bot.emit('message', username, message, packet.sender);
|
||||
} else 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].substr(2);
|
||||
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];
|
||||
bot.emit('message', username, message, packet.sender);
|
||||
} else if (raw.match(/§.*§b: \/.*/g)) {
|
||||
const username = raw.split('§b: ')[0];
|
||||
|
|
Loading…
Reference in a new issue