Skip to content

componentsV2Message

componentsV2Message<T>(components, options?): object & T

Defined in: packages/builders/src/components.ts:776

A message payload laid out with Components V2: the components, and the flag Discord requires for them. A V2 message cannot also carry content or embeds.

T extends Record<string, unknown> = Record<string, never>

{ toJSON: APIComponent; } | object[]

Top-level components (containers, sections, text displays, action rows…).

T & object

Extra message fields, such as allowed_mentions or ephemeral; flags are combined.

object & T

channel.send(componentsV2Message(new CreateContainer().addComponents(new CreateTextDisplay().setContent("Hi"))))