lunibee 0.2.1 → 0.2.3

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.
Files changed (49) hide show
  1. package/README.md +6 -6
  2. package/dist/builders/attachment.d.ts +5 -1
  3. package/dist/builders/commands.d.ts +136 -47
  4. package/dist/builders/components.d.ts +164 -45
  5. package/dist/builders/embed.d.ts +5 -1
  6. package/dist/builders/index.d.ts +9 -4
  7. package/dist/builders/index.js +206 -105
  8. package/dist/builders/index.js.map +8 -8
  9. package/dist/core/events.d.ts +28 -12
  10. package/dist/core/index.d.ts +2 -1
  11. package/dist/core/index.js +377 -150
  12. package/dist/core/index.js.map +25 -25
  13. package/dist/core/permissions.d.ts +6 -2
  14. package/dist/index.d.ts +5 -4
  15. package/dist/index.js +662 -268
  16. package/dist/index.js.map +33 -32
  17. package/dist/managers/base.d.ts +4 -0
  18. package/dist/managers/emoji.d.ts +7 -1
  19. package/dist/managers/guild-resources.d.ts +11 -3
  20. package/dist/managers/guild.d.ts +13 -5
  21. package/dist/managers/index.d.ts +31 -14
  22. package/dist/managers/index.js +167 -80
  23. package/dist/managers/index.js.map +18 -18
  24. package/dist/managers/member.d.ts +5 -3
  25. package/dist/managers/message.d.ts +7 -3
  26. package/dist/managers/role.d.ts +13 -1
  27. package/dist/rest/error-codes.d.ts +48 -0
  28. package/dist/rest/errors.d.ts +1 -0
  29. package/dist/rest/index.d.ts +1 -0
  30. package/dist/rest/index.js +53 -3
  31. package/dist/rest/index.js.map +7 -6
  32. package/dist/rest/routes.d.ts +4 -2
  33. package/dist/sharding/index.js +7 -6
  34. package/dist/sharding/index.js.map +6 -6
  35. package/dist/structures/base.d.ts +18 -9
  36. package/dist/structures/index.d.ts +15 -9
  37. package/dist/structures/index.js +198 -68
  38. package/dist/structures/index.js.map +12 -12
  39. package/dist/structures/interactions.d.ts +85 -11
  40. package/dist/structures/resources.d.ts +11 -1
  41. package/dist/types/gateway.d.ts +14 -0
  42. package/dist/types/index.d.ts +204 -16
  43. package/dist/types/index.js +37 -10
  44. package/dist/types/index.js.map +4 -4
  45. package/dist/voice/index.js +4 -3
  46. package/dist/voice/index.js.map +3 -3
  47. package/dist/ws/index.js +2 -1
  48. package/dist/ws/index.js.map +5 -5
  49. package/package.json +15 -15
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // packages/builders/src/embed.ts
3
- class EmbedBuilder {
3
+ class CreateEmbed {
4
4
  #data = {};
5
5
  setTitle(value) {
6
6
  if (value === null)
@@ -131,6 +131,7 @@ function url(value, field) {
131
131
  throw new TypeError(`${field} must be a valid URL.`, { cause: error });
132
132
  }
133
133
  }
134
+ var EmbedBuilder = CreateEmbed;
134
135
  // packages/types/src/gateway.ts
135
136
  var GatewayIntentBits = {
136
137
  Guilds: 1 << 0,
@@ -184,7 +185,7 @@ var IntentBits = {
184
185
  directMessagePolls: 1 << 25
185
186
  };
186
187
  // packages/types/src/index.ts
187
- var ButtonStyle = {
188
+ var ButtonType = {
188
189
  Primary: 1,
189
190
  Secondary: 2,
190
191
  Success: 3,
@@ -194,7 +195,7 @@ var ButtonStyle = {
194
195
  };
195
196
 
196
197
  // packages/builders/src/components.ts
197
- var ComponentType = {
198
+ var ComponentEnum = {
198
199
  ActionRow: 1,
199
200
  Button: 2,
200
201
  StringSelect: 3,
@@ -212,9 +213,9 @@ var ComponentType = {
212
213
  ContentInventoryEntry: 16,
213
214
  Container: 17
214
215
  };
215
- var TextInputStyle = { Short: 1, Paragraph: 2 };
216
+ var TextInputType = { Short: 1, Paragraph: 2 };
216
217
 
217
- class ActionRowBuilder {
218
+ class CreateActionRow {
218
219
  #components = [];
219
220
  addComponents(...components) {
220
221
  if (!components.length)
@@ -233,15 +234,15 @@ class ActionRowBuilder {
233
234
  if (components.length === 0)
234
235
  throw new RangeError("An action row needs at least one component.");
235
236
  const types = components.map((component) => component.type);
236
- if (types.some((type) => type !== ComponentType.Button) && components.length > 1)
237
+ if (types.some((type) => type !== ComponentEnum.Button) && components.length > 1)
237
238
  throw new RangeError("A select menu or text input must be alone in its action row.");
238
- return { type: ComponentType.ActionRow, components };
239
+ return { type: ComponentEnum.ActionRow, components };
239
240
  }
240
241
  }
241
242
 
242
- class StringSelectBuilder {
243
+ class CreateStringSelect {
243
244
  #data = {
244
- type: ComponentType.StringSelect
245
+ type: ComponentEnum.StringSelect
245
246
  };
246
247
  setCustomId(value) {
247
248
  validateText(value, 100, "Component custom ID");
@@ -300,18 +301,18 @@ class StringSelectBuilder {
300
301
  }
301
302
  }
302
303
 
303
- class ButtonBuilder {
304
+ class CreateButton {
304
305
  #data = {
305
- type: ComponentType.Button,
306
- style: ButtonStyle.Secondary
306
+ type: ComponentEnum.Button,
307
+ style: ButtonType.Secondary
307
308
  };
308
309
  setStyle(style) {
309
310
  const data = this.#data;
310
311
  data.style = style;
311
- if (style === ButtonStyle.Link) {
312
+ if (style === ButtonType.Link) {
312
313
  delete data.custom_id;
313
314
  delete data.sku_id;
314
- } else if (style === ButtonStyle.Premium) {
315
+ } else if (style === ButtonType.Premium) {
315
316
  delete data.custom_id;
316
317
  delete data.url;
317
318
  delete data.label;
@@ -324,7 +325,7 @@ class ButtonBuilder {
324
325
  }
325
326
  setCustomId(value) {
326
327
  validateText(value, 100, "Button custom ID");
327
- if (this.#data.style === ButtonStyle.Link)
328
+ if (this.#data.style === ButtonType.Link)
328
329
  throw new TypeError("Link buttons cannot use custom IDs.");
329
330
  this.#data.custom_id = value;
330
331
  return this;
@@ -344,13 +345,13 @@ class ButtonBuilder {
344
345
  cause: error
345
346
  });
346
347
  }
347
- this.setStyle(ButtonStyle.Link);
348
+ this.setStyle(ButtonType.Link);
348
349
  this.#data.url = url.toString();
349
350
  return this;
350
351
  }
351
352
  setSKUId(skuId) {
352
353
  validateText(skuId, 20, "Button SKU ID");
353
- this.setStyle(ButtonStyle.Premium);
354
+ this.setStyle(ButtonType.Premium);
354
355
  this.#data.sku_id = skuId;
355
356
  return this;
356
357
  }
@@ -364,12 +365,12 @@ class ButtonBuilder {
364
365
  }
365
366
  toJSON() {
366
367
  const data = this.#data;
367
- if (data.style === ButtonStyle.Link) {
368
+ if (data.style === ButtonType.Link) {
368
369
  if (!data.url)
369
370
  throw new TypeError("Link buttons require a URL.");
370
371
  if (data.custom_id || data.sku_id)
371
372
  throw new TypeError("Link buttons cannot have a custom ID or SKU ID.");
372
- } else if (data.style === ButtonStyle.Premium) {
373
+ } else if (data.style === ButtonType.Premium) {
373
374
  if (!data.sku_id)
374
375
  throw new TypeError("Premium buttons require a SKU ID.");
375
376
  if (data.custom_id || data.url || data.label || data.emoji)
@@ -380,16 +381,16 @@ class ButtonBuilder {
380
381
  if (data.url || data.sku_id)
381
382
  throw new TypeError("Only link buttons have a URL and only premium buttons have a SKU ID.");
382
383
  }
383
- if (data.style !== ButtonStyle.Premium && !data.label && !data.emoji)
384
+ if (data.style !== ButtonType.Premium && !data.label && !data.emoji)
384
385
  throw new TypeError("Buttons require a label or an emoji.");
385
386
  return structuredClone(data);
386
387
  }
387
388
  }
388
389
 
389
- class EntitySelectBuilder {
390
+ class CreateEntitySelect {
390
391
  #data;
391
392
  constructor(type) {
392
- if (type !== ComponentType.UserSelect && type !== ComponentType.RoleSelect && type !== ComponentType.MentionableSelect && type !== ComponentType.ChannelSelect)
393
+ if (type !== ComponentEnum.UserSelect && type !== ComponentEnum.RoleSelect && type !== ComponentEnum.MentionableSelect && type !== ComponentEnum.ChannelSelect)
393
394
  throw new TypeError("Invalid select component type.");
394
395
  this.#data = { type };
395
396
  }
@@ -431,7 +432,7 @@ class EntitySelectBuilder {
431
432
  }
432
433
  }
433
434
 
434
- class ModalBuilder {
435
+ class CreateModal {
435
436
  #components = [];
436
437
  #custom_id;
437
438
  #title;
@@ -454,7 +455,7 @@ class ModalBuilder {
454
455
  return this;
455
456
  }
456
457
  addTextInputs(...inputs) {
457
- return this.addComponents(...inputs.map((input) => new ActionRowBuilder().addComponents(input)));
458
+ return this.addComponents(...inputs.map((input) => new CreateActionRow().addComponents(input)));
458
459
  }
459
460
  toJSON() {
460
461
  if (!this.#custom_id || !this.#title)
@@ -470,10 +471,10 @@ class ModalBuilder {
470
471
  }
471
472
  }
472
473
 
473
- class TextInputBuilder {
474
+ class CreateTextInput {
474
475
  #data = {
475
- type: ComponentType.TextInput,
476
- style: TextInputStyle.Short
476
+ type: ComponentEnum.TextInput,
477
+ style: TextInputType.Short
477
478
  };
478
479
  setStyle(style) {
479
480
  this.#data.style = style;
@@ -523,7 +524,7 @@ class TextInputBuilder {
523
524
  }
524
525
  }
525
526
 
526
- class ContainerBuilder {
527
+ class CreateContainer {
527
528
  #components = [];
528
529
  #accentColor;
529
530
  #spoiler;
@@ -546,7 +547,7 @@ class ContainerBuilder {
546
547
  }
547
548
  toJSON() {
548
549
  const data = {
549
- type: ComponentType.Container,
550
+ type: ComponentEnum.Container,
550
551
  components: this.#components.map((c) => c.toJSON())
551
552
  };
552
553
  if (this.#accentColor !== undefined)
@@ -557,7 +558,7 @@ class ContainerBuilder {
557
558
  }
558
559
  }
559
560
 
560
- class SectionBuilder {
561
+ class CreateSection {
561
562
  #components = [];
562
563
  #accessory;
563
564
  addComponents(...components) {
@@ -572,14 +573,14 @@ class SectionBuilder {
572
573
  }
573
574
  toJSON() {
574
575
  return {
575
- type: ComponentType.Section,
576
+ type: ComponentEnum.Section,
576
577
  components: this.#components.length ? this.#components.map((c) => c.toJSON()) : undefined,
577
578
  accessory: this.#accessory?.toJSON()
578
579
  };
579
580
  }
580
581
  }
581
582
 
582
- class TextDisplayBuilder {
583
+ class CreateTextDisplay {
583
584
  #content = "";
584
585
  setContent(content) {
585
586
  validateText(content, 4000, "Text display content");
@@ -588,13 +589,13 @@ class TextDisplayBuilder {
588
589
  }
589
590
  toJSON() {
590
591
  return {
591
- type: ComponentType.TextDisplay,
592
+ type: ComponentEnum.TextDisplay,
592
593
  content: this.#content
593
594
  };
594
595
  }
595
596
  }
596
597
 
597
- class MediaGalleryBuilder {
598
+ class CreateMediaGallery {
598
599
  #items = [];
599
600
  addItems(...items) {
600
601
  if (!items.length) {
@@ -608,13 +609,13 @@ class MediaGalleryBuilder {
608
609
  }
609
610
  toJSON() {
610
611
  return {
611
- type: ComponentType.MediaGallery,
612
+ type: ComponentEnum.MediaGallery,
612
613
  items: structuredClone(this.#items)
613
614
  };
614
615
  }
615
616
  }
616
617
 
617
- class FileComponentBuilder {
618
+ class CreateFileComponent {
618
619
  #url = "";
619
620
  #spoiler;
620
621
  setUrl(url) {
@@ -630,7 +631,7 @@ class FileComponentBuilder {
630
631
  if (!this.#url)
631
632
  throw new Error("File component must have a URL.");
632
633
  const data = {
633
- type: ComponentType.File,
634
+ type: ComponentEnum.File,
634
635
  file: { url: this.#url }
635
636
  };
636
637
  if (this.#spoiler !== undefined)
@@ -639,7 +640,7 @@ class FileComponentBuilder {
639
640
  }
640
641
  }
641
642
 
642
- class SeparatorBuilder {
643
+ class CreateSeparator {
643
644
  #spacing;
644
645
  #divider;
645
646
  setSpacing(spacing) {
@@ -652,7 +653,7 @@ class SeparatorBuilder {
652
653
  }
653
654
  toJSON() {
654
655
  const data = {
655
- type: ComponentType.Separator
656
+ type: ComponentEnum.Separator
656
657
  };
657
658
  if (this.#spacing !== undefined)
658
659
  data.spacing = this.#spacing;
@@ -662,7 +663,7 @@ class SeparatorBuilder {
662
663
  }
663
664
  }
664
665
 
665
- class ThumbnailBuilder {
666
+ class CreateThumbnail {
666
667
  #url = "";
667
668
  #description;
668
669
  #spoiler;
@@ -682,7 +683,7 @@ class ThumbnailBuilder {
682
683
  }
683
684
  toJSON() {
684
685
  const data = {
685
- type: ComponentType.Thumbnail,
686
+ type: ComponentEnum.Thumbnail,
686
687
  url: this.#url
687
688
  };
688
689
  if (this.#description !== undefined)
@@ -693,7 +694,7 @@ class ThumbnailBuilder {
693
694
  }
694
695
  }
695
696
 
696
- class ContentInventoryEntryBuilder {
697
+ class CreateContentInventoryEntry {
697
698
  #id = "";
698
699
  setId(id) {
699
700
  validateText(id, 100, "Content inventory entry ID");
@@ -702,7 +703,7 @@ class ContentInventoryEntryBuilder {
702
703
  }
703
704
  toJSON() {
704
705
  return {
705
- type: ComponentType.ContentInventoryEntry,
706
+ type: ComponentEnum.ContentInventoryEntry,
706
707
  id: this.#id
707
708
  };
708
709
  }
@@ -723,27 +724,27 @@ function validateLength(value, field, max = 4000) {
723
724
  if (!Number.isInteger(value) || value < 0 || value > max)
724
725
  throw new RangeError(`${field} must be an integer between 0 and ${max}.`);
725
726
  }
726
- class UserSelectMenuBuilder extends EntitySelectBuilder {
727
+ class CreateUserSelectMenu extends CreateEntitySelect {
727
728
  constructor() {
728
- super(ComponentType.UserSelect);
729
+ super(ComponentEnum.UserSelect);
729
730
  }
730
731
  }
731
732
 
732
- class RoleSelectMenuBuilder extends EntitySelectBuilder {
733
+ class CreateRoleSelectMenu extends CreateEntitySelect {
733
734
  constructor() {
734
- super(ComponentType.RoleSelect);
735
+ super(ComponentEnum.RoleSelect);
735
736
  }
736
737
  }
737
738
 
738
- class MentionableSelectMenuBuilder extends EntitySelectBuilder {
739
+ class CreateMentionableSelectMenu extends CreateEntitySelect {
739
740
  constructor() {
740
- super(ComponentType.MentionableSelect);
741
+ super(ComponentEnum.MentionableSelect);
741
742
  }
742
743
  }
743
744
 
744
- class ChannelSelectMenuBuilder extends EntitySelectBuilder {
745
+ class CreateChannelSelectMenu extends CreateEntitySelect {
745
746
  constructor() {
746
- super(ComponentType.ChannelSelect);
747
+ super(ComponentEnum.ChannelSelect);
747
748
  }
748
749
  }
749
750
  function assertSelect(data) {
@@ -763,8 +764,30 @@ function componentsV2Message(components, options) {
763
764
  flags: (options?.flags ?? 0) | IS_COMPONENTS_V2
764
765
  };
765
766
  }
767
+ var ButtonBuilder = CreateButton;
768
+ var ChannelSelectMenuBuilder = CreateChannelSelectMenu;
769
+ var ContainerBuilder = CreateContainer;
770
+ var ContentInventoryEntryBuilder = CreateContentInventoryEntry;
771
+ var EntitySelectBuilder = CreateEntitySelect;
772
+ var FileComponentBuilder = CreateFileComponent;
773
+ var MediaGalleryBuilder = CreateMediaGallery;
774
+ var MentionableSelectMenuBuilder = CreateMentionableSelectMenu;
775
+ var ModalBuilder = CreateModal;
776
+ var RoleSelectMenuBuilder = CreateRoleSelectMenu;
777
+ var SectionBuilder = CreateSection;
778
+ var SeparatorBuilder = CreateSeparator;
779
+ var StringSelectBuilder = CreateStringSelect;
780
+ var StringSelectMenuBuilder = CreateStringSelect;
781
+ var TextDisplayBuilder = CreateTextDisplay;
782
+ var TextInputBuilder = CreateTextInput;
783
+ var ThumbnailBuilder = CreateThumbnail;
784
+ var UserSelectMenuBuilder = CreateUserSelectMenu;
785
+ var ActionRowBuilder = CreateActionRow;
786
+ var ButtonStyle = ButtonType;
787
+ var TextInputStyle = TextInputType;
788
+ var ComponentType = ComponentEnum;
766
789
  // packages/builders/src/commands.ts
767
- var ApplicationCommandOptionType = {
790
+ var ApplicationCommandOptionEnum = {
768
791
  Subcommand: 1,
769
792
  SubcommandGroup: 2,
770
793
  String: 3,
@@ -777,8 +800,12 @@ var ApplicationCommandOptionType = {
777
800
  Number: 10,
778
801
  Attachment: 11
779
802
  };
803
+ function validateContexts(contexts) {
804
+ if (contexts.some((context) => context !== 0 && context !== 1 && context !== 2))
805
+ throw new RangeError("Command contexts must be 0, 1 or 2.");
806
+ }
780
807
 
781
- class SlashCommandBuilder {
808
+ class CreateSlashCommand {
782
809
  #data = { type: 1 };
783
810
  setName(name) {
784
811
  validateName(name, "Command name");
@@ -790,6 +817,11 @@ class SlashCommandBuilder {
790
817
  this.#data.description = description;
791
818
  return this;
792
819
  }
820
+ setContexts(...contexts) {
821
+ validateContexts(contexts);
822
+ this.#data.contexts = [...contexts];
823
+ return this;
824
+ }
793
825
  setDMPermission(enabled) {
794
826
  this.#data.dm_permission = enabled;
795
827
  return this;
@@ -810,37 +842,37 @@ class SlashCommandBuilder {
810
842
  return this;
811
843
  }
812
844
  addStringOption(configure) {
813
- return this.addOption(configure(new StringOptionBuilder));
845
+ return this.addOption(configure(new CreateStringOption));
814
846
  }
815
847
  addIntegerOption(configure) {
816
- return this.addOption(configure(new IntegerOptionBuilder));
848
+ return this.addOption(configure(new CreateIntegerOption));
817
849
  }
818
850
  addNumberOption(configure) {
819
- return this.addOption(configure(new NumberOptionBuilder));
851
+ return this.addOption(configure(new CreateNumberOption));
820
852
  }
821
853
  addBooleanOption(configure) {
822
- return this.addOption(configure(new BooleanOptionBuilder));
854
+ return this.addOption(configure(new CreateBooleanOption));
823
855
  }
824
856
  addUserOption(configure) {
825
- return this.addOption(configure(new UserOptionBuilder));
857
+ return this.addOption(configure(new CreateUserOption));
826
858
  }
827
859
  addChannelOption(configure) {
828
- return this.addOption(configure(new ChannelOptionBuilder));
860
+ return this.addOption(configure(new CreateChannelOption));
829
861
  }
830
862
  addRoleOption(configure) {
831
- return this.addOption(configure(new RoleOptionBuilder));
863
+ return this.addOption(configure(new CreateRoleOption));
832
864
  }
833
865
  addMentionableOption(configure) {
834
- return this.addOption(configure(new MentionableOptionBuilder));
866
+ return this.addOption(configure(new CreateMentionableOption));
835
867
  }
836
868
  addAttachmentOption(configure) {
837
- return this.addOption(configure(new AttachmentOptionBuilder));
869
+ return this.addOption(configure(new CreateAttachmentOption));
838
870
  }
839
871
  addSubcommand(configure) {
840
- return this.addOption(configure(new SubcommandBuilder));
872
+ return this.addOption(configure(new CreateSubcommand));
841
873
  }
842
874
  addSubcommandGroup(configure) {
843
- return this.addOption(configure(new SubcommandGroupBuilder));
875
+ return this.addOption(configure(new CreateSubcommandGroup));
844
876
  }
845
877
  toJSON() {
846
878
  return structuredClone(this.#data);
@@ -860,7 +892,7 @@ class SlashCommandBuilder {
860
892
  }
861
893
  }
862
894
 
863
- class CommandOptionBuilder {
895
+ class CreateCommandOption {
864
896
  data;
865
897
  constructor(type) {
866
898
  this.data = { type };
@@ -888,9 +920,9 @@ class CommandOptionBuilder {
888
920
  }
889
921
  }
890
922
 
891
- class StringOptionBuilder extends CommandOptionBuilder {
923
+ class CreateStringOption extends CreateCommandOption {
892
924
  constructor() {
893
- super(ApplicationCommandOptionType.String);
925
+ super(ApplicationCommandOptionEnum.String);
894
926
  }
895
927
  addChoices(...choices) {
896
928
  const current = this.data.choices ?? [];
@@ -924,9 +956,9 @@ class StringOptionBuilder extends CommandOptionBuilder {
924
956
  }
925
957
  }
926
958
 
927
- class IntegerOptionBuilder extends CommandOptionBuilder {
959
+ class CreateIntegerOption extends CreateCommandOption {
928
960
  constructor() {
929
- super(ApplicationCommandOptionType.Integer);
961
+ super(ApplicationCommandOptionEnum.Integer);
930
962
  }
931
963
  setMinValue(value) {
932
964
  validateNumberRange(value, -9007199254740991, 9007199254740991, "min_value", true);
@@ -959,9 +991,9 @@ class IntegerOptionBuilder extends CommandOptionBuilder {
959
991
  }
960
992
  }
961
993
 
962
- class NumberOptionBuilder extends CommandOptionBuilder {
994
+ class CreateNumberOption extends CreateCommandOption {
963
995
  constructor() {
964
- super(ApplicationCommandOptionType.Number);
996
+ super(ApplicationCommandOptionEnum.Number);
965
997
  }
966
998
  setMinValue(value) {
967
999
  validateNumberRange(value, -9007199254740991, 9007199254740991, "min_value", false);
@@ -994,39 +1026,39 @@ class NumberOptionBuilder extends CommandOptionBuilder {
994
1026
  }
995
1027
  }
996
1028
 
997
- class BooleanOptionBuilder extends CommandOptionBuilder {
1029
+ class CreateBooleanOption extends CreateCommandOption {
998
1030
  constructor() {
999
- super(ApplicationCommandOptionType.Boolean);
1031
+ super(ApplicationCommandOptionEnum.Boolean);
1000
1032
  }
1001
1033
  }
1002
1034
 
1003
- class UserOptionBuilder extends CommandOptionBuilder {
1035
+ class CreateUserOption extends CreateCommandOption {
1004
1036
  constructor() {
1005
- super(ApplicationCommandOptionType.User);
1037
+ super(ApplicationCommandOptionEnum.User);
1006
1038
  }
1007
1039
  }
1008
1040
 
1009
- class RoleOptionBuilder extends CommandOptionBuilder {
1041
+ class CreateRoleOption extends CreateCommandOption {
1010
1042
  constructor() {
1011
- super(ApplicationCommandOptionType.Role);
1043
+ super(ApplicationCommandOptionEnum.Role);
1012
1044
  }
1013
1045
  }
1014
1046
 
1015
- class MentionableOptionBuilder extends CommandOptionBuilder {
1047
+ class CreateMentionableOption extends CreateCommandOption {
1016
1048
  constructor() {
1017
- super(ApplicationCommandOptionType.Mentionable);
1049
+ super(ApplicationCommandOptionEnum.Mentionable);
1018
1050
  }
1019
1051
  }
1020
1052
 
1021
- class AttachmentOptionBuilder extends CommandOptionBuilder {
1053
+ class CreateAttachmentOption extends CreateCommandOption {
1022
1054
  constructor() {
1023
- super(ApplicationCommandOptionType.Attachment);
1055
+ super(ApplicationCommandOptionEnum.Attachment);
1024
1056
  }
1025
1057
  }
1026
1058
 
1027
- class ChannelOptionBuilder extends CommandOptionBuilder {
1059
+ class CreateChannelOption extends CreateCommandOption {
1028
1060
  constructor() {
1029
- super(ApplicationCommandOptionType.Channel);
1061
+ super(ApplicationCommandOptionEnum.Channel);
1030
1062
  }
1031
1063
  addChannelTypes(...types) {
1032
1064
  if (types.some((type) => !Number.isInteger(type) || type < 0))
@@ -1036,36 +1068,36 @@ class ChannelOptionBuilder extends CommandOptionBuilder {
1036
1068
  }
1037
1069
  }
1038
1070
 
1039
- class SubcommandBuilder extends CommandOptionBuilder {
1071
+ class CreateSubcommand extends CreateCommandOption {
1040
1072
  constructor() {
1041
- super(ApplicationCommandOptionType.Subcommand);
1073
+ super(ApplicationCommandOptionEnum.Subcommand);
1042
1074
  }
1043
1075
  addStringOption(configure) {
1044
- return this.addChildOption(configure(new StringOptionBuilder));
1076
+ return this.addChildOption(configure(new CreateStringOption));
1045
1077
  }
1046
1078
  addIntegerOption(configure) {
1047
- return this.addChildOption(configure(new IntegerOptionBuilder));
1079
+ return this.addChildOption(configure(new CreateIntegerOption));
1048
1080
  }
1049
1081
  addNumberOption(configure) {
1050
- return this.addChildOption(configure(new NumberOptionBuilder));
1082
+ return this.addChildOption(configure(new CreateNumberOption));
1051
1083
  }
1052
1084
  addBooleanOption(configure) {
1053
- return this.addChildOption(configure(new BooleanOptionBuilder));
1085
+ return this.addChildOption(configure(new CreateBooleanOption));
1054
1086
  }
1055
1087
  addUserOption(configure) {
1056
- return this.addChildOption(configure(new UserOptionBuilder));
1088
+ return this.addChildOption(configure(new CreateUserOption));
1057
1089
  }
1058
1090
  addChannelOption(configure) {
1059
- return this.addChildOption(configure(new ChannelOptionBuilder));
1091
+ return this.addChildOption(configure(new CreateChannelOption));
1060
1092
  }
1061
1093
  addRoleOption(configure) {
1062
- return this.addChildOption(configure(new RoleOptionBuilder));
1094
+ return this.addChildOption(configure(new CreateRoleOption));
1063
1095
  }
1064
1096
  addMentionableOption(configure) {
1065
- return this.addChildOption(configure(new MentionableOptionBuilder));
1097
+ return this.addChildOption(configure(new CreateMentionableOption));
1066
1098
  }
1067
1099
  addAttachmentOption(configure) {
1068
- return this.addChildOption(configure(new AttachmentOptionBuilder));
1100
+ return this.addChildOption(configure(new CreateAttachmentOption));
1069
1101
  }
1070
1102
  addChildOption(option) {
1071
1103
  const options = this.data.options ?? [];
@@ -1076,7 +1108,7 @@ class SubcommandBuilder extends CommandOptionBuilder {
1076
1108
  throw new RangeError(`Duplicate option name: ${String(payload.name)}.`);
1077
1109
  if (payload.required === true && options.some((existing) => existing.required !== true))
1078
1110
  throw new RangeError("Required subcommand options must be placed before optional options.");
1079
- if (options.some((existing) => existing.type === ApplicationCommandOptionType.Subcommand))
1111
+ if (options.some((existing) => existing.type === ApplicationCommandOptionEnum.Subcommand))
1080
1112
  throw new RangeError("Subcommands cannot contain nested subcommands.");
1081
1113
  options.push(payload);
1082
1114
  this.data.options = options;
@@ -1084,18 +1116,18 @@ class SubcommandBuilder extends CommandOptionBuilder {
1084
1116
  }
1085
1117
  }
1086
1118
 
1087
- class SubcommandGroupBuilder extends CommandOptionBuilder {
1119
+ class CreateSubcommandGroup extends CreateCommandOption {
1088
1120
  constructor() {
1089
- super(ApplicationCommandOptionType.SubcommandGroup);
1121
+ super(ApplicationCommandOptionEnum.SubcommandGroup);
1090
1122
  }
1091
1123
  addSubcommand(configure) {
1092
1124
  const options = this.data.options ?? [];
1093
1125
  if (options.length >= 25)
1094
1126
  throw new RangeError("A subcommand group cannot contain more than 25 subcommands.");
1095
- const payload = configure(new SubcommandBuilder).toJSON();
1127
+ const payload = configure(new CreateSubcommand).toJSON();
1096
1128
  if (options.some((existing) => existing.name === payload.name))
1097
1129
  throw new RangeError(`Duplicate subcommand name: ${String(payload.name)}.`);
1098
- if (payload.type !== ApplicationCommandOptionType.Subcommand)
1130
+ if (payload.type !== ApplicationCommandOptionEnum.Subcommand)
1099
1131
  throw new TypeError("Subcommand group children must be subcommands.");
1100
1132
  options.push(payload);
1101
1133
  this.data.options = options;
@@ -1119,7 +1151,7 @@ function validateNumberRange(value, minimum, maximum, field, integerOnly = true)
1119
1151
  throw new RangeError(`${field} must be ${integerOnly ? "an integer" : "a number"} between ${minimum} and ${maximum}.`);
1120
1152
  }
1121
1153
 
1122
- class ContextMenuCommandBuilder {
1154
+ class CreateContextMenuCommand {
1123
1155
  data;
1124
1156
  constructor(type = 2) {
1125
1157
  this.data = { type };
@@ -1148,27 +1180,53 @@ class ContextMenuCommandBuilder {
1148
1180
  this.data.integration_types = [...types];
1149
1181
  return this;
1150
1182
  }
1183
+ setContexts(...contexts) {
1184
+ validateContexts(contexts);
1185
+ this.data.contexts = [...contexts];
1186
+ return this;
1187
+ }
1188
+ setNameLocalizations(localizations) {
1189
+ this.data.name_localizations = localizations === null ? null : { ...localizations };
1190
+ return this;
1191
+ }
1151
1192
  toJSON() {
1152
1193
  return structuredClone(this.data);
1153
1194
  }
1154
1195
  }
1155
1196
 
1156
- class UserCommandBuilder extends ContextMenuCommandBuilder {
1197
+ class CreateUserCommand extends CreateContextMenuCommand {
1157
1198
  constructor() {
1158
1199
  super(2);
1159
1200
  }
1160
1201
  }
1161
1202
 
1162
- class MessageCommandBuilder extends ContextMenuCommandBuilder {
1203
+ class CreateMessageCommand extends CreateContextMenuCommand {
1163
1204
  constructor() {
1164
1205
  super(3);
1165
1206
  }
1166
1207
  }
1208
+ var AttachmentOptionBuilder = CreateAttachmentOption;
1209
+ var BooleanOptionBuilder = CreateBooleanOption;
1210
+ var ChannelOptionBuilder = CreateChannelOption;
1211
+ var CommandOptionBuilder = CreateCommandOption;
1212
+ var ContextMenuCommandBuilder = CreateContextMenuCommand;
1213
+ var IntegerOptionBuilder = CreateIntegerOption;
1214
+ var MentionableOptionBuilder = CreateMentionableOption;
1215
+ var MessageCommandBuilder = CreateMessageCommand;
1216
+ var NumberOptionBuilder = CreateNumberOption;
1217
+ var RoleOptionBuilder = CreateRoleOption;
1218
+ var SlashCommandBuilder = CreateSlashCommand;
1219
+ var StringOptionBuilder = CreateStringOption;
1220
+ var SubcommandBuilder = CreateSubcommand;
1221
+ var SubcommandGroupBuilder = CreateSubcommandGroup;
1222
+ var UserCommandBuilder = CreateUserCommand;
1223
+ var UserOptionBuilder = CreateUserOption;
1224
+ var ApplicationCommandOptionType = ApplicationCommandOptionEnum;
1167
1225
  // packages/builders/src/attachment.ts
1168
1226
  import { readFile } from "fs/promises";
1169
1227
  import { basename } from "path";
1170
1228
 
1171
- class AttachmentBuilder {
1229
+ class CreateAttachment {
1172
1230
  name;
1173
1231
  description;
1174
1232
  file;
@@ -1212,20 +1270,62 @@ class AttachmentBuilder {
1212
1270
  throw new TypeError("Attachment file must be a supported binary value or file path.");
1213
1271
  }
1214
1272
  }
1273
+ var AttachmentBuilder = CreateAttachment;
1215
1274
  export {
1216
1275
  ActionRowBuilder,
1276
+ ApplicationCommandOptionEnum,
1217
1277
  ApplicationCommandOptionType,
1218
1278
  AttachmentBuilder,
1219
1279
  AttachmentOptionBuilder,
1220
1280
  BooleanOptionBuilder,
1221
1281
  ButtonBuilder,
1222
1282
  ButtonStyle,
1283
+ ButtonType,
1223
1284
  ChannelOptionBuilder,
1224
1285
  ChannelSelectMenuBuilder,
1286
+ CommandOptionBuilder,
1287
+ ComponentEnum,
1225
1288
  ComponentType,
1226
1289
  ContainerBuilder,
1227
1290
  ContentInventoryEntryBuilder,
1228
1291
  ContextMenuCommandBuilder,
1292
+ CreateActionRow,
1293
+ CreateAttachment,
1294
+ CreateAttachmentOption,
1295
+ CreateBooleanOption,
1296
+ CreateButton,
1297
+ CreateChannelOption,
1298
+ CreateChannelSelectMenu,
1299
+ CreateCommandOption,
1300
+ CreateContainer,
1301
+ CreateContentInventoryEntry,
1302
+ CreateContextMenuCommand,
1303
+ CreateEmbed,
1304
+ CreateEntitySelect,
1305
+ CreateFileComponent,
1306
+ CreateIntegerOption,
1307
+ CreateMediaGallery,
1308
+ CreateMentionableOption,
1309
+ CreateMentionableSelectMenu,
1310
+ CreateMessageCommand,
1311
+ CreateModal,
1312
+ CreateNumberOption,
1313
+ CreateRoleOption,
1314
+ CreateRoleSelectMenu,
1315
+ CreateSection,
1316
+ CreateSeparator,
1317
+ CreateSlashCommand,
1318
+ CreateStringOption,
1319
+ CreateStringSelect,
1320
+ CreateStringSelect as CreateStringSelectMenu,
1321
+ CreateSubcommand,
1322
+ CreateSubcommandGroup,
1323
+ CreateTextDisplay,
1324
+ CreateTextInput,
1325
+ CreateThumbnail,
1326
+ CreateUserCommand,
1327
+ CreateUserOption,
1328
+ CreateUserSelectMenu,
1229
1329
  EmbedBuilder,
1230
1330
  EntitySelectBuilder,
1231
1331
  FileComponentBuilder,
@@ -1243,12 +1343,13 @@ export {
1243
1343
  SlashCommandBuilder,
1244
1344
  StringOptionBuilder,
1245
1345
  StringSelectBuilder,
1246
- StringSelectBuilder as StringSelectMenuBuilder,
1346
+ StringSelectMenuBuilder,
1247
1347
  SubcommandBuilder,
1248
1348
  SubcommandGroupBuilder,
1249
1349
  TextDisplayBuilder,
1250
1350
  TextInputBuilder,
1251
1351
  TextInputStyle,
1352
+ TextInputType,
1252
1353
  ThumbnailBuilder,
1253
1354
  UserCommandBuilder,
1254
1355
  UserOptionBuilder,
@@ -1256,4 +1357,4 @@ export {
1256
1357
  componentsV2Message
1257
1358
  };
1258
1359
 
1259
- //# debugId=8C8B25AA416C8B5064756E2164756E21
1360
+ //# debugId=8CD676224F0295FD64756E2164756E21