This commit is contained in:
Raven Scott 2024-06-22 16:56:04 -04:00
parent 0e6d074c11
commit 8c0f7ebd0f
2 changed files with 23 additions and 9 deletions

26
app.js
View File

@ -61,18 +61,30 @@ function updatePeerCount() {
} }
} }
async function processGuild(guildData) { async function processGuild(guildTopic) {
const parsedData = JSON.parse(guildData); // Simulate fetching guild data for the given topic
config.guilds[parsedData.guildTopic] = { const guildData = {
alias: parsedData.guildAlias, guildTopic,
rooms: parsedData.rooms, guildAlias: "Sample Guild",
owner: parsedData.owner rooms: [
{ topic: "room1", alias: "Room 1" },
{ topic: "room2", alias: "Room 2" }
],
owner: config.userName
};
config.guilds[guildData.guildTopic] = {
alias: guildData.guildAlias,
rooms: guildData.rooms,
owner: guildData.owner
}; };
writeConfigToFile("./config.json"); writeConfigToFile("./config.json");
renderGuildList(); renderGuildList();
await joinGuild(parsedData.guildTopic); await joinGuild(guildData.guildTopic);
} }
export { processGuild };
async function joinGuild(guildTopic) { async function joinGuild(guildTopic) {
const guild = config.guilds[guildTopic]; const guild = config.guilds[guildTopic];
if (guild) { if (guild) {

View File

@ -103,7 +103,9 @@
</div> </div>
</div> </div>
<script> <script type="module">
import { processGuild } from './app.js';
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const messageInput = document.getElementById('message'); const messageInput = document.getElementById('message');
const copyTopicLink = document.getElementById('copy-topic-link'); const copyTopicLink = document.getElementById('copy-topic-link');