Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added premium button #618

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading