Class Message<T>

Represents a message.

Type Parameters

Hierarchy (view full)

Constructors

Properties

activity?: MessageActivity

The activity associated with this message.

The application associated with this message. This can be present in two scenarios:

applicationID: null | string

The ID of the application associated with this message. This can be present in two scenarios:

The attachments on this message.

author: User

The author of this message.

call?: Call

The call associated with this message.

channelID: string

The ID of the channel this message was created in.

components: MessageActionRow[]

The components on this message.

content: string

The content of this message.

editedTimestamp: null | Date

The timestamp at which this message was last edited.

embeds: Embed[]

The embeds on this message.

flags: number

The flags on this message.

guildID: T extends AnyTextableGuildChannel
    ? string
    : null | string

The ID of the guild this message is in.

id: string
interaction?: MessageInteraction

The interaction info, if this message was the result of an interaction.

Deprecated

Use Message#interactionMetadata instead.

interactionMetadata?: MessageInteractionMetadata

The interaction info, if this message was the result of an interaction.

member: T extends AnyTextableGuildChannel
    ? Member
    : undefined | Member

The member that created this message, if this message is in a guild.

mentionChannels?: ChannelMention[]

Channels mentioned in a CROSSPOSTED channel follower message. See Discord's docs for more information.

mentions: MessageMentions

The mentions in this message.

messageReference?: MessageReference

If this message is a REPLY or THREAD_STARTER_MESSAGE, some info about the referenced message.

messageSnapshots?: MessageSnapshot[]

If this message is a forwarded message, the partial contents of that message.

nonce?: string | number

A nonce for ensuring a message was sent.

pinned: boolean

If this message is pinned.

poll?: Poll

The poll on this message, if any.

position?: number

This message's relative position, if in a thread.

reactions: MessageReaction[]

The reactions on this message.

referencedMessage?: null | Message<Uncached | AnyTextableChannel>

If this message is a REPLY or THREAD_STARTER_MESSAGE, this will be the message that's referenced.

roleSubscriptionData?: RoleSubscriptionData

The data of the role subscription purchase or renewal that prompted this message.

stickerItems?: StickerItem[]

The sticker items on this message.

The thread associated with this message, if any.

timestamp: Date

The timestamp at which this message was sent.

tts: boolean

If this message was read aloud.

The type of this message.

webhookID?: string

The webhook associated with this message, if sent via a webhook. This only has an id property.

Accessors

Methods

  • Add a reaction to this message.

    Parameters

    • emoji: string

      The reaction to add to the message. name:id for custom emojis, and the unicode codepoint for default emojis.

    Returns Promise<void>

  • Remove a reaction from this message.

    Parameters

    • emoji: string

      The reaction to remove from the message. name:id for custom emojis, and the unicode codepoint for default emojis.

    • user: string = "@me"

      The user to remove the reaction from, @me for the current user (default).

    Returns Promise<void>

  • Remove all, or a specific emoji's reactions from this message.

    Parameters

    • Optional emoji: string

      The reaction to remove from the message. name:id for custom emojis, and the unicode codepoint for default emojis. Omit to remove all reactions.

    Returns Promise<void>

  • Get the users who reacted with a specific emoji on this message.

    Parameters

    • emoji: string

      The reaction to remove from the message. name:id for custom emojis, and the unicode codepoint for default emojis.

    • Optional options: GetReactionsOptions

      The options for getting the reactions.

    Returns Promise<User[]>