maybe
This commit is contained in:
parent
9c1703d1ae
commit
cdb86c0ad0
18
index.js
18
index.js
|
@ -272,6 +272,9 @@ xmpp.on("stanza", (stanza) => {
|
||||||
query.getChildren("item").forEach((item) => {
|
query.getChildren("item").forEach((item) => {
|
||||||
// Check if the JID is on the blacklist, if so, ignore it
|
// Check if the JID is on the blacklist, if so, ignore it
|
||||||
if (blacklist.includes(item.attrs.jid)) return;
|
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);
|
iem.push(item.attrs);
|
||||||
console.log(`${colors.cyan("[INFO]")} Found room: ${item.attrs.jid}`);
|
console.log(`${colors.cyan("[INFO]")} Found room: ${item.attrs.jid}`);
|
||||||
// Join the room
|
// Join the room
|
||||||
|
@ -945,19 +948,10 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// New setup, we're pulling from wfos.json now
|
// get chunks from iem
|
||||||
const wfoChunks = [];
|
const chunks = chunkArray(iem, Math.ceil(iem.length / 50));
|
||||||
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))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
chunks.forEach((chunk, index) => {
|
||||||
|
|
||||||
wfoChunks.forEach((chunk, index) => {
|
|
||||||
const categoryName = `Rooms ${index + 1}`;
|
const categoryName = `Rooms ${index + 1}`;
|
||||||
interaction.guild.channels.create({
|
interaction.guild.channels.create({
|
||||||
name: categoryName,
|
name: categoryName,
|
||||||
|
|
Loading…
Reference in a new issue