#Get user who clicked button

18 messages · Page 1 of 1 (latest)

proper wolf
#

I would like to get the nickname of the user who pressed the button, only that when I type there, for example, interaction.member.user.username, it gives me the user who typed the slash command

blazing turtleBOT
#

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

proper wolf
#

await confirmation.update({ embeds: [potwierdzenie], components: [] });

    const myDB = getDb();
    const db = myDB.collection(`ThxList`);

    const doc = {
      user: user.username + "#" + user.discriminator,
      userId: user.id,
      from: interaction.user.username,
      fromId: interaction.user.id,
      acceptedBy: ???,
    };
    const result = await db.insertOne(doc);
    console.log(
      `A document was inserted with the _id: ${result.insertedId}`
    );
north moth
#

buttoninteraction.member.nickname or .displayName

#

What is interaction? The button interaction?

#

And what is confirmation

#

They both seem to be interactions, looks like confirmation is the buttoninteraction from what you said

proper wolf
#

const confirmation = await response.awaitMessageComponent({ time: null });

north moth
#

I was right, why is the time null btw

proper wolf
proper wolf
north moth
#

confirmation.member.nickname or confirmation.member.displayName to get the username if the nickname is null. From ur code, you're not tryna get the nickname, that's the username

north moth
# proper wolf is that infinity

I mean, technically but you can just not pass it, which I don't recommend cuz then if the person doesn't click you'd have the collector going on forever which can affect memory and stuff

#

If more than one collector is created and stuff of course

proper wolf
#

ok