Skip to main content
Version: 0.37.106

APIMessage

@deprecated

API and gateway v8 are deprecated and the types will not receive further updates, please update to v10.

Index

Properties

optionalactivity

optionalapplication

application?: Partial<APIApplication>

optionalapplication_id

application_id?: string

If the message is a response to an Interaction, this is the id of the interaction’s application

attachments

attachments: APIAttachment[]

author

author: APIUser

The author of this message (only a valid user in the case where the message is generated by a user or bot user)

If the message is generated by a webhook, the author object corresponds to the webhook’s id, username, and avatar. You can tell if a message is generated by a webhook by checking for the webhook_id property

See https://discord.com/developers/docs/resources/user#user-object

channel_id

channel_id: string

ID of the channel the message was sent in

optionalcomponents

Sent if the message contains components like buttons, action rows, or other interactive components

content

content: string

Contents of the message

edited_timestamp

edited_timestamp: null | string

When this message was edited (or null if never)

embeds

embeds: APIEmbed[]

optionalflags

flags?: MessageFlags

optionalguild_id

guild_id?: string

ID of the guild the message was sent in

id

id: string

ID of the message

optionalinteraction

interaction?: APIMessageInteraction

Sent if the message is a response to an Interaction

optionalmember

Member properties for this message’s author

The member object exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels

See https://discord.com/developers/docs/resources/guild#guild-member-object

optionalmention_channels

mention_channels?: APIChannelMention[]

Channels specifically mentioned in this message

Not all channel mentions in a message will appear in mention_channels.

  • Only textual channels that are visible to everyone in a lurkable guild will ever be included
  • Only crossposted messages (via Channel Following) currently include mention_channels at all

If no mentions in the message meet these requirements, this field will not be sent

See https://discord.com/developers/docs/resources/channel#channel-mention-object

mention_everyone

mention_everyone: boolean

Whether this message mentions everyone

mention_roles

mention_roles: string[]

Roles specifically mentioned in this message

mentions

mentions: (APIUser & { member?: Omit<APIGuildMember, user> })[]

Users specifically mentioned in the message

The member field is only present in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels

See https://discord.com/developers/docs/resources/user#user-object See https://discord.com/developers/docs/resources/guild#guild-member-object

optionalmessage_reference

message_reference?: APIMessageReference

Reference data sent with crossposted messages, replies, pins, and thread starter messages

optionalnonce

nonce?: string | number

A nonce that can be used for optimistic message sending (up to 25 characters)

You will not receive this from further fetches. This is received only once from a MESSAGE_CREATE event to ensure it got sent

pinned

pinned: boolean

Whether this message is pinned

optionalreactions

reactions?: APIReaction[]

optionalreferenced_message

referenced_message?: null | APIMessage

The message associated with the message_reference

This field is only returned for messages with a type of 19 (REPLY).

If the message is a reply but the referenced_message field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown.

If the field exists but is null, the referenced message was deleted

See https://discord.com/developers/docs/resources/channel#message-object

optionalsticker_items

sticker_items?: APIStickerItem[]

optionalstickers

stickers?: APISticker[]

The stickers sent with the message

@deprecated

Use sticker_items instead

timestamp

timestamp: string

When this message was sent

tts

tts: boolean

Whether this was a TTS message

type

optionalwebhook_id

webhook_id?: string

If the message is generated by a webhook, this is the webhook’s id