From e5d9a687d4b7ad031fa8538c630fcfe147503ce1 Mon Sep 17 00:00:00 2001 From: MoSiren Date: Wed, 12 Jun 2024 03:11:58 +0000 Subject: [PATCH] NWR Play Works --- index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 6a81503..7e4a67a 100644 --- a/index.js +++ b/index.js @@ -632,6 +632,7 @@ discord.on('ready', async () => { }, { "name": "play", + "type": 1, "description": "Play a stream", "options": [ { @@ -644,11 +645,12 @@ discord.on('ready', async () => { }, { "name": "nwrplay", - "description": "Play a NWR stream", + "description": "Nwr stream", + "type": 1, "options": [ { - "name": "Callsign", - "description": "Enter a Valid NWR Callsign", + "name": "callsign", + "description": "The URL of the stream to play", "type": 3, "required": true } @@ -1037,6 +1039,7 @@ discord.on("interactionCreate", async (interaction) => { if (!interaction.inGuild()) return interaction.reply({ content: "This command can only be used in a guild", ephemeral: true }); // Get the URL url = interaction.options.getString("url"); + const data2 = JSON.parse(nwrstreams.readFileSync('./data/nwrstreams.json', 'utf8')); // Sanity check URL for funny stuff if (!url.match(/https?:\/\/[^\s]+/)) return interaction.reply({ content: "Invalid URL", ephemeral: true }); // Get the channel @@ -1056,7 +1059,7 @@ discord.on("interactionCreate", async (interaction) => { // Get the callsign const callsign = interaction.options.getString("callsign"); // Read the JSON file - const data = JSON.parse(nwrstreams.readFileSync('./data/nwrstreams.json', 'utf8')); + const data = nwrstreams // Get the URL associated with the callsign const url = data.callsigns[callsign]; // Sanity check URL for funny stuff