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

229
Visualizações
Error while doing an embed commands discord js

I was trying to ask the bot to send a report to a console chat when a command is executed but I end up with an unexpected error. I thought the error will be in the main file but instead the error is from node_modules

here's the code(part of)

       var CommandName1 = message.content
       var CommandName2 = CommandName1.replace(prefix, "") 
       let time = await date.toLocaleString('en-US');
       var user = message.author.tag
       var UserProfile = message.author.avatarURL()
       var UserID = message.author.id
       var MessageID = message.channel.id

       let report = new Discord.MessageEmbed()
       .setTitle("Report From Main Core File")
       .setColor("DARK_BUT_NOT_BLACK")
       .setDescription("command: `" + `${CommandName2}` + "` \n" + "execution: `successful` \nreport path: `Bot Core Assets/SCP bot assets/main.js` \ntime: `" + `${time}` + "` \n" + "user: `" + `${user}` + "`\n" + "user profile: `" + `${UserProfile}` + "`\n" + "user ID: " + `${UserID}\n` + "message ID: " + `${MessageID}`)

       clients.channels.cache.get("890166184979361792").send({embeds: [report]})

the error I got

C:\Users\1love\Dropbox\My PC (DESKTOP-MEST1TS)\Desktop\Bot Core Assets\SCP bot assets\node_modules\discord.js\src\rest\RequestHandler.js:298
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (C:\Users\1love\Dropbox\My PC (DESKTOP-MEST1TS)\Desktop\Bot Core Assets\SCP bot assets\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Users\1love\Dropbox\My PC (DESKTOP-MEST1TS)\Desktop\Bot Core Assets\SCP bot assets\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async TextChannel.send (C:\Users\1love\Dropbox\My PC (DESKTOP-MEST1TS)\Desktop\Bot Core Assets\SCP bot assets\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:15) { 
  method: 'post',
  code: 50006,
  httpStatus: 400,
  requestData: {
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: undefined,
      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 Respostas
Responde à pergunta

0

Check your version of discord.js. I suspect, you are still using V12, because I copied your code, and it works flawlessly for me.

Check your discord.js version by running

npm list discord.js

If it still says v12, run

npm install discord.js@latest

Also make sure you have node v16.6.0 or later installed.

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