Reworked commands, added some funny stuff

This commit is contained in:
MrMasrozYTLIVE 2024-06-14 17:20:37 +03:00
parent d5650a9d7b
commit 75be3a5b33

View File

@ -43,17 +43,18 @@ class Client extends EventEmitter {
const messageObj = JSON.parse(message.toString());
if (this.joinedRooms.has(messageObj.topic)) { // Process message only if it is from a joined room
this.currentTopic = messageObj.topic; // Set the current topic from the incoming message
if (messageObj.type === "message")
this.emit('onMessage', peer, new TextMessage(messageObj.name, messageObj.avatar, messageObj.topic, messageObj.timestamp, messageObj.message));
if (messageObj.type === "file")
this.emit('onFile', peer, new FileMessage(messageObj.name, messageObj.avatar, messageObj.fileName, messageObj.fileUrl, messageObj.fileType, messageObj.avatar, messageObj.topic, messageObj.timestamp));
this.emit('onFile', peer, new FileMessage(messageObj.name, messageObj.avatar, messageObj.avatar, messageObj.topic, messageObj.timestamp, messageObj.fileName, messageObj.fileUrl, messageObj.fileType));
if (messageObj.type === "icon")
this.emit('onIcon', peer, messageObj);
if (messageObj.type === "audio")
this.emit('onAudio', peer, new AudioMessage());
this.emit('onAudio', peer, new AudioMessage(messageObj.name, messageObj.avatar, messageObj.avatar, messageObj.topic, messageObj.timestamp, messageObj.audio, messageObj.audioType));
}
});