From ace275c9cd0c90c0bf90c008fff92e181ea32a68 Mon Sep 17 00:00:00 2001 From: Felix Date: Fri, 21 Jun 2024 21:27:48 +0200 Subject: [PATCH] feat: added premium button (#618) --- src/constants.ts | 19 ++++++++++++++++--- .../interfaces/messageInteraction.ts | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 47231f2e..732a5e1e 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -50,7 +50,10 @@ export enum InteractionResponseType { APPLICATION_COMMAND_AUTOCOMPLETE_RESULT = 8, /** Respond to an interaction with a popup modal. */ MODAL = 9, - /** Respond to an interaction with prompt for a premium subscription. */ + /** + * Respond to an interaction with prompt for a premium subscription. + * @deprecated Use `ComponentButtonPremium` instead. + */ PREMIUM_REQUIRED = 10 } @@ -870,7 +873,9 @@ export enum ButtonStyle { /** A red button. */ DANGER = 4, /** A gray button with a link icon. */ - LINK = 5 + LINK = 5, + /** A premium button. */ + PREMIUM = 6 } export enum TextInputStyle { @@ -892,7 +897,7 @@ export interface ComponentActionRow { } /** Any component button. */ -export type AnyComponentButton = ComponentButton | ComponentButtonLink; +export type AnyComponentButton = ComponentButton | ComponentButtonLink | ComponentButtonPremium; /** A regular component button. */ export interface ComponentButton { @@ -923,6 +928,14 @@ export interface ComponentButtonLink extends Omit { + /** The style of button to show. */ + style: ButtonStyle.PREMIUM; + /** The identifier for a purchasable SKU. */ + sku_id: string; +} + export interface ComponentSelectMenu { /** The type of component to use. */ type: diff --git a/src/structures/interfaces/messageInteraction.ts b/src/structures/interfaces/messageInteraction.ts index 344cd447..57e39827 100644 --- a/src/structures/interfaces/messageInteraction.ts +++ b/src/structures/interfaces/messageInteraction.ts @@ -212,6 +212,7 @@ export class MessageInteractionContext extends BaseInteractionContext { /** * Creates a message that prompts the user for a premium subscription. * @returns Whether the message passed + * @deprecated Use `ComponentButtonPremium` instead. */ async promptPremium(): Promise { if (!this.initiallyResponded && !this.deferred) {