title: Discord.MessageEmbed is not a constructor
body: <p>So recently I tried adding a command handler into my discord bot. All the commands that had Embeds came up with the error &quot;Discord.MessageEmbed is not a constructor&quot;.</p>
  <p>this only happened when i added the command handler but the commands worked fine without it.</p>
  <p>further details:
  discord.js version [12]
  node version [14.15.3]</p>
  <p>code:</p>
  <pre><code>const { MessageEmbed } = require(&quot;discord.js&quot;);
  
  module.exports = {
      name: 'help',
      description: &quot;Sets up a dynamic help message!&quot;,
      async execute(message, args, Discord, client) {
          const purge = ':one:';
          const music = ':two:';
          const ban = ':three:';
      
          const purgeembed = new MessageEmbed()
  
                           
  
          .setColor('RANDOM')
          .setTitle('purge info')
          .setDescription(&quot;this is a embed for more info about the purge command and how to use it&quot;)
          .addFields(
              {name: ' ‍ ', value: &quot;`this command allows a user to purge (delete) messages that are less than 14 days old`&quot;, inline: true},
              {name: ' ‍ ', value: '%purge [number of messages &lt; 1000]'}
          )
          .setFooter(&quot;check bellow for how it works  [unfinished]&quot;);
  
  
          const musicembed = new Discord.MessageEmbed()
                                              
          .setColor('RANDOM')
          .setTitle('music info')
          .setDescription(&quot;this is a embed for more info about the music command and how to use it&quot;)
          .addFields(
              {name: ' ‍ ', value: &quot;`this command allows a user to listen to music in a voice channel with alot of options like playing music from a link or by searching for the song through yt there is also a Queuing for music`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`assoiciated commands:`&quot;,},
              {name: ' ‍ ', value: &quot;`......`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`......`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`......`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`......`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`......`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`%...`&quot;},
          )
          .setFooter(&quot;check bellow for how it works  [unfinished]&quot;); 
          
  
  
  
          const banembed = new Discord.MessageEmbed()
                                              
          .setColor('RANDOM')
          .setTitle('ban info')
          .setDescription(&quot;this is a embed for more info about the ban command and how to use it&quot;)
          .addFields(
              {name: ' ‍ ', value: &quot;`this command allows a moderator to ban a user`&quot;, inline: true},
              {name: ' ‍ ', value: &quot;`you can ban a user if you are a moderator but you need to give a reason to the owner first`&quot;},
              {name: ' ‍ ', value: &quot;`%ban @user`&quot;},
          )
          .setFooter(&quot;check bellow for how it works  [unfinished]&quot;);
  
  
   
          let embed = new Discord.MessageEmbed()
              .setColor('RANDOM')
              .setTitle('Choose a reaction for more info about a command!')
              .setDescription('Choosing a reaction will allow you to get more info about a specific command!\n\n'
                  + `${purge} for purge help\n\n`
                  + `${music} for music help\n\n`
                  + `${ban} for ban help\n\n`);
   
                  message.channel.send(embed).then(embedMessage =&gt; {
                      embedMessage.react('1️⃣');
                      embedMessage.react('2️⃣');
                      embedMessage.react('3️⃣');
                    });
  
             
                    message.client.on('messageReactionAdd', (reaction, user) =&gt; {
                     
                    if (user.id === '795613081295650837'){
  
                     }else{
                      
                      
  
                        if (reaction.emoji.name === '1️⃣') {
                          
                          message.channel.bulkDelete(1);
  
                        setTimeout(function(){ 
                                      message.channel.send(purgeembed);
                                  }, 600);
                                          
                          }
                          if (reaction.emoji.name === '2️⃣') {
  
                              message.channel.bulkDelete(1);
  
                            setTimeout(function(){ 
                                      message.channel.send(musicembed);
                                  }, 600);
                          }
                          if (reaction.emoji.name === '3️⃣') {
  
                              message.channel.bulkDelete(1);
  
                            setTimeout(function(){ 
                                      message.channel.send(banembed);
                                  }, 600);
                              }
                       else {
                          return;
                      }}
   
          });
      }
   
  }   
  </code></pre>
  <p>full error:</p>
  <pre><code>(node:15924) UnhandledPromiseRejectionWarning: TypeError: Discord.MessageEmbed is not a constructor
      at Object.execute (C:\Users\x\Desktop\Advanced coding\discord bot\commands\help.js:25:28)
      at module.exports (C:\Users\x\Desktop\Advanced coding\discord bot\events\guild\message.js:9:24)
      at Client.emit (events.js:315:20)
      at MessageCreateAction.handle (C:\Users\x\Desktop\Advanced coding\discord bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
      at Object.module.exports [as MESSAGE_CREATE] (C:\Users\x\Desktop\Advanced coding\discord bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
      at WebSocketManager.handlePacket (C:\Users\x\Desktop\Advanced coding\discord bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
      at WebSocketShard.onPacket (C:\Users\x\Desktop\Advanced coding\discord bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
      at WebSocketShard.onMessage (C:\Users\x\Desktop\Advanced coding\discord bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
      at WebSocket.onMessage (C:\Users\x\Desktop\Advanced coding\discord bot\node_modules\ws\lib\event-target.js:132:16)
      at WebSocket.emit (events.js:315:20)
  (Use `node --trace-warnings ...` to show where the warning was created)
  (node:15924) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
  (node:15924) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  C:\Users\x\Desktop\Advanced coding\discord bot\events\client\ready.js:9
                Client.user.setPresence({
                            ^
  
  TypeError: Cannot read property 'setPresence' of undefined
      at Timeout.presence [as _onTimeout] (C:\Users\x\Desktop\Advanced coding\discord bot\events\client\ready.js:9:27)
      at listOnTimeout (internal/timers.js:554:17)
      at processTimers (internal/timers.js:497:7)
  
  </code></pre>
  <p>main file:</p>
  <pre><code>const Discord = require('discord.js');
  const client = new Discord.Client({partials: [&quot;MESSAGE&quot;, &quot;CHANNEL&quot;, &quot;REACTION&quot;]});
  const fs = require('fs');
  
  client.commands = new Discord.Collection();
  client.events = new Discord.Collection();
  
  ['command_handler', 'event_handler'].forEach(handler =&gt;{
     require(`./handlers/${handler}`)(client, Discord);
  })
  
  
  
  
  /* const commandFiles = fs.readdirSync('./commands/').filter(file =&gt; file.endsWith('.js'));
  
  for(const file of commandFiles){
  
     const command = require(`./commands/${file}`);
     client.commands.set(command.name, command);
  }
  
  client.once('ready', () =&gt; {
     function presence() {
        let status = ['&lt;help for help'] //you can add how many you like
        let rstatus = Math.floor(Math.random() * status.length); //this chooses a status from the ones you typed up
        client.user.setPresence({
            status: &quot;online&quot;, //you can change to offline, dnd
            type: &quot;WATCHING&quot;,
            activity: {
                name: `${status[rstatus]}`, //rhese sets the status                type: &quot;WATCHING&quot; //you can change to listening, streaming, playing (just a quick google search :) )
            }
        });
    }
    console.log(`Discord Bot ${client.user.tag} is online!`); // the presence needs to be like this, near the ready event
    setInterval(presence, 30000) //you can reduce/add the time (milliseconds) if you reduce it l3ss then 15 seconds your bot will get ratelimited
  });
  
  client.on('message', message =&gt;{
  
     if(!message.content.startsWith(prefix) || message.author.bot) return;  
     const args = message.content.slice(prefix.length).split(/ +/);
     const command = args.shift().toLowerCase();
     message.delete();
  
     if(command === 'help'){
     client.commands.get('help').execute(message, args, Discord);
     }else if(command == 'purge'){
     client.commands.get('purge').execute(message, args, Discord);
     }else if(command == 'play'){
        client.commands.get('play').execute(message, args, Discord);
     }else if(command == 'congrat'){
        client.commands.get('congrat').execute(message, args, Discord);
     }else if(command == 'kick'){
        client.commands.get('kick').execut(emessage, args, Discord);
     }else if(command == 'ban'){
        client.commands.get('ban').execute(message, args, Discord);
     }else if(command == 'ping'){
        client.commands.get('ping').execute(message, args, Discord);
     }
  }); */
  
  client.login('token')
  </code></pre>
  <p>any help would be highly appreciated, thanks.</p>