Class SafeEmbedBuilder

Hierarchy

  • EmbedBuilder
    • SafeEmbedBuilder

Constructors

  • Parameters

    • Optionaldata: APIEmbed | EmbedData

    Returns SafeEmbedBuilder

Methods

  • Appends fields to the embed.

    Parameters

    • ...fields: RestOrArray<APIEmbedField> | [APIEmbedField[] | readonly APIEmbedField[]]

      The fields to add

    Returns this

    This method accepts either an array of fields or a variable number of field parameters. The maximum amount of fields that can be added is 25.

    Using an array:

    const fields: APIEmbedField[] = ...;
    const embed = new EmbedBuilder()
    .addFields(fields);

    Using rest parameters (variadic):

    const embed = new EmbedBuilder()
    .addFields(
    { name: 'Field 1', value: 'Value 1' },
    { name: 'Field 2', value: 'Value 2' },
    );
  • Sets the author of this embed.

    Parameters

    • options: null | EmbedAuthorOptions

      The options to use

    Returns this

  • Sets the description of this embed.

    Parameters

    • description: null | string

      The description to use

    Returns this

  • Sets the fields for this embed.

    Parameters

    • ...fields: RestOrArray<APIEmbedField> | [APIEmbedField[] | readonly APIEmbedField[]]

      The fields to set

    Returns this

    This method is an alias for EmbedBuilder.spliceFields. More specifically, it splices the entire array of fields, replacing them with the provided fields.

    You can set a maximum of 25 fields.

  • Sets the footer of this embed.

    Parameters

    • options: null | EmbedFooterOptions

      The footer to use

    Returns this

  • Sets the title for this embed.

    Parameters

    • title: null | string

      The title to use

    Returns this

  • Removes, replaces, or inserts fields for this embed.

    Parameters

    • index: number

      The index to start at

    • deleteCount: number

      The number of fields to remove

    • ...fields: APIEmbedField[]

      The replacing field objects

    Returns this

    This method behaves similarly to Array.prototype.splice(). The maximum amount of fields that can be added is 25.

    It's useful for modifying and adjusting order of the already-existing fields of an embed.

    Remove the first field:

    embed.spliceFields(0, 1);
    

    Remove the first n fields:

    const n = 4;
    embed.spliceFields(0, n);

    Remove the last field:

    embed.spliceFields(-1, 1);
    
MMNEPVFCICPMFPCPTTAAATR