#My bot's buttons isn't working in dms

34 messages · Page 1 of 1 (latest)

teal jewelBOT
#

• 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.

cosmic hound
#

Can you share the full code?

frozen scroll
#

Ig that much is enough

#

Btw its working for 1 user but not for the mentioned user + the user itself

warped gull
#

it means the button was disabled

#

and more code would be nice, since that doesnt provide anything but your send and your collector

#

not your buttons

frozen scroll
#

I mean it simply says that This interaction failed

frozen scroll
#

a min

#
const xyz = new ButtonBuilder()
                    .setCustomId('xyz')
                    .setLabel('xyz')
                    .setStyle(ButtonStyle.Danger)
                    const row = new ActionRowBuilder()
                    .addComponents(xyz);

let response = await interaction.user.send({
                        embeds: [embed],
                        components: [row]
                    })
    
                    let response2 = await targetUserObj.send({
                        embeds: [embed],
                        components: []
                    })
                    const collectorFilter = i => i.user.id === interaction.user.id;

                        const confirmation = await response.awaitMessageComponent({filter: collectorFilter, time: 60000 });
                        const confirmation2 = await response2.awaitMessageComponent({ filter: collectorFilter, time: 60000 });

                        if (confirmation.customId === 'xyz') {
                            await confirmation.update({ embeds: [embed], components: [] });
                            await confirmation2.update({embeds: [embed], components: [row]})
                        }

                        if(confirmation2.customId === 'xyz'){
                            await confirmation.update({ embeds: [embed], components: [row] });
                            await confirmation2.update({embeds: [embed], components: []})
                        }
#

What I'm trying to do here is

#

When the person who executed the command clicks the button in his dms then the button will get updated and get removed from his embed but will be visible in the mentioned user's embed

#

and when that users clicks the button in his dms then it will be visible to the person who executed the command

#

it's kinda like toggling

#

@warped gull Do you know why it is not working

#

??

warped gull
#

you have overlapping variables for your row

frozen scroll
#

no

#

i just pasted it

#

2 times

#

see now

#

?

warped gull
#

ok so what i understand is that you have two collectors, one for each message

frozen scroll
frozen scroll
#

What I'm trying to do here is
When the person who executed the command clicks the button in his dms then the button will get updated and get removed from his embed but will be visible in the mentioned user's embed

warped gull
#

thats because you put your if statements after those collectors

frozen scroll
#

I have to put it inside of if statements?

#

Then how will it work

#

?

warped gull
#

no, your if statements are after your two collectors