Duplicating Embeds

Whenever I go to edit my embed they duplicate but the buttons that went to the other embed still control the top one.
5 Replies
d.js toolkit
d.js toolkit12mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Post the full error stack trace, not just the top part! - Show your code! - Explain what exactly your issue is. - Not a discord.js issue? Check out #useful-servers. - Issue solved? Press the button!
Toasty
Toasty12mo ago
Toasty
Toasty12mo ago
The buttons still control the top ones tho
Toasty
Toasty12mo ago
Toasty
Toasty12mo ago
const id = new EmbedBuilder()
.setTitle('User Identification')
.addFields(
{ name: 'Buyer', value: '`None`' },
{ name: 'Seller', value: '`None`' },
);
const roles = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('buyer')
.setLabel('I am buyer')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('seller')
.setLabel('I am seller')
.setStyle(ButtonStyle.Secondary)
)
channel.send({ embeds: [id], components: [roles]})
const collector = channel.createMessageComponentCollector({
componentType: ComponentType.Button,

});
collector.on('collect', (interaction) => {
var buy = '`None`'
var sell = '`None`'
if (interaction.customId === 'buyer') {
buy = interaction.member
const id = new EmbedBuilder()
.setTitle('User Identification')
.addFields(
{ name: 'Buyer', value: `${buy}` },
{ name: 'Seller', value: `${sell}` },
);

interaction2.editReply({embeds: [id]})
const id = new EmbedBuilder()
.setTitle('User Identification')
.addFields(
{ name: 'Buyer', value: '`None`' },
{ name: 'Seller', value: '`None`' },
);
const roles = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('buyer')
.setLabel('I am buyer')
.setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId('seller')
.setLabel('I am seller')
.setStyle(ButtonStyle.Secondary)
)
channel.send({ embeds: [id], components: [roles]})
const collector = channel.createMessageComponentCollector({
componentType: ComponentType.Button,

});
collector.on('collect', (interaction) => {
var buy = '`None`'
var sell = '`None`'
if (interaction.customId === 'buyer') {
buy = interaction.member
const id = new EmbedBuilder()
.setTitle('User Identification')
.addFields(
{ name: 'Buyer', value: `${buy}` },
{ name: 'Seller', value: `${sell}` },
);

interaction2.editReply({embeds: [id]})