From d2df2a48ba2a600ffb96d76bddcc4fc69bb41964 Mon Sep 17 00:00:00 2001 From: dziban303 Date: Sat, 18 Jan 2025 07:24:04 -0700 Subject: [PATCH 1/2] Update data/satellites.json --- data/{sattelites.json => satellites.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename data/{sattelites.json => satellites.json} (100%) diff --git a/data/sattelites.json b/data/satellites.json similarity index 100% rename from data/sattelites.json rename to data/satellites.json -- 2.43.5 From 310daf37f94235e4663415d50367e11f84796912 Mon Sep 17 00:00:00 2001 From: dziban303 Date: Sat, 18 Jan 2025 07:25:28 -0700 Subject: [PATCH 2/2] Update index.js sattelite->satellite --- index.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/index.js b/index.js index 504fe87..59cc114 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ const wfos = require("./data/wfos.json"); const blacklist = require("./data/blacklist.json"); const events = require("./data/events.json"); const outlookURLs = require("./data/outlook.json"); -const sattelites = require("./data/sattelites.json"); +const satellites = require("./data/satellites.json"); const nwrstreams = {callsigns:{}}; const Jimp = require("jimp"); const { client, xml } = require("@xmpp/client"); @@ -681,19 +681,19 @@ discord.on('ready', async () => { commands = require("./data/commands.json"); // Add dynamic commands (based on datas files) satCommand = { - "name": "sattelite", - "description": "Get the latest sattelite images from a given sattelite", + "name": "satellite", + "description": "Get the latest satellite images from a given satellite", "options": [ { - "name": "sattelite", - "description": "The sattelite to get images from", + "name": "satellite", + "description": "The satellite to get images from", "type": 3, "required": true, "choices": [] } ] } - for (const key in sattelites) { + for (const key in satellites) { satCommand.options[0].choices.push({ "name": key, "value": key @@ -1332,18 +1332,18 @@ discord.on("interactionCreate", async (interaction) => { console.error(err); }); break; - case "sattelite": // Get satellite images - sat = interaction.options.getString("sattelite"); - if (!sattelites[sat]) return interaction.reply({ content: "Invalid satellite", ephemeral: true }); + case "satellite": // Get satellite images + sat = interaction.options.getString("satellite"); + if (!satellites[sat]) return interaction.reply({ content: "Invalid satellite", ephemeral: true }); // Fetch all the images productOptions = [] await (() => { - for (const key in sattelites[sat].products) { - // make a discord customid safe id for the product name, add it to the sattelites object - sattelites[sat].products[key].customid = key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(); + for (const key in satellites[sat].products) { + // make a discord customid safe id for the product name, add it to the satellites object + satellites[sat].products[key].customid = key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(); productOptions.push({ label: key, - value: sattelites[sat].products[key].customid + value: satellites[sat].products[key].customid }) } console.log(JSON.stringify(productOptions, null, 2)) @@ -1426,7 +1426,7 @@ discord.on("interactionCreate", async (interaction) => { sat = satData.sat product = interaction.values[0]; // find the original product name - product_name = Object.keys(sattelites[sat].products).find(key => sattelites[sat].products[key].customid === product); + product_name = Object.keys(satellites[sat].products).find(key => satellites[sat].products[key].customid === product); imageOptions = [] satMessages[interaction.customId.split("|")[1]] = { sat, @@ -1435,13 +1435,13 @@ discord.on("interactionCreate", async (interaction) => { images: {} } await (() => { - // for key, value in sattelites[sat].products[product_name] + // for key, value in satellites[sat].products[product_name] console.log(product_name) - for (const key in sattelites[sat].products[product_name]) { - // make a discord customid safe id for the product name, add it to the sattelites object - //console.log(sattelites[sat].products[product_name]) + for (const key in satellites[sat].products[product_name]) { + // make a discord customid safe id for the product name, add it to the satellites object + //console.log(satellites[sat].products[product_name]) if (key === "customid") continue; - satMessages[interaction.customId.split("|")[1]].images[key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase()] = sattelites[sat].products[product_name][key]; + satMessages[interaction.customId.split("|")[1]].images[key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase()] = satellites[sat].products[product_name][key]; imageOptions.push({ label: key, value: key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase() -- 2.43.5