Constructor
new Message()
Properties:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
activity |
Object
|
<nullable> |
The activity specified in the message |
||||||||||||||||||||
application |
Object
|
<nullable> |
The application of the activity in the message |
||||||||||||||||||||
applicationID |
String
|
<nullable> |
The ID of the interaction's application |
||||||||||||||||||||
attachments |
Array.<Object>
|
Array of attachments |
|||||||||||||||||||||
author |
User
|
The message author |
|||||||||||||||||||||
call |
Object
|
The call associated with the message |
|||||||||||||||||||||
| Name | Type | Attributes | Description |
|---|---|---|---|
endedTimestamp |
Number
|
<nullable> |
The time when the call ended |
participants |
Array.<String>
|
An array of user IDs that participated in the call |
channelDMChannel
|
TextChannel
|
NewsChannel
The channel the message is in. Can be partial with only the id if the channel is not cached.
channelMentionsArray.<String>
Array of mentions channels' ids
cleanContentString
Message content with mentions replaced by names. Mentions are currently escaped, but this behavior is [DEPRECATED] and will be removed soon. Use allowed mentions, the official way of avoiding unintended mentions, when creating messages.
commandCommand
The Command used in the Message, if any (CommandClient only)
componentsArray.<Object>
An array of component objects
contentString
Message content
createdAtNumber
Timestamp of message creation
editedTimestampNumber
Timestamp of latest message edit
embedsArray.<Object>
Array of embeds
flagsNumber
Message flags (see constants)
guildIDString
The ID of the guild this message is in (undefined if in DMs)
idString
The ID of the message
interactionObject
An object containing info about the interaction the message is responding to, if applicable
Properties
| Name | Type | Attributes | Description |
|---|---|---|---|
id |
String
|
The ID of the interaction |
|
member |
Member
|
<nullable> |
The member who invoked the interaction |
name |
String
|
The name of the command |
|
type |
Number
|
The type of interaction |
|
user |
User
|
The user who invoked the interaction |
jumpLinkString
The url used by Discord clients to jump to this message
memberMember
The message author with server-specific data
mentionEveryoneBoolean
Whether the message mentions everyone/here or not
mentionsArray.<User>
Array of mentioned users
messageReferenceObject
An object containing the reference to the original message if it is a crossposted message, reply or forwarded message
Properties
| Name | Type | Attributes | Description |
|---|---|---|---|
channelID |
String
|
The ID of the channel this message was crossposted from |
|
guildID |
String
|
<nullable> |
The ID of the guild this message was crossposted from |
messageID |
String
|
<nullable> |
The ID of the original message this message was crossposted from |
type |
Number
|
The type of reference. Either |
messageSnapshotsArray.<Object>
The message associated with the messageReference
Properties
| Name | Type | Attributes | Description |
|---|---|---|---|
guildID |
String
|
<nullable> |
The ID of the guild this message originated from |
message |
Message
|
Subset of message fields. The list of message fields subset consists of: |
pinnedBoolean
Whether the message is pinned or not
pollObject
A poll object. See the official Discord API documentation entry for object structure. Note: poll.expiry is an int, not ISO8601 as mentioned in Discord docs
prefixString
The prefix used in the Message, if any (CommandClient only)
reactionsObject
An object containing the reactions on the message. Each key is a reaction emoji and each value is an object with properties burst_colors (Arraycount (Number), count_details (an object with burst and normal keys corresponding to the amount of reactions), me (Boolean) and me_burst for that specific reaction emoji.
referencedMessageMessage
The message that was replied to. If undefined, message data was not received. If null, the message was deleted.
roleMentionsArray.<String>
Array of mentioned roles' ids
roleSubscriptionDataObject
An object containing the data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message. See the official Discord API documentation entry for object structure
stickersArray.<Object>
[DEPRECATED] The stickers sent with the message
stickerItemsArray.<Object>
The stickers sent with the message
timestampNumber
Timestamp of message creation
ttsBoolean
Whether to play the message using TTS or not
typeNumber
The type of the message
webhookIDString
ID of the webhook that sent the message
- Source:
Methods
addReaction(reaction) → {Promise}
Add a reaction to a message
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
reaction |
String
|
The reaction (Unicode string if Unicode emoji, |
Returns:
- Type:
-
Promise
createThreadWithMessage(options) → {Promise.<(NewsThreadChannel|PublicThreadChannel)>}
Create a thread with this message
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
The thread options
|
Returns:
- Type:
-
Promise.<(NewsThreadChannel|PublicThreadChannel)>
crosspost() → {Promise.<Message>}
Crosspost (publish) a message to subscribed channels (NewsChannel only)
- Source:
Returns:
- Type:
-
Promise.<Message>
delete(reasonopt) → {Promise}
Delete the message
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
reason |
String
|
<optional> |
The reason to be displayed in audit logs |
Returns:
- Type:
-
Promise
deleteWebhook(token) → {Promise}
Delete the message as a webhook
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
token |
String
|
The token of the webhook |
Returns:
- Type:
-
Promise
edit(content) → {Promise.<Message>}
Edit the message
- Source:
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
content |
String
|
Array
|
Object
|
A string, array of strings, or object. If an object is passed:
|
Returns:
- Type:
-
Promise.<Message>
editWebhook(token, options) → {Promise.<Message>}
Edit the message as a webhook
- Source:
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
token |
String
|
The token of the webhook |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object
|
Webhook message edit options
|
Returns:
- Type:
-
Promise.<Message>
getReaction(reaction, optionsopt, beforeopt, afteropt) → {Promise.<Array.<User>>}
Get a list of users who reacted with a specific reaction
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
reaction |
String
|
The reaction (Unicode string if Unicode emoji, |
|||||||||||||||||||||
options |
Object
|
<optional> |
Options for the request. If this is a number, it is treated as
|
||||||||||||||||||||
before |
String
|
<optional> |
[DEPRECATED] Get users before this user ID. Discord no longer supports this parameter |
||||||||||||||||||||
after |
String
|
<optional> |
[DEPRECATED] Get users after this user ID |
Returns:
- Type:
-
Promise.<Array.<User>>
removeReaction(reaction, userIDopt) → {Promise}
Remove a reaction from a message
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
reaction |
String
|
The reaction (Unicode string if Unicode emoji, |
||
userID |
String
|
<optional> |
"@me" |
The ID of the user to remove the reaction for |
Returns:
- Type:
-
Promise
removeReactionEmoji(reaction) → {Promise}
Remove all reactions from a message for a single emoji
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
reaction |
String
|
The reaction (Unicode string if Unicode emoji, |
Returns:
- Type:
-
Promise
removeReactions() → {Promise}
Remove all reactions from a message
- Source:
Returns:
- Type:
-
Promise
unpin() → {Promise}
Unpin the message
- Source:
Returns:
- Type:
-
Promise