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

270
Views
How do I make my bot send a message after user has replied to a question

I'm trying to make a system where a user is given a question by the bot and after the user replies it clears these 2 messages and asks another question and repeats until all the questions are complete.

I can't make it to wait for the user to input their answer before asking another question, any help?

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

You should use Collectors and I think awaitMessages : https://discordjs.guide/popular-topics/collectors.html#await-messages

Its a totally different way to do it but simpler

Something like that :

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()

...

That is returning the first message (or messages) that contain(s) the valid answer to your question. After that you can run your treatement!

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!