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

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

0

npm uninstall -S discord.js

and then

npm i discord.js --save

about 4 years ago · Juan Pablo Isaza Report

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