Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda