test
This commit is contained in:
parent
a1b11f7ae6
commit
da1bf28e3d
40
app.js
40
app.js
@ -61,32 +61,18 @@ function updatePeerCount() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processGuild(guildTopic) {
|
async function processGuild(guildData) {
|
||||||
// Simulate fetching guild data for the given topic
|
const parsedData = JSON.parse(guildData);
|
||||||
console.log('Processing guild for topic:', guildTopic); // Debugging log
|
config.guilds[parsedData.guildTopic] = {
|
||||||
|
alias: parsedData.guildAlias,
|
||||||
const guildData = {
|
rooms: parsedData.rooms,
|
||||||
guildTopic,
|
owner: parsedData.owner
|
||||||
guildAlias: "Sample Guild",
|
|
||||||
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(guildData.guildTopic);
|
await joinGuild(parsedData.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) {
|
||||||
@ -209,7 +195,6 @@ function setupEventListeners() {
|
|||||||
const attachFileButton = document.getElementById('attach-file');
|
const attachFileButton = document.getElementById('attach-file');
|
||||||
const fileInput = document.getElementById('file-input');
|
const fileInput = document.getElementById('file-input');
|
||||||
const talkButton = document.getElementById('talk-btn');
|
const talkButton = document.getElementById('talk-btn');
|
||||||
const joinGuildBtn = document.getElementById('join-guild');
|
|
||||||
|
|
||||||
if (registerForm) {
|
if (registerForm) {
|
||||||
registerForm.addEventListener('submit', registerUser);
|
registerForm.addEventListener('submit', registerUser);
|
||||||
@ -249,17 +234,6 @@ function setupEventListeners() {
|
|||||||
if (talkButton) {
|
if (talkButton) {
|
||||||
setupTalkButton();
|
setupTalkButton();
|
||||||
}
|
}
|
||||||
if (joinGuildBtn) {
|
|
||||||
joinGuildBtn.addEventListener('click', async (event) => {
|
|
||||||
const guildTopic = document.getElementById('join-guild-topic').value.trim();
|
|
||||||
if (guildTopic) {
|
|
||||||
console.log('Join Guild button clicked with topic:', guildTopic); // Debugging log
|
|
||||||
await processGuild(guildTopic);
|
|
||||||
} else {
|
|
||||||
console.error('Guild topic is empty');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add event listeners only for room items
|
// Add event listeners only for room items
|
||||||
document.querySelectorAll('.room-item').forEach(item => {
|
document.querySelectorAll('.room-item').forEach(item => {
|
||||||
|
Loading…
Reference in New Issue
Block a user