more test

This commit is contained in:
Raven Scott 2024-07-07 21:30:09 -04:00
parent e0ad9c7067
commit 55875f468c

7
app.js
View File

@ -263,7 +263,7 @@ function setupEventListeners() {
}); });
} }
function handleIncomingMessage(messageObj) { function handleIncomingMessage(messageObj, connection) {
console.log('Received message:', messageObj); // Debugging log console.log('Received message:', messageObj); // Debugging log
if (messageObj.type === 'icon') { if (messageObj.type === 'icon') {
@ -376,6 +376,9 @@ function handleIncomingMessage(messageObj) {
}); });
connection.write(guildResponseMessage); connection.write(guildResponseMessage);
} }
} else if (messageObj.type === 'guildResponse') {
const guildData = messageObj.guildData;
processGuild(guildData);
} else { } else {
console.error('Received unknown message type:', messageObj); console.error('Received unknown message type:', messageObj);
} }
@ -428,7 +431,7 @@ async function handleConnection(connection, info) {
connection.write(guildJoinMessage); connection.write(guildJoinMessage);
} }
} else { } else {
eventEmitter.emit('onMessage', messageObj); eventEmitter.emit('onMessage', messageObj, connection);
} }
}); });