Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Message

Represents a message sent in a TextChannel within Discord

Hierarchy

Index

Constructors

constructor

Properties

activity

activity: MessageActivity | undefined

Sent with Rich Presence-related chat embeds

application

application: MessageApplication | undefined

Sent with Rich Presence-related chat embeds

attachments

Collection of all MessageAttachments attached to this message

author

author: User | undefined

The author of this message. Might not be a valid User object if message was generated by a webhook

bot

bot: Bot

The Bot operating this structure

channel

The channel the message was sent in

content

content: string

The content of the message

deleted

deleted: boolean

Whether this message is deleted from its channel

editedAt

editedAt: Timestamp | null

Timestamp of when this message was edited. Possibly null if message has not been edited

embeds

embeds: MessageEmbed[]

All embedded content associated to this message

flags

flags: MessageFlags | undefined

Describes extra features of the message

guild

guild: Guild | undefined

The guild the message was sent in. Possibly null if message was sent over a DM

id

The message's ID

member

member: Member | undefined

The member properties for this message's author. Might not exist if message was sent over a DM

mentions

mentions: MessageMentions

All types of mentionable instances mentioned in this message

mentionsEveryone

mentionsEveryone: boolean

Whether this message mentions everyone

messageReference

messageReference: MessageReference | undefined

Reference data sent with crossposted messages

nonce

nonce: number | string | undefined

Used for validating a message was sent

pinned

pinned: boolean

Whether this message is pinned

reactions

The message's reactions controller

sentAt

sentAt: Timestamp

Timestamp of when this message was sent

tts

tts: boolean

Whether this was a TTS message

type

The type of the message

webhookId

webhookId: Snowflake | undefined

The Webhook ID in case this message was generated by a Webhook

Methods

clone

  • clone(): this

delete

  • delete(): Promise<void>

edit

  • Edits a previously sent message. The fields content, embed and flags can be edited by the original message author. Other users can only edit flags and only if they have the Permission.ManageMessages permission in the corresponding channel.

    example
    message.edit('Updated content!');
    1. A MessageEditData object, containing any of the fields @example ```typescript message.edit({ content: 'Updated content!', embed: { title: 'My Embed!' } }); ```

    Parameters

    • data: string | MessageEditData

      The updated message data. Can be:

      1. Raw content to be edited to

    Returns Promise<Message>

pin

  • pin(): Promise<void>

react

unpin

  • unpin(): Promise<void>

update

Generated using TypeDoc