Feat: Adding GUILDS! #12
19
app.js
19
app.js
@ -351,6 +351,8 @@ function handleIncomingMessage(messageObj) {
|
||||
peer.write(renameMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else if (messageObj.type === 'guildJoin') {
|
||||
@ -361,7 +363,22 @@ function handleIncomingMessage(messageObj) {
|
||||
renderGuildList();
|
||||
joinGuild(guildTopic);
|
||||
}
|
||||
} else {
|
||||
} else if (messageObj.type === 'guildRequest') {
|
||||
const guildTopic = messageObj.guildTopic;
|
||||
const guild = config.guilds[guildTopic];
|
||||
if (guild) {
|
||||
const guildResponseMessage = JSON.stringify({
|
||||
type: 'guildResponse',
|
||||
guildData: JSON.stringify({
|
||||
guildTopic,
|
||||
guildAlias: guild.alias,
|
||||
rooms: guild.rooms,
|
||||
owner: guild.owner
|
||||
})
|
||||
});
|
||||
connection.write(guildResponseMessage);
|
||||
}
|
||||
} else {
|
||||
console.error('Received unknown message type:', messageObj);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@
|
||||
joinGuildBtn.addEventListener('click', async (event) => {
|
||||
const guildTopic = document.getElementById('join-guild-topic').value.trim();
|
||||
if (guildTopic) {
|
||||
await processGuild(guildTopic);
|
||||
await joinGuildRequest(guildTopic);
|
||||
}
|
||||
});
|
||||
|
||||
@ -254,4 +254,4 @@
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user