|
1 | 1 | /* eslint-disable jsdoc/check-param-names */ |
2 | 2 |
|
3 | 3 | import type { RawFile, RequestData, REST } from '@discordjs/rest'; |
4 | | -import { InteractionResponseType, Routes } from 'discord-api-types/v10'; |
5 | | -import type { |
6 | | - APICommandAutocompleteInteractionResponseCallbackData, |
7 | | - APIInteractionResponseCallbackData, |
8 | | - APIModalInteractionResponseCallbackData, |
9 | | - RESTGetAPIWebhookWithTokenMessageResult, |
10 | | - Snowflake, |
11 | | - APIInteractionResponseDeferredChannelMessageWithSource, |
| 4 | +import { |
| 5 | + InteractionResponseType, |
| 6 | + Routes, |
| 7 | + type APICommandAutocompleteInteractionResponseCallbackData, |
| 8 | + type APIInteractionResponseCallbackData, |
| 9 | + type APIInteractionResponseDeferredChannelMessageWithSource, |
| 10 | + type APIModalInteractionResponseCallbackData, |
| 11 | + type APIPremiumRequiredInteractionResponse, |
| 12 | + type RESTGetAPIWebhookWithTokenMessageResult, |
| 13 | + type Snowflake, |
12 | 14 | } from 'discord-api-types/v10'; |
13 | 15 | import type { WebhooksAPI } from './webhook.js'; |
14 | 16 |
|
@@ -248,4 +250,26 @@ export class InteractionsAPI { |
248 | 250 | signal, |
249 | 251 | }); |
250 | 252 | } |
| 253 | + |
| 254 | + /** |
| 255 | + * Sends a premium required response to an interaction |
| 256 | + * |
| 257 | + * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response} |
| 258 | + * @param interactionId - The id of the interaction |
| 259 | + * @param interactionToken - The token of the interaction |
| 260 | + * @param options - The options for sending the premium required response |
| 261 | + */ |
| 262 | + public async sendPremiumRequired( |
| 263 | + interactionId: Snowflake, |
| 264 | + interactionToken: string, |
| 265 | + { signal }: Pick<RequestData, 'signal'> = {}, |
| 266 | + ) { |
| 267 | + await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), { |
| 268 | + auth: false, |
| 269 | + body: { |
| 270 | + type: InteractionResponseType.PremiumRequired, |
| 271 | + } satisfies APIPremiumRequiredInteractionResponse, |
| 272 | + signal, |
| 273 | + }); |
| 274 | + } |
251 | 275 | } |
0 commit comments