UNPKG

dressed

Version:

A sleek, serverless-ready Discord bot framework.

22 lines (21 loc) 1.32 kB
import type { APIInteractionResponse, RESTPostAPIInteractionCallbackQuery, Snowflake } from "discord-api-types/v10"; import { InteractionResponseType } from "discord-api-types/v10"; import type { RawFile } from "../types/file.ts"; import type { InteractionCallbackResponse } from "../types/interaction.ts"; import { type CallConfig } from "../utils/call-discord.ts"; /** * Respond to an interaction by sending a modal, message, or update the original. * @param interactionId The ID of the interaction to callback * @param interactionToken The token of the interaction to callback * @param type The type of response * @param data The data to use, the respective modal, message data etc. * @param files Files used in messages * @param options Optional parameters for the request */ export declare function createInteractionCallback<T extends keyof typeof InteractionResponseType, P extends RESTPostAPIInteractionCallbackQuery, E extends object = Extract<APIInteractionResponse, { type: (typeof InteractionResponseType)[T]; }>>(interactionId: Snowflake, interactionToken: string, type: T, ...[data, files, params, $req]: E extends { data?: infer D; } ? [...(E extends { data: object; } ? [D] : [D?]), RawFile[]?, P?, CallConfig?] : [undefined?, undefined?, P?, CallConfig?]): InteractionCallbackResponse<P>;