Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const ImageFormats = [
] as const;
export type ImageFormat = typeof ImageFormats[number];

export type FilterFileTypes = "image" | "video" | "audio" | `.${string}`;

export enum WebhookTypes {
/** Incoming webhooks can post messages to channels with a generated token */
INCOMING = 1,
Expand Down
12 changes: 7 additions & 5 deletions lib/types/applications.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import type {
TeamPayoutAccountStatus,
TeamPayoutGateway,
TeamMemberRoleType,
ApplicationType
ApplicationType,
FilterFileTypes
} from "../Constants";
import type ApplicationCommand from "../structures/ApplicationCommand";
import type ClientApplication from "../structures/ClientApplication";
Expand Down Expand Up @@ -283,7 +284,7 @@ export interface RawApplicationCommandOption {
description: string;
description_localizations?: LocaleMap | null;
description_localized?: string;
file_types?: Array<string>;
file_types?: Array<FilterFileTypes>;
max_length?: number;
max_value?: number;
min_length?: number;
Expand All @@ -303,7 +304,7 @@ export interface CombinedApplicationCommandOption {
description: string;
descriptionLocalizations?: LocaleMap | null;
descriptionLocalized?: string;
fileTypes?: Array<string>;
fileTypes?: Array<FilterFileTypes>;
maxLength?: number;
maxValue?: number;
minLength?: number;
Expand Down Expand Up @@ -394,10 +395,11 @@ interface ApplicationCommandOptionsSubCommandGroup extends ApplicationCommandOpt
options?: Array<ApplicationCommandOptionsSubCommand | ApplicationCommandOptionsWithValue>;
}

export interface ApplicationCommandOptionsAttachment extends ApplicationCommandOptionBase<ApplicationCommandOptionTypes.ATTACHMENT> {
fileTypes?: Array<string>;
interface ApplicationCommandOptionsFileTypeFilter {
fileTypes?: Array<FilterFileTypes>;
}

export interface ApplicationCommandOptionsAttachment extends ApplicationCommandOptionBase<ApplicationCommandOptionTypes.ATTACHMENT>, ApplicationCommandOptionsFileTypeFilter {}
export interface ApplicationCommandOptionsBoolean extends ApplicationCommandOptionBase<ApplicationCommandOptionTypes.BOOLEAN> {}
export interface ApplicationCommandOptionsChannel extends ApplicationCommandOptionBase<ApplicationCommandOptionTypes.CHANNEL>, ApplicationCommandOptionsChannelTypes {}
export type ApplicationCommandOptionsInteger = ApplicationCommandOptionBase<ApplicationCommandOptionTypes.INTEGER> & Types.Shared.ExclusifyUnion<ApplicationCommandOptionsAutocomplete | ApplicationCommandOptionsMinMaxValue | ApplicationCommandOptionsChoices<ApplicationCommandOptionTypes.INTEGER>>;
Expand Down
7 changes: 4 additions & 3 deletions lib/types/channels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import type {
SeparatorSpacingSize,
GuildInviteChannelTypes,
DMInviteChannelTypes,
MessageReferenceType
MessageReferenceType,
FilterFileTypes
} from "../Constants";
import type Member from "../structures/Member";
import type AnnouncementChannel from "../structures/AnnouncementChannel";
Expand Down Expand Up @@ -1648,7 +1649,7 @@ export interface RawModalLabel extends Omit<BaseComponent, "id"> {

export interface ModalFileUploadComponent extends BaseComponent {
customID: string;
fileTypes?: Array<string>;
fileTypes?: Array<FilterFileTypes>;
maxValues?: number;
minValues?: number;
required?: boolean;
Expand All @@ -1657,7 +1658,7 @@ export interface ModalFileUploadComponent extends BaseComponent {

export interface RawModalFileUploadComponent extends BaseComponent {
custom_id: string;
file_types?: Array<string>;
file_types?: Array<FilterFileTypes>;
max_values?: number;
min_values?: number;
required?: boolean;
Expand Down
Loading