Trying some changes to make bot messages and client mmessages have same format

This commit is contained in:
MrMasrozYTLIVE 2024-06-14 17:44:05 +03:00
parent d449249f41
commit 14aa129f6d

18
app.js
View File

@ -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