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

965
Vistas
Embeds are not working (On every embed error: new Discord.MessageEmbed is not a constructor)

I recently added a command handler into my discord bot. All the commands that had Embeds came up with the error "Discord.MessageEmbed is not a constructor".

code:

const Discord = require('discord.js');

module.exports = {
    name: 'embed',
    description: "Embeds!",
    execute(client, message, args, Discord){
        const embed = new Discord.MessageEmbed()
        

        .setColor('#3498DB')
        .setAuthor("Afghar | Test", "https://i.imgur.com/jF4xyap.png")
        .addFields(
            { name: "Test", value: "- `test`", inline: true },
            { name: "Test", value: "- `test`", inline: true },
            { name: '‎', value: '‎' },

        )

        .addField("\u200b", "\u200b")
        .setTimestamp()
        .setFooter("test", "http://i.imgur.com/w1vhFSR.png");

        message.channel.send({ embeds: [embed] });
    }
}

full error:

C:\Asghar\commands\test.js:7
        const embed = new Discord.MessageEmbed()
                      ^

TypeError: Discord.MessageEmbed is not a constructor
    at Object.execute (C:\Asghar\commands\test.js:7:23)
    at module.exports (C:\Asghar\events\guild\message.js:11:25)
    at Client.emit (node:events:527:28)
    at MessageCreateAction.handle (C:\Asghar\node_modules\discord.js\src\client\actions\MessageCreate.js:34:18)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Asghar\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Asghar\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
    at WebSocketShard.onPacket (C:\Asghar\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Asghar\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Asghar\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:527:28)
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

npm uninstall -S discord.js

and then

npm i discord.js --save

about 4 years ago · Juan Pablo Isaza Denunciar

0

Discord.MessageEmbed assumes you imported the discord.js module as a variable named Discord. Your execute method seems to have a different Discord variable which is not the actual discord.js module:

    execute(client, message, args, Discord){

This overrides your original Discord variable which is the discord.js module:

const Discord = require('discord.js');

You should see what that new Discord variable in the execute method does, and delete it if it isn't needed, or rename it.

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