Add nickname to legacy chat

This commit is contained in:
7cc5c4f330d47060 2024-08-17 07:50:30 -04:00
parent 5f0c8a99e1
commit 05c3e3b4d2
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -131,7 +131,8 @@ module.exports = {
b.emit('chat', {
json,
type: 'system',
uuid, message: split.join(': '),
uuid,
message: split.join(': '),
nickname,
username
})
@ -141,6 +142,7 @@ module.exports = {
const json = parse1204(data.message)
const parsed = parsePlain(json)
let chatName
let nickname
let username
let message
let uuid
@ -153,15 +155,19 @@ module.exports = {
} else { // Servers with Extras chat, such as Kaboom
const split = parsed.split(': ')
chatName = split.splice(0, 1)[0]
const chatNameSplit = chatName.split(" ");
nickname = chatNameSplit[chatNameSplit.length-1]
username = b.findRealName(chatName)
uuid = b.findUUID(username)
message = split.join(': ')
}
if(data.uuid) uuid = data.uuid;
b.emit('chat', {
json,
type: 'legacy',
uuid: data.uuid ? data.uuid : uuid,
uuid: uuid,
message,
nickname,
username
})
})