Skip to main content
Module

x/discordeno/mod.ts>DiscordMessage

Discord API library for Deno
Latest
interface DiscordMessage
Re-export
import { type DiscordMessage } from "https://deno.land/x/discordeno@18.0.1/mod.ts";

Properties

id: string

id of the message

channel_id: string

id of the channel the message was sent in

optional
guild_id: string

id of the guild the message was sent in Note: For MESSAGE_CREATE and MESSAGE_UPDATE events, the message object may not contain a guild_id or member field since the events are sent directly to the receiving user and the bot who sent the message, rather than being sent through the guild like non-ephemeral messages.

author: DiscordUser

The author of this message (not guaranteed to be a valid user) Note: The author object follows the structure of the user object, but is 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 on the message object.

optional
member: DiscordMember

Member properties for this message's author Note: The member object exists in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels. This allows bots to obtain real-time member data without requiring bots to store member state in memory.

optional
content: string

Contents of the message

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

optional
mentions: (DiscordUser & { member?: Partial<DiscordMember>; })[]

Users specifically mentioned in the message Note: The user objects in the mentions array will only have the partial member field present in MESSAGE_CREATE and MESSAGE_UPDATE events from text-based guild channels.

optional
mention_roles: string[]

Roles specifically mentioned in this message

optional
mention_channels: DiscordChannelMention[]

Channels specifically mentioned in this message Note: 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.

attachments: DiscordAttachment[]

Any attached files

embeds: DiscordEmbed[]

Any embedded content

optional
reactions: DiscordReaction[]

Reactions to the message

optional
nonce: number | string

Used for validating a message was sent

pinned: boolean

Whether this message is pinned

optional
webhook_id: string

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

type: MessageTypes

Type of message

optional
activity: DiscordMessageActivity

Sent with Rich Presence-related chat embeds

optional
application: Partial<DiscordApplication>

Sent with Rich Presence-related chat embeds

optional
application_id: string

if the message is an Interaction or application-owned webhook, this is the id of the application

optional
message_reference: Omit<DiscordMessageReference, "failIfNotExists">

Data showing the source of a crossposted channel follow add, pin or reply message

optional
flags: number

Message flags combined as a bitfield

optional
deprecated
stickers: DiscordSticker[]

The stickers sent with the message (bots currently can only receive messages with stickers, not send)

optional
referenced_message: DiscordMessage

The message associated with the message_reference Note: 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.

optional
interaction: DiscordMessageInteraction

Sent if the message is a response to an Interaction

optional
thread: Omit<DiscordChannel, "member"> & { member: DiscordThreadMember; }

The thread that was started from this message, includes thread member object

optional
components: DiscordMessageComponents

The components related to this message

optional
sticker_items: DiscordStickerItem[]

Sent if the message contains stickers