Message
- class Message()
A message snapshot received from Discord or returned by a REST request. Event objects are not live views. Call Message.fetch when a handler needs the newest state.
Example
discord.on(discord.events.MESSAGE_CREATE, async (message) => { if (!message.author || message.author.bot || message.content !== '!ping') return; await message.reply('pong'); });
exported from
lib.weeble.dProperties
- Message.attachments
type: readonly
Attachment[]Files attached to the message.
- Message.author
-
User or webhook identity that sent the message, or
nullwhen Discord omits the author from a partial message payload.
- Message.channel
type: readonly
MessageChannelLightweight channel handle. Use it to send without fetching the full channel first, for example
await message.channel.send("Hello").
- Message.content
type: readonly string
Raw message content. In guilds this may be empty unless the bot has the privileged Message Content intent or Discord grants an exception.
- Message.createdTimestamp
type: readonly number
Timestamp derived from the Discord snowflake ID, in milliseconds since epoch.
- Message.editedAt
-
When this message was last edited, or
nullif it has not been edited.
- Message.editedTimestamp
-
Edited timestamp in milliseconds since epoch, or
nullif never edited.
- Message.guildId
-
ID of the guild this message was sent in, or
nullwhen Discord omits it.
- Message.member
type: readonly
GuildMember| nullThe guild member who sent the message, or
nullif not in a guild.
- Message.mentionEveryone
type: readonly boolean
Indicates whether the message mentions everyone or here.
- Message.mentions
type: readonly
User[]User objects explicitly mentioned in the message content. This array does not include users mentioned only inside embeds or components.
- Message.reactions
type: readonly
MessageReaction[]Reactions on the message.
- Message.reference
type: readonly
MessageReference| nullReference to a replied-to or crossposted message, or
null.
- Message.referencedMessage
-
The message being replied to, or
nullwhen unavailable.
- Message.type
type: readonly
MessageTypeThe type of message (system message, reply, etc.).
- Message.webhookId
-
ID of the webhook that sent this message, or
nullif sent by a user.
Methods
- async Message.clearReactions(emoji: string) Promise<void>
Remove all reactions for a specific emoji, or all reactions if no emoji is given.
- Parameters:
emoji — – Emoji string to clear, or omit to clear all reactions.
-
async Message.createThread(options:
ThreadFromMessageCreateOptions) Promise<ThreadChannel> Create a thread from this message.
- Parameters:
options — – Thread options including name, auto-archive duration, and slowmode.
- Returns:
The created thread channel.
-
async Message.crosspost() Promise<
Message> Crosspost (publish) this message to followed channels. Only valid in announcement channels.
- Returns:
The published message.
- async Message.delete(reason: string) Promise<void>
Delete this message.
- Parameters:
reason — – Audit-log reason for deleting the message.
-
async Message.edit(content: string |
EditMessageOptions) Promise<Message> Edit this message with new content or options.
- Parameters:
content — – New message body as a string, or an options object with embeds, components, etc.
- Returns:
The updated message.
-
async Message.endPoll() Promise<
Message> End the poll on this message early and publish results.
- Returns:
The updated message with finalized poll results.
-
async Message.fetch() Promise<
Message> Requests the latest version of this message from Discord. Use this when the event snapshot may be stale after edits, reactions, or poll updates.
- Returns:
The updated message.
- async Message.fetchChannel() Promise<TextChannel>
Fetch the channel this message was sent in from Discord.
-
async Message.fetchGuild() Promise<
Guild| null> Fetch the guild, or return
nullwhen Discord omitted the guild ID.- Returns:
The guild, or
nullif this message was not sent in a guild.
-
async Message.fetchReactionUsers(emoji: string, options: { after?: string; limit?: number; }) Promise<
User[]> Fetch users who reacted to this message with a specific emoji.
- Parameters:
emoji — – Emoji string (for example
"🔥"or"name:id"for a custom emoji).options — – Optional pagination. Discord returns up to 100 users per request.
- Returns:
Array of users who reacted with that emoji.
-
async Message.forward(channelId: string) Promise<
Message> Forward this message’s content and embeds to another channel.
- Parameters:
channelId — – The ID of the channel to forward to.
- Returns:
The sent message in the target channel.
- async Message.pin(reason: string) Promise<void>
Pin this message to the channel.
- Parameters:
reason — – Audit-log reason for pinning the message.
- async Message.react(emoji: string) Promise<void>
Add a reaction to this message using a Discord emoji string.
- Parameters:
emoji — – Emoji string (e.g.
"🔥"for unicode or"custom:123"for custom emoji).
- async Message.removeReaction(emoji: string, userId: string) Promise<void>
Remove another user’s reaction from this message.
- Parameters:
emoji — – The emoji string identifying the reaction.
userId — – The ID of the user whose reaction to remove.
-
async Message.reply(content: string |
SendMessageOptions) Promise<Message> Reply to this message with text or full message options. The returned message is the newly created reply, not this source message.
- Parameters:
content — – Message body as a string, or a full options object for embeds, files, etc.
- Returns:
The sent message.