I want to make a System who read a embed by id and edit it. I want to copy the Description from the old Embed but it gives a error
Code:
message.delete();
if(message.author.id === "697786816379617320") {
if(!args[1]) return message.channel.send({ content: "Keine Message ID" });
else if(args[0]) {
const VorschlagEmbedOriginal = message.embeds[0];
const VorschlagAbgelehnt = new Discord.MessageEmbed(VorschlagEmbedOriginal)
.setTitle("» :x: - VORSCHLAG ABGELEHNT")
.setDescription(VorschlagEmbedOriginal.description)
.setThumbnail("https://i.imgur.com/kgcY5rF.png")
.setColor('#ff0000');
message.channel.messages.fetch({around: args[1], limit: 1})
.then(msg => {
const fetchedMsg = msg.first();
fetchedMsg.edit({ embeds: [VorschlagAbgelehnt] });
});
}
}
else return;
}`
Assumming that this message is in the same channel that the command is being sent in this should help. You were defining the embed before it was even fetched. First you need to fetch the message then the client will have access to the message embed.
message.delete();
if (message.author.id === "697786816379617320") {
if (!args[1]) return message.channel.send({
content: "Keine Message ID"
});
if (args[0]) {
message.channel.messages.fetch(args[1])
.then(msg => {
const VorschlagAbgelehnt = new MessageEmbed(msg.embeds[0])
.setTitle("» :x: - VORSCHLAG ABGELEHNT")
.setDescription(`${msg.embeds[0].description}`)
.setThumbnail("https://i.imgur.com/kgcY5rF.png")
.setColor('#ff0000');
msg.edit({
embeds: [VorschlagAbgelehnt]
});
});
}
} else return;