Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MessageBuilder

Hierarchy

Implements

  • {} & {}

Index

Constructors

constructor

Properties

data

data: PartialRequired<MessageData, "allowed_mentions">

The Message data to send to the api

files

files: File[]

The files to send to the api

Methods

Protected _split

  • _split(__namedParameters?: { append: string; char: string; maxLength: number; prepend: string }): string[]
  • Internal shared method to split the content by.

    Parameters

    • Default value __namedParameters: { append: string; char: string; maxLength: number; prepend: string } = {}
      • append: string
      • char: string
      • maxLength: number
      • prepend: string

    Returns string[]

addFile

  • addFile(file: File): this

parseEveryone

  • parseEveryone(): this

parseRoles

  • parseRoles(...ids: string[]): this
  • Allows Role mentions to ping

    example

    messageBuilder.parseRoles(); // All roles will be mentionable.

    example

    messageBuilder.parseRoles('339959033937264641', '339947394726625300') // Only those two roles will be mentioned even if you mention other roles in your message.

    Parameters

    • Rest ...ids: string[]

      role ids you want to mention

    Returns this

parseUsers

  • parseUsers(...ids: string[]): this
  • Allows User mentions to ping

    example

    messageBuilder.parseUsers(); // All users will be mentionable.

    example

    messageBuilder.parseUsers('167383252271628289', '242043489611808769') // Only those two users will be mentioned even if you mention other users in your message.

    Parameters

    • Rest ...ids: string[]

      user ids you want to mention

    Returns this

setContent

  • setContent(content?: string | null): this

setEmbed

  • setEmbed(embed?: APIEmbedData | null): this
  • setEmbed(embed?: undefined | ((embed: Embed) => Embed)): this

setNonce

  • setNonce(nonce?: number | string): this

setTTS

  • setTTS(tts: boolean): this

spliceFile

  • spliceFile(index: number, deleteCount: number, file?: File): this

split

Generated using TypeDoc