dressed
Version:
A sleek, serverless-ready Discord bot framework.
24 lines • 1.08 kB
JavaScript
import { InteractionResponseType, Routes } from "discord-api-types/v10";
import { callDiscord } from "../utils/call-discord.js";
/**
* 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 async function createInteractionCallback(interactionId, interactionToken, type, ...[data, files, params, $req]) {
const res = await callDiscord(Routes.interactionCallback(interactionId, interactionToken), {
method: "POST",
body: {
type: InteractionResponseType[type],
data,
},
params,
files,
}, $req);
return ((params === null || params === void 0 ? void 0 : params.with_response) ? res.json() : null);
}
//# sourceMappingURL=interactions.js.map