mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
support [a] b > message and fix other chat stuff
This commit is contained in:
parent
58d5b078d8
commit
e9134745aa
1 changed files with 8 additions and 4 deletions
12
util/chat.js
12
util/chat.js
|
@ -48,19 +48,23 @@ function parsePlayerMessages (message, packet, bot) {
|
||||||
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, '')
|
||||||
const message = raw.split(': ')[1]
|
const message = raw.split(': ').slice(1).join(' ').replace(/§#....../gm, '')
|
||||||
bot.emit('message', username, message, packet.sender)
|
bot.emit('message', username, message, packet.sender)
|
||||||
} else if (raw.match(/.* .*\u203a .*/g)) {
|
} else if (raw.match(/.* .*\u203a .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
||||||
const message = raw.split('\u203a ')[1].substring(2)
|
const message = raw.split('\u203a ').slice(1).join(' ').substring(2)
|
||||||
bot.emit('message', username, message, packet.sender)
|
bot.emit('message', username, message, packet.sender)
|
||||||
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
||||||
const message = raw.split('\u00BB ')[1].substring(2)
|
const message = raw.split('\u00BB ').slice(1).join(' ').substring(2)
|
||||||
|
bot.emit('message', username, message, packet.sender)
|
||||||
|
} else if (raw.match(/.* .*> .*/g)) {
|
||||||
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/>.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
||||||
|
const message = raw.split('> ').slice(1).join(' ').substring(2)
|
||||||
bot.emit('message', username, message, packet.sender)
|
bot.emit('message', username, message, packet.sender)
|
||||||
} else if (raw.match(/<.*> .*/g)) {
|
} else if (raw.match(/<.*> .*/g)) {
|
||||||
const username = raw.substring(1).split('>')[0]
|
const username = raw.substring(1).split('>')[0]
|
||||||
const message = raw.split('> ')[1]
|
const message = raw.split('> ').slice(1).join(' ')
|
||||||
|
|
||||||
bot.emit('message', username, message, packet.sender)
|
bot.emit('message', username, message, packet.sender)
|
||||||
} else if (raw.match(/§.*§b: §b\/.*/g)) {
|
} else if (raw.match(/§.*§b: §b\/.*/g)) {
|
||||||
|
|
Loading…
Reference in a new issue