Skip to content

Commit

Permalink
feat: added premium button (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbrettnich authored Jun 21, 2024
1 parent d0e5013 commit ace275c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -923,6 +928,14 @@ export interface ComponentButtonLink extends Omit<ComponentButton, 'custom_id' |
url: string;
}

/** A component button with a premium sku. */
export interface ComponentButtonPremium extends Omit<ComponentButton, 'custom_id' | 'label' | 'emoji' | 'style'> {
/** 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:
Expand Down
1 change: 1 addition & 0 deletions src/structures/interfaces/messageInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean> {
if (!this.initiallyResponded && !this.deferred) {
Expand Down

0 comments on commit ace275c

Please sign in to comment.