Cannot update embed after component interaction

Sending a new embed to the channel doesn't work either. What should I do?
async execute(interaction) {
...

interaction
.editReply(replyMessage)
.then(() => {
const collectorFilter = (i) => i.user.id === interaction.user.id;
const taskPromises = values.map((row) => {
const embed = generateEmbed(row); // an embed object
const select = new StringSelectMenuBuilder()
.setCustomId("selector")
.setPlaceholder("Select a new status!")
.addOptions(
...StatusChoices.map((c) =>
new StringSelectMenuOptionBuilder().setLabel(c).setValue(c),
),
);

return interaction
.followUp({
embeds: [embed],
components: [new ActionRowBuilder().addComponents(select)],
})
.then((msg) => {
return msg.awaitMessageComponent({
filter: collectorFilter,
});
})
.then((conf) => {
const newEmbed = EmbedBuilder.from(conf.message.embeds[0])
.setColor(StatusColor[conf.values[0]])
.setDescription(
`Status updated`,
);
// ↓ this doesn't work either ↓
// const newEmbed = new EmbedBuilder()
// .setTitle("Some title")
// .setDescription("Description after the edit");

const channel = interaction.client.channels.cache.get(
JSON.parse(process.env.CHANNEL)["notice"],
);

channel.send({
content: `Status updated`,
embed: [newEmbed],
});

conf.update({
content: `Status updated`,
embed: [newEmbed],
components: [],
});
});
});

return Promise.all(taskPromises);
});
},
async execute(interaction) {
...

interaction
.editReply(replyMessage)
.then(() => {
const collectorFilter = (i) => i.user.id === interaction.user.id;
const taskPromises = values.map((row) => {
const embed = generateEmbed(row); // an embed object
const select = new StringSelectMenuBuilder()
.setCustomId("selector")
.setPlaceholder("Select a new status!")
.addOptions(
...StatusChoices.map((c) =>
new StringSelectMenuOptionBuilder().setLabel(c).setValue(c),
),
);

return interaction
.followUp({
embeds: [embed],
components: [new ActionRowBuilder().addComponents(select)],
})
.then((msg) => {
return msg.awaitMessageComponent({
filter: collectorFilter,
});
})
.then((conf) => {
const newEmbed = EmbedBuilder.from(conf.message.embeds[0])
.setColor(StatusColor[conf.values[0]])
.setDescription(
`Status updated`,
);
// ↓ this doesn't work either ↓
// const newEmbed = new EmbedBuilder()
// .setTitle("Some title")
// .setDescription("Description after the edit");

const channel = interaction.client.channels.cache.get(
JSON.parse(process.env.CHANNEL)["notice"],
);

channel.send({
content: `Status updated`,
embed: [newEmbed],
});

conf.update({
content: `Status updated`,
embed: [newEmbed],
components: [],
});
});
});

return Promise.all(taskPromises);
});
},
No description
No description
No description
2 Replies
d.js toolkit
d.js toolkit14mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
PurifiedWater
PurifiedWaterOP14mo ago
[email protected] and v20.9.0 for node Oh god it's a typo
Want results from more Discord servers?
Add your server