Skip to content

Commit

Permalink
fix(core): include data for defer (#9284)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Apr 1, 2023
1 parent 2792e48 commit 9d69bba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 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 {
APIModalInteractionResponseCallbackData,
RESTGetAPIWebhookWithTokenMessageResult,
Snowflake,
APIInteractionResponseDeferredChannelMessageWithSource,
} from 'discord-api-types/v10';
import type { WebhooksAPI } from './webhook.js';

Expand Down Expand Up @@ -44,13 +45,20 @@ 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
* @param options - The options to use when deferring
*/
public async defer(interactionId: Snowflake, interactionToken: string, { signal }: Pick<RequestData, 'signal'> = {}) {
public async defer(
interactionId: Snowflake,
interactionToken: string,
data: APIInteractionResponseDeferredChannelMessageWithSource['data'],
{ signal }: Pick<RequestData, 'signal'> = {},
) {
await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
auth: false,
body: {
type: InteractionResponseType.DeferredChannelMessageWithSource,
data,
},
signal,
});
Expand Down

0 comments on commit 9d69bba

Please sign in to comment.