Message
Extends
Base
Type Parameters
Type Parameter | Default type |
---|---|
IsPartial extends boolean | false |
Constructors
new Message()
new Message<
IsPartial
>(client
,rawDataOrIds
):Message
<IsPartial
>
Parameters
Parameter | Type |
---|---|
client | Client |
rawDataOrIds | IsPartial extends true ? object : APIMessage |
Returns
Message
<IsPartial
>
Overrides
Base.constructor
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
channelId | readonly | string | The ID of the channel the message is in | - |
client | public | Client | - | Base.client |
id | readonly | string | The ID of the message | - |
Accessors
applicationId
get
applicationId():IfPartial
<IsPartial
,undefined
|string
>
If this message is a response to an interaction, this is the ID of the interaction's application
Returns
IfPartial
<IsPartial
, undefined
| string
>
attachments
get
attachments():IfPartial
<IsPartial
,APIAttachment
[]>
The attachments of the message
Returns
IfPartial
<IsPartial
, APIAttachment
[]>
author
Get the author of the message
Returns
IfPartial
<IsPartial
, null
| User
<false
>>
components
get
components():IfPartial
<IsPartial
,APIActionRowComponent
<APIMessageActionRowComponent
>[]>
The components of the message
Returns
IfPartial
<IsPartial
, APIActionRowComponent
<APIMessageActionRowComponent
>[]>
content
get
content():IfPartial
<IsPartial
,string
>
The content of the message
Returns
IfPartial
<IsPartial
, string
>
editedTimestamp
get
editedTimestamp():IfPartial
<IsPartial
,null
|string
>
If this message was edited, this is the timestamp of the edit
Returns
IfPartial
<IsPartial
, null
| string
>
embeds
Returns
flags
get
flags():IfPartial
<IsPartial
,MessageFlags
>
The flags of the message
Returns
IfPartial
<IsPartial
, MessageFlags
>
interactionMetadata
get
interactionMetadata():IfPartial
<IsPartial
,undefined
|APIMessageInteractionMetadata
>
The interaction metadata of the message
Returns
IfPartial
<IsPartial
, undefined
| APIMessageInteractionMetadata
>
mentionedEveryone
get
mentionedEveryone():IfPartial
<IsPartial
,boolean
>
Whether the message mentions everyone
Returns
IfPartial
<IsPartial
, boolean
>
mentionedRoles
The roles mentioned in the message
Returns
IfPartial
<IsPartial
, Role
<true
>[]>
mentionedUsers
The users mentioned in the message
Returns
IfPartial
<IsPartial
, User
<false
>[]>
messageReference
get
messageReference():IfPartial
<IsPartial
,undefined
|APIMessageReference
>
The data about the referenced message. You can use Message.referencedMessage to get the referenced message itself.
Returns
IfPartial
<IsPartial
, undefined
| APIMessageReference
>
partial
get
partial():IsPartial
Whether the message is a partial message (meaning it does not have all the data). If this is true, you should use Message.fetch to get the full data of the message.
Returns
IsPartial
pinned
get
pinned():IfPartial
<IsPartial
,boolean
>
Whether the message is pinned
Returns
IfPartial
<IsPartial
, boolean
>
poll
get
poll():IfPartial
<IsPartial
,undefined
|APIPoll
>
The poll contained in the message
Returns
IfPartial
<IsPartial
, undefined
| APIPoll
>
position
get
position():IfPartial
<IsPartial
,undefined
|number
>
The approximate position of the message in the channel
Returns
IfPartial
<IsPartial
, undefined
| number
>
reactions
get
reactions():IfPartial
<IsPartial
,APIReaction
[]>
The reactions on the message
Returns
IfPartial
<IsPartial
, APIReaction
[]>
referencedMessage
get
referencedMessage():IfPartial
<IsPartial
,null
|Message
<false
>>
The referenced message itself
Returns
IfPartial
<IsPartial
, null
| Message
<false
>>
stickers
get
stickers():IfPartial
<IsPartial
,APIStickerItem
[]>
The stickers in the message
Returns
IfPartial
<IsPartial
, APIStickerItem
[]>
thread
get
thread():IfPartial
<IsPartial
,null
|GuildThreadChannel
<AnnouncementThread
|PublicThread
,false
>>
Get the thread associated with this message, if there is one
Returns
IfPartial
<IsPartial
, null
| GuildThreadChannel
<AnnouncementThread
| PublicThread
, false
>>
timestamp
get
timestamp():IfPartial
<IsPartial
,string
>
The timestamp of the original message
Returns
IfPartial
<IsPartial
, string
>
tts
get
tts():IfPartial
<IsPartial
,boolean
>
Whether the message is a TTS message
Returns
IfPartial
<IsPartial
, boolean
>
type
get
type():IfPartial
<IsPartial
,MessageType
>
The type of the message
Returns
IfPartial
<IsPartial
, MessageType
>
Methods
delete()
delete():
Promise
<unknown
>
Delete this message from Discord
Returns
Promise
<unknown
>
edit()
edit(
data
):Promise
<void
>
Parameters
Parameter | Type |
---|---|
data | object |
data.allowedMentions ? | APIAllowedMentions |
data.components ? | Row <BaseComponent >[] |
data.content ? | string |
data.embeds ? | Embed [] |
Returns
Promise
<void
>
fetch()
fetch():
Promise
<void
>
Fetch updated data for this message. If the message is partial, this will fetch all the data for the message and populate the fields. If the message is not partial, all fields will be updated with new values from Discord.
Returns
Promise
<void
>
fetchChannel()
fetchChannel():
Promise
<null
|GuildCategoryChannel
<false
> |DmChannel
<false
> |GroupDmChannel
<false
> |GuildTextChannel
<false
> |GuildVoiceChannel
<false
> |GuildAnnouncementChannel
<false
> |GuildThreadChannel
<ThreadChannelType
,false
> |GuildStageChannel
<false
> |GuildForumChannel
<false
> |GuildMediaChannel
>
Get the channel the message was sent in
Returns
Promise
<null
| GuildCategoryChannel
<false
> | DmChannel
<false
> | GroupDmChannel
<false
> | GuildTextChannel
<false
> | GuildVoiceChannel
<false
> | GuildAnnouncementChannel
<false
> | GuildThreadChannel
<ThreadChannelType
, false
> | GuildStageChannel
<false
> | GuildForumChannel
<false
> | GuildMediaChannel
>
pin()
pin():
Promise
<void
>
Pin this message
Returns
Promise
<void
>
startThread()
startThread(
data
):Promise
<GuildThreadChannel
<ThreadChannelType
,false
>>
Start a thread with this message as the associated start message. If you want to start a thread without a start message, use BaseGuildTextChannel.startThread
Parameters
Parameter | Type |
---|---|
data | RESTPostAPIChannelThreadsJSONBody |
Returns
Promise
<GuildThreadChannel
<ThreadChannelType
, false
>>
unpin()
unpin():
Promise
<void
>
Unpin this message
Returns
Promise
<void
>