Skip to content
GitHub

MockMessageOverrides

interface in meocord/testing Since 4.1.0

interface MockMessageOverrides

What createMockMessage builds a message with.

Components and embeds may be API JSON, builders or discord.js instances.

Members

id

id?: string

The message's id.

content

content?: string

The message's text.

author

author?: User

Who sent it, such as a user from createMockUser, or the client's own user for a message the bot sent; a new person otherwise. Two messages from one author count as one user's, such as for a per-user cooldown. It is cached on the message's client, and in a server its member is the guild's cached member for that user, or a new one.

components

components?: readonly (
  APIMessageTopLevelComponent | JSONEncodable<APIMessageTopLevelComponent>
)[]

Its top-level components: action rows, or Components V2 such as a container.

embeds

embeds?: readonly (APIEmbed | JSONEncodable<APIEmbed>)[]

Its embeds.

flags

flags?: MessageFlagsResolvable

Its flags: a number, flag names or a MessageFlagsBitField.

guild

guild?: Guild | null

The guild it was sent in, such as one from createMockGuild with members in its cache; null for a DM.

channel

channel?: TextBasedChannel | DeepMocked<BaseChannel>

The channel it was sent in, such as one from createMockChannel. Unless given, a text channel of its guild, cached there, or the author's DM channel for a DM. A channel given sets the message's guild, unless guild is given too: none for a DM channel, so inGuild() is false, and the channel's own server for a server's channel. One in another server than the guild given is refused, naming both. The channel is cached on the message's client, as the gateway caches it.

client

client?: Client

The client it arrived on, such as one from createMockClient; a new mock client otherwise.

users

users?: readonly User[]

Users in the client's users.cache, by their id, beside those the content mentions.

editedTimestamp

editedTimestamp?: number | null

When it was last edited, in milliseconds since the epoch; null, the default, for a message never edited.