import { ApplicationCommandDatum, ApplicationCommandInteractionDataOption, Component, Interaction, InteractionType, MessageComponentDatum, ModalSubmitDatum, ResolvedDatum, Snowflake } from "droff/types"; import * as O from "fp-ts/Option"; import Im from "immutable"; export interface InteractionTypeMap { [InteractionType.APPLICATION_COMMAND]: ApplicationCommandDatum; [InteractionType.APPLICATION_COMMAND_AUTOCOMPLETE]: ApplicationCommandDatum; [InteractionType.MESSAGE_COMPONENT]: MessageComponentDatum; [InteractionType.MODAL_SUBMIT]: ModalSubmitDatum; } export declare const getData: (type: K) => (interaction: Interaction) => O.Option; export declare const getCommandData: (interaction: Interaction) => O.Option; export declare const getAutocompleteData: (interaction: Interaction) => O.Option; export declare const getCommandOrAutocompleteData: (interaction: Interaction) => O.Option; export declare const getComponentData: (interaction: Interaction) => O.Option; export declare const getModalData: (interaction: Interaction) => O.Option; /** * Maybe find a sub-command within the interaction options. */ export declare const findSubCommand: (name: string) => (interaction: Interaction) => O.Option; /** * If the sub-command exists return `true`, else `false`. */ export declare const isSubCommand: (name: string) => (interaction: Interaction) => boolean; /** * Maybe get the options for a sub-command */ export declare const subCommandOptions: (name: string) => (interaction: Interaction) => O.Option; /** * A lens for accessing the options in a interaction. */ export declare const options: (interaction: Interaction) => ApplicationCommandInteractionDataOption[]; /** * A lens for accessing nested options in a interaction. */ export declare const optionsWithNested: (interaction: Interaction) => ApplicationCommandInteractionDataOption[]; /** * Return the interaction options as a name / value map. */ export declare const transformOptions: (options: ApplicationCommandInteractionDataOption[]) => Im.Map; /** * Return the interaction options as a name / value map. */ export declare const optionsMap: (interaction: Interaction) => Im.Map; /** * Try find a matching option from the interaction. */ export declare const getOption: (name: string) => (interaction: Interaction) => O.Option; /** * Try find a matching option value from the interaction. */ export declare const optionValue: (name: string) => (interaction: Interaction) => O.Option; /** * Try extract resolved data */ export declare const resolved: (interaction: Interaction) => O.Option; /** * Try find a matching option value from the interaction. */ export declare const resolveOptionValue: (name: string, f: (id: Snowflake, data: ResolvedDatum) => T | undefined) => (interaction: Interaction) => O.Option>; /** * A lens for accessing the components in a interaction. */ export declare const components: (interaction: Interaction) => Component[]; /** * A lens for accessing the components in a interaction. */ export declare const componentsWithValue: (interaction: Interaction) => Component[]; /** * Return the interaction components as an id / value map. */ export declare const transformComponents: (options: Component[]) => Im.Map; /** * Return the interaction components as an id / value map. */ export declare const componentsMap: (interaction: Interaction) => Im.Map; /** * Try find a matching component from the interaction. */ export declare const getComponent: (id: string) => (interaction: Interaction) => O.Option; /** * Try find a matching component value from the interaction. */ export declare const componentValue: (id: string) => (interaction: Interaction) => O.Option;