Fix outlook command

This commit is contained in:
Christopher Cookman 2024-06-18 20:31:48 -06:00
parent 46000e92ee
commit c77577a382
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -91,7 +91,7 @@ const getUniqueChannels = function () {
// Get first url in a string, return object {string, url} remove the url from the string
const getFirstURL = function (string) {
const url = string.match(/(https?:\/\/[^\s]+)/g);
url = string.match(/(https?:\/\/[^\s]+)/g);
if (!url) return { string, url: null };
const newString = string.replace(url[0], "");
return { string: newString, url: url[0] };
@ -1071,7 +1071,7 @@ discord.on("interactionCreate", async (interaction) => {
// Get the callsign
const callsign = interaction.options.getString("callsign");
// Get the URL associated with the callsign
const url = nwrstreams.callsigns[callsign];
url = nwrstreams.callsigns[callsign];
// Get the voice channel
channel = interaction.member.voice?.channel; // Use a unique variable name
@ -1287,7 +1287,7 @@ discord.on("interactionCreate", async (interaction) => {
case Discord.InteractionType.MessageComponent:
if (interaction.customId) {
const product_id = interaction.customId;
const url = `https://mesonet.agron.iastate.edu/api/1/nwstext/${product_id}`;
url = `https://mesonet.agron.iastate.edu/api/1/nwstext/${product_id}`;
await interaction.deferReply({ ephemeral: true });
fetch(url).then((res) => {
if (res.status !== 200) {