Embed Create

Creating and Sending an Embed Example

  1. Importing Functions:

    const { newCommand, embedCreate } = require('mvk-project');

    We first import newCommand and embedCreate from the mvk-project package. Later, we will also import sendMessage to send the created embed.

  2. Importing sendMessage:

    const { newCommand, embedCreate, sendMessage } = require('mvk-project');

    Now, we include sendMessage to handle sending the embed.

  3. Defining a New Command:

    newCommand({
      name: 'test-command',
      code: async function (message) {
      }
    });

    We define a new command named test-command. This command will be executed when called in a message.

  4. Creating an Embed:

    const embed = embedCreate({
      description: 'Hi user!',
      color: '#4488ee',
      footer: 'MVK Project - NPM'
    });

    Inside the command's code function, we create an embed using embedCreate. The embed has a description, color, and footer.

  5. Sending the Embed:

    sendMessage({
      channel: message.channel, // Get actual channel
      embeds: [embed]
    });

    Finally, we send the created embed using sendMessage, specifying the channel and the embed.

  6. Final Code:

    const { newCommand, embedCreate, sendMessage } = require('mvk-project');
    
    newCommand({
      name: 'test-command',
      code: async function (message) {
        const embed = embedCreate({
          description: 'Hi user!',
          color: '#4488ee',
          footer: 'MVK Project - NPM'
        }); // Create embed.
    
        sendMessage({
          channel: message.channel, // Actual channel
          embeds: [embed]
        }); // Send embed. We'll look at this function more in-depth later.
      }
    });

Embed Options:

The embedCreate function supports the following options:

  • title

  • titleUrl

  • author

  • authorIcon

  • thumbnail

  • image

  • description

  • color

  • footer

  • footerIcon

  • timestamp

All options are strings, except for timestamp, which is a boolean.

Last updated