import type { Awaitable, FlatObjectKeys } from '../../common'; import type { ModalContext } from '../../components'; import type { ComponentContext } from '../../components/componentcontext'; import type { MessageCommandInteraction, UserCommandInteraction } from '../../structures'; import { type APIApplicationCommandBasicOption, type APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from '../../types'; import type { LocalizationMap } from '../../types/payloads'; import type { AutocompleteCallback, EntryPointContext, MenuCommandContext, OnAutocompleteErrorCallback, ReturnOptionsTypes } from '..'; import type { CommandContext } from './chatcontext'; import type { DefaultLocale, MiddlewareContext, OKFunction, SeyfertChannelMap, StopFunction } from './shared'; export interface SeyfertBasicOption { required?: R; value?(data: { context: CommandContext; value: ReturnOptionsTypes[T]; }, ok: OKFunction, fail: StopFunction): Awaitable; description: string; description_localizations?: APIApplicationCommandBasicOption['description_localizations']; name_localizations?: APIApplicationCommandBasicOption['name_localizations']; locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; } export interface SeyfertBaseChoiceableOption[] : never, R = true | false, VC = never> { required?: R; choices?: C; value?: ValueCallback; description: string; description_localizations?: APIApplicationCommandBasicOption['description_localizations']; name_localizations?: APIApplicationCommandBasicOption['name_localizations']; locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; } export type SeyfertChoice = { readonly name: string; readonly value: T; name_localizations?: LocalizationMap | null; locales?: FlatObjectKeys; } | (APIApplicationCommandOptionChoice & { locales?: FlatObjectKeys; }); export type ChoiceableTypes = ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number; export interface ChoiceableValues { [ApplicationCommandOptionType.String]: string; [ApplicationCommandOptionType.Number]: number; [ApplicationCommandOptionType.Integer]: number; } export type ValueCallback[] : keyof SeyfertChannelMap, I = any> = (data: { context: CommandContext; value: T extends ChoiceableTypes ? C extends readonly SeyfertChoice[] ? C[number]['value'] extends ReturnOptionsTypes[T] ? C[number]['value'] : never : never : C extends keyof SeyfertChannelMap ? SeyfertChannelMap[C] : never; }, ok: OKFunction, fail: StopFunction) => Awaitable; export type SeyfertStringOption[], R = boolean, VC = never> = SeyfertBaseChoiceableOption & { autocomplete?: AutocompleteCallback; onAutocompleteError?: OnAutocompleteErrorCallback; min_length?: number; max_length?: number; }; export type SeyfertIntegerOption[], R = boolean, VC = never> = SeyfertBaseChoiceableOption & { autocomplete?: AutocompleteCallback; onAutocompleteError?: OnAutocompleteErrorCallback; min_value?: number; max_value?: number; }; export type SeyfertNumberOption[], R = boolean, VC = never> = SeyfertBaseChoiceableOption & { autocomplete?: AutocompleteCallback; onAutocompleteError?: OnAutocompleteErrorCallback; min_value?: number; max_value?: number; }; export type SeyfertBooleanOption = SeyfertBasicOption; export type SeyfertUserOption = SeyfertBasicOption; export type SeyfertChannelOption = { required?: R; value?: ValueCallback; description: string; description_localizations?: APIApplicationCommandBasicOption['description_localizations']; name_localizations?: APIApplicationCommandBasicOption['name_localizations']; locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; channel_types?: readonly C[]; }; export type SeyfertRoleOption = SeyfertBasicOption; export type SeyfertMentionableOption = SeyfertBasicOption; export type SeyfertAttachmentOption = SeyfertBasicOption; export declare function createStringOption[] = readonly SeyfertChoice[], VC = never>(data: SeyfertStringOption): { readonly type: ApplicationCommandOptionType.String; readonly required?: R | undefined; readonly choices?: C | undefined; readonly value?: ValueCallback | undefined; readonly description: string; readonly description_localizations?: APIApplicationCommandBasicOption["description_localizations"]; readonly name_localizations?: APIApplicationCommandBasicOption["name_localizations"]; readonly locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; readonly autocomplete?: AutocompleteCallback; readonly onAutocompleteError?: OnAutocompleteErrorCallback; readonly min_length?: number; readonly max_length?: number; }; export declare function createIntegerOption[] = readonly SeyfertChoice[], VC = never>(data: SeyfertIntegerOption): { readonly type: ApplicationCommandOptionType.Integer; readonly required?: R | undefined; readonly choices?: C | undefined; readonly value?: ValueCallback | undefined; readonly description: string; readonly description_localizations?: APIApplicationCommandBasicOption["description_localizations"]; readonly name_localizations?: APIApplicationCommandBasicOption["name_localizations"]; readonly locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; readonly autocomplete?: AutocompleteCallback; readonly onAutocompleteError?: OnAutocompleteErrorCallback; readonly min_value?: number; readonly max_value?: number; }; export declare function createNumberOption[] = readonly SeyfertChoice[], VC = never>(data: SeyfertNumberOption): { readonly type: ApplicationCommandOptionType.Number; readonly required?: R | undefined; readonly choices?: C | undefined; readonly value?: ValueCallback | undefined; readonly description: string; readonly description_localizations?: APIApplicationCommandBasicOption["description_localizations"]; readonly name_localizations?: APIApplicationCommandBasicOption["name_localizations"]; readonly locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; readonly autocomplete?: AutocompleteCallback; readonly onAutocompleteError?: OnAutocompleteErrorCallback; readonly min_value?: number; readonly max_value?: number; }; export declare function createChannelOption(data: SeyfertChannelOption): { readonly type: ApplicationCommandOptionType.Channel; readonly required?: R | undefined; readonly value?: ValueCallback | undefined; readonly description: string; readonly description_localizations?: APIApplicationCommandBasicOption["description_localizations"]; readonly name_localizations?: APIApplicationCommandBasicOption["name_localizations"]; readonly locales?: { name?: FlatObjectKeys; description?: FlatObjectKeys; }; readonly channel_types?: readonly C[] | undefined; }; export declare function createBooleanOption = SeyfertBooleanOption>(data: T): T & { readonly type: ApplicationCommandOptionType.Boolean; }; export declare function createUserOption = SeyfertUserOption>(data: T): T & { readonly type: ApplicationCommandOptionType.User; }; export declare function createRoleOption = SeyfertRoleOption>(data: T): T & { readonly type: ApplicationCommandOptionType.Role; }; export declare function createMentionableOption = SeyfertMentionableOption>(data: T): T & { readonly type: ApplicationCommandOptionType.Mentionable; }; export declare function createAttachmentOption = SeyfertAttachmentOption>(data: T): T & { readonly type: ApplicationCommandOptionType.Attachment; }; export type AnyContext = CommandContext | MenuCommandContext | UserCommandInteraction> | ComponentContext | ModalContext | EntryPointContext; export declare function createMiddleware(data: MiddlewareContext): MiddlewareContext;