lunibee 0.2.0 → 0.2.2

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 (45) hide show
  1. package/README.md +6 -6
  2. package/dist/builders/attachment.d.ts +5 -1
  3. package/dist/builders/commands.d.ts +131 -45
  4. package/dist/builders/components.d.ts +183 -41
  5. package/dist/builders/embed.d.ts +12 -8
  6. package/dist/builders/index.d.ts +9 -4
  7. package/dist/builders/index.js +234 -110
  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 +5 -3
  11. package/dist/core/index.js +414 -78
  12. package/dist/core/index.js.map +18 -18
  13. package/dist/core/permissions.d.ts +6 -2
  14. package/dist/index.d.ts +5 -4
  15. package/dist/index.js +869 -194
  16. package/dist/index.js.map +25 -24
  17. package/dist/managers/guild-resources.d.ts +22 -2
  18. package/dist/managers/guild.d.ts +3 -1
  19. package/dist/managers/index.d.ts +7 -3
  20. package/dist/managers/index.js +167 -33
  21. package/dist/managers/index.js.map +13 -13
  22. package/dist/managers/member.d.ts +13 -12
  23. package/dist/managers/message.d.ts +16 -4
  24. package/dist/rest/index.js +2 -2
  25. package/dist/rest/index.js.map +1 -1
  26. package/dist/sharding/index.js +3 -2
  27. package/dist/sharding/index.js.map +4 -4
  28. package/dist/structures/base.d.ts +36 -0
  29. package/dist/structures/index.d.ts +38 -3
  30. package/dist/structures/index.js +240 -34
  31. package/dist/structures/index.js.map +11 -11
  32. package/dist/structures/interactions.d.ts +110 -12
  33. package/dist/structures/options.d.ts +2 -0
  34. package/dist/structures/resources.d.ts +40 -4
  35. package/dist/types/gateway.d.ts +14 -0
  36. package/dist/types/index.d.ts +185 -10
  37. package/dist/types/index.js +37 -10
  38. package/dist/types/index.js.map +4 -4
  39. package/dist/utils/args.d.ts +79 -0
  40. package/dist/utils/index.d.ts +1 -0
  41. package/dist/utils/index.js +190 -2
  42. package/dist/utils/index.js.map +5 -4
  43. package/dist/ws/index.js +2 -1
  44. package/dist/ws/index.js.map +4 -4
  45. package/package.json +14 -14
@@ -1,17 +1,26 @@
1
1
  // @bun
2
2
  // packages/builders/src/embed.ts
