edit embed

hello, this is my command for edit embed, but i must somehow implement edit embed by message id, how i can do it? what i must add?
const { Client, Intents, MessageAttachment, MessageEmbed } = require('discord.js');
module.exports = {
name: "edit-embed",
usage: '/edit-embed <messageid> <description> <title>',
options: [
{
type: 3,
name: 'description',
description: "",
required: false,
},
{
type: 3,
name: 'title',
description: "",
required: false,
},
{
type: 3,
name: 'footer',
description: "",
required: false,
},
],
category: "Moderation",
description: "EMBED",
userPerms: ["ADMINISTRATOR"],
ownerOnly: false,
run: async (client, interaction) => {
const description = interaction.options.getString('description');
const title = interaction.options.getString('title');
const footer = interaction.options.getString('footer');


const embed = new client.discord.MessageEmbed()
.setTitle(!title ? '' : title)
.setDescription(!description ? '' : description)
.setColor(client.config.embedColor)
.setFooter(!footer ? '' : footer)


await interaction.reply({ content: 'Done!', ephemeral: true });
return message.edit({ embeds: [embed], files: [icon] })

}
}
const { Client, Intents, MessageAttachment, MessageEmbed } = require('discord.js');
module.exports = {
name: "edit-embed",
usage: '/edit-embed <messageid> <description> <title>',
options: [
{
type: 3,
name: 'description',
description: "",
required: false,
},
{
type: 3,
name: 'title',
description: "",
required: false,
},
{
type: 3,
name: 'footer',
description: "",
required: false,
},
],
category: "Moderation",
description: "EMBED",
userPerms: ["ADMINISTRATOR"],
ownerOnly: false,
run: async (client, interaction) => {
const description = interaction.options.getString('description');
const title = interaction.options.getString('title');
const footer = interaction.options.getString('footer');


const embed = new client.discord.MessageEmbed()
.setTitle(!title ? '' : title)
.setDescription(!description ? '' : description)
.setColor(client.config.embedColor)
.setFooter(!footer ? '' : footer)


await interaction.reply({ content: 'Done!', ephemeral: true });
return message.edit({ embeds: [embed], files: [icon] })

}
}
1 Reply
MRDGH2821
MRDGH28212y ago
You have to add one more option - message_id From that you have to fetch the message object Then check if its your bot's message And finally message.edit
Want results from more Discord servers?
Add your server