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

182
Views
Enviar un mensaje efímero a la persona que hizo clic en el botón

Quiero mostrar botones en un mensaje, pero solo permitir que el solicitante original del mensaje interactúe con los botones. Si alguien más hace clic en los botones, quiero enviarles un mensaje secreto diciéndoles que su clic fue ignorado.

He estado investigando esto durante un tiempo y sigo encontrando personas que dicen que no es posible, ¡pero el bot Dank Memer ya hace exactamente esto! Si hace clic en un botón en el mensaje de otra persona, el bot le enviará un mensaje que dice "Este menú no es para usted". y dirá "Solo tú puedes ver este mensaje"

Actualmente tengo este código

 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"); } });

Aquí hay una foto de Dank Memer haciéndolo... Lo que me lleva a creer que es posible. (Dijo esto en respuesta a que le pedí una tabla de clasificación en una cuenta y luego intenté navegar por ella en una cuenta diferente).

Dank Memer hacer lo que me han dicho es imposible

¡Por favor, dime cómo se hace esto!

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

0

Según este ejemplo de la guía discord.js, puede hacer esto respondiendo al objeto recopilado , ya que representa una interacción:

 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

Para que su respuesta sea ephemeral , debe usar interaction.reply y obtener dicho código:

 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!