feat!: components v2 (#1190)

This commit is contained in:
advaith
2025-04-21 14:52:14 -07:00
committed by GitHub
parent 076e7b8f7b
commit 9f769c319e
22 changed files with 663 additions and 93 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
deno/** linguist-generated

View File

@@ -6,5 +6,10 @@
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit"
},
"cSpell.enableFiletypes": ["mdx"]
"cSpell.enableFiletypes": ["mdx"],
"search.exclude": {
"**/v6": true,
"**/v8": true,
"deno": true
}
}

View File

@@ -1,4 +1,4 @@
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel.ts';
import type {
APIBaseInteraction,
APIDMInteractionWrapper,
@@ -14,7 +14,7 @@ export interface ModalSubmitComponent {
}
export interface ModalSubmitActionRowComponent
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
extends Omit<APIActionRowComponent<APIComponentInModalActionRow>, 'components'> {
components: ModalSubmitComponent[];
}

View File

@@ -1,5 +1,5 @@
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10.ts';
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel.ts';
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
/**
@@ -141,5 +141,5 @@ export interface APIModalInteractionResponseCallbackData {
/**
* Between 1 and 5 (inclusive) components that make up the modal
*/
components: APIActionRowComponent<APIModalActionRowComponent>[];
components: APIActionRowComponent<APIComponentInModalActionRow>[];
}

View File

