Guh
This commit is contained in:
parent
233c1804d9
commit
62f9f4af19
4
index.js
4
index.js
|
@ -616,6 +616,7 @@ discord.on("interactionCreate", async (interaction) => {
|
|||
if (interaction.customId) {
|
||||
const product_id = interaction.customId;
|
||||
const url = `https://mesonet.agron.iastate.edu/api/1/nwstext/${product_id}`;
|
||||
interaction.deferReply({ ephemeral: true });
|
||||
fetch(url).then((res) => {
|
||||
if (res.status !== 200) {
|
||||
interaction.reply({ content: "Failed to get product text", ephemeral: true });
|
||||
|
@ -638,6 +639,9 @@ discord.on("interactionCreate", async (interaction) => {
|
|||
interaction.followUp({content: message, ephemeral: true});
|
||||
})
|
||||
});
|
||||
}).catch((err) => {
|
||||
interaction.reply({ content: "Failed to get product text", ephemeral: true });
|
||||
console.log(`${colors.red("[ERROR]")} Failed to get product text: ${err.message}`);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue