From cdb86c0ad0633a28f612b3e785c483800cebfe67 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Thu, 16 May 2024 21:20:06 -0600 Subject: [PATCH] maybe --- index.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index fb3ac38..ff1d8db 100644 --- a/index.js +++ b/index.js @@ -272,6 +272,9 @@ xmpp.on("stanza", (stanza) => { query.getChildren("item").forEach((item) => { // Check if the JID is on the blacklist, if so, ignore it if (blacklist.includes(item.attrs.jid)) return; + // get proper name from wfos + const wfo = getWFOByRoom(item.attrs.jid.split("@")[0]); + item.attrs.properName = wfo.location; iem.push(item.attrs); console.log(`${colors.cyan("[INFO]")} Found room: ${item.attrs.jid}`); // Join the room @@ -945,19 +948,10 @@ discord.on("interactionCreate", async (interaction) => { - // New setup, we're pulling from wfos.json now - const wfoChunks = []; - const wfoChunkSize = 50; - const totalWFOs = wfos.length; - // wfos is object "wfo": {"location": "Text Name", "room": "roomname"} - for (let i = 0; i < totalWFOs; i += wfoChunkSize) { - wfoChunks.push(wfos.slice(i, i + wfoChunkSize)); - console.log(wfos.slice(i, i + wfoChunkSize)) - } + // get chunks from iem + const chunks = chunkArray(iem, Math.ceil(iem.length / 50)); - - - wfoChunks.forEach((chunk, index) => { + chunks.forEach((chunk, index) => { const categoryName = `Rooms ${index + 1}`; interaction.guild.channels.create({ name: categoryName,