@@ -687,7 +687,7 @@ export interface APIMessage {
*
* @see {@link https://support-dev.discord.com/hc/articles/4404772028055}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
components?: APIMessageTopLevelComponent[];
/**
* Sent if the message contains stickers
*
@@ -909,6 +909,10 @@ export enum MessageFlags {
* This message has a snapshot (via Message Forwarding)
*/
HasSnapshot = 1 << 14,
/**
* This flag is required to use new components
*/
IsComponentsV2 = 1 << 15,
}
/**
@@ -1559,6 +1563,10 @@ export interface APIBaseComponent<T extends ComponentType> {
* The type of the component
*/
type: T;
/**
* int32, auto generated via increment if not provided
*/
id?: number;
}
/**
@@ -1597,6 +1605,14 @@ export enum ComponentType {
* Select menu for channels
*/
ChannelSelect,
Section,
TextDisplay,
Thumbnail,
MediaGallery,
File,
Separator,
ContentInventoryEntry = 16,
Container,
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
@@ -1611,7 +1627,7 @@ export enum ComponentType {
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#action-rows}
*/
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
export interface APIActionRowComponent<T extends APIComponentInActionRow>
extends APIBaseComponent<ComponentType.ActionRow> {
/**
* The components in the ActionRow
@@ -1901,6 +1917,77 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}
export enum UnfurledMediaItemLoadingState {
Unknown,
Loading,
LoadedSuccess,
LoadedNotFound,
}
export interface APIUnfurledMediaItem {
/**
* Supports arbitrary urls _and_ attachment://<filename> references
*/
url: string;
proxy_url?: string;
width?: number | null;
height?: number | null;
placeholder?: string | null;
placeholder_version?: number | null;
content_type?: string | null;
loading_state?: UnfurledMediaItemLoadingState;
flags?: number;
}
export interface APISectionComponent extends APIBaseComponent<ComponentType.Section> {
components: APITextDisplayComponent[];
accessory: APISectionAccessoryComponent;
}
export interface APITextDisplayComponent extends APIBaseComponent<ComponentType.TextDisplay> {
content: string;
}
export interface APIThumbnailComponent extends APIBaseComponent<ComponentType.Thumbnail> {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryItem {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryComponent extends APIBaseComponent<ComponentType.MediaGallery> {
items: APIMediaGalleryItem[];
}
export enum SeparatorSpacingSize {
Small = 1,
Large,
}
export interface APISeparatorComponent extends APIBaseComponent<ComponentType.Separator> {
divider?: boolean;
spacing?: SeparatorSpacingSize;
}
export interface APIFileComponent extends APIBaseComponent<ComponentType.File> {
/**
* The APIUnfurledMediaItem ONLY supports attachment://<filename> references
*/
file: APIUnfurledMediaItem;
spoiler?: boolean;
}
export interface APIContainerComponent extends APIBaseComponent<ComponentType.Container> {
accent_color?: number | null;
spoiler?: boolean;
components: APIComponentInContainer[];
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
*/
@@ -1966,20 +2053,57 @@ export enum ChannelFlags {
}
/**
* All components that can appear in messages.
*
* For more specific sets, see {@link APIMessageTopLevelComponent}, {@link APIComponentInMessageActionRow}, {@link APIComponentInContainer}, and {@link APISectionAccessoryComponent}
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageComponent = APIActionRowComponent<APIMessageActionRowComponent> | APIMessageActionRowComponent;
export type APIModalComponent = APIActionRowComponent<APIModalActionRowComponent> | APIModalActionRowComponent;
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
export type APIMessageComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIButtonComponent
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISelectMenuComponent
| APISeparatorComponent
| APITextDisplayComponent
| APIThumbnailComponent;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
export type APIMessageTopLevelComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
export type APIComponentInActionRow = APIComponentInMessageActionRow | APIComponentInModalActionRow;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuComponent;
// Modal components
export type APIModalActionRowComponent = APITextInputComponent;
export type APIComponentInModalActionRow = APITextInputComponent;
export type APISectionAccessoryComponent = APIButtonComponent | APIThumbnailComponent;
export type APIComponentInContainer =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIMessageSnapshotFields = Pick<
APIMessage,

View File

@@ -1,4 +1,4 @@
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel.ts';
import type {
APIBaseInteraction,
APIDMInteractionWrapper,
@@ -14,7 +14,7 @@ export interface ModalSubmitComponent {
}
export interface ModalSubmitActionRowComponent
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
extends Omit<APIActionRowComponent<APIComponentInModalActionRow>, 'components'> {
components: ModalSubmitComponent[];
}

View File

@@ -1,5 +1,5 @@
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel.ts';
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
/**
@@ -141,5 +141,5 @@ export interface APIModalInteractionResponseCallbackData {
/**
* Between 1 and 5 (inclusive) components that make up the modal
*/
components: APIActionRowComponent<APIModalActionRowComponent>[];
components: APIActionRowComponent<APIComponentInModalActionRow>[];
}

View File

@@ -195,6 +195,10 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
* ID of the DM creator
*/
owner_id?: Snowflake;
/**
* The id of the last message sent in this channel (may not point to an existing or valid message)
*/
last_message_id?: Snowflake | null;
/**
* Whether the channel is managed by an OAuth2 application
*/
@@ -448,7 +452,8 @@ export enum ChannelType {
*/
GuildMedia,
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
/**
* A channel that users can follow and crosspost into their own guild
*
@@ -512,7 +517,7 @@ export interface APIMessage {
/**
* 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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**
*
@@ -568,7 +573,7 @@ export interface APIMessage {
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
*
* 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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 {@link https://support-dev.discord.com/hc/articles/4404772028055}
@@ -579,7 +584,7 @@ export interface APIMessage {
*
* @see {@link 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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 {@link https://support-dev.discord.com/hc/articles/4404772028055}
@@ -661,6 +666,8 @@ export interface APIMessage {
interaction_metadata?: APIMessageInteractionMetadata;
/**
* Sent if the message is a response to an Interaction
*
* @deprecated In favor of `interaction_metadata`
*/
interaction?: APIMessageInteraction;
/**
@@ -670,13 +677,13 @@ export interface APIMessage {
/**
* 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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 {@link https://support-dev.discord.com/hc/articles/4404772028055}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
components?: APIMessageTopLevelComponent[];
/**
* Sent if the message contains stickers
*
@@ -696,6 +703,10 @@ export interface APIMessage {
* It can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread
*/
position?: number;
/**
* Data of the role subscription purchase or renewal that prompted this `ROLE_SUBSCRIPTION_PURCHASE` message
*/
role_subscription_data?: APIMessageRoleSubscriptionData;
/**
* Data for users, members, channels, and roles in the message's auto-populated select menus
*
@@ -708,7 +719,6 @@ export interface APIMessage {
* The `MESSAGE_CONTENT` privileged gateway intent is required 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**.
* You also need to specify the intent bit value (`1 << 15`) if you are connecting to the gateway
*
* @see {@link https://support-dev.discord.com/hc/articles/4404772028055}
*/
@@ -894,6 +904,10 @@ export enum MessageFlags {
* This message has a snapshot (via Message Forwarding)
*/
HasSnapshot = 1 << 14,
/**
* This flag is required to use new components
*/
IsComponentsV2 = 1 << 15,
}
/**
@@ -910,6 +924,28 @@ export interface APIMessageCall {
ended_timestamp?: string | null;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#role-subscription-data-object-role-subscription-data-object-structure}
*/
export interface APIMessageRoleSubscriptionData {
/**
* The id of the SKU and listing the user is subscribed to
*/
role_subscription_listing_id: Snowflake;
/**
* The name of the tier the user is subscribed to
*/
tier_name: string;
/**
* The number of months the user has been subscribed for
*/
total_months_subscribed: number;
/**
* Whether this notification is for a renewal
*/
is_renewal: boolean;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#followed-channel-object}
*/
@@ -1526,6 +1562,10 @@ export interface APIBaseComponent<T extends ComponentType> {
* The type of the component
*/
type: T;
/**
* int32, auto generated via increment if not provided
*/
id?: number;
}
/**
@@ -1564,6 +1604,14 @@ export enum ComponentType {
* Select menu for channels
*/
ChannelSelect,
Section,
TextDisplay,
Thumbnail,
MediaGallery,
File,
Separator,
ContentInventoryEntry = 16,
Container,
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
@@ -1578,7 +1626,7 @@ export enum ComponentType {
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#action-rows}
*/
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
export interface APIActionRowComponent<T extends APIComponentInActionRow>
extends APIBaseComponent<ComponentType.ActionRow> {
/**
* The components in the ActionRow
@@ -1868,6 +1916,77 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}
export enum UnfurledMediaItemLoadingState {
Unknown,
Loading,
LoadedSuccess,
LoadedNotFound,
}
export interface APIUnfurledMediaItem {
/**
* Supports arbitrary urls _and_ attachment://<filename> references
*/
url: string;
proxy_url?: string;
width?: number | null;
height?: number | null;
placeholder?: string | null;
placeholder_version?: number | null;
content_type?: string | null;
loading_state?: UnfurledMediaItemLoadingState;
flags?: number;
}
export interface APISectionComponent extends APIBaseComponent<ComponentType.Section> {
components: APITextDisplayComponent[];
accessory: APISectionAccessoryComponent;
}
export interface APITextDisplayComponent extends APIBaseComponent<ComponentType.TextDisplay> {
content: string;
}
export interface APIThumbnailComponent extends APIBaseComponent<ComponentType.Thumbnail> {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryItem {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryComponent extends APIBaseComponent<ComponentType.MediaGallery> {
items: APIMediaGalleryItem[];
}
export enum SeparatorSpacingSize {
Small = 1,
Large,
}
export interface APISeparatorComponent extends APIBaseComponent<ComponentType.Separator> {
divider?: boolean;
spacing?: SeparatorSpacingSize;
}
export interface APIFileComponent extends APIBaseComponent<ComponentType.File> {
/**
* The APIUnfurledMediaItem ONLY supports attachment://<filename> references
*/
file: APIUnfurledMediaItem;
spoiler?: boolean;
}
export interface APIContainerComponent extends APIBaseComponent<ComponentType.Container> {
accent_color?: number | null;
spoiler?: boolean;
components: APIComponentInContainer[];
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
*/
@@ -1933,20 +2052,57 @@ export enum ChannelFlags {
}
/**
* All components that can appear in messages.
*
* For more specific sets, see {@link APIMessageTopLevelComponent}, {@link APIComponentInMessageActionRow}, {@link APIComponentInContainer}, and {@link APISectionAccessoryComponent}
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageComponent = APIActionRowComponent<APIMessageActionRowComponent> | APIMessageActionRowComponent;
export type APIModalComponent = APIActionRowComponent<APIModalActionRowComponent> | APIModalActionRowComponent;
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
export type APIMessageComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIButtonComponent
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISelectMenuComponent
| APISeparatorComponent
| APITextDisplayComponent
| APIThumbnailComponent;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
export type APIMessageTopLevelComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
export type APIComponentInActionRow = APIComponentInMessageActionRow | APIComponentInModalActionRow;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuComponent;
// Modal components
export type APIModalActionRowComponent = APITextInputComponent;
export type APIComponentInModalActionRow = APITextInputComponent;
export type APISectionAccessoryComponent = APIButtonComponent | APIThumbnailComponent;
export type APIComponentInContainer =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIMessageSnapshotFields = Pick<
APIMessage,

View File

@@ -1,13 +1,11 @@
import type { Permissions, Snowflake } from '../../globals.ts';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIChannel,
APIEmbed,
APIExtendedInvite,
APIFollowedChannel,
APIMessage,
APIMessageActionRowComponent,
APIMessageReference,
APIThreadList,
APIThreadMember,
@@ -25,6 +23,7 @@ import type {
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
} from '../../payloads/v10/mod.ts';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals.ts';
import type { RESTAPIPoll } from './poll.ts';
@@ -311,7 +310,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* IDs of up to 3 stickers in the server to send in the message
*
@@ -464,7 +463,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null | undefined;
components?: APIMessageTopLevelComponent[] | null | undefined;
}
/**

View File

@@ -1,12 +1,11 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIAllowedMentions,
APIActionRowComponent,
APIEmbed,
APIMessage,
APIWebhook,
MessageFlags,
APIMessageActionRowComponent,
APIMessageTopLevelComponent,
} from '../../payloads/v10/mod.ts';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _Nullable } from '../../utils/internals.ts';
import type { RESTAPIAttachment } from './channel.ts';
@@ -136,7 +135,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
*/
@@ -298,7 +297,10 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message-query-string-params}
*/
export type RESTPatchAPIWebhookWithTokenQuery = Pick<RESTPostAPIWebhookWithTokenQuery, 'thread_id' | 'with_components'>;
export type RESTPatchAPIWebhookWithTokenMessageQuery = Pick<
RESTPostAPIWebhookWithTokenQuery,
'thread_id' | 'with_components'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}

View File

@@ -1,13 +1,11 @@
import type { Permissions, Snowflake } from '../../globals.ts';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIChannel,
APIEmbed,
APIExtendedInvite,
APIFollowedChannel,
APIMessage,
APIMessageActionRowComponent,
APIMessageReference,
APIThreadList,
APIThreadMember,
@@ -25,6 +23,7 @@ import type {
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
} from '../../payloads/v9/mod.ts';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals.ts';
import type { RESTAPIPoll } from './poll.ts';
@@ -318,7 +317,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* IDs of up to 3 stickers in the server to send in the message
*
@@ -478,7 +477,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null | undefined;
components?: APIMessageTopLevelComponent[] | null | undefined;
}
/**

View File

@@ -1,12 +1,11 @@
import type { Snowflake } from '../../globals.ts';
import type {
APIAllowedMentions,
APIActionRowComponent,
APIEmbed,
APIMessage,
APIWebhook,
MessageFlags,
APIMessageActionRowComponent,
APIMessageTopLevelComponent,
} from '../../payloads/v9/mod.ts';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _Nullable } from '../../utils/internals.ts';
import type { RESTAPIAttachment } from './channel.ts';
@@ -136,7 +135,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
*/
@@ -298,7 +297,10 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message-query-string-params}
*/
export type RESTPatchAPIWebhookWithTokenQuery = Pick<RESTPostAPIWebhookWithTokenQuery, 'thread_id' | 'with_components'>;
export type RESTPatchAPIWebhookWithTokenMessageQuery = Pick<
RESTPostAPIWebhookWithTokenQuery,
'thread_id' | 'with_components'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}

View File

@@ -1,4 +1,4 @@
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel';
import type {
APIBaseInteraction,
APIDMInteractionWrapper,
@@ -14,7 +14,7 @@ export interface ModalSubmitComponent {
}
export interface ModalSubmitActionRowComponent
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
extends Omit<APIActionRowComponent<APIComponentInModalActionRow>, 'components'> {
components: ModalSubmitComponent[];
}

View File

@@ -1,5 +1,5 @@
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10';
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel';
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
/**
@@ -141,5 +141,5 @@ export interface APIModalInteractionResponseCallbackData {
/**
* Between 1 and 5 (inclusive) components that make up the modal
*/
components: APIActionRowComponent<APIModalActionRowComponent>[];
components: APIActionRowComponent<APIComponentInModalActionRow>[];
}

View File

@@ -687,7 +687,7 @@ export interface APIMessage {
*
* @see {@link https://support-dev.discord.com/hc/articles/4404772028055}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
components?: APIMessageTopLevelComponent[];
/**
* Sent if the message contains stickers
*
@@ -909,6 +909,10 @@ export enum MessageFlags {
* This message has a snapshot (via Message Forwarding)
*/
HasSnapshot = 1 << 14,
/**
* This flag is required to use new components
*/
IsComponentsV2 = 1 << 15,
}
/**
@@ -1559,6 +1563,10 @@ export interface APIBaseComponent<T extends ComponentType> {
* The type of the component
*/
type: T;
/**
* int32, auto generated via increment if not provided
*/
id?: number;
}
/**
@@ -1597,6 +1605,14 @@ export enum ComponentType {
* Select menu for channels
*/
ChannelSelect,
Section,
TextDisplay,
Thumbnail,
MediaGallery,
File,
Separator,
ContentInventoryEntry = 16,
Container,
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
@@ -1611,7 +1627,7 @@ export enum ComponentType {
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#action-rows}
*/
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
export interface APIActionRowComponent<T extends APIComponentInActionRow>
extends APIBaseComponent<ComponentType.ActionRow> {
/**
* The components in the ActionRow
@@ -1901,6 +1917,77 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}
export enum UnfurledMediaItemLoadingState {
Unknown,
Loading,
LoadedSuccess,
LoadedNotFound,
}
export interface APIUnfurledMediaItem {
/**
* Supports arbitrary urls _and_ attachment://<filename> references
*/
url: string;
proxy_url?: string;
width?: number | null;
height?: number | null;
placeholder?: string | null;
placeholder_version?: number | null;
content_type?: string | null;
loading_state?: UnfurledMediaItemLoadingState;
flags?: number;
}
export interface APISectionComponent extends APIBaseComponent<ComponentType.Section> {
components: APITextDisplayComponent[];
accessory: APISectionAccessoryComponent;
}
export interface APITextDisplayComponent extends APIBaseComponent<ComponentType.TextDisplay> {
content: string;
}
export interface APIThumbnailComponent extends APIBaseComponent<ComponentType.Thumbnail> {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryItem {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryComponent extends APIBaseComponent<ComponentType.MediaGallery> {
items: APIMediaGalleryItem[];
}
export enum SeparatorSpacingSize {
Small = 1,
Large,
}
export interface APISeparatorComponent extends APIBaseComponent<ComponentType.Separator> {
divider?: boolean;
spacing?: SeparatorSpacingSize;
}
export interface APIFileComponent extends APIBaseComponent<ComponentType.File> {
/**
* The APIUnfurledMediaItem ONLY supports attachment://<filename> references
*/
file: APIUnfurledMediaItem;
spoiler?: boolean;
}
export interface APIContainerComponent extends APIBaseComponent<ComponentType.Container> {
accent_color?: number | null;
spoiler?: boolean;
components: APIComponentInContainer[];
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
*/
@@ -1966,20 +2053,57 @@ export enum ChannelFlags {
}
/**
* All components that can appear in messages.
*
* For more specific sets, see {@link APIMessageTopLevelComponent}, {@link APIComponentInMessageActionRow}, {@link APIComponentInContainer}, and {@link APISectionAccessoryComponent}
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageComponent = APIActionRowComponent<APIMessageActionRowComponent> | APIMessageActionRowComponent;
export type APIModalComponent = APIActionRowComponent<APIModalActionRowComponent> | APIModalActionRowComponent;
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
export type APIMessageComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIButtonComponent
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISelectMenuComponent
| APISeparatorComponent
| APITextDisplayComponent
| APIThumbnailComponent;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
export type APIMessageTopLevelComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
export type APIComponentInActionRow = APIComponentInMessageActionRow | APIComponentInModalActionRow;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuComponent;
// Modal components
export type APIModalActionRowComponent = APITextInputComponent;
export type APIComponentInModalActionRow = APITextInputComponent;
export type APISectionAccessoryComponent = APIButtonComponent | APIThumbnailComponent;
export type APIComponentInContainer =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIMessageSnapshotFields = Pick<
APIMessage,

View File

@@ -1,4 +1,4 @@
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel';
import type {
APIBaseInteraction,
APIDMInteractionWrapper,
@@ -14,7 +14,7 @@ export interface ModalSubmitComponent {
}
export interface ModalSubmitActionRowComponent
extends Omit<APIActionRowComponent<APIModalActionRowComponent>, 'components'> {
extends Omit<APIActionRowComponent<APIComponentInModalActionRow>, 'components'> {
components: ModalSubmitComponent[];
}

View File

@@ -1,5 +1,5 @@
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
import type { APIActionRowComponent, APIComponentInModalActionRow } from '../channel';
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
/**
@@ -141,5 +141,5 @@ export interface APIModalInteractionResponseCallbackData {
/**
* Between 1 and 5 (inclusive) components that make up the modal
*/
components: APIActionRowComponent<APIModalActionRowComponent>[];
components: APIActionRowComponent<APIComponentInModalActionRow>[];
}

View File

@@ -195,6 +195,10 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
* ID of the DM creator
*/
owner_id?: Snowflake;
/**
* The id of the last message sent in this channel (may not point to an existing or valid message)
*/
last_message_id?: Snowflake | null;
/**
* Whether the channel is managed by an OAuth2 application
*/
@@ -448,7 +452,8 @@ export enum ChannelType {
*/
GuildMedia,
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
/**
* A channel that users can follow and crosspost into their own guild
*
@@ -512,7 +517,7 @@ export interface APIMessage {
/**
* 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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**
*
@@ -568,7 +573,7 @@ export interface APIMessage {
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
*
* 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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 {@link https://support-dev.discord.com/hc/articles/4404772028055}
@@ -579,7 +584,7 @@ export interface APIMessage {
*
* @see {@link 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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 {@link https://support-dev.discord.com/hc/articles/4404772028055}
@@ -661,6 +666,8 @@ export interface APIMessage {
interaction_metadata?: APIMessageInteractionMetadata;
/**
* Sent if the message is a response to an Interaction
*
* @deprecated In favor of `interaction_metadata`
*/
interaction?: APIMessageInteraction;
/**
@@ -670,13 +677,13 @@ export interface APIMessage {
/**
* 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
* The `MESSAGE_CONTENT` privileged gateway intent is required 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 {@link https://support-dev.discord.com/hc/articles/4404772028055}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[];
components?: APIMessageTopLevelComponent[];
/**
* Sent if the message contains stickers
*
@@ -696,6 +703,10 @@ export interface APIMessage {
* It can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread
*/
position?: number;
/**
* Data of the role subscription purchase or renewal that prompted this `ROLE_SUBSCRIPTION_PURCHASE` message
*/
role_subscription_data?: APIMessageRoleSubscriptionData;
/**
* Data for users, members, channels, and roles in the message's auto-populated select menus
*
@@ -708,7 +719,6 @@ export interface APIMessage {
* The `MESSAGE_CONTENT` privileged gateway intent is required 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**.
* You also need to specify the intent bit value (`1 << 15`) if you are connecting to the gateway
*
* @see {@link https://support-dev.discord.com/hc/articles/4404772028055}
*/
@@ -894,6 +904,10 @@ export enum MessageFlags {
* This message has a snapshot (via Message Forwarding)
*/
HasSnapshot = 1 << 14,
/**
* This flag is required to use new components
*/
IsComponentsV2 = 1 << 15,
}
/**
@@ -910,6 +924,28 @@ export interface APIMessageCall {
ended_timestamp?: string | null;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#role-subscription-data-object-role-subscription-data-object-structure}
*/
export interface APIMessageRoleSubscriptionData {
/**
* The id of the SKU and listing the user is subscribed to
*/
role_subscription_listing_id: Snowflake;
/**
* The name of the tier the user is subscribed to
*/
tier_name: string;
/**
* The number of months the user has been subscribed for
*/
total_months_subscribed: number;
/**
* Whether this notification is for a renewal
*/
is_renewal: boolean;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#followed-channel-object}
*/
@@ -1526,6 +1562,10 @@ export interface APIBaseComponent<T extends ComponentType> {
* The type of the component
*/
type: T;
/**
* int32, auto generated via increment if not provided
*/
id?: number;
}
/**
@@ -1564,6 +1604,14 @@ export enum ComponentType {
* Select menu for channels
*/
ChannelSelect,
Section,
TextDisplay,
Thumbnail,
MediaGallery,
File,
Separator,
ContentInventoryEntry = 16,
Container,
// EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS //
@@ -1578,7 +1626,7 @@ export enum ComponentType {
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#action-rows}
*/
export interface APIActionRowComponent<T extends APIActionRowComponentTypes>
export interface APIActionRowComponent<T extends APIComponentInActionRow>
extends APIBaseComponent<ComponentType.ActionRow> {
/**
* The components in the ActionRow
@@ -1868,6 +1916,77 @@ export interface APITextInputComponent extends APIBaseComponent<ComponentType.Te
required?: boolean;
}
export enum UnfurledMediaItemLoadingState {
Unknown,
Loading,
LoadedSuccess,
LoadedNotFound,
}
export interface APIUnfurledMediaItem {
/**
* Supports arbitrary urls _and_ attachment://<filename> references
*/
url: string;
proxy_url?: string;
width?: number | null;
height?: number | null;
placeholder?: string | null;
placeholder_version?: number | null;
content_type?: string | null;
loading_state?: UnfurledMediaItemLoadingState;
flags?: number;
}
export interface APISectionComponent extends APIBaseComponent<ComponentType.Section> {
components: APITextDisplayComponent[];
accessory: APISectionAccessoryComponent;
}
export interface APITextDisplayComponent extends APIBaseComponent<ComponentType.TextDisplay> {
content: string;
}
export interface APIThumbnailComponent extends APIBaseComponent<ComponentType.Thumbnail> {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryItem {
media: APIUnfurledMediaItem;
description?: string | null;
spoiler?: boolean;
}
export interface APIMediaGalleryComponent extends APIBaseComponent<ComponentType.MediaGallery> {
items: APIMediaGalleryItem[];
}
export enum SeparatorSpacingSize {
Small = 1,
Large,
}
export interface APISeparatorComponent extends APIBaseComponent<ComponentType.Separator> {
divider?: boolean;
spacing?: SeparatorSpacingSize;
}
export interface APIFileComponent extends APIBaseComponent<ComponentType.File> {
/**
* The APIUnfurledMediaItem ONLY supports attachment://<filename> references
*/
file: APIUnfurledMediaItem;
spoiler?: boolean;
}
export interface APIContainerComponent extends APIBaseComponent<ComponentType.Container> {
accent_color?: number | null;
spoiler?: boolean;
components: APIComponentInContainer[];
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#message-snapshot-object}
*/
@@ -1933,20 +2052,57 @@ export enum ChannelFlags {
}
/**
* All components that can appear in messages.
*
* For more specific sets, see {@link APIMessageTopLevelComponent}, {@link APIComponentInMessageActionRow}, {@link APIComponentInContainer}, and {@link APISectionAccessoryComponent}
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageComponent = APIActionRowComponent<APIMessageActionRowComponent> | APIMessageActionRowComponent;
export type APIModalComponent = APIActionRowComponent<APIModalActionRowComponent> | APIModalActionRowComponent;
export type APIActionRowComponentTypes = APIMessageActionRowComponent | APIModalActionRowComponent;
export type APIMessageComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIButtonComponent
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISelectMenuComponent
| APISeparatorComponent
| APITextDisplayComponent
| APIThumbnailComponent;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIMessageActionRowComponent = APIButtonComponent | APISelectMenuComponent;
export type APIMessageTopLevelComponent =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIContainerComponent
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIModalComponent = APIActionRowComponent<APIComponentInModalActionRow> | APIComponentInModalActionRow;
export type APIComponentInActionRow = APIComponentInMessageActionRow | APIComponentInModalActionRow;
/**
* @see {@link https://discord.com/developers/docs/interactions/message-components#message-components}
*/
export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuComponent;
// Modal components
export type APIModalActionRowComponent = APITextInputComponent;
export type APIComponentInModalActionRow = APITextInputComponent;
export type APISectionAccessoryComponent = APIButtonComponent | APIThumbnailComponent;
export type APIComponentInContainer =
| APIActionRowComponent<APIComponentInMessageActionRow>
| APIFileComponent
| APIMediaGalleryComponent
| APISectionComponent
| APISeparatorComponent
| APITextDisplayComponent;
export type APIMessageSnapshotFields = Pick<
APIMessage,

View File

@@ -1,13 +1,11 @@
import type { Permissions, Snowflake } from '../../globals';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIChannel,
APIEmbed,
APIExtendedInvite,
APIFollowedChannel,
APIMessage,
APIMessageActionRowComponent,
APIMessageReference,
APIThreadList,
APIThreadMember,
@@ -25,6 +23,7 @@ import type {
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
} from '../../payloads/v10/index';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals';
import type { RESTAPIPoll } from './poll';
@@ -311,7 +310,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* IDs of up to 3 stickers in the server to send in the message
*
@@ -464,7 +463,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null | undefined;
components?: APIMessageTopLevelComponent[] | null | undefined;
}
/**

View File

@@ -1,12 +1,11 @@
import type { Snowflake } from '../../globals';
import type {
APIAllowedMentions,
APIActionRowComponent,
APIEmbed,
APIMessage,
APIWebhook,
MessageFlags,
APIMessageActionRowComponent,
APIMessageTopLevelComponent,
} from '../../payloads/v10/index';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _Nullable } from '../../utils/internals';
import type { RESTAPIAttachment } from './channel';
@@ -136,7 +135,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
*/
@@ -298,7 +297,10 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message-query-string-params}
*/
export type RESTPatchAPIWebhookWithTokenQuery = Pick<RESTPostAPIWebhookWithTokenQuery, 'thread_id' | 'with_components'>;
export type RESTPatchAPIWebhookWithTokenMessageQuery = Pick<
RESTPostAPIWebhookWithTokenQuery,
'thread_id' | 'with_components'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}

View File

@@ -1,13 +1,11 @@
import type { Permissions, Snowflake } from '../../globals';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIChannel,
APIEmbed,
APIExtendedInvite,
APIFollowedChannel,
APIMessage,
APIMessageActionRowComponent,
APIMessageReference,
APIThreadList,
APIThreadMember,
@@ -25,6 +23,7 @@ import type {
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
} from '../../payloads/v9/index';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals';
import type { RESTAPIPoll } from './poll';
@@ -318,7 +317,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* IDs of up to 3 stickers in the server to send in the message
*
@@ -478,7 +477,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | null | undefined;
components?: APIMessageTopLevelComponent[] | null | undefined;
}
/**

View File

@@ -1,12 +1,11 @@
import type { Snowflake } from '../../globals';
import type {
APIAllowedMentions,
APIActionRowComponent,
APIEmbed,
APIMessage,
APIWebhook,
MessageFlags,
APIMessageActionRowComponent,
APIMessageTopLevelComponent,
} from '../../payloads/v9/index';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _Nullable } from '../../utils/internals';
import type { RESTAPIAttachment } from './channel';
@@ -136,7 +135,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*
* @see {@link https://discord.com/developers/docs/interactions/message-components#component-object}
*/
components?: APIActionRowComponent<APIMessageActionRowComponent>[] | undefined;
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
*/
@@ -298,7 +297,10 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message-query-string-params}
*/
export type RESTPatchAPIWebhookWithTokenQuery = Pick<RESTPostAPIWebhookWithTokenQuery, 'thread_id' | 'with_components'>;
export type RESTPatchAPIWebhookWithTokenMessageQuery = Pick<
RESTPostAPIWebhookWithTokenQuery,
'thread_id' | 'with_components'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}