26 lines
878 B
JavaScript
26 lines
878 B
JavaScript
const { EmbedBuilder } = require('discord.js');
|
|
|
|
module.exports = {
|
|
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
|
|
}],
|
|
run: async (client, interaction) => {
|
|
let encodedLocation = encodeURIComponent(interaction.options._hoistedOptions[0].value);
|
|
let location = interaction.options._hoistedOptions[0].value;
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor("#FF0000")
|
|
.setTitle(`The weather for: ${location}`)
|
|
.setTimestamp()
|
|
.setImage(`https://wttr.in/${encodedLocation}.png`)
|
|
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
|
|
await interaction.editReply({ embeds: [embed] });
|
|
},
|
|
};
|