Skip to main content
Module

x/discord_api_types/v9.ts>APIMessage

Up to date Discord API Typings, versioned by the API version
Go to Latest
interface APIMessage
Re-export
import { type APIMessage } from "https://deno.land/x/discord_api_types@0.37.11/v9.ts";

Properties

ID of the message

channel_id: Snowflake

ID of the channel the message was sent in

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

content: string

Contents of the message

The MESSAGE_CONTENT privileged gateway intent will become required after August 31, 2022 for verified applications to receive a non-empty value from this field

In the Discord Developers Portal, you need to enable the toggle of this intent of your application in Bot > Privileged Gateway Intents

See https://support-dev.discord.com/hc/en-us/articles/4404772028055

timestamp: string

When this message was sent

edited_timestamp: string | null

When this message was edited (or null if never)

tts: boolean

Whether this was a TTS message

mention_everyone: boolean

Whether this message mentions everyone

mentions: APIUser[]

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

mention_roles: APIRole["id"][]

Roles specifically mentioned in this message

See https://discord.com/developers/docs/topics/permissions#role-object

optional
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

attachments: APIAttachment[]

Any attached files

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

The MESSAGE_CONTENT privileged gateway intent will become required after August 31, 2022 for verified applications to receive a non-empty value from this field

In the Discord Developers Portal, you need to enable the toggle of this intent of your application in Bot > Privileged Gateway Intents

See https://support-dev.discord.com/hc/en-us/articles/4404772028055

embeds: APIEmbed[]

Any embedded content

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

The MESSAGE_CONTENT privileged gateway intent will become required after August 31, 2022 for verified applications to receive a non-empty value from this field

In the Discord Developers Portal, you need to enable the toggle of this intent of your application in Bot > Privileged Gateway Intents

See https://support-dev.discord.com/hc/en-us/articles/4404772028055

optional
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: boolean

Whether this message is pinned

optional
webhook_id: Snowflake

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

optional
application: Partial<APIApplication>
optional
application_id: Snowflake

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

optional
message_reference: APIMessageReference

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

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

optional
referenced_message: APIMessage | null

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

optional
interaction: APIMessageInteraction

Sent if the message is a response to an Interaction

optional
thread: APIChannel

Sent if a thread was started from this message

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

The MESSAGE_CONTENT privileged gateway intent will become required after August 31, 2022 for verified applications to receive a non-empty value from this field

In the Discord Developers Portal, you need to enable the toggle of this intent of your application in Bot > Privileged Gateway Intents

See https://support-dev.discord.com/hc/en-us/articles/4404772028055

optional
sticker_items: APIStickerItem[]
optional
deprecated
stickers: APISticker[]
optional
position: number

A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread

It can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread