WTTR-DISCORD/commands/Info/ping.js

26 lines
878 B
JavaScript
Raw Normal View History

2022-07-23 08:04:10 -04:00
const { EmbedBuilder } = require('discord.js');
2022-07-22 18:09:13 -04:00
module.exports = {
2023-08-20 19:40:54 -04:00
name: "weather",
description: "Get the weather for a location",
private: false,
options: [{
name: "location",
description: "The data you would like inside of the QR",
required: true,
type: 3 // 6 is type USER
}],
2022-07-22 18:09:13 -04:00
run: async (client, interaction) => {
2023-08-20 19:40:54 -04:00
let encodedLocation = encodeURIComponent(interaction.options._hoistedOptions[0].value);
let location = interaction.options._hoistedOptions[0].value;
2022-07-23 08:04:10 -04:00
const embed = new EmbedBuilder()
2022-07-22 18:09:13 -04:00
.setColor("#FF0000")
2023-08-20 19:40:54 -04:00
.setTitle(`The weather for: ${location}`)
2022-07-22 18:09:13 -04:00
.setTimestamp()
2023-08-20 19:40:54 -04:00
.setImage(`https://wttr.in/${encodedLocation}.png`)
2022-07-22 18:09:13 -04:00
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
2023-08-20 19:40:54 -04:00
await interaction.editReply({ embeds: [embed] });
2022-07-22 18:09:13 -04:00
},
};