feat: Support is_spoiler (#1700)

This commit is contained in:
Jiralite
2026-07-09 12:14:02 +03:00
committed by GitHub
parent e2f8effd03
commit 0e09f2204f
12 changed files with 168 additions and 56 deletions
+1 -1
View File
@@ -964,7 +964,7 @@ export interface APIAttachment {
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
* The duration of the audio or video file
*/
duration_secs?: number;
/**
+1 -1
View File
@@ -959,7 +959,7 @@ export interface APIAttachment {
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
* The duration of the audio or video file
*/
duration_secs?: number;
/**
+38 -10
View File
@@ -23,7 +23,6 @@ import type {
SortOrderType,
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
APIAnnouncementThreadChannel,
@@ -264,16 +263,42 @@ export type RESTAPIMessageReference = _AddUndefinedToPossiblyUndefinedProperties
export type APIMessageReferenceSend = RESTAPIMessageReference;
/**
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* This structure is used in Message Create and Edit requests to set which attachments are in the message and provide their metadata.
*
* When editing, you must provide the `id` of each file to keep, and you can optionally update the `description` and `is_spoiler` fields of existing attachments.
*
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
export type RESTAPIAttachment = Partial<
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
> & {
export interface RESTAPIAttachment {
/**
* Attachment id or a number that matches `n` in `files[n]`
* Attachment id, for new attachments this must match the `n` in `files[n]`
*/
id: Snowflake | number;
};
/**
* Name of file attached
*/
filename?: string | undefined;
/**
* The title of the file
*/
title?: string | undefined;
/**
* Description (alt text) for the file (max 1024 characters)
*/
description?: string | undefined;
/**
* The duration of the audio or video file (required for voice messages)
*/
duration_secs?: number | undefined;
/**
* Base64 encoded bytearray representing a sampled waveform (required for voice messages)
*/
waveform?: string | undefined;
/**
* Whether the attachment should be marked as a spoiler and blurred until clicked, this sets the `IS_SPOILER` attachment flag
*/
is_spoiler?: boolean | undefined;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#create-message}
@@ -322,7 +347,9 @@ export interface RESTPostAPIChannelMessageJSONBody {
*/
sticker_ids?: [Snowflake, Snowflake, Snowflake] | [Snowflake, Snowflake] | [Snowflake] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments. See Uploading Files
*
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -465,11 +492,12 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*/
allowed_mentions?: APIAllowedMentions | null | undefined;
/**
* Attached files to keep
* Attached files to keep and their metadata. See Uploading Files
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+3 -3
View File
@@ -137,7 +137,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*/
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -268,11 +268,11 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = _AddUndefinedToPossibl
>
> & {
/**
* Attached files to keep
* attached files to keep and their metadata
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+38 -10
View File
@@ -23,7 +23,6 @@ import type {
SortOrderType,
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
APIAnnouncementThreadChannel,
@@ -264,16 +263,42 @@ export type RESTAPIMessageReference = _AddUndefinedToPossiblyUndefinedProperties
export type APIMessageReferenceSend = RESTAPIMessageReference;
/**
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* This structure is used in Message Create and Edit requests to set which attachments are in the message and provide their metadata.
*
* When editing, you must provide the `id` of each file to keep, and you can optionally update the `description` and `is_spoiler` fields of existing attachments.
*
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
export type RESTAPIAttachment = Partial<
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
> & {
export interface RESTAPIAttachment {
/**
* Attachment id or a number that matches `n` in `files[n]`
* Attachment id, for new attachments this must match the `n` in `files[n]`
*/
id: Snowflake | number;
};
/**
* Name of file attached
*/
filename?: string | undefined;
/**
* The title of the file
*/
title?: string | undefined;
/**
* Description (alt text) for the file (max 1024 characters)
*/
description?: string | undefined;
/**
* The duration of the audio or video file (required for voice messages)
*/
duration_secs?: number | undefined;
/**
* Base64 encoded bytearray representing a sampled waveform (required for voice messages)
*/
waveform?: string | undefined;
/**
* Whether the attachment should be marked as a spoiler and blurred until clicked, this sets the `IS_SPOILER` attachment flag
*/
is_spoiler?: boolean | undefined;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#create-message}
@@ -329,7 +354,9 @@ export interface RESTPostAPIChannelMessageJSONBody {
*/
sticker_ids?: [Snowflake, Snowflake, Snowflake] | [Snowflake, Snowflake] | [Snowflake] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments. See Uploading Files
*
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -479,11 +506,12 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*/
allowed_mentions?: APIAllowedMentions | null | undefined;
/**
* Attached files to keep
* Attached files to keep and their metadata. See Uploading Files
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+3 -3
View File
@@ -137,7 +137,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*/
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -268,11 +268,11 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = _AddUndefinedToPossibl
>
> & {
/**
* Attached files to keep
* Attached files to keep and their metadata
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+1 -1
View File
@@ -964,7 +964,7 @@ export interface APIAttachment {
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
* The duration of the audio or video file
*/
duration_secs?: number;
/**
+1 -1
View File
@@ -959,7 +959,7 @@ export interface APIAttachment {
*/
ephemeral?: boolean;
/**
* The duration of the audio file (currently for voice messages)
* The duration of the audio or video file
*/
duration_secs?: number;
/**
+38 -10
View File
@@ -23,7 +23,6 @@ import type {
SortOrderType,
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
APIAnnouncementThreadChannel,
@@ -264,16 +263,42 @@ export type RESTAPIMessageReference = _AddUndefinedToPossiblyUndefinedProperties
export type APIMessageReferenceSend = RESTAPIMessageReference;
/**
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* This structure is used in Message Create and Edit requests to set which attachments are in the message and provide their metadata.
*
* When editing, you must provide the `id` of each file to keep, and you can optionally update the `description` and `is_spoiler` fields of existing attachments.
*
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
export type RESTAPIAttachment = Partial<
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
> & {
export interface RESTAPIAttachment {
/**
* Attachment id or a number that matches `n` in `files[n]`
* Attachment id, for new attachments this must match the `n` in `files[n]`
*/
id: Snowflake | number;
};
/**
* Name of file attached
*/
filename?: string | undefined;
/**
* The title of the file
*/
title?: string | undefined;
/**
* Description (alt text) for the file (max 1024 characters)
*/
description?: string | undefined;
/**
* The duration of the audio or video file (required for voice messages)
*/
duration_secs?: number | undefined;
/**
* Base64 encoded bytearray representing a sampled waveform (required for voice messages)
*/
waveform?: string | undefined;
/**
* Whether the attachment should be marked as a spoiler and blurred until clicked, this sets the `IS_SPOILER` attachment flag
*/
is_spoiler?: boolean | undefined;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#create-message}
@@ -322,7 +347,9 @@ export interface RESTPostAPIChannelMessageJSONBody {
*/
sticker_ids?: [Snowflake, Snowflake, Snowflake] | [Snowflake, Snowflake] | [Snowflake] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments. See Uploading Files
*
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -465,11 +492,12 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*/
allowed_mentions?: APIAllowedMentions | null | undefined;
/**
* Attached files to keep
* Attached files to keep and their metadata. See Uploading Files
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+3 -3
View File
@@ -137,7 +137,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*/
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -268,11 +268,11 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = _AddUndefinedToPossibl
>
> & {
/**
* Attached files to keep
* attached files to keep and their metadata
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+38 -10
View File
@@ -23,7 +23,6 @@ import type {
SortOrderType,
ForumLayoutType,
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
APIAnnouncementThreadChannel,
@@ -264,16 +263,42 @@ export type RESTAPIMessageReference = _AddUndefinedToPossiblyUndefinedProperties
export type APIMessageReferenceSend = RESTAPIMessageReference;
/**
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* This structure is used in Message Create and Edit requests to set which attachments are in the message and provide their metadata.
*
* When editing, you must provide the `id` of each file to keep, and you can optionally update the `description` and `is_spoiler` fields of existing attachments.
*
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
export type RESTAPIAttachment = Partial<
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
> & {
export interface RESTAPIAttachment {
/**
* Attachment id or a number that matches `n` in `files[n]`
* Attachment id, for new attachments this must match the `n` in `files[n]`
*/
id: Snowflake | number;
};
/**
* Name of file attached
*/
filename?: string | undefined;
/**
* The title of the file
*/
title?: string | undefined;
/**
* Description (alt text) for the file (max 1024 characters)
*/
description?: string | undefined;
/**
* The duration of the audio or video file (required for voice messages)
*/
duration_secs?: number | undefined;
/**
* Base64 encoded bytearray representing a sampled waveform (required for voice messages)
*/
waveform?: string | undefined;
/**
* Whether the attachment should be marked as a spoiler and blurred until clicked, this sets the `IS_SPOILER` attachment flag
*/
is_spoiler?: boolean | undefined;
}
/**
* @see {@link https://discord.com/developers/docs/resources/channel#create-message}
@@ -329,7 +354,9 @@ export interface RESTPostAPIChannelMessageJSONBody {
*/
sticker_ids?: [Snowflake, Snowflake, Snowflake] | [Snowflake, Snowflake] | [Snowflake] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments. See Uploading Files
*
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -479,11 +506,12 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*/
allowed_mentions?: APIAllowedMentions | null | undefined;
/**
* Attached files to keep
* Attached files to keep and their metadata. See Uploading Files
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/reference#uploading-files}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
+3 -3
View File
@@ -137,7 +137,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
*/
components?: APIMessageTopLevelComponent[] | undefined;
/**
* Attachment objects with filename and description
* Metadata for the attachments
*/
attachments?: RESTAPIAttachment[] | undefined;
/**
@@ -268,11 +268,11 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = _AddUndefinedToPossibl
>
> & {
/**
* Attached files to keep
* Attached files to keep and their metadata
*
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
*
* @see {@link https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure}
* @see {@link https://docs.discord.com/developers/resources/message#attachment-object-attachment-request-structure}
*/
attachments?: RESTAPIAttachment[] | undefined;
/**