Skip to content

Commit

Permalink
fix(core): include data for defer
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Mar 27, 2023
1 parent d1ebe4a commit b7c63b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/api/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
APIInteractionResponseCallbackData,
APIModalInteractionResponseCallbackData,
RESTGetAPIWebhookWithTokenMessageResult,
APIInteractionResponseDeferredChannelMessageWithSource,
} from 'discord-api-types/v10';
import type { WebhooksAPI } from './webhook.js';

Expand Down Expand Up @@ -41,12 +42,18 @@ export class InteractionsAPI {
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
* @param interactionId - The id of the interaction
* @param interactionToken - The token of the interaction
* @param data - The data to use when deferring the reply
*/
public async defer(interactionId: Snowflake, interactionToken: string) {
public async defer(
interactionId: Snowflake,
interactionToken: string,
data?: APIInteractionResponseDeferredChannelMessageWithSource['data'],
) {
await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
auth: false,
body: {
type: InteractionResponseType.DeferredChannelMessageWithSource,
data,
},
});
}
Expand Down

0 comments on commit b7c63b7

Please sign in to comment.