Results

Namespace

Type

Hierarchy

Index

Type aliases

Static AnyMessage

A type alias to describe any message class type.

Static OutgoingMessage

OutgoingMessage: string | OutgoingMessageOptions | Embed

A type alias to describe possible outgoing message types.

Static OutgoingMessageArgument

OutgoingMessageArgument<T>: T | Promise<T> | function

A type alias to describe the possible configurations to use when sending a message.

If a Promise-like type is used, the bot will send a typing indicator for the channel before resolving the Promise and sending its content.

Type parameters

Static OutgoingMessageOptions

OutgoingMessageOptions: IOutgoingMessageOptions & object | object | object | object

A type-alias used to describe the possible options for message content. See discord.Message.IOutgoingMessageOptions for a full list of options.

Properties

Readonly activity

activity: IMessageActivity | null

The activity object included with this message, if set.

Readonly application

application: IMessageApplication | null

The application metadata used to render activity data for a message, if set.

Readonly attachments

An array of attachments sent with this message.

Readonly author

author: User

The author of this message, if any.

Readonly channelId

channelId: Snowflake

The id of the text channel this message was sent in.

Note: You can fetch the full channel data with discord.Message.getChannel.

Readonly content

content: string

The text content of this message.

May contain up to 2000 characters.

Readonly editedTimestamp

editedTimestamp: string | null

The timestamp at which the message was last edited at, in ISO-8601 format.

Readonly embeds

embeds: Array<Embed>

An array of embeds included with this message.

Readonly flags

flags: Flags | null

A bit set of flags containing more information for this message.

Readonly guildId

guildId: Snowflake | null

The id of the guild this message was sent in. Will be null for messages sent in [[discord.DMChannel]] DM channels.

Note: You can fetch the full guild data with discord.Message.getGuild.

Readonly id

The unique id for this message. The id can be used to find the time the message was created.

Readonly member

member: GuildMember | null

If the message was sent in a guild, the discord.GuildMember who sent this message.

Readonly mentionChannels

mentionChannels: Array<IMessageChannelMention>

An array of partial channel objects mentioned in this channel.

Readonly mentionEveryone

mentionEveryone: boolean

true if this message mentions everyone.

Readonly mentionRoles

mentionRoles: Array<Snowflake>

An array of role ids mentioned in this channel.

Readonly mentions

mentions: Array<User & object>

An array of user objects, containing partial member objects, of users mentioned in this message.

Readonly messageReference

messageReference: IMessageReference | null

The original message reference for cross-posted announcement messages.

Readonly pinned

pinned: boolean

true if this message is pinned to the channel.

Readonly reactions

An array of emoji reactions added to this message.

Readonly timestamp

timestamp: string

The timestamp at which this message was sent at, in ISO-8601 format.

Readonly type

type: Type

The type of message this is. See discord.Message.Type for a list of possible values.

Readonly webhookId

webhookId: Snowflake | null

The id of the webhook that sent this message. null if this message was not sent by a webhook.

Methods

addReaction

  • addReaction(emoji: string): Promise<void>
  • Reacts to this message with the specified emoji.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    • emoji: string

      A raw unicode emoji like ✅, or a custom emoji in the format of name:id

    Returns Promise<void>

delete

  • delete(): Promise<void>
  • Attempts to permanently delete this message.

    If an error occurred, a discord.ApiError exception is thrown.

    Returns Promise<void>

deleteAllReactions

deleteAllReactionsForEmoji

  • deleteAllReactionsForEmoji(emoji: string): Promise<void>
  • Deletes all reactions for the emoji specified on this message.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    • emoji: string

      A raw unicode emoji like ✅, or a custom emoji in the format of name:id

    Returns Promise<void>

deleteOwnReaction

  • deleteOwnReaction(emoji: string): Promise<void>
  • Deletes the bot user's own reaction to this message of the specified emoji.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    • emoji: string

      A raw unicode emoji like ✅, or a custom emoji in the format of name:id

    Returns Promise<void>

deleteReaction

  • deleteReaction(emoji: string, user: Snowflake | User): Promise<void>
  • Deletes a user's reaction to the message.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    • emoji: string

      A raw unicode emoji like ✅, or a custom emoji in the format of name:id

    • user: Snowflake | User

      A user id or reference to a user object.

    Returns Promise<void>

edit

  • edit(messageOptions: Pick<OutgoingMessageOptions, "content" | "embed"> & object): Promise<Message>
  • Attempts to edit a message. Messages may only be edited by their author.

    If you wish to remove an embed from the message, set the embed property to null. The message content may be set to an empty string only if the message has or is receiving an embed with the edit.

    Note: You may not modify allowedMentions or tts when editing a message, these only apply when a message is initially received.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    • messageOptions: Pick<OutgoingMessageOptions, "content" | "embed"> & object

      New message options for this message.

    Returns Promise<Message>

    On success, the Promise resolves as the new message object.

  • edit(content: string): Promise<Message>
  • Attempts to edit a message. Replaces the content with the new provided content.

    Messages may only be edited if authored by the bot.

    Note: If you'd like more options (embeds, allowed mentions, etc) see discord.Message.OutgoingMessageOptions.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    • content: string

      New content for this message.

    Returns Promise<Message>

    On success, the Promise resolves as the new message object.

  • edit(embed: Embed): Promise<Message>
  • Attempts to edit a message. Sets the content to an empty string and adds or updates the embed associated with this message.

    Messages may only be edited if authored by the bot.

    If an error occurred, a discord.ApiError exception is thrown.

    Parameters

    Returns Promise<Message>

    On success, the Promise resolves as the new message object.

getChannel

getGuild

  • getGuild(): Promise<Guild | null>
  • Fetches the data for the guild this message was sent in.

    If the message was not sent in a guild, the Promise resolves as null.

    Returns Promise<Guild | null>

iterReactions

  • iterReactions(emoji: string, options?: IIterReactionsOptions): AsyncIterableIterator<User>
  • Provides an async iterator over a list of users that reacted to the message with the given emoji.

    Parameters

    Returns AsyncIterableIterator<User>

reply

setPinned

  • setPinned(pinned: boolean): Promise<void>
  • Changes the pinned status of this message.

    Parameters

    • pinned: boolean

      true if the message should be pinned, otherwise false.

    Returns Promise<void>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc