mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
feat: premium application subscriptions (#9907)
* feat: premium application subscriptions * types: readonly array Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * fix: requested changes Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * fix: core client types --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
/* eslint-disable jsdoc/check-param-names */
|
||||
|
||||
import type { RawFile, RequestData, REST } from '@discordjs/rest';
|
||||
import { InteractionResponseType, Routes } from 'discord-api-types/v10';
|
||||
import type {
|
||||
APICommandAutocompleteInteractionResponseCallbackData,
|
||||
APIInteractionResponseCallbackData,
|
||||
APIModalInteractionResponseCallbackData,
|
||||
RESTGetAPIWebhookWithTokenMessageResult,
|
||||
Snowflake,
|
||||
APIInteractionResponseDeferredChannelMessageWithSource,
|
||||
import {
|
||||
InteractionResponseType,
|
||||
Routes,
|
||||
type APICommandAutocompleteInteractionResponseCallbackData,
|
||||
type APIInteractionResponseCallbackData,
|
||||
type APIInteractionResponseDeferredChannelMessageWithSource,
|
||||
type APIModalInteractionResponseCallbackData,
|
||||
type APIPremiumRequiredInteractionResponse,
|
||||
type RESTGetAPIWebhookWithTokenMessageResult,
|
||||
type Snowflake,
|
||||
} from 'discord-api-types/v10';
|
||||
import type { WebhooksAPI } from './webhook.js';
|
||||
|
||||
@@ -248,4 +250,26 @@ export class InteractionsAPI {
|
||||
signal,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a premium required response to an interaction
|
||||
*
|
||||
* @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 options - The options for sending the premium required response
|
||||
*/
|
||||
public async sendPremiumRequired(
|
||||
interactionId: Snowflake,
|
||||
interactionToken: string,
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
|
||||
auth: false,
|
||||
body: {
|
||||
type: InteractionResponseType.PremiumRequired,
|
||||
} satisfies APIPremiumRequiredInteractionResponse,
|
||||
signal,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user