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

310
Vistas
Ban Command discord.js (v13)

Hello I've been trying to make a ban command with discord.js (v13) but I am getting this error and I don't know what is the cause of a problem

If anyone can help I would be very grateful

DiscordAPIError: Invalid Form Body
embeds[0].description: This field is required

My code :

module.exports = {
  name: "ban",
  description: "This command ban's someone",
  category: "moderation",
  example: ["!ban @member"],
  callback: async ({ message, args }) => {
    try {
    const member = message.mentions.members.first();
    const permission = message.member.permissions.has("BAN_MEMBERS");

    if (!permission)
      return message.reply(
        "❌ | You don't have permission to use this command"
      );

    if (!args[0]) return message.reply(`❌ | Please specify someone`);

    if (!member) return message.reply(`💤 | Cannot find that member...`);

    if (member.id === message.author.id)
      return message.reply(`❌ | You cannot ban yourself!`);

    if (message.member.roles.highest.position < member.roles.highest.position)
      return message.reply(
        `❌ | You cannot ban user who have higher role than you...`
      );

    if (!member.bannable) return message.reply(`❌ | I cannot ban that member`);

    return (
      (await member.ban()) +
      message
        .reply({
          content: `:anger: | User ${member} has been banned`,
        })
        .then((msg) => {
          setTimeout(() => msg.delete(), 5000);
        })
    );
      } catch(err) {
        message.reply(`awww there was an ${err}`)
      }
  },
};
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

If you're updating discord.js from v12 to v13, make sure to keep these changes in mind: https://discordjs.guide/additional-info/changes-in-v13.html#sending-messages-embeds-files-etc

The embeds option was replaced with embeds arrays, meaning they must be in the options object. Try this code out:

module.exports = {
name: "ban",
description: "This command ban's someone",
category: "moderation",
example: ["!ban @member"],
callback: async ({ message, args }) => {
  try {
      
  const member = message.mentions.members.first();
  const permission = message.member.permissions.has(Discord.Permissions.FLAGS.BAN_MEMBERS)

  if (!permission)
    return message.reply({ 
        contents: "❌ | You don't have permission to use this command"
    });

  if (!args[0]) return message.reply({ content: `❌ | Please specify someone` });

  if (!member) return message.reply({ content: `💤 | Cannot find that member...` } );

  if (member.id === message.author.id)
    return message.reply({ content: `❌ | You cannot ban yourself!` });

  if (message.member.roles.highest.position < member.roles.highest.position)
    return message.reply({
      content: `❌ | You cannot ban user who have higher role than you...`
    });

  if (!member.bannable) return message.reply({ content: `❌ | I cannot ban that member`});

  return (
    (await member.ban()) +
    message
      .reply({
        content: `:anger: | User ${member} has been banned`
      })
      .then((msg) => {
        setTimeout(() => msg.delete(), 5000);
      })
  );
    } catch(err) {
      message.reply({ content: `awww there was an ${err}` })
    }
}, };
about 4 years ago · Santiago Gelvez 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