MessageAttachement isn't working
Hi, I'm trying to add a local file to my embed but it is giving me an
Invalid Form BodyInvalid Form Body error: Scheme "attachement" is not supported. Scheme must be one of ('http', 'https').Scheme "attachement" is not supported. Scheme must be one of ('http', 'https').. My code looks like the following:const { MessageEmbed, MessageAttachment } = require("discord.js");
const countries = require("svg-country-flags/countries.json");
module.exports = {
data: new SlashCommandBuilder()
.setName("guess")
.setDescription("Guess a random flag"),
async execute(interaction) {
let randomProperty = function (obj) {
let keys = Object.keys(obj);
let num = keys.length * Math.random() << 0;
return `${keys[num]}, ${obj[keys[num]]}`;
};
let randCountry = randomProperty(countries);
randCountry = randCountry.split(", ");
const file = new MessageAttachment(`./node_modules/svg-country-flags/png1000px/${randCountry[0]}.png`);
const guessEmbed = new MessageEmbed()
.setColor("GREEN")
.setTitle("Guess that Flag!")
.setDescription(`<t:${countdown}:R>`)
.setImage({
url: `attachement://${randCountry[0]}.png`,
size: 256
})
interaction.reply({ embeds: [guessEmbed], files: [file] })
};
};const { MessageEmbed, MessageAttachment } = require("discord.js");
const countries = require("svg-country-flags/countries.json");
module.exports = {
data: new SlashCommandBuilder()
.setName("guess")
.setDescription("Guess a random flag"),
async execute(interaction) {
let randomProperty = function (obj) {
let keys = Object.keys(obj);
let num = keys.length * Math.random() << 0;
return `${keys[num]}, ${obj[keys[num]]}`;
};
let randCountry = randomProperty(countries);
randCountry = randCountry.split(", ");
const file = new MessageAttachment(`./node_modules/svg-country-flags/png1000px/${randCountry[0]}.png`);
const guessEmbed = new MessageEmbed()
.setColor("GREEN")
.setTitle("Guess that Flag!")
.setDescription(`<t:${countdown}:R>`)
.setImage({
url: `attachement://${randCountry[0]}.png`,
size: 256
})
interaction.reply({ embeds: [guessEmbed], files: [file] })
};
};