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

262
Views
¿Cómo hago para que mi bot envíe un mensaje después de que el usuario haya respondido a una pregunta?

Estoy tratando de crear un sistema en el que el bot le haga una pregunta al usuario y, después de que el usuario responda, borra estos 2 mensajes y hace otra pregunta y repite hasta que todas las preguntas estén completas.

No puedo esperar a que el usuario ingrese su respuesta antes de hacer otra pregunta, ¿alguna ayuda?

 const { MessageEmbed } = require("discord.js"); const clearMessages = require("./clearMessages"); const askEventQuestions = async (client, channelId) => { const edonoChannel = client.channels.cache.get(channelId); let q1Answer = "" //event questions embeds const q1 = new MessageEmbed() .setColor("AQUA") .setDescription("What Type of Event would you like to donate for?"); const q2 = new MessageEmbed() .setColor("AQUA") .setDescription("What are the amounts of DMC/Items that you are donating?"); //send and set answer for questions await edonoChannel.send({ embeds: [q1] }); client.on("messageCreate", async (message) => { q1Answer = message.content; if (q1Answer !== "") { await clearMessages(2, message); console.log(q1Answer); } }); await edonoChannel.send({ embeds: [q2] });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Deberías usar Collectors y creo que awaitMessages : https://discordjs.guide/popular-topics/collectors.html#await-messages

Es una forma totalmente diferente de hacerlo pero más simple.

Algo como eso :

 const isValid = response => response.content == '' const question = await edonoChannel.send({ embeds: [q1] }) const stepper = await question.channel.awaitMessages({isValid, your options ?}) const answer = stepper.first().content // this is your answer content, the data is necessarily the unique valid response, thanks to isValid function await question.delete() await stepper.delete() ...

Eso es devolver el primer mensaje (o mensajes) que contienen la respuesta válida a su pregunta. ¡Después de eso puedes ejecutar tu tratamiento!

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!