NWR Play Works
This commit is contained in:
parent
0a9376d4d7
commit
e5d9a687d4
11
index.js
11
index.js
|
@ -632,6 +632,7 @@ discord.on('ready', async () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "play",
|
"name": "play",
|
||||||
|
"type": 1,
|
||||||
"description": "Play a stream",
|
"description": "Play a stream",
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
|
@ -644,11 +645,12 @@ discord.on('ready', async () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nwrplay",
|
"name": "nwrplay",
|
||||||
"description": "Play a NWR stream",
|
"description": "Nwr stream",
|
||||||
|
"type": 1,
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"name": "Callsign",
|
"name": "callsign",
|
||||||
"description": "Enter a Valid NWR Callsign",
|
"description": "The URL of the stream to play",
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"required": true
|
"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 });
|
if (!interaction.inGuild()) return interaction.reply({ content: "This command can only be used in a guild", ephemeral: true });
|
||||||
// Get the URL
|
// Get the URL
|
||||||
url = interaction.options.getString("url");
|
url = interaction.options.getString("url");
|
||||||
|
const data2 = JSON.parse(nwrstreams.readFileSync('./data/nwrstreams.json', 'utf8'));
|
||||||
// Sanity check URL for funny stuff
|
// Sanity check URL for funny stuff
|
||||||
if (!url.match(/https?:\/\/[^\s]+/)) return interaction.reply({ content: "Invalid URL", ephemeral: true });
|
if (!url.match(/https?:\/\/[^\s]+/)) return interaction.reply({ content: "Invalid URL", ephemeral: true });
|
||||||
// Get the channel
|
// Get the channel
|
||||||
|
@ -1056,7 +1059,7 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
// Get the callsign
|
// Get the callsign
|
||||||
const callsign = interaction.options.getString("callsign");
|
const callsign = interaction.options.getString("callsign");
|
||||||
// Read the JSON file
|
// Read the JSON file
|
||||||
const data = JSON.parse(nwrstreams.readFileSync('./data/nwrstreams.json', 'utf8'));
|
const data = nwrstreams
|
||||||
// Get the URL associated with the callsign
|
// Get the URL associated with the callsign
|
||||||
const url = data.callsigns[callsign];
|
const url = data.callsigns[callsign];
|
||||||
// Sanity check URL for funny stuff
|
// Sanity check URL for funny stuff
|
||||||
|
|
Loading…
Reference in a new issue