Class ExtraEmbed

Represents an extended version of EmbedBuilder with additional features.

Hierarchy

  • EmbedBuilder
    • ExtraEmbed

Constructors

  • Creates a new instance of ExtraEmbed.

    Parameters

    • color: ExtraEmbedColor = 'Default'

      The color of the embed.

    • Optional options: ExtraEmbedOptions

      The additional options for the embed.

    Returns ExtraEmbed

Properties

data: APIEmbed

The API data associated with this embed.

Accessors

  • get length(): number
  • Returns number

Methods

  • Appends fields to the embed.

    Parameters

    • Rest ...fields: RestOrArray<APIEmbedField>

      The fields to add

    Returns this

    Remarks

    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.

    Example

    Using an array:

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

    Example

    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

  • Parameters

    • color: null | ColorResolvable

    Returns this

  • Sets the description of the embed.

    Parameters

    • description: string

      The description text.

    • codeblocks: boolean = false

      Whether to wrap the description in a code block.

    • language: string = 'typescript'

      The language of the code block. Defaults to 'typescript'.

    Returns this

    The updated ExtraEmbed instance.

  • Sets the fields for this embed.

    Parameters

    • Rest ...fields: RestOrArray<APIEmbedField>

      The fields to set

    Returns this

    Remarks

    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 image of this embed.

    Parameters

    • url: null | string

      The image URL to use

    Returns this

  • Sets the thumbnail of this embed.

    Parameters

    • url: null | string

      The thumbnail URL to use

    Returns this

  • Sets the timestamp of this embed.

    Parameters

    • Optional timestamp: null | number | Date

      The timestamp or date to use

    Returns this

  • Sets the title for this embed.

    Parameters

    • title: null | string

      The title to use

    Returns this

  • Sets the URL of this embed.

    Parameters

    • url: null | string

      The URL 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

    • Rest ...fields: APIEmbedField[]

      The replacing field objects

    Returns this

    Remarks

    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.

    Example

    Remove the first field:

    embed.spliceFields(0, 1);
    

    Example

    Remove the first n fields:

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

    Example

    Remove the last field:

    embed.spliceFields(-1, 1);
    
  • Serializes this builder to API-compatible JSON data.

    Returns APIEmbed

    Remarks

    This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.

  • Parameters

    • other: APIEmbed | JSONEncodable<APIEmbed>

    Returns EmbedBuilder

Generated using TypeDoc