Class Message<T>

Represents a message.

Type Parameters

Hierarchy

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:

attachments: TypedCollection<string, RawAttachment, Attachment, []>

The attachments on this message.

author: User

The author of 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.

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: {
    channels: string[];
    everyone: boolean;
    members: Member[];
    roles: string[];
    users: User[];
}

The mentions in this message.

Type declaration

  • channels: string[]

    The ids of the channels mentioned in this message.

  • everyone: boolean

    If @everyone/@here is mentioned in this message.

  • members: Member[]

    The members mentioned in this message.

  • roles: string[]

    The ids of the roles mentioned in this message.

  • users: User[]

    The users mentioned in this message.

messageReference?: MessageReference

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

nonce?: string | number

A nonce for ensuring a message was sent.

pinned: boolean

If this message is pinned.

position?: number

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

reactions: Record<string, 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.

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>

  • Delete this message.

    Parameters

    • Optional reason: string

      The reason for deleting the message.

    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[]>

  • Pin this message.

    Parameters

    • Optional reason: string

      The reason for pinning the message.

    Returns Promise<void>

  • Unpin this message.

    Parameters

    • Optional reason: string

      The reason for unpinning the message.

    Returns Promise<void>