Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda