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

498
Visualizações
Unable to send embed message in discord.js v13

so the bot runs smoothly with these codes, all the prefix command are working except the embed message. When I want to send an embed message an error appears (The bot didn't send any embed message and went offline a few minutes later)

Codes:

const Discord = require('discord.js');
const client = new Discord.Client({ intents: 32767 });
const { MessageEmbed } = require('discord.js');

client.on('ready', () => {
  console.log('Bot is online!');
});

client.on('messageCreate', (message) => {
  const prefix = '.';
  if (!message.content.startsWith(prefix)) return;

  if (message.content === `${prefix}hello`) {
    message.channel.send("Hello, I'm I.R.F.A.N.\nIntegrted Robot For Assistant Needs\nI'm Currently In Development");
  }

  if (message.content === `${prefix}embed`) {
    let embed = new Discord.MessageEmbed()
      .setTitle("Title")
      .setDescription("Description")
      .setColor("#0099ff")
      message.channel.send({embed:[embed]});
  }
});

client.login('token censored');

Terminal:

throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (C:\Users\M. IRFAN NAZRIL\Documents\Belajar Coding\discord 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\M. IRFAN NAZRIL\Documents\Belajar Coding\discord bot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
    at async TextChannel.send (C:\Users\M. IRFAN NAZRIL\Documents\Belajar Coding\discord bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:176:15) {
  method: 'post',
  path: '/channels/990157044688494663/messages',
  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: []
  }
}

It says, "tts: false," but I've allowed all the permissions in discord

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You sent the message incorrectly. It should be:

message.channel.send({ embeds: [embed] })
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