@discordjs/builders 1.9.0-dev.1719662645-ab8bf0f4d → 1.9.0-dev.1720138205-4f59b740d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _sapphire_shapeshift from '@sapphire/shapeshift';
2
- import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, Snowflake, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, InteractionContextType, Permissions, ApplicationIntegrationType, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
2
+ import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, Snowflake, APISelectMenuComponent, APIChannelSelectComponent, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, InteractionContextType, Permissions, ApplicationIntegrationType, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
3
3
  export * from '@discordjs/formatters';
4
4
  import { JSONEncodable, Equatable } from '@discordjs/util';
5
5
 
@@ -391,7 +391,7 @@ declare const defaultValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
391
391
  declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
392
392
  declare const channelTypesValidator: _sapphire_shapeshift.ArrayValidator<ChannelType[], ChannelType>;
393
393
  declare const urlValidator: _sapphire_shapeshift.StringValidator<string>;
394
- declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
394
+ declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, skuId?: string, url?: string): void;
395
395
 
396
396
  declare const Assertions$4_buttonLabelValidator: typeof buttonLabelValidator;
397
397
  declare const Assertions$4_buttonStyleValidator: typeof buttonStyleValidator;
@@ -500,6 +500,13 @@ declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
500
500
  * @param customId - The custom id to use
501
501
  */
502
502
  setCustomId(customId: string): this;
503
+ /**
504
+ * Sets the SKU id that represents a purchasable SKU for this button.
505
+ *
506
+ * @remarks Only available when using premium-style buttons.
507
+ * @param skuId - The SKU id to use
508
+ */
509
+ setSKUId(skuId: Snowflake): this;
503
510
  /**
504
511
  * Sets the emoji to display on this button.
505
512
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _sapphire_shapeshift from '@sapphire/shapeshift';
2
- import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, Snowflake, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, InteractionContextType, Permissions, ApplicationIntegrationType, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
2
+ import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, Snowflake, APISelectMenuComponent, APIChannelSelectComponent, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, InteractionContextType, Permissions, ApplicationIntegrationType, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
3
3
  export * from '@discordjs/formatters';
4
4
  import { JSONEncodable, Equatable } from '@discordjs/util';
5
5
 
@@ -391,7 +391,7 @@ declare const defaultValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
391
391
  declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
392
392
  declare const channelTypesValidator: _sapphire_shapeshift.ArrayValidator<ChannelType[], ChannelType>;
393
393
  declare const urlValidator: _sapphire_shapeshift.StringValidator<string>;
394
- declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
394
+ declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, skuId?: string, url?: string): void;
395
395
 
396
396
  declare const Assertions$4_buttonLabelValidator: typeof buttonLabelValidator;
397
397
  declare const Assertions$4_buttonStyleValidator: typeof buttonStyleValidator;
@@ -500,6 +500,13 @@ declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
500
500
  * @param customId - The custom id to use
501
501
  */
502
502
  setCustomId(customId: string): this;
503
+ /**
504
+ * Sets the SKU id that represents a purchasable SKU for this button.
505
+ *
506
+ * @remarks Only available when using premium-style buttons.
507
+ * @param skuId - The SKU id to use
508
+ */
509
+ setSKUId(skuId: Snowflake): this;
503
510
  /**
504
511
  * Sets the emoji to display on this button.
505
512
  *
package/dist/index.js CHANGED
@@ -544,19 +544,31 @@ var channelTypesValidator = import_shapeshift2.s.nativeEnum(import_v10.ChannelTy
544
544
  var urlValidator = import_shapeshift2.s.string.url({
545
545
  allowedProtocols: ["http:", "https:", "discord:"]
546
546
  }).setValidationEnabled(isValidationEnabled);
547
- function validateRequiredButtonParameters(style, label, emoji, customId, url) {
548
- if (url && customId) {
549
- throw new RangeError("URL and custom id are mutually exclusive");
550
- }
551
- if (!label && !emoji) {
552
- throw new RangeError("Buttons must have a label and/or an emoji");
553
- }
554
- if (style === import_v10.ButtonStyle.Link) {
555
- if (!url) {
556
- throw new RangeError("Link buttons must have a url");
547
+ function validateRequiredButtonParameters(style, label, emoji, customId, skuId, url) {
548
+ if (style === import_v10.ButtonStyle.Premium) {
549
+ if (!skuId) {
550
+ throw new RangeError("Premium buttons must have an SKU id.");
551
+ }
552
+ if (customId || label || url || emoji) {
553
+ throw new RangeError("Premium buttons cannot have a custom id, label, URL, or emoji.");
554
+ }
555
+ } else {
556
+ if (skuId) {
557
+ throw new RangeError("Non-premium buttons must not have an SKU id.");
558
+ }
559
+ if (url && customId) {
560
+ throw new RangeError("URL and custom id are mutually exclusive.");
561
+ }
562
+ if (!label && !emoji) {
563
+ throw new RangeError("Non-premium buttons must have a label and/or an emoji.");
564
+ }
565
+ if (style === import_v10.ButtonStyle.Link) {
566
+ if (!url) {
567
+ throw new RangeError("Link buttons must have a URL.");
568
+ }
569
+ } else if (url) {
570
+ throw new RangeError("Non-premium and non-link buttons cannot have a URL.");
557
571
  }
558
- } else if (url) {
559
- throw new RangeError("Non-link buttons cannot have a url");
560
572
  }
561
573
  }
562
574
  __name(validateRequiredButtonParameters, "validateRequiredButtonParameters");
@@ -655,6 +667,16 @@ var ButtonBuilder = class extends ComponentBuilder {
655
667
  this.data.custom_id = customIdValidator.parse(customId);
656
668
  return this;
657
669
  }
670
+ /**
671
+ * Sets the SKU id that represents a purchasable SKU for this button.
672
+ *
673
+ * @remarks Only available when using premium-style buttons.
674
+ * @param skuId - The SKU id to use
675
+ */
676
+ setSKUId(skuId) {
677
+ this.data.sku_id = skuId;
678
+ return this;
679
+ }
658
680
  /**
659
681
  * Sets the emoji to display on this button.
660
682
  *
@@ -691,6 +713,7 @@ var ButtonBuilder = class extends ComponentBuilder {
691
713
  this.data.label,
692
714
  this.data.emoji,
693
715
  this.data.custom_id,
716
+ this.data.sku_id,
694
717
  this.data.url
695
718
  );
696
719
  return {
@@ -2823,7 +2846,7 @@ function embedLength(data) {
2823
2846
  __name(embedLength, "embedLength");
2824
2847
 
2825
2848
  // src/index.ts
2826
- var version = "1.9.0-dev.1719662645-ab8bf0f4d";
2849
+ var version = "1.9.0-dev.1720138205-4f59b740d";
2827
2850
  // Annotate the CommonJS export names for ESM import in node:
2828
2851
  0 && (module.exports = {
2829
2852
  ActionRowBuilder,