How do I send Discord Embed?

I have a code that sends Discord Embed however does not see the MessageEmbed namespace what could be wrong?
// Import the necessary modules
const { Client, IntentsBitField, Partials, MessageEmbed } = require('discord.js');

// Create a new instance of a Discord client
const client = new Discord.Client();

// Define your bot's token here
const token = 'bottoken';

// Set up an event listener for when the bot is ready
client.once('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

// Set up an event listener for incoming messages
client.on('messageCreate', async message => {
    // Ignore messages from bots
    if (message.author.bot) return;

     // Create a new embedded message
        const embed = new MessageEmbed()
            .setColor('#0099ff')              // Set the color of the embed
            .setTitle('Example Embed')        // Set the title of the embed
            .setDescription('This is an example of an embedded message.') // Set the description of the embed
            .setImage('https://example.com/image.png') // Set an image for the embed
            .setTimestamp();                  // Add a timestamp to the embed

        // Send the embedded message to the same channel
        message.channel.send(embed);
});

// Log in to Discord with your app's token
client.login(token);

ReferenceError: MessageEmbed is not defined
    at Client.<anonymous> (D:\KJPiTechnologes\discordbots\moderator\src\index.js:69:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

TypeError: MessageEmbed is not a constructor
    at Client.<anonymous> (D:\KJPiTechnologes\discordbots\moderator\src\index.js:69:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Was this page helpful?