From 14aa129f6ddbc2382babf43c90cc0e2fe88fc3d7 Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:44:05 +0300 Subject: [PATCH] Trying some changes to make bot messages and client mmessages have same format --- app.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app.js b/app.js index 3608b34..b5800d4 100644 --- a/app.js +++ b/app.js @@ -290,11 +290,11 @@ function setupTalkButton() { const audioMessage = { type: 'audio', name: config.userName, - audio: b4a.toString(buffer, 'base64'), - audioType: audioBlob.type, avatar: updatePortInUrl(config.userAvatar), topic: topic, - timestamp: Date.now() + timestamp: Date.now(), + audio: b4a.toString(buffer, 'base64'), + audioType: audioBlob.type }; console.log('Sending audio message:', audioMessage); // Debugging log @@ -565,10 +565,10 @@ async function sendMessage(e) { const messageObj = JSON.stringify({ type: 'message', name: config.userName, - message, avatar: config.userAvatar, topic: topic, - timestamp: timestamp + timestamp: timestamp, + message }); const peers = [...activeRooms.find(room => room.topic === topic).swarm.connections]; @@ -592,12 +592,12 @@ async function handleFileInput(event) { const fileMessage = { type: 'file', name: config.userName, - fileName: file.name, - file: b4a.toString(buffer, 'base64'), - fileType: file.type, avatar: updatePortInUrl(config.userAvatar), topic: topic, - timestamp: Date.now() + timestamp: Date.now(), + fileName: file.name, + file: b4a.toString(buffer, 'base64'), + fileType: file.type }; console.log('Sending file message:', fileMessage); // Debugging log