Class

Message

A message in a channel.

Extends Base

Constructor

Construct a message from API data.

new Message(client: Client, data: APIMessage)
client
Client
data
APIMessageAPI message from REST or MESSAGE_CREATE

Properties

NameTypeDescription
attachmentsread-onlyCollection<string, MessageAttachment>Attached files (images, videos, etc.).
authorread-onlyUserThe user who sent this message.
callMessageCall | nullCall data if this message represents a call event.
channelread-onlyTextBasedChannel | nullCached text-capable channel (guild text, guild voice, or DM), or null if uncached / not text-based. Narrowed type has channel.send and channel.delete.
channelIdread-onlystringChannel ID where this message was sent.
clientread-onlyClientThe Client that instantiated this message.
contentstringText content of the message.
createdAtread-onlyDateWhen the message was created.
editedAtDate | nullWhen the message was last edited, or null if never edited.
embedsMessageEmbed[]Embedded content (camelCase read view; send with EmbedBuilder).
flagsMessageFlagsBitFieldMessage flags bitfield.
guildread-onlyGuild | nullCached guild, or null for DMs / uncached.
guildIdread-onlystring | nullGuild ID if in a guild channel, null for DMs.
idread-onlystringSnowflake ID of this message.
memberread-onlyGuildMember | nullCached guild member for the author, or null in DMs / if uncached.
mentionEveryonebooleanWhether @everyone or @here was mentioned.
mentionRolesstring[]Role IDs mentioned in the message.
mentionsUser[]Users mentioned in the message.
messageReferenceMessageReference | nullReference to a replied-to message, if any.
messageSnapshotsMessageSnapshot[]Message snapshots for forwarded messages.
noncestring | nullClient-side nonce for deduplication.
partialread-onlyfalseDiscriminant vs PartialMessage: always false on a hydrated Message.
pinnedbooleanWhether the message is pinned.
reactionsread-onlyMessageReactionManagerReactions on the message.
referencedMessageMessage | nullThe full referenced (replied-to) message, or null.
stickersMessageSticker[]Stickers sent with the message.
ttsbooleanWhether this is a text-to-speech message.
typeread-onlyMessageTypeMessage type (Default, Reply, etc.).
webhookIdstring | nullWebhook ID if sent by a webhook.

Methods

.delete()

Promise<void>

Delete this message.

await message.delete();

.deleteAttachment(attachmentId)

attachmentId: stringPromise<void>

Delete a specific attachment from this message.

await message.deleteAttachment(attachmentId);

.fetch()

Promise<Message>

Fetch the latest version of this message from the API.

await message.fetch();

.fetchReactionUsers(emoji, options?)

emoji: EmojiInput, options?: { limit?: number; after?: string; }Promise<User[]>

Fetch users who reacted with a specific emoji.

await message.fetchReactionUsers(emoji);

.fetchReactionUsersPage(emoji, options?)

emoji: EmojiInput, options?: { limit?: number; after?: string; }Promise<{ users: User[]; hasMore: boolean; nextAfter: string | null }>

Fetch reaction users with pagination metadata.

await message.fetchReactionUsersPage(emoji);

.pin()

Promise<void>

Pin this message in the channel.

await message.pin();

.react(emoji)

emoji: EmojiInputPromise<void>

React to this message with an emoji.

await message.react(emoji);

.removeAllReactions()

Promise<void>

Remove all reactions from this message.

await message.removeAllReactions();

.removeReaction(emoji, userId?)

emoji: EmojiInput, userId?: stringPromise<void>

Remove a reaction (bot's own or a user's if ID is provided).

await message.removeReaction(emoji);

.removeReactionEmoji(emoji)

emoji: EmojiInputPromise<void>

Remove all reactions of a specific emoji.

await message.removeReactionEmoji(emoji);

.resolveGuild()

Promise<Guild | null>

Fetch and resolve the guild, or null if a DM. Propagates network/auth errors; only returns null when there is no guildId.

const guild = await message.resolveGuild();

.unpin()

Promise<void>

Unpin this message from the channel.

await message.unpin();