From 75be3a5b33912e0ba1c96564ce4db2430af581cc Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:20:37 +0300 Subject: [PATCH] Reworked commands, added some funny stuff --- chatBot/includes/Client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chatBot/includes/Client.js b/chatBot/includes/Client.js index eec549e..d5f6866 100644 --- a/chatBot/includes/Client.js +++ b/chatBot/includes/Client.js @@ -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)); } });