Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Send an ephemeral message to person who clicked button

I want to show buttons on a message, but only allow the original requester of the message to interact with the buttons. If anybody else clicks the buttons then I want to send them a secret message telling them that their click was ignored.

I've been looking into this for a while and I keep finding people saying that it's not possible, but yet the Dank Memer bot already does exactly this! If you click a button on somebody else's message then the bot will send you a message saying "This menu is not for you." and it will say "Only you can see this message"

Currently I have this code

const collector = message.createMessageComponentCollector({ componentType: "BUTTON", time: 15000});

collector.on("collect",collected => {
    if(collected.user.id !== interaction.user.id){
        //collected.member.send("This command is being controlled by somebody else.");
        // What can I put in here to send an ephemeral message to collected.user?? I can send them a DM using .send(), but that's not what I want.
        return;
    }
    if(collected.customId === "confirm"){
        interaction.followUp("Success");
    }else{
        interaction.followUp("Ignore");
    }
});

Here's a picture of Dank Memer doing it... Which leads me to believe it's possible. (He said this in response to me asking for a leaderboard on one account and then trying to navigate it on a different account.)

Dank Memer doing what I've been told is impossible

Please tell me how this is done!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Based on this example from the discord.js guide you are able to do this by replying to the collected object as it represents an interaction:

collector.on("collect",collected => {
    // Replies to the user who clicked a button that wasn't theirs
    if(collected.user.id !== interaction.user.id){
        collected.reply({ content: `These buttons aren't for you!`, ephemeral: true })
        return;
    }
    if(collected.customId === "confirm"){
        interaction.followUp("Success");
    } else {
        interaction.followUp("Ignore");
    }
});
about 4 years ago · Juan Pablo Isaza Report

0

To make your reply ephemeral you have to use interaction.reply and get such code:

interaction.reply({ content: `text`, ephemeral: true })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!