3
- class EmbedBuilder {
3
+ class CreateEmbed {
4
4
  #data = {};
5
5
  setTitle(value) {
6
- this.#data.title = validate(value, 256, "Embed title");
6
+ if (value === null)
7
+ delete this.#data.title;
8
+ else
9
+ this.#data.title = validate(value, 256, "Embed title");
7
10
  return this;
8
11
  }
9
12
  setDescription(value) {
10
- this.#data.description = validate(value, 4096, "Embed description");
13
+ if (value === null)
14
+ delete this.#data.description;
15
+ else
16
+ this.#data.description = validate(value, 4096, "Embed description");
11
17
  return this;
12
18
  }
13
19
  setURL(value) {
14
- this.#data.url = url(value, "Embed URL");
20
+ if (value === null)
21
+ delete this.#data.url;
22
+ else
23
+ this.#data.url = url(value, "Embed URL");
15
24
  return this;
16
25
  }
17
26
  setColor(value) {
@@ -43,11 +52,19 @@ class EmbedBuilder {
43
52
  return this;
44
53
  }
45
54
  setThumbnail(value) {
55
+ if (value === null) {
56
+ delete this.#data.thumbnail;
57
+ return this;
58
+ }
46
59
  const valueURL = typeof value === "string" ? value : value.url;
47
60
  this.#data.thumbnail = { url: url(valueURL, "Thumbnail URL") };
48
61
  return this;
49
62
  }
50
63
  setImage(value) {
64
+ if (value === null) {
65
+ delete this.#data.image;
66
+ return this;
67
+ }
51
68
  const valueURL = typeof value === "string" ? value : value.url;
52
69
  this.#data.image = { url: url(valueURL, "Image URL") };
53
70
  return this;
@@ -114,6 +131,7 @@ function url(value, field) {
114
131
  throw new TypeError(`${field} must be a valid URL.`, { cause: error });
115
132
  }
116
133
  }
134
+ var EmbedBuilder = CreateEmbed;
117
135
  // packages/types/src/gateway.ts
118
136
  var GatewayIntentBits = {
119
137
  Guilds: 1 << 0,
@@ -167,7 +185,7 @@ var IntentBits = {
167
185
  directMessagePolls: 1 << 25
168
186
  };
169
187
  // packages/types/src/index.ts
170
- var ButtonStyle = {
188
+ var ButtonType = {
171
189
  Primary: 1,
172
190
  Secondary: 2,
173
191
  Success: 3,
@@ -177,7 +195,7 @@ var ButtonStyle = {
177
195
  };
178
196
 
179
197
  // packages/builders/src/components.ts
180
- var ComponentType = {
198
+ var ComponentEnum = {
181
199
  ActionRow: 1,
182
200
  Button: 2,
183
201
  StringSelect: 3,
@@ -195,9 +213,9 @@ var ComponentType = {
195
213
  ContentInventoryEntry: 16,
196
214
  Container: 17
197
215
  };
198
- var TextInputStyle = { Short: 1, Paragraph: 2 };
216
+ var TextInputType = { Short: 1, Paragraph: 2 };
199
217
 
200
- class ActionRowBuilder {
218
+ class CreateActionRow {
201
219
  #components = [];
202
220
  addComponents(...components) {
203
221
  if (!components.length)
@@ -216,15 +234,15 @@ class ActionRowBuilder {
216
234
  if (components.length === 0)
217
235
  throw new RangeError("An action row needs at least one component.");
218
236
  const types = components.map((component) => component.type);
219
- if (types.some((type) => type !== ComponentType.Button) && components.length > 1)
237
+ if (types.some((type) => type !== ComponentEnum.Button) && components.length > 1)
220
238
  throw new RangeError("A select menu or text input must be alone in its action row.");
221
- return { type: ComponentType.ActionRow, components };
239
+ return { type: ComponentEnum.ActionRow, components };
222
240
  }
223
241
  }
224
242
 
225
- class StringSelectBuilder {
243
+ class CreateStringSelect {
226
244
  #data = {
227
- type: ComponentType.StringSelect
245
+ type: ComponentEnum.StringSelect
228
246
  };
229
247
  setCustomId(value) {
230
248
  validateText(value, 100, "Component custom ID");
@@ -283,18 +301,18 @@ class StringSelectBuilder {
283
301
  }
284
302
  }
285
303
 
286
- class ButtonBuilder {
304
+ class CreateButton {
287
305
  #data = {
288
- type: ComponentType.Button,
289
- style: ButtonStyle.Secondary
306
+ type: ComponentEnum.Button,
307
+ style: ButtonType.Secondary
290
308
  };
291
309
  setStyle(style) {
292
310
  const data = this.#data;
293
311
  data.style = style;
294
- if (style === ButtonStyle.Link) {
312
+ if (style === ButtonType.Link) {
295
313
  delete data.custom_id;
296
314
  delete data.sku_id;
297
- } else if (style === ButtonStyle.Premium) {
315
+ } else if (style === ButtonType.Premium) {
298
316
  delete data.custom_id;
299
317
  delete data.url;
300
318
  delete data.label;
@@ -307,7 +325,7 @@ class ButtonBuilder {
307
325
  }
308
326
  setCustomId(value) {
309
327
  validateText(value, 100, "Button custom ID");
310
- if (this.#data.style === ButtonStyle.Link)
328
+ if (this.#data.style === ButtonType.Link)
311
329
  throw new TypeError("Link buttons cannot use custom IDs.");
312
330
  this.#data.custom_id = value;
313
331
  return this;
@@ -327,13 +345,13 @@ class ButtonBuilder {
327
345
  cause: error
328
346
  });
329
347
  }
330
- this.setStyle(ButtonStyle.Link);
348
+ this.setStyle(ButtonType.Link);
331
349
  this.#data.url = url.toString();
332
350
  return this;
333
351
  }
334
352
  setSKUId(skuId) {
335
353
  validateText(skuId, 20, "Button SKU ID");
336
- this.setStyle(ButtonStyle.Premium);
354
+ this.setStyle(ButtonType.Premium);
337
355
  this.#data.sku_id = skuId;
338
356
  return this;
339
357
  }
@@ -347,12 +365,12 @@ class ButtonBuilder {
347
365
  }
348
366
  toJSON() {
349
367
  const data = this.#data;
350
- if (data.style === ButtonStyle.Link) {
368
+ if (data.style === ButtonType.Link) {
351
369
  if (!data.url)
352
370
  throw new TypeError("Link buttons require a URL.");
353
371
  if (data.custom_id || data.sku_id)
354
372
  throw new TypeError("Link buttons cannot have a custom ID or SKU ID.");
355
- } else if (data.style === ButtonStyle.Premium) {
373
+ } else if (data.style === ButtonType.Premium) {
356
374
  if (!data.sku_id)
357
375
  throw new TypeError("Premium buttons require a SKU ID.");
358
376
  if (data.custom_id || data.url || data.label || data.emoji)
@@ -363,16 +381,16 @@ class ButtonBuilder {
363
381
  if (data.url || data.sku_id)
364
382
  throw new TypeError("Only link buttons have a URL and only premium buttons have a SKU ID.");
365
383
  }
366
- if (data.style !== ButtonStyle.Premium && !data.label && !data.emoji)
384
+ if (data.style !== ButtonType.Premium && !data.label && !data.emoji)
367
385
  throw new TypeError("Buttons require a label or an emoji.");
368
386
  return structuredClone(data);
369
387
  }
370
388
  }
371
389
 
372
- class EntitySelectBuilder {
390
+ class CreateEntitySelect {
373
391
  #data;
374
392
  constructor(type) {
375
- 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)
376
394
  throw new TypeError("Invalid select component type.");
377
395
  this.#data = { type };
378
396
  }
@@ -414,7 +432,7 @@ class EntitySelectBuilder {
414
432
  }
415
433
  }
416
434
 
417
- class ModalBuilder {
435
+ class CreateModal {
418
436
  #components = [];
419
437
  #custom_id;
420
438
  #title;
@@ -436,6 +454,9 @@ class ModalBuilder {
436
454
  this.#components.push(...components);
437
455
  return this;
438
456
  }
457
+ addTextInputs(...inputs) {
458
+ return this.addComponents(...inputs.map((input) => new CreateActionRow().addComponents(input)));
459
+ }
439
460
  toJSON() {
440
461
  if (!this.#custom_id || !this.#title)
441
462
  throw new TypeError("Modals require a custom ID and a title.");
@@ -443,17 +464,17 @@ class ModalBuilder {
443
464
  throw new RangeError("Modals require at least one component.");
444
465
  return {
445
466
  type: 9,
446
- ...this.#custom_id ? { custom_id: this.#custom_id } : {},
447
- ...this.#title ? { title: this.#title } : {},
467
+ custom_id: this.#custom_id,
468
+ title: this.#title,
448
469
  components: this.#components.map((component) => component.toJSON())
449
470
  };
450
471
  }
451
472
  }
452
473
 
453
- class TextInputBuilder {
474
+ class CreateTextInput {
454
475
  #data = {
455
- type: ComponentType.TextInput,
456
- style: TextInputStyle.Short
476
+ type: ComponentEnum.TextInput,
477
+ style: TextInputType.Short
457
478
  };
458
479
  setStyle(style) {
459
480
  this.#data.style = style;
@@ -503,7 +524,7 @@ class TextInputBuilder {
503
524
  }
504
525
  }
505
526
 
506
- class ContainerBuilder {
527
+ class CreateContainer {
507
528
  #components = [];
508
529
  #accentColor;
509
530
  #spoiler;
@@ -526,7 +547,7 @@ class ContainerBuilder {
526
547
  }
527
548
  toJSON() {
528
549
  const data = {
529
- type: ComponentType.Container,
550
+ type: ComponentEnum.Container,
530
551
  components: this.#components.map((c) => c.toJSON())
531
552
  };
532
553
  if (this.#accentColor !== undefined)
@@ -537,7 +558,7 @@ class ContainerBuilder {
537
558
  }
538
559
  }
539
560
 
540
- class SectionBuilder {
561
+ class CreateSection {
541
562
  #components = [];
542
563
  #accessory;
543
564
  addComponents(...components) {
@@ -552,14 +573,14 @@ class SectionBuilder {
552
573
  }
553
574
  toJSON() {
554
575
  return {
555
- type: ComponentType.Section,
576
+ type: ComponentEnum.Section,
556
577
  components: this.#components.length ? this.#components.map((c) => c.toJSON()) : undefined,
557
578
  accessory: this.#accessory?.toJSON()
558
579
  };
559
580
  }
560
581
  }
561
582
 
562
- class TextDisplayBuilder {
583
+ class CreateTextDisplay {
563
584
  #content = "";
564
585
  setContent(content) {
565
586
  validateText(content, 4000, "Text display content");
@@ -568,13 +589,13 @@ class TextDisplayBuilder {
568
589
  }
569
590
  toJSON() {
570
591
  return {
571
- type: ComponentType.TextDisplay,
592
+ type: ComponentEnum.TextDisplay,
572
593
  content: this.#content
573
594
  };
574
595
  }
575
596
  }
576
597
 
577
- class MediaGalleryBuilder {
598
+ class CreateMediaGallery {
578
599
  #items = [];
579
600
  addItems(...items) {
580
601
  if (!items.length) {
@@ -588,13 +609,13 @@ class MediaGalleryBuilder {
588
609
  }
589
610
  toJSON() {
590
611
  return {
591
- type: ComponentType.MediaGallery,
612
+ type: ComponentEnum.MediaGallery,
592
613
  items: structuredClone(this.#items)
593
614
  };
594
615
  }
595
616
  }
596
617
 
597
- class FileComponentBuilder {
618
+ class CreateFileComponent {
598
619
  #url = "";
599
620
  #spoiler;
600
621
  setUrl(url) {
@@ -610,7 +631,7 @@ class FileComponentBuilder {
610
631
  if (!this.#url)
611
632
  throw new Error("File component must have a URL.");
612
633
  const data = {
613
- type: ComponentType.File,
634
+ type: ComponentEnum.File,
614
635
  file: { url: this.#url }
615
636
  };
616
637
  if (this.#spoiler !== undefined)
@@ -619,7 +640,7 @@ class FileComponentBuilder {
619
640
  }
620
641
  }
621
642
 
622
- class SeparatorBuilder {
643
+ class CreateSeparator {
623
644
  #spacing;
624
645
  #divider;
625
646
  setSpacing(spacing) {
@@ -632,7 +653,7 @@ class SeparatorBuilder {
632
653
  }
633
654
  toJSON() {
634
655
  const data = {
635
- type: ComponentType.Separator
656
+ type: ComponentEnum.Separator
636
657
  };
637
658
  if (this.#spacing !== undefined)
638
659
  data.spacing = this.#spacing;
@@ -642,7 +663,7 @@ class SeparatorBuilder {
642
663
  }
643
664
  }
644
665
 
645
- class ThumbnailBuilder {
666
+ class CreateThumbnail {
646
667
  #url = "";
647
668
  #description;
648
669
  #spoiler;
@@ -662,7 +683,7 @@ class ThumbnailBuilder {
662
683
  }
663
684
  toJSON() {
664
685
  const data = {
665
- type: ComponentType.Thumbnail,
686
+ type: ComponentEnum.Thumbnail,
666
687
  url: this.#url
667
688
  };
668
689
  if (this.#description !== undefined)
@@ -673,7 +694,7 @@ class ThumbnailBuilder {
673
694
  }
674
695
  }
675
696
 
676
- class ContentInventoryEntryBuilder {
697
+ class CreateContentInventoryEntry {
677
698
  #id = "";
678
699
  setId(id) {
679
700
  validateText(id, 100, "Content inventory entry ID");
@@ -682,7 +703,7 @@ class ContentInventoryEntryBuilder {
682
703
  }
683
704
  toJSON() {
684
705
  return {
685
- type: ComponentType.ContentInventoryEntry,
706
+ type: ComponentEnum.ContentInventoryEntry,
686
707
  id: this.#id
687
708
  };
688
709
  }
@@ -703,27 +724,27 @@ function validateLength(value, field, max = 4000) {
703
724
  if (!Number.isInteger(value) || value < 0 || value > max)
704
725
  throw new RangeError(`${field} must be an integer between 0 and ${max}.`);
705
726
  }
706
- class UserSelectMenuBuilder extends EntitySelectBuilder {
727
+ class CreateUserSelectMenu extends CreateEntitySelect {
707
728
  constructor() {
708
- super(ComponentType.UserSelect);
729
+ super(ComponentEnum.UserSelect);
709
730
  }
710
731
  }
711
732
 
712
- class RoleSelectMenuBuilder extends EntitySelectBuilder {
733
+ class CreateRoleSelectMenu extends CreateEntitySelect {
713
734
  constructor() {
714
- super(ComponentType.RoleSelect);
735
+ super(ComponentEnum.RoleSelect);
715
736
  }
716
737
  }
717
738
 
718
- class MentionableSelectMenuBuilder extends EntitySelectBuilder {
739
+ class CreateMentionableSelectMenu extends CreateEntitySelect {
719
740
  constructor() {
720
- super(ComponentType.MentionableSelect);
741
+ super(ComponentEnum.MentionableSelect);
721
742
  }
722
743
  }
723
744
 
724
- class ChannelSelectMenuBuilder extends EntitySelectBuilder {
745
+ class CreateChannelSelectMenu extends CreateEntitySelect {
725
746
  constructor() {
726
- super(ComponentType.ChannelSelect);
747
+ super(ComponentEnum.ChannelSelect);
727
748
  }
728
749
  }
729
750
  function assertSelect(data) {
@@ -732,8 +753,41 @@ function assertSelect(data) {
732
753
  if ((data.min_values ?? 1) > (data.max_values ?? 1))
733
754
  throw new RangeError("min_values cannot exceed max_values.");
734
755
  }
756
+ var IS_COMPONENTS_V2 = 1 << 15;
757
+ function componentsV2Message(components, options) {
758
+ const list = Array.isArray(components) ? components : [components];
759
+ if (!list.length)
760
+ throw new TypeError("A Components V2 message needs at least one component.");
761
+ return {
762
+ ...options ?? {},
763
+ components: list.map((component) => component.toJSON()),
764
+ flags: (options?.flags ?? 0) | IS_COMPONENTS_V2
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;
735
789
  // packages/builders/src/commands.ts
736
- var ApplicationCommandOptionType = {
790
+ var ApplicationCommandOptionEnum = {
737
791
  Subcommand: 1,
738
792
  SubcommandGroup: 2,
739
793
  String: 3,
@@ -747,7 +801,7 @@ var ApplicationCommandOptionType = {
747
801
  Attachment: 11
748
802
  };
749
803
 
750
- class SlashCommandBuilder {
804
+ class CreateSlashCommand {
751
805
  #data = { type: 1 };
752
806
  setName(name) {
753
807
  validateName(name, "Command name");
@@ -779,37 +833,37 @@ class SlashCommandBuilder {
779
833
  return this;
780
834
  }
781
835
  addStringOption(configure) {
782
- return this.addOption(configure(new StringOptionBuilder));
836
+ return this.addOption(configure(new CreateStringOption));
783
837
  }
784
838
  addIntegerOption(configure) {
785
- return this.addOption(configure(new IntegerOptionBuilder));
839
+ return this.addOption(configure(new CreateIntegerOption));
786
840
  }
787
841
  addNumberOption(configure) {
788
- return this.addOption(configure(new NumberOptionBuilder));
842
+ return this.addOption(configure(new CreateNumberOption));
789
843
  }
790
844
  addBooleanOption(configure) {
791
- return this.addOption(configure(new BooleanOptionBuilder));
845
+ return this.addOption(configure(new CreateBooleanOption));
792
846
  }
793
847
  addUserOption(configure) {
794
- return this.addOption(configure(new UserOptionBuilder));
848
+ return this.addOption(configure(new CreateUserOption));
795
849
  }
796
850
  addChannelOption(configure) {
797
- return this.addOption(configure(new ChannelOptionBuilder));
851
+ return this.addOption(configure(new CreateChannelOption));
798
852
  }
799
853
  addRoleOption(configure) {
800
- return this.addOption(configure(new RoleOptionBuilder));
854
+ return this.addOption(configure(new CreateRoleOption));
801
855
  }
802
856
  addMentionableOption(configure) {
803
- return this.addOption(configure(new MentionableOptionBuilder));
857
+ return this.addOption(configure(new CreateMentionableOption));
804
858
  }
805
859
  addAttachmentOption(configure) {
806
- return this.addOption(configure(new AttachmentOptionBuilder));
860
+ return this.addOption(configure(new CreateAttachmentOption));
807
861
  }
808
862
  addSubcommand(configure) {
809
- return this.addOption(configure(new SubcommandBuilder));
863
+ return this.addOption(configure(new CreateSubcommand));
810
864
  }
811
865
  addSubcommandGroup(configure) {
812
- return this.addOption(configure(new SubcommandGroupBuilder));
866
+ return this.addOption(configure(new CreateSubcommandGroup));
813
867
  }
814
868
  toJSON() {
815
869
  return structuredClone(this.#data);
@@ -829,7 +883,7 @@ class SlashCommandBuilder {
829
883
  }
830
884
  }
831
885
 
832
- class CommandOptionBuilder {
886
+ class CreateCommandOption {
833
887
  data;
834
888
  constructor(type) {
835
889
  this.data = { type };
@@ -857,9 +911,9 @@ class CommandOptionBuilder {
857
911
  }
858
912
  }
859
913
 
860
- class StringOptionBuilder extends CommandOptionBuilder {
914
+ class CreateStringOption extends CreateCommandOption {
861
915
  constructor() {
862
- super(ApplicationCommandOptionType.String);
916
+ super(ApplicationCommandOptionEnum.String);
863
917
  }
864
918
  addChoices(...choices) {
865
919
  const current = this.data.choices ?? [];
@@ -893,9 +947,9 @@ class StringOptionBuilder extends CommandOptionBuilder {
893
947
  }
894
948
  }
895
949
 
896
- class IntegerOptionBuilder extends CommandOptionBuilder {
950
+ class CreateIntegerOption extends CreateCommandOption {
897
951
  constructor() {
898
- super(ApplicationCommandOptionType.Integer);
952
+ super(ApplicationCommandOptionEnum.Integer);
899
953
  }
900
954
  setMinValue(value) {
901
955
  validateNumberRange(value, -9007199254740991, 9007199254740991, "min_value", true);
@@ -928,9 +982,9 @@ class IntegerOptionBuilder extends CommandOptionBuilder {
928
982
  }
929
983
  }
930
984
 
931
- class NumberOptionBuilder extends CommandOptionBuilder {
985
+ class CreateNumberOption extends CreateCommandOption {
932
986
  constructor() {
933
- super(ApplicationCommandOptionType.Number);
987
+ super(ApplicationCommandOptionEnum.Number);
934
988
  }
935
989
  setMinValue(value) {
936
990
  validateNumberRange(value, -9007199254740991, 9007199254740991, "min_value", false);
@@ -963,39 +1017,39 @@ class NumberOptionBuilder extends CommandOptionBuilder {
963
1017
  }
964
1018
  }
965
1019
 
966
- class BooleanOptionBuilder extends CommandOptionBuilder {
1020
+ class CreateBooleanOption extends CreateCommandOption {
967
1021
  constructor() {
968
- super(ApplicationCommandOptionType.Boolean);
1022
+ super(ApplicationCommandOptionEnum.Boolean);
969
1023
  }
970
1024
  }
971
1025
 
972
- class UserOptionBuilder extends CommandOptionBuilder {
1026
+ class CreateUserOption extends CreateCommandOption {
973
1027
  constructor() {
974
- super(ApplicationCommandOptionType.User);
1028
+ super(ApplicationCommandOptionEnum.User);
975
1029
  }
976
1030
  }
977
1031
 
978
- class RoleOptionBuilder extends CommandOptionBuilder {
1032
+ class CreateRoleOption extends CreateCommandOption {
979
1033
  constructor() {
980
- super(ApplicationCommandOptionType.Role);
1034
+ super(ApplicationCommandOptionEnum.Role);
981
1035
  }
982
1036
  }
983
1037
 
984
- class MentionableOptionBuilder extends CommandOptionBuilder {
1038
+ class CreateMentionableOption extends CreateCommandOption {
985
1039
  constructor() {
986
- super(ApplicationCommandOptionType.Mentionable);
1040
+ super(ApplicationCommandOptionEnum.Mentionable);
987
1041
  }
988
1042
  }
989
1043
 
990
- class AttachmentOptionBuilder extends CommandOptionBuilder {
1044
+ class CreateAttachmentOption extends CreateCommandOption {
991
1045
  constructor() {
992
- super(ApplicationCommandOptionType.Attachment);
1046
+ super(ApplicationCommandOptionEnum.Attachment);
993
1047
  }
994
1048
  }
995
1049
 
996
- class ChannelOptionBuilder extends CommandOptionBuilder {
1050
+ class CreateChannelOption extends CreateCommandOption {
997
1051
  constructor() {
998
- super(ApplicationCommandOptionType.Channel);
1052
+ super(ApplicationCommandOptionEnum.Channel);
999
1053
  }
1000
1054
  addChannelTypes(...types) {
1001
1055
  if (types.some((type) => !Number.isInteger(type) || type < 0))
@@ -1005,36 +1059,36 @@ class ChannelOptionBuilder extends CommandOptionBuilder {
1005
1059
  }
1006
1060
  }
1007
1061
 
1008
- class SubcommandBuilder extends CommandOptionBuilder {
1062
+ class CreateSubcommand extends CreateCommandOption {
1009
1063
  constructor() {
1010
- super(ApplicationCommandOptionType.Subcommand);
1064
+ super(ApplicationCommandOptionEnum.Subcommand);
1011
1065
  }
1012
1066
  addStringOption(configure) {
1013
- return this.addChildOption(configure(new StringOptionBuilder));
1067
+ return this.addChildOption(configure(new CreateStringOption));
1014
1068
  }
1015
1069
  addIntegerOption(configure) {
1016
- return this.addChildOption(configure(new IntegerOptionBuilder));
1070
+ return this.addChildOption(configure(new CreateIntegerOption));
1017
1071
  }
1018
1072
  addNumberOption(configure) {
1019
- return this.addChildOption(configure(new NumberOptionBuilder));
1073
+ return this.addChildOption(configure(new CreateNumberOption));
1020
1074
  }
1021
1075
  addBooleanOption(configure) {
1022
- return this.addChildOption(configure(new BooleanOptionBuilder));
1076
+ return this.addChildOption(configure(new CreateBooleanOption));
1023
1077
  }
1024
1078
  addUserOption(configure) {
1025
- return this.addChildOption(configure(new UserOptionBuilder));
1079
+ return this.addChildOption(configure(new CreateUserOption));
1026
1080
  }
1027
1081
  addChannelOption(configure) {
1028
- return this.addChildOption(configure(new ChannelOptionBuilder));
1082
+ return this.addChildOption(configure(new CreateChannelOption));
1029
1083
  }
1030
1084
  addRoleOption(configure) {
1031
- return this.addChildOption(configure(new RoleOptionBuilder));
1085
+ return this.addChildOption(configure(new CreateRoleOption));
1032
1086
  }
1033
1087
  addMentionableOption(configure) {
1034
- return this.addChildOption(configure(new MentionableOptionBuilder));
1088
+ return this.addChildOption(configure(new CreateMentionableOption));
1035
1089
  }
1036
1090
  addAttachmentOption(configure) {
1037
- return this.addChildOption(configure(new AttachmentOptionBuilder));
1091
+ return this.addChildOption(configure(new CreateAttachmentOption));
1038
1092
  }
1039
1093
  addChildOption(option) {
1040
1094
  const options = this.data.options ?? [];
@@ -1045,7 +1099,7 @@ class SubcommandBuilder extends CommandOptionBuilder {
1045
1099
  throw new RangeError(`Duplicate option name: ${String(payload.name)}.`);
1046
1100
  if (payload.required === true && options.some((existing) => existing.required !== true))
1047
1101
  throw new RangeError("Required subcommand options must be placed before optional options.");
1048
- if (options.some((existing) => existing.type === ApplicationCommandOptionType.Subcommand))
1102
+ if (options.some((existing) => existing.type === ApplicationCommandOptionEnum.Subcommand))
1049
1103
  throw new RangeError("Subcommands cannot contain nested subcommands.");
1050
1104
  options.push(payload);
1051
1105
  this.data.options = options;
@@ -1053,18 +1107,18 @@ class SubcommandBuilder extends CommandOptionBuilder {
1053
1107
  }
1054
1108
  }
1055
1109
 
1056
- class SubcommandGroupBuilder extends CommandOptionBuilder {
1110
+ class CreateSubcommandGroup extends CreateCommandOption {
1057
1111
  constructor() {
1058
- super(ApplicationCommandOptionType.SubcommandGroup);
1112
+ super(ApplicationCommandOptionEnum.SubcommandGroup);
1059
1113
  }
1060
1114
  addSubcommand(configure) {
1061
1115
  const options = this.data.options ?? [];
1062
1116
  if (options.length >= 25)
1063
1117
  throw new RangeError("A subcommand group cannot contain more than 25 subcommands.");
1064
- const payload = configure(new SubcommandBuilder).toJSON();
1118
+ const payload = configure(new CreateSubcommand).toJSON();
1065
1119
  if (options.some((existing) => existing.name === payload.name))
1066
1120
  throw new RangeError(`Duplicate subcommand name: ${String(payload.name)}.`);
1067
- if (payload.type !== ApplicationCommandOptionType.Subcommand)
1121
+ if (payload.type !== ApplicationCommandOptionEnum.Subcommand)
1068
1122
  throw new TypeError("Subcommand group children must be subcommands.");
1069
1123
  options.push(payload);
1070
1124
  this.data.options = options;
@@ -1088,7 +1142,7 @@ function validateNumberRange(value, minimum, maximum, field, integerOnly = true)
1088
1142
  throw new RangeError(`${field} must be ${integerOnly ? "an integer" : "a number"} between ${minimum} and ${maximum}.`);
1089
1143
  }
1090
1144
 
1091
- class ContextMenuCommandBuilder {
1145
+ class CreateContextMenuCommand {
1092
1146
  data;
1093
1147
  constructor(type = 2) {
1094
1148
  this.data = { type };
@@ -1117,27 +1171,54 @@ class ContextMenuCommandBuilder {
1117
1171
  this.data.integration_types = [...types];
1118
1172
  return this;
1119
1173
  }
1174
+ setContexts(...contexts) {
1175
+ if (contexts.some((context) => context !== 0 && context !== 1 && context !== 2))
1176
+ throw new RangeError("Command contexts must be 0, 1 or 2.");
1177
+ this.data.contexts = [...contexts];
1178
+ return this;
1179
+ }
1180
+ setNameLocalizations(localizations) {
1181
+ this.data.name_localizations = localizations === null ? null : { ...localizations };
1182
+ return this;
1183
+ }
1120
1184
  toJSON() {
1121
1185
  return structuredClone(this.data);
1122
1186
  }
1123
1187
  }
1124
1188
 
1125
- class UserCommandBuilder extends ContextMenuCommandBuilder {
1189
+ class CreateUserCommand extends CreateContextMenuCommand {
1126
1190
  constructor() {
1127
1191
  super(2);
1128
1192
  }
1129
1193
  }
1130
1194
 
1131
- class MessageCommandBuilder extends ContextMenuCommandBuilder {
1195
+ class CreateMessageCommand extends CreateContextMenuCommand {
1132
1196
  constructor() {
1133
1197
  super(3);
1134
1198
  }
1135
1199
  }
1200
+ var AttachmentOptionBuilder = CreateAttachmentOption;
1201
+ var BooleanOptionBuilder = CreateBooleanOption;
1202
+ var ChannelOptionBuilder = CreateChannelOption;
1203
+ var CommandOptionBuilder = CreateCommandOption;
1204
+ var ContextMenuCommandBuilder = CreateContextMenuCommand;
1205
+ var IntegerOptionBuilder = CreateIntegerOption;
1206
+ var MentionableOptionBuilder = CreateMentionableOption;
1207
+ var MessageCommandBuilder = CreateMessageCommand;
1208
+ var NumberOptionBuilder = CreateNumberOption;
1209
+ var RoleOptionBuilder = CreateRoleOption;
1210
+ var SlashCommandBuilder = CreateSlashCommand;
1211
+ var StringOptionBuilder = CreateStringOption;
1212
+ var SubcommandBuilder = CreateSubcommand;
1213
+ var SubcommandGroupBuilder = CreateSubcommandGroup;
1214
+ var UserCommandBuilder = CreateUserCommand;
1215
+ var UserOptionBuilder = CreateUserOption;
1216
+ var ApplicationCommandOptionType = ApplicationCommandOptionEnum;
1136
1217
  // packages/builders/src/attachment.ts
1137
1218
  import { readFile } from "fs/promises";
1138
1219
  import { basename } from "path";
1139
1220
 
1140
- class AttachmentBuilder {
1221
+ class CreateAttachment {
1141
1222
  name;
1142
1223
  description;
1143
1224
  file;
@@ -1181,20 +1262,61 @@ class AttachmentBuilder {
1181
1262
  throw new TypeError("Attachment file must be a supported binary value or file path.");
1182
1263
  }
1183
1264
  }
1265
+ var AttachmentBuilder = CreateAttachment;
1184
1266
  export {
1185
1267
  ActionRowBuilder,
1268
+ ApplicationCommandOptionEnum,
1186
1269
  ApplicationCommandOptionType,
1187
1270
  AttachmentBuilder,
1188
1271
  AttachmentOptionBuilder,
1189
1272
  BooleanOptionBuilder,
1190
1273
  ButtonBuilder,
1191
1274
  ButtonStyle,
1275
+ ButtonType,
1192
1276
  ChannelOptionBuilder,
1193
1277
  ChannelSelectMenuBuilder,
1278
+ CommandOptionBuilder,
1279
+ ComponentEnum,
1194
1280
  ComponentType,
1195
1281
  ContainerBuilder,
1196
1282
  ContentInventoryEntryBuilder,
1197
1283
  ContextMenuCommandBuilder,
1284
+ CreateActionRow,
1285
+ CreateAttachment,
1286
+ CreateAttachmentOption,
1287
+ CreateBooleanOption,
1288
+ CreateButton,
1289
+ CreateChannelOption,
1290
+ CreateChannelSelectMenu,
1291
+ CreateContainer,
1292
+ CreateContentInventoryEntry,
1293
+ CreateContextMenuCommand,
1294
+ CreateEmbed,
1295
+ CreateEntitySelect,
1296
+ CreateFileComponent,
1297
+ CreateIntegerOption,
1298
+ CreateMediaGallery,
1299
+ CreateMentionableOption,
1300
+ CreateMentionableSelectMenu,
1301
+ CreateMessageCommand,
1302
+ CreateModal,
1303
+ CreateNumberOption,
1304
+ CreateRoleOption,
1305
+ CreateRoleSelectMenu,
1306
+ CreateSection,
1307
+ CreateSeparator,
1308
+ CreateSlashCommand,
1309
+ CreateStringOption,
1310
+ CreateStringSelect,
1311
+ CreateStringSelect as CreateStringSelectMenu,
1312
+ CreateSubcommand,
1313
+ CreateSubcommandGroup,
1314
+ CreateTextDisplay,
1315
+ CreateTextInput,
1316
+ CreateThumbnail,
1317
+ CreateUserCommand,
1318
+ CreateUserOption,
1319
+ CreateUserSelectMenu,
1198
1320
  EmbedBuilder,
1199
1321
  EntitySelectBuilder,
1200
1322
  FileComponentBuilder,
@@ -1212,16 +1334,18 @@ export {
1212
1334
  SlashCommandBuilder,
1213
1335
  StringOptionBuilder,
1214
1336
  StringSelectBuilder,
1215
- StringSelectBuilder as StringSelectMenuBuilder,
1337
+ StringSelectMenuBuilder,
1216
1338
  SubcommandBuilder,
1217
1339
  SubcommandGroupBuilder,
1218
1340
  TextDisplayBuilder,
1219
1341
  TextInputBuilder,
1220
1342
  TextInputStyle,
1343
+ TextInputType,
1221
1344
  ThumbnailBuilder,
1222
1345
  UserCommandBuilder,
1223
1346
  UserOptionBuilder,
1224
- UserSelectMenuBuilder
1347
+ UserSelectMenuBuilder,
1348
+ componentsV2Message
1225
1349
  };
1226
1350
 
1227
- //# debugId=91BF5BFA3419A2E364756E2164756E21
1351
+ //# debugId=E27BC2383A77150B64756E2164756E21