mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
fix(core): include data for defer (#9284)
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
|||||||
APIModalInteractionResponseCallbackData,
|
APIModalInteractionResponseCallbackData,
|
||||||
RESTGetAPIWebhookWithTokenMessageResult,
|
RESTGetAPIWebhookWithTokenMessageResult,
|
||||||
Snowflake,
|
Snowflake,
|
||||||
|
APIInteractionResponseDeferredChannelMessageWithSource,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import type { WebhooksAPI } from './webhook.js';
|
import type { WebhooksAPI } from './webhook.js';
|
||||||
|
|
||||||
@@ -44,13 +45,20 @@ export class InteractionsAPI {
|
|||||||
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
||||||
* @param interactionId - The id of the interaction
|
* @param interactionId - The id of the interaction
|
||||||
* @param interactionToken - The token 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
|
* @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), {
|
await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
|
||||||
auth: false,
|
auth: false,
|
||||||
body: {
|
body: {
|
||||||
type: InteractionResponseType.DeferredChannelMessageWithSource,
|
type: InteractionResponseType.DeferredChannelMessageWithSource,
|
||||||
|
data,
|
||||||
},
|
},
|
||||||
signal,
|
signal,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user