Issue: Cant update my button, after a change the embed with message.awaitMessageComponent

This is my code :
const message = await interaction.reply({ embeds: [embed], ephemeral: true, components: [row] })

const CollectorFilter = (interaction: { user: { id: any; }; }) => interaction.user.id === interaction.user.id


try {
const Collector = await message.awaitMessageComponent({ filter: CollectorFilter, time: 60_000 })

console.log(Collector.customId)
if (Collector.customId === 'guild') {
returnButton.setDisabled(false)
guildButton.setDisabled(true)

// @ts-ignore
await interaction.editReply({ embeds: [guildembed], components: [row] })
} else if (Collector.customId === 'return') {
returnButton.setDisabled(true)
guildButton.setDisabled(false)

// @ts-ignore
await interaction.editReply({ embeds: [embed], components: [row] })
}

} catch (error) {
await interaction.deleteReply()
}
const message = await interaction.reply({ embeds: [embed], ephemeral: true, components: [row] })

const CollectorFilter = (interaction: { user: { id: any; }; }) => interaction.user.id === interaction.user.id


try {
const Collector = await message.awaitMessageComponent({ filter: CollectorFilter, time: 60_000 })

console.log(Collector.customId)
if (Collector.customId === 'guild') {
returnButton.setDisabled(false)
guildButton.setDisabled(true)

// @ts-ignore
await interaction.editReply({ embeds: [guildembed], components: [row] })
} else if (Collector.customId === 'return') {
returnButton.setDisabled(true)
guildButton.setDisabled(false)

// @ts-ignore
await interaction.editReply({ embeds: [embed], components: [row] })
}

} catch (error) {
await interaction.deleteReply()
}
No description
4 Replies
d.js toolkit
d.js toolkit•14mo 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!
Melio
MelioOP•14mo ago
i have tested it before, that do the same 😢 did u have any other solution ? how do i do that ? ohhh sorryy im just to tired x)
Melio
MelioOP•14mo ago
No description
Melio
MelioOP•14mo ago
thats not working 😢
const message = await interaction.reply({ embeds: [embed], ephemeral: true, components: [row], fetchReply: true })

const CollectorFilter = (interaction: { user: { id: any; }; }) => interaction.user.id === interaction.user.id


try {
const Collector = await message.awaitMessageComponent({ filter: CollectorFilter, time: 60000 })
if (Collector.customId === 'guild') {
returnButton.setDisabled(false)
guildButton.setDisabled(true)
await Collector.update({ embeds: [guildembed], components: [row] })
}
else if (Collector.customId === 'return') {
returnButton.setDisabled(true)
guildButton.setDisabled(false)
await Collector.update({ embeds: [embed], components: [row] })
}
const message = await interaction.reply({ embeds: [embed], ephemeral: true, components: [row], fetchReply: true })

const CollectorFilter = (interaction: { user: { id: any; }; }) => interaction.user.id === interaction.user.id


try {
const Collector = await message.awaitMessageComponent({ filter: CollectorFilter, time: 60000 })
if (Collector.customId === 'guild') {
returnButton.setDisabled(false)
guildButton.setDisabled(true)
await Collector.update({ embeds: [guildembed], components: [row] })
}
else if (Collector.customId === 'return') {
returnButton.setDisabled(true)
guildButton.setDisabled(false)
await Collector.update({ embeds: [embed], components: [row] })
}
i have fetch the reply like u said, and that work one time, but not the second oh
try {
const Collector = await message.createMessageComponentCollector({ componentType: ComponentType.Button, filter: CollectorFilter, time: 60000 })
Collector.on('collect', async (interaction) => {
await interaction.deferUpdate()
Collector.collected.forEach(async (Collector) => {
if (Collector.customId === 'guild') {
returnButton.setDisabled(false)
guildButton.setDisabled(true)
// @ts-ignore
await interaction.editReply({ embeds: [guildembed], components: [row] })
} else if (Collector.customId === 'return') {
returnButton.setDisabled(true)
guildButton.setDisabled(false)

// @ts-ignore
await interaction.editReply({ embeds: [embed], components: [row] })
}
}
)
})



} catch (error) {
await interaction.deleteReply()
}
try {
const Collector = await message.createMessageComponentCollector({ componentType: ComponentType.Button, filter: CollectorFilter, time: 60000 })
Collector.on('collect', async (interaction) => {
await interaction.deferUpdate()
Collector.collected.forEach(async (Collector) => {
if (Collector.customId === 'guild') {
returnButton.setDisabled(false)
guildButton.setDisabled(true)
// @ts-ignore
await interaction.editReply({ embeds: [guildembed], components: [row] })
} else if (Collector.customId === 'return') {
returnButton.setDisabled(true)
guildButton.setDisabled(false)

// @ts-ignore
await interaction.editReply({ embeds: [embed], components: [row] })
}
}
)
})



} catch (error) {
await interaction.deleteReply()
}
like that ? (if yes, i arldy do that before, and i m just idiot) bc im idiot
Want results from more Discord servers?
Add your server