forked from ChrisChrome/weather-bot
Use WFOs for setupall
This commit is contained in:
parent
403ee86e4d
commit
4e1d52178f
|
@ -1,8 +1,8 @@
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const client = new Discord.Client({intents: ["Guilds"]})
|
const client = new Discord.Client({intents: ["Guilds"]})
|
||||||
const config = require('../config.json');
|
const config = require('./config.json');
|
||||||
|
|
||||||
categories = ["1237806700879417416", "1237806701722337451", "1237806702473121853", "1237806703010123857"]
|
categories = ["1237807432311373895", "1237807432709963807", "1237807433678590023", "1237807434425434164"]
|
||||||
|
|
||||||
client.once('ready', () => {
|
client.once('ready', () => {
|
||||||
console.log('Ready!');
|
console.log('Ready!');
|
18
index.js
18
index.js
|
@ -946,12 +946,22 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
// Create channels for all rooms
|
// Create channels for all rooms
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
const chunkSize = 50;
|
const chunkSize = 50;
|
||||||
const totalRooms = iem.length;
|
// const totalRooms = iem.length;
|
||||||
for (let i = 0; i < totalRooms; i += chunkSize) {
|
// for (let i = 0; i < totalRooms; i += chunkSize) {
|
||||||
chunks.push(iem.slice(i, i + chunkSize));
|
// chunks.push(iem.slice(i, i + chunkSize));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// New setup, we're pulling from wfos.json now
|
||||||
|
const wfoChunks = [];
|
||||||
|
const wfoChunkSize = 50;
|
||||||
|
const totalWFOs = wfos.length;
|
||||||
|
for (let i = 0; i < totalWFOs; i += wfoChunkSize) {
|
||||||
|
wfoChunks.push(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