Get user who clicked button

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
11 Replies
d.js toolkit
d.js toolkit2y 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.
Yoqurt
YoqurtOP2y ago
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} );
sexy dark chocolate
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
Yoqurt
YoqurtOP2y ago
const confirmation = await response.awaitMessageComponent({ time: null });
sexy dark chocolate
I was right, why is the time null btw
Yoqurt
YoqurtOP2y ago
async execute(interaction) {...... is that infinity
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
sexy dark chocolate
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
Yoqurt
YoqurtOP2y ago
I fix that thanks
sexy dark chocolate
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
Yoqurt
YoqurtOP2y ago
ok I will keep this in mind
Want results from more Discord servers?
Add your server