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

82
Vistas
Issue with awaiting for user input

I've just started learning discord.js 3 days ago, and I'm coming across this error. I'm trying to make it so if the user says !faction it will ask them to say their faction name, then once they've sent their faction name, it asks them for more information about their faction. Here's my code:

factionEmbed = {
title : "Request to create faction.",
color : embedColor,
description : "Please reply with your faction name.",
author : {
name : message.author.username,
icon_url : message.author.displayAvatarURL()
           }
       }
message.channel.send({embeds : [factionEmbed]});

let filter = m => m.author.id === message.author.id
message.channel.send({embeds : []}).then(() => {
message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
           })
           .then(message => {
const nameOfFaction = message.first();
message.channel.send("Please provide us with info about your faction.")
message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
             })
             .then(message => {
const factionInfo = message.content;
message.channel.send("Submitted for review.")
             })
           })
           .catch(collected => {
message.channel.send('Timeout');
           });
       })
   }```

Edit: Error Message:

DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (C:\Users\Halcy\Desktop\BTN Bot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\Halcy\Desktop\BTN Bot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
    at async TextChannel.send (C:\Users\Halcy\Desktop\BTN Bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15) {
  method: 'post',
  path: '/channels/931712816090603545/messages',
  code: 50006,
  httpStatus: 400,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: [],
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    },
    files: []
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like the error is resulting from you trying to send an empty message, or, more specifically, a message with an empty array of embeds:

message.channel.send({embeds : []}).then(() => {
...
})

You'll need to either add some content/embeds to that method call, or remove it altogether. It seems to me that you may have intended to include the function passed as a parameter to then in a call to then for the first message you sent.

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