Feat: Adding GUILDS! #12

Merged
snxraven merged 21 commits from guilds into main 2024-07-07 23:01:33 -04:00
Showing only changes of commit 55875f468c - Show all commits

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);
} }
}); });