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

220
Views
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 answers
Answer question

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 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!