feat: add file_types for file uploads (#1708)

This commit is contained in:
Naiyar
2026-07-15 14:56:54 +03:00
committed by GitHub
parent 265d0aed8b
commit 3231f19386
8 changed files with 72 additions and 12 deletions
@@ -2,8 +2,11 @@ import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandAttachmentOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
export type FileUploadType = 'audio' | 'image' | 'video' | `.${string}`;
export interface APIApplicationCommandAttachmentOption extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment> {
file_types?: FileUploadType[];
}
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Attachment,
+13 -1
View File
@@ -5,7 +5,12 @@ import type { _NonNullableFields } from '../../utils/internals.ts';
import type { APIApplication } from './application.ts';
import type { APIChannel, APIThreadChannel, APIThreadMember, ChannelType } from './channel.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIInteractionDataResolved, APIMessageInteraction, APIMessageInteractionMetadata } from './interactions.ts';
import type {
APIInteractionDataResolved,
APIMessageInteraction,
APIMessageInteractionMetadata,
FileUploadType,
} from './interactions.ts';
import type { APIRole } from './permissions.ts';
import type { APIPoll } from './poll.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
@@ -1890,6 +1895,13 @@ export interface APIFileUploadComponent extends APIBaseComponent<ComponentType.F
* Maximum number of items that can be uploaded (defaults to 1); max 10
*/
max_values?: number;
/**
* Allowed file types that can be uploaded; max 10
*
* If only dot-prefixed extensions are specified, you must also include `.jpg` for image uploads
* and both `.mp4` and `.mov` for video uploads because of mobile platform limitations.
*/
file_types?: FileUploadType[];
/**
* Whether the file upload requires files to be uploaded before submitting the modal
*
@@ -2,8 +2,11 @@ import type { Snowflake } from '../../../../../globals.ts';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base.ts';
import type { ApplicationCommandOptionType } from './shared.ts';
export type APIApplicationCommandAttachmentOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
export type FileUploadType = 'audio' | 'image' | 'video' | `.${string}`;
export interface APIApplicationCommandAttachmentOption extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment> {
file_types?: FileUploadType[];
}
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Attachment,
+13 -1
View File
@@ -5,7 +5,12 @@ import type { _NonNullableFields } from '../../utils/internals.ts';
import type { APIApplication } from './application.ts';
import type { APIChannel, APIThreadChannel, APIThreadMember, ChannelType } from './channel.ts';
import type { APIPartialEmoji } from './emoji.ts';
import type { APIInteractionDataResolved, APIMessageInteraction, APIMessageInteractionMetadata } from './interactions.ts';
import type {
APIInteractionDataResolved,
APIMessageInteraction,
APIMessageInteractionMetadata,
FileUploadType,
} from './interactions.ts';
import type { APIRole } from './permissions.ts';
import type { APIPoll } from './poll.ts';
import type { APISticker, APIStickerItem } from './sticker.ts';
@@ -1885,6 +1890,13 @@ export interface APIFileUploadComponent extends APIBaseComponent<ComponentType.F
* Maximum number of items that can be uploaded (defaults to 1); max 10
*/
max_values?: number;
/**
* Allowed file types that can be uploaded; max 10
*
* If only dot-prefixed extensions are specified, you must also include `.jpg` for image uploads
* and both `.mp4` and `.mov` for video uploads because of mobile platform limitations.
*/
file_types?: FileUploadType[];
/**
* Whether the file upload requires files to be uploaded before submitting the modal
*
@@ -2,8 +2,11 @@ import type { Snowflake } from '../../../../../globals';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandAttachmentOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
export type FileUploadType = 'audio' | 'image' | 'video' | `.${string}`;
export interface APIApplicationCommandAttachmentOption extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment> {
file_types?: FileUploadType[];
}
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Attachment,
+13 -1
View File
@@ -5,7 +5,12 @@ import type { _NonNullableFields } from '../../utils/internals';
import type { APIApplication } from './application';
import type { APIChannel, APIThreadChannel, APIThreadMember, ChannelType } from './channel';
import type { APIPartialEmoji } from './emoji';
import type { APIInteractionDataResolved, APIMessageInteraction, APIMessageInteractionMetadata } from './interactions';
import type {
APIInteractionDataResolved,
APIMessageInteraction,
APIMessageInteractionMetadata,
FileUploadType,
} from './interactions';
import type { APIRole } from './permissions';
import type { APIPoll } from './poll';
import type { APISticker, APIStickerItem } from './sticker';
@@ -1890,6 +1895,13 @@ export interface APIFileUploadComponent extends APIBaseComponent<ComponentType.F
* Maximum number of items that can be uploaded (defaults to 1); max 10
*/
max_values?: number;
/**
* Allowed file types that can be uploaded; max 10
*
* If only dot-prefixed extensions are specified, you must also include `.jpg` for image uploads
* and both `.mp4` and `.mov` for video uploads because of mobile platform limitations.
*/
file_types?: FileUploadType[];
/**
* Whether the file upload requires files to be uploaded before submitting the modal
*
@@ -2,8 +2,11 @@ import type { Snowflake } from '../../../../../globals';
import type { APIApplicationCommandOptionBase, APIInteractionDataOptionBase } from './base';
import type { ApplicationCommandOptionType } from './shared';
export type APIApplicationCommandAttachmentOption =
APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment>;
export type FileUploadType = 'audio' | 'image' | 'video' | `.${string}`;
export interface APIApplicationCommandAttachmentOption extends APIApplicationCommandOptionBase<ApplicationCommandOptionType.Attachment> {
file_types?: FileUploadType[];
}
export type APIApplicationCommandInteractionDataAttachmentOption = APIInteractionDataOptionBase<
ApplicationCommandOptionType.Attachment,
+13 -1
View File
@@ -5,7 +5,12 @@ import type { _NonNullableFields } from '../../utils/internals';
import type { APIApplication } from './application';
import type { APIChannel, APIThreadChannel, APIThreadMember, ChannelType } from './channel';
import type { APIPartialEmoji } from './emoji';
import type { APIInteractionDataResolved, APIMessageInteraction, APIMessageInteractionMetadata } from './interactions';
import type {
APIInteractionDataResolved,
APIMessageInteraction,
APIMessageInteractionMetadata,
FileUploadType,
} from './interactions';
import type { APIRole } from './permissions';
import type { APIPoll } from './poll';
import type { APISticker, APIStickerItem } from './sticker';
@@ -1885,6 +1890,13 @@ export interface APIFileUploadComponent extends APIBaseComponent<ComponentType.F
* Maximum number of items that can be uploaded (defaults to 1); max 10
*/
max_values?: number;
/**
* Allowed file types that can be uploaded; max 10
*
* If only dot-prefixed extensions are specified, you must also include `.jpg` for image uploads
* and both `.mp4` and `.mov` for video uploads because of mobile platform limitations.
*/
file_types?: FileUploadType[];
/**
* Whether the file upload requires files to be uploaded before submitting the modal
*