@impulsedev/chameleon 3.5.0 → 3.7.0

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.js CHANGED
@@ -1,10 +1,16 @@
1
1
  import {
2
2
  ActionRowBuilder,
3
+ AttachmentFlag,
3
4
  ButtonBuilder,
4
5
  ButtonStyle,
5
6
  Colors,
6
7
  ComponentType,
7
8
  EmbedBuilder,
9
+ EmbedType,
10
+ MessageActivityType,
11
+ MessageFlag,
12
+ MessageReferenceType,
13
+ MessageType,
8
14
  ModalBuilder,
9
15
  SelectMenuBuilder,
10
16
  TextInputBuilder,
@@ -33,7 +39,7 @@ import {
33
39
  serializeComponent,
34
40
  toCamelCase,
35
41
  toSnakeCase
36
- } from "./chunk-G4SUOXGV.js";
42
+ } from "./chunk-CGH3AKKX.js";
37
43
 
38
44
  // src/types/user/index.ts
39
45
  var UserFlag = {
@@ -153,88 +159,6 @@ var ForumLayoutType = {
153
159
  GALLERY_VIEW: 2
154
160
  };
155
161
 
156
- // src/types/message/index.ts
157
- var MessageType = {
158
- DEFAULT: 0,
159
- RECIPIENT_ADD: 1,
160
- RECIPIENT_REMOVE: 2,
161
- CALL: 3,
162
- CHANNEL_NAME_CHANGE: 4,
163
- CHANNEL_ICON_CHANGE: 5,
164
- CHANNEL_PINNED_MESSAGE: 6,
165
- USER_JOIN: 7,
166
- GUILD_BOOST: 8,
167
- GUILD_BOOST_TIER_1: 9,
168
- GUILD_BOOST_TIER_2: 10,
169
- GUILD_BOOST_TIER_3: 11,
170
- CHANNEL_FOLLOW_ADD: 12,
171
- GUILD_DISCOVERY_DISQUALIFIED: 14,
172
- GUILD_DISCOVERY_REQUALIFIED: 15,
173
- GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING: 16,
174
- GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING: 17,
175
- THREAD_CREATED: 18,
176
- REPLY: 19,
177
- CHAT_INPUT_COMMAND: 20,
178
- THREAD_STARTER_MESSAGE: 21,
179
- GUILD_INVITE_REMINDER: 22,
180
- CONTEXT_MENU_COMMAND: 23,
181
- AUTO_MODERATION_ACTION: 24,
182
- ROLE_SUBSCRIPTION_PURCHASE: 25,
183
- INTERACTION_PREMIUM_UPSELL: 26,
184
- STAGE_START: 27,
185
- STAGE_END: 28,
186
- STAGE_SPEAKER: 29,
187
- STAGE_TOPIC: 31,
188
- GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: 32,
189
- GUILD_INCIDENT_ALERT_MODE_ENABLED: 36,
190
- GUILD_INCIDENT_ALERT_MODE_DISABLED: 37,
191
- GUILD_INCIDENT_REPORT_RAID: 38,
192
- GUILD_INCIDENT_REPORT_FALSE_ALARM: 39,
193
- PURCHASE_NOTIFICATION: 44,
194
- POLL_RESULT: 46
195
- };
196
- var MessageActivityType = {
197
- JOIN: 1,
198
- SPECTATE: 2,
199
- LISTEN: 3,
200
- JOIN_REQUEST: 5
201
- };
202
- var MessageFlag = {
203
- CROSSPOSTED: 1 << 0,
204
- IS_CROSSPOST: 1 << 1,
205
- SUPPRESS_EMBEDS: 1 << 2,
206
- SOURCE_MESSAGE_DELETED: 1 << 3,
207
- URGENT: 1 << 4,
208
- HAS_THREAD: 1 << 5,
209
- EPHEMERAL: 1 << 6,
210
- LOADING: 1 << 7,
211
- FAILED_TO_MENTION_SOME_ROLES_IN_THREAD: 1 << 8,
212
- SUPPRESS_NOTIFICATIONS: 1 << 12,
213
- IS_VOICE_MESSAGE: 1 << 13,
214
- HAS_SNAPSHOT: 1 << 14,
215
- IS_COMPONENTS_V2: 1 << 15
216
- };
217
- var MessageReferenceType = {
218
- DEFAULT: 0,
219
- FORWARD: 1
220
- };
221
- var EmbedType = {
222
- RICH: "rich",
223
- IMAGE: "image",
224
- VIDEO: "video",
225
- GIFV: "gifv",
226
- ARTICLE: "article",
227
- LINK: "link",
228
- POLL_RESULT: "poll_result"
229
- };
230
- var AttachmentFlag = {
231
- IS_CLIP: 1 << 0,
232
- IS_THUMBNAIL: 1 << 1,
233
- IS_REMIX: 1 << 2,
234
- IS_SPOILER: 1 << 3,
235
- IS_ANIMATED: 1 << 5
236
- };
237
-
238
162
  // src/types/application/index.ts
239
163
  var ApplicationFlag = {
240
164
  APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE: 1 << 6,
@@ -887,6 +811,7 @@ var ChameleonREST = class {
887
811
  ok: false,
888
812
  status: response.status,
889
813
  ...typeof errData?.code === "number" ? { code: errData.code } : {},
814
+ error: typeof errData?.message === "string" ? errData.message : response.statusText,
890
815
  message: typeof errData?.message === "string" ? errData.message : response.statusText,
891
816
  raw: data
892
817
  };
@@ -894,6 +819,7 @@ var ChameleonREST = class {
894
819
  return {
895
820
  ok: false,
896
821
  status: 0,
822
+ error: error instanceof Error ? error.message : "Unknown network error",
897
823
  message: error instanceof Error ? error.message : "Unknown network error"
898
824
  };
899
825
  }
@@ -958,6 +884,7 @@ var ChameleonREST = class {
958
884
  ok: false,
959
885
  status: response.status,
960
886
  ...typeof errData?.code === "number" ? { code: errData.code } : {},
887
+ error: typeof errData?.message === "string" ? errData.message : response.statusText,
961
888
  message: typeof errData?.message === "string" ? errData.message : response.statusText,
962
889
  raw: data
963
890
  };
@@ -965,6 +892,7 @@ var ChameleonREST = class {
965
892
  return {
966
893
  ok: false,
967
894
  status: 0,
895
+ error: error instanceof Error ? error.message : "Unknown network error",
968
896
  message: error instanceof Error ? error.message : "Unknown network error"
969
897
  };
970
898
  }
@@ -1338,7 +1266,7 @@ var ChameleonGateway = class {
1338
1266
  // package.json
1339
1267
  var package_default = {
1340
1268
  name: "@impulsedev/chameleon",
1341
- version: "3.0.0",
1269
+ version: "3.6.0",
1342
1270
  description: "highly optimized, memory-efficient, and fully type-safe Discord API library",
1343
1271
  main: "dist/index.js",
1344
1272
  types: "dist/index.d.ts",
@@ -1414,6 +1342,12 @@ var CHAMELEON_VERSION = package_default.version;
1414
1342
  var CHAMELEON = package_default.name;
1415
1343
 
1416
1344
  // src/commands/options.ts
1345
+ function choice(name, value) {
1346
+ return { name, value };
1347
+ }
1348
+ function choices(...items) {
1349
+ return items;
1350
+ }
1417
1351
  var opt = {
1418
1352
  string: (description, options) => ({
1419
1353
  type: "string",
@@ -1446,12 +1380,317 @@ var opt = {
1446
1380
  channel: (description, options) => ({
1447
1381
  type: "channel",
1448
1382
  description,
1449
- required: options?.required ?? false
1383
+ required: options?.required ?? false,
1384
+ ...options
1450
1385
  }),
1451
1386
  role: (description, options) => ({
1452
1387
  type: "role",
1453
1388
  description,
1454
1389
  required: options?.required ?? false
1390
+ }),
1391
+ mentionable: (description, options) => ({
1392
+ type: "mentionable",
1393
+ description,
1394
+ required: options?.required ?? false
1395
+ }),
1396
+ attachment: (description, options) => ({
1397
+ type: "attachment",
1398
+ description,
1399
+ required: options?.required ?? false
1400
+ })
1401
+ };
1402
+
1403
+ // src/components/define.ts
1404
+ function resolveButtonStyle(style) {
1405
+ if (typeof style === "number") return style;
1406
+ const map = { primary: 1, secondary: 2, success: 3, danger: 4, link: 5, premium: 6 };
1407
+ return map[style] ?? 1;
1408
+ }
1409
+ function defineButton(def) {
1410
+ return { ...def, type: "button" };
1411
+ }
1412
+ var Button = {
1413
+ /** Build a reusable button definition that can be used in both V1 action rows and V2 accessories */
1414
+ of: (def) => defineButton(def),
1415
+ /** @param customId Component custom ID sent back in the interaction payload @param label Visible button text */
1416
+ primary: (customId, label) => defineButton({ customId, label, style: "primary" }),
1417
+ /** @param customId Component custom ID sent back in the interaction payload @param label Visible button text */
1418
+ secondary: (customId, label) => defineButton({ customId, label, style: "secondary" }),
1419
+ /** @param customId Component custom ID sent back in the interaction payload @param label Visible button text */
1420
+ success: (customId, label) => defineButton({ customId, label, style: "success" }),
1421
+ /** @param customId Component custom ID sent back in the interaction payload @param label Visible button text */
1422
+ danger: (customId, label) => defineButton({ customId, label, style: "danger" }),
1423
+ /** @param url Destination URL opened by the button @param label Visible button text */
1424
+ link: (url, label) => defineButton({ url, label, style: "link" }),
1425
+ /** @param skuId Premium SKU ID used by Discord premium buttons @param label Visible button text */
1426
+ premium: (skuId, label) => defineButton({ skuId, label, style: "premium" })
1427
+ };
1428
+ function defineStringSelect(def) {
1429
+ return { ...def, type: "string_select" };
1430
+ }
1431
+ function defineUserSelect(def) {
1432
+ return { ...def, type: "user_select" };
1433
+ }
1434
+ function defineRoleSelect(def) {
1435
+ return { ...def, type: "role_select" };
1436
+ }
1437
+ function defineChannelSelect(def) {
1438
+ return { ...def, type: "channel_select" };
1439
+ }
1440
+ function defineMentionableSelect(def) {
1441
+ return { ...def, type: "mentionable_select" };
1442
+ }
1443
+ var field = {
1444
+ /**
1445
+ * Create a single-line text input field for a modal
1446
+ * @param id Field ID used as the key inside `ctx.fields`
1447
+ * @param label Visible field label shown in the modal
1448
+ * @param options Extra validation and UX settings for the text input
1449
+ */
1450
+ short: (id, label, options) => ({
1451
+ id,
1452
+ type: 1 /* SHORT */,
1453
+ label,
1454
+ required: options?.required ?? true,
1455
+ ...options
1456
+ }),
1457
+ /**
1458
+ * Create a multi-line text input field for a modal
1459
+ * @param id Field ID used as the key inside `ctx.fields`
1460
+ * @param label Visible field label shown in the modal
1461
+ * @param options Extra validation and UX settings for the paragraph input
1462
+ */
1463
+ paragraph: (id, label, options) => ({
1464
+ id,
1465
+ type: 2 /* PARAGRAPH */,
1466
+ label,
1467
+ required: options?.required ?? true,
1468
+ ...options
1469
+ }),
1470
+ /**
1471
+ * Create a boolean checkbox field for a modal
1472
+ * @param id Field ID used as the key inside `ctx.fields`
1473
+ * @param label Visible field label shown in the modal
1474
+ * @param options Checkbox settings such as `required` and default `value`
1475
+ */
1476
+ checkbox: (id, label, options) => ({
1477
+ id,
1478
+ type: 23,
1479
+ label,
1480
+ required: options?.required ?? true,
1481
+ ...options
1482
+ }),
1483
+ /**
1484
+ * Create a multi-select checkbox group field for a modal
1485
+ * @param id Field ID used as the key inside `ctx.fields`
1486
+ * @param label Visible field label shown in the modal
1487
+ * @param options Available choices and selection limits
1488
+ */
1489
+ checkboxGroup: (id, label, options) => ({
1490
+ id,
1491
+ type: 22,
1492
+ label,
1493
+ required: options?.required ?? true,
1494
+ ...options
1495
+ }),
1496
+ /**
1497
+ * Create a single-choice radio group field for a modal
1498
+ * @param id Field ID used as the key inside `ctx.fields`
1499
+ * @param label Visible field label shown in the modal
1500
+ * @param options Available choices for the radio group
1501
+ */
1502
+ radioGroup: (id, label, options) => ({
1503
+ id,
1504
+ type: 21,
1505
+ label,
1506
+ required: options?.required ?? true,
1507
+ ...options
1508
+ }),
1509
+ /**
1510
+ * Create a file upload field for a modal
1511
+ * Submitted files are available in `ctx.attachments[id]`
1512
+ * @param id Field ID used as the key inside `ctx.fields` and `ctx.attachments`
1513
+ * @param label Visible field label shown in the modal
1514
+ * @param options Upload field settings such as `required`
1515
+ */
1516
+ fileUpload: (id, label, options) => ({
1517
+ id,
1518
+ type: 19,
1519
+ label,
1520
+ required: options?.required ?? true,
1521
+ ...options
1522
+ })
1523
+ };
1524
+ function defineModal(def) {
1525
+ return { ...def, type: "modal" };
1526
+ }
1527
+ var ModalDefinitionBuilder = class _ModalDefinitionBuilder {
1528
+ constructor(customId, title, fieldsDef = []) {
1529
+ this.customId = customId;
1530
+ this.title = title;
1531
+ this.fieldsDef = fieldsDef;
1532
+ }
1533
+ customId;
1534
+ title;
1535
+ fieldsDef;
1536
+ /**
1537
+ * Append one or more fields to the modal definition
1538
+ * The resulting builder keeps full type information, so added field IDs become available in `ctx.fields`
1539
+ * @param fields Fields to add to the modal
1540
+ */
1541
+ add(...fields) {
1542
+ return new _ModalDefinitionBuilder(
1543
+ this.customId,
1544
+ this.title,
1545
+ [...this.fieldsDef, ...fields]
1546
+ );
1547
+ }
1548
+ /**
1549
+ * Finalize the modal definition and attach its submit handler
1550
+ * The handler receives a strongly-typed `ctx.fields` object derived from the fields added to this builder
1551
+ * @param execute Modal submit handler
1552
+ */
1553
+ execute(execute) {
1554
+ return defineModal({
1555
+ customId: this.customId,
1556
+ title: this.title,
1557
+ fields: this.fieldsDef,
1558
+ execute
1559
+ });
1560
+ }
1561
+ handle(execute) {
1562
+ return this.execute(execute);
1563
+ }
1564
+ };
1565
+ function modal(customId, title) {
1566
+ return new ModalDefinitionBuilder(customId, title);
1567
+ }
1568
+
1569
+ // src/components/v2.ts
1570
+ function serializeV2Button(button) {
1571
+ const obj = {
1572
+ type: 2 /* BUTTON */,
1573
+ custom_id: button.customId,
1574
+ url: button.url,
1575
+ label: button.label,
1576
+ style: resolveButtonStyle(button.style),
1577
+ disabled: button.disabled,
1578
+ emoji: button.emoji,
1579
+ sku_id: button.skuId
1580
+ };
1581
+ return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0));
1582
+ }
1583
+ function normalizeV2Component(component) {
1584
+ if (component && typeof component === "object" && "type" in component && component.type === "button") {
1585
+ return serializeV2Button(component);
1586
+ }
1587
+ if (component && typeof component.toJSON === "function") {
1588
+ return component.toJSON();
1589
+ }
1590
+ return component;
1591
+ }
1592
+ function serializeModalFieldComponent(field2) {
1593
+ return {
1594
+ type: field2.type === 1 /* SHORT */ || field2.type === 2 /* PARAGRAPH */ ? 4 /* TEXT_INPUT */ : field2.type,
1595
+ custom_id: field2.id,
1596
+ required: field2.required,
1597
+ style: field2.type === 1 /* SHORT */ || field2.type === 2 /* PARAGRAPH */ ? field2.type : void 0,
1598
+ min_length: field2.minLength,
1599
+ max_length: field2.maxLength,
1600
+ placeholder: field2.placeholder,
1601
+ value: field2.value,
1602
+ options: field2.options,
1603
+ min_values: field2.minValues,
1604
+ max_values: field2.maxValues
1605
+ };
1606
+ }
1607
+ var SectionBuilder = class {
1608
+ data;
1609
+ constructor(components, accessory) {
1610
+ this.data = {
1611
+ type: 9 /* SECTION */,
1612
+ components
1613
+ };
1614
+ if (accessory) {
1615
+ this.data.accessory = accessory;
1616
+ }
1617
+ }
1618
+ accessory(accessory) {
1619
+ this.data.accessory = accessory;
1620
+ return this;
1621
+ }
1622
+ toJSON() {
1623
+ return {
1624
+ ...this.data,
1625
+ components: this.data.components.map((component) => normalizeV2Component(component)),
1626
+ ...this.data.accessory ? { accessory: normalizeV2Component(this.data.accessory) } : {}
1627
+ };
1628
+ }
1629
+ };
1630
+ var TextDisplay = {
1631
+ of: (content) => ({
1632
+ type: 10 /* TEXT_DISPLAY */,
1633
+ content
1634
+ })
1635
+ };
1636
+ var Thumbnail = {
1637
+ of: (url, description, spoiler) => ({
1638
+ type: 11 /* THUMBNAIL */,
1639
+ media: { url },
1640
+ description,
1641
+ spoiler
1642
+ })
1643
+ };
1644
+ var Separator = {
1645
+ of: (spacing, divider) => ({
1646
+ type: 14 /* SEPARATOR */,
1647
+ spacing,
1648
+ divider
1649
+ })
1650
+ };
1651
+ var Section = {
1652
+ /**
1653
+ * Section builder
1654
+ * @param components Child components rendered inside the section body
1655
+ * @param accessory Optional accessory rendered on the side of the section
1656
+ */
1657
+ of: (components, accessory) => {
1658
+ return new SectionBuilder(components, accessory);
1659
+ },
1660
+ /** @param content Text rendered as a single TextDisplay inside the section */
1661
+ text: (content) => {
1662
+ return Section.of([TextDisplay.of(content)]);
1663
+ }
1664
+ };
1665
+ var Container = {
1666
+ /**
1667
+ * Container builder
1668
+ * @param components Child components rendered inside the container
1669
+ * @param spoiler Whether the container should be hidden behind a spoiler
1670
+ */
1671
+ of: (components, spoiler) => {
1672
+ const obj = {
1673
+ type: 17 /* CONTAINER */,
1674
+ components
1675
+ };
1676
+ if (spoiler !== void 0) {
1677
+ obj.spoiler = spoiler;
1678
+ }
1679
+ return obj;
1680
+ },
1681
+ /** Helper for stacking V2 components vertically without manually creating an array */
1682
+ stack: (...components) => {
1683
+ return Container.of(components);
1684
+ }
1685
+ };
1686
+ var Label = {
1687
+ /** Wrap a modal field component in a V2 label container */
1688
+ of: (field2) => ({
1689
+ type: 18 /* LABEL */,
1690
+ label: field2.label,
1691
+ component: Object.fromEntries(
1692
+ Object.entries(serializeModalFieldComponent(field2)).filter(([, value]) => value !== void 0)
1693
+ )
1455
1694
  })
1456
1695
  };
1457
1696
 
@@ -1473,16 +1712,27 @@ var BaseInteractionContext = class {
1473
1712
  this.guild = guild;
1474
1713
  this.channel = channel;
1475
1714
  }
1715
+ get client() {
1716
+ return this._client;
1717
+ }
1476
1718
  get replied() {
1477
1719
  return this._replied;
1478
1720
  }
1479
1721
  get deferred() {
1480
1722
  return this._deferred;
1481
1723
  }
1724
+ _assertOk(result, action) {
1725
+ if (result.ok) return;
1726
+ const details = result.message ? `: ${result.message}` : "";
1727
+ const raw = result.raw !== void 0 ? ` | raw=${JSON.stringify(result.raw)}` : "";
1728
+ throw new Error(`Discord rejected interaction ${action}${details}${raw}`);
1729
+ }
1482
1730
  _resolvePayload(payload) {
1483
1731
  const data = typeof payload === "string" ? { content: payload } : { ...payload };
1484
1732
  if (typeof payload === "object") {
1485
- if (payload.ephemeral) data.flags = MESSAGE_FLAGS.EPHEMERAL;
1733
+ if (payload.flags !== void 0 || payload.ephemeral) {
1734
+ data.flags = (payload.flags ?? 0) | (payload.ephemeral ? MESSAGE_FLAGS.EPHEMERAL : 0);
1735
+ }
1486
1736
  if (payload.embeds) {
1487
1737
  data.embeds = payload.embeds.map((e) => {
1488
1738
  if (e && typeof e.toJSON === "function") {
@@ -1497,52 +1747,46 @@ var BaseInteractionContext = class {
1497
1747
  }
1498
1748
  return data;
1499
1749
  }
1750
+ _serializeModalField(field2) {
1751
+ return Label.of(field2);
1752
+ }
1500
1753
  async reply(payload) {
1501
1754
  if (this._replied || this._deferred) throw new Error("Interaction already acknowledged.");
1502
1755
  const data = this._resolvePayload(payload);
1503
- await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1756
+ const result = await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1504
1757
  type: 4 /* CHANNEL_MESSAGE_WITH_SOURCE */,
1505
1758
  data
1506
1759
  });
1760
+ this._assertOk(result, "reply");
1507
1761
  this._replied = true;
1508
1762
  }
1509
1763
  async defer(options) {
1510
1764
  if (this._replied || this._deferred) throw new Error("Interaction already acknowledged.");
1511
- await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1765
+ const result = await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1512
1766
  type: 5 /* DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE */,
1513
1767
  data: { flags: options?.ephemeral ? MESSAGE_FLAGS.EPHEMERAL : 0 }
1514
1768
  });
1769
+ this._assertOk(result, "defer");
1515
1770
  this._deferred = true;
1516
1771
  }
1517
1772
  async followUp(payload) {
1518
1773
  if (!this._deferred && !this._replied) throw new Error("Interaction not acknowledged.");
1519
1774
  const data = this._resolvePayload(payload);
1520
- await this._client.rest.post(`/webhooks/${this._client.user?.id}/${this.interactionToken}`, data);
1775
+ const result = await this._client.rest.post(`/webhooks/${this._client.user?.id}/${this.interactionToken}`, data);
1776
+ this._assertOk(result, "followUp");
1521
1777
  }
1522
- async showModal(modal) {
1778
+ async showModal(modal2) {
1523
1779
  if (this._replied || this._deferred) throw new Error("Interaction already acknowledged.");
1524
- const payload = modal.type === "modal" ? {
1525
- custom_id: modal.customId,
1526
- title: modal.title,
1527
- components: Array.isArray(modal.fields) ? modal.fields.map((f) => ({
1528
- type: 1 /* ACTION_ROW */,
1529
- components: [{
1530
- type: 4 /* TEXT_INPUT */,
1531
- custom_id: f.id,
1532
- style: f.type,
1533
- label: f.label,
1534
- required: f.required,
1535
- min_length: f.minLength,
1536
- max_length: f.maxLength,
1537
- placeholder: f.placeholder,
1538
- value: f.value
1539
- }]
1540
- })) : []
1541
- } : modal;
1542
- await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1780
+ const payload = modal2.type === "modal" ? {
1781
+ custom_id: modal2.customId,
1782
+ title: modal2.title,
1783
+ components: Array.isArray(modal2.fields) ? modal2.fields.map((f) => this._serializeModalField(f)) : []
1784
+ } : modal2;
1785
+ const result = await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1543
1786
  type: 9 /* MODAL */,
1544
1787
  data: payload
1545
1788
  });
1789
+ this._assertOk(result, "showModal");
1546
1790
  this._replied = true;
1547
1791
  }
1548
1792
  };
@@ -1554,32 +1798,457 @@ var CommandContext = class extends BaseInteractionContext {
1554
1798
  }
1555
1799
  };
1556
1800
 
1801
+ // src/utils/bitfield.ts
1802
+ var BitField = class _BitField {
1803
+ static FLAGS = {};
1804
+ bitfield;
1805
+ constructor(bits = 0n) {
1806
+ this.bitfield = this.constructor.resolve(bits);
1807
+ }
1808
+ has(bit) {
1809
+ const resolved = this.constructor.resolve(bit);
1810
+ return (this.bitfield & resolved) === resolved;
1811
+ }
1812
+ any(bit) {
1813
+ const resolved = this.constructor.resolve(bit);
1814
+ return (this.bitfield & resolved) !== 0n;
1815
+ }
1816
+ add(...bits) {
1817
+ let total = 0n;
1818
+ for (const bit of bits) {
1819
+ total |= this.constructor.resolve(bit);
1820
+ }
1821
+ this.bitfield |= total;
1822
+ return this;
1823
+ }
1824
+ remove(...bits) {
1825
+ let total = 0n;
1826
+ for (const bit of bits) {
1827
+ total |= this.constructor.resolve(bit);
1828
+ }
1829
+ this.bitfield &= ~total;
1830
+ return this;
1831
+ }
1832
+ toArray() {
1833
+ const flags = this.constructor.FLAGS;
1834
+ return Object.keys(flags).filter((flag) => this.has(flags[flag]));
1835
+ }
1836
+ serialize() {
1837
+ const flags = this.constructor.FLAGS;
1838
+ const result = {};
1839
+ for (const [flag, value] of Object.entries(flags)) {
1840
+ result[flag] = this.has(value);
1841
+ }
1842
+ return result;
1843
+ }
1844
+ equals(other) {
1845
+ return this.bitfield === this.constructor.resolve(other);
1846
+ }
1847
+ freeze() {
1848
+ return Object.freeze(this);
1849
+ }
1850
+ toString() {
1851
+ return this.bitfield.toString();
1852
+ }
1853
+ toJSON() {
1854
+ return this.toString();
1855
+ }
1856
+ static resolve(bit) {
1857
+ if (typeof bit === "bigint") return bit;
1858
+ if (typeof bit === "number") return BigInt(bit);
1859
+ if (bit instanceof _BitField) return bit.bitfield;
1860
+ if (typeof bit === "string") {
1861
+ const flag = this.FLAGS[bit];
1862
+ if (flag !== void 0) return flag;
1863
+ const parsed = BigInt(bit);
1864
+ return parsed;
1865
+ }
1866
+ if (Array.isArray(bit)) {
1867
+ return bit.reduce((acc, b) => acc | this.resolve(b), 0n);
1868
+ }
1869
+ throw new TypeError(`Cannot resolve BitField from: ${bit}`);
1870
+ }
1871
+ };
1872
+
1873
+ // src/types/permissions.ts
1874
+ var PermissionsBitField = class _PermissionsBitField extends BitField {
1875
+ static FLAGS = { ...DISCORD_PERMISSIONS };
1876
+ static ALL = Object.values(DISCORD_PERMISSIONS).reduce((a, b) => a | b, 0n);
1877
+ get isAdmin() {
1878
+ return this.has("ADMINISTRATOR");
1879
+ }
1880
+ static from(bits) {
1881
+ return new _PermissionsBitField(bits);
1882
+ }
1883
+ };
1884
+ var UserFlagsBitField = class extends BitField {
1885
+ static FLAGS = {
1886
+ STAFF: 1n << 0n,
1887
+ PARTNER: 1n << 1n,
1888
+ HYPESQUAD: 1n << 2n,
1889
+ BUG_HUNTER_LEVEL_1: 1n << 3n,
1890
+ HYPESQUAD_ONLINE_HOUSE_1: 1n << 6n,
1891
+ HYPESQUAD_ONLINE_HOUSE_2: 1n << 7n,
1892
+ HYPESQUAD_ONLINE_HOUSE_3: 1n << 8n,
1893
+ PREMIUM_EARLY_SUPPORTER: 1n << 9n,
1894
+ TEAM_PSEUDO_USER: 1n << 10n,
1895
+ BUG_HUNTER_LEVEL_2: 1n << 14n,
1896
+ VERIFIED_BOT: 1n << 16n,
1897
+ VERIFIED_DEVELOPER: 1n << 17n,
1898
+ CERTIFIED_MODERATOR: 1n << 18n,
1899
+ BOT_HTTP_INTERACTIONS: 1n << 19n,
1900
+ ACTIVE_DEVELOPER: 1n << 22n
1901
+ };
1902
+ };
1903
+ var IntentsBitField = class extends BitField {
1904
+ static FLAGS = {
1905
+ Guilds: 1n << 0n,
1906
+ GuildMembers: 1n << 1n,
1907
+ GuildModeration: 1n << 2n,
1908
+ GuildEmojisAndStickers: 1n << 3n,
1909
+ GuildIntegrations: 1n << 4n,
1910
+ GuildWebhooks: 1n << 5n,
1911
+ GuildInvites: 1n << 6n,
1912
+ GuildVoiceStates: 1n << 7n,
1913
+ GuildPresences: 1n << 8n,
1914
+ GuildMessages: 1n << 9n,
1915
+ GuildMessageReactions: 1n << 10n,
1916
+ GuildMessageTyping: 1n << 11n,
1917
+ DirectMessages: 1n << 12n,
1918
+ DirectMessageReactions: 1n << 13n,
1919
+ DirectMessageTyping: 1n << 14n,
1920
+ MessageContent: 1n << 15n,
1921
+ GuildScheduledEvents: 1n << 16n,
1922
+ AutoModerationConfiguration: 1n << 20n,
1923
+ AutoModerationExecution: 1n << 21n,
1924
+ GuildMessagePolls: 1n << 24n,
1925
+ DirectMessagePolls: 1n << 25n
1926
+ };
1927
+ };
1928
+ function computeBasePermissions(member, guild) {
1929
+ if (member.roles === void 0) return 0n;
1930
+ const userId = member.user?.id;
1931
+ if (userId && userId === guild.ownerId) return PermissionsBitField.ALL;
1932
+ const everyoneRole = guild.roles.find((r) => r.id === guild.id);
1933
+ let permissions = everyoneRole ? BigInt(everyoneRole.permissions) : 0n;
1934
+ for (const roleId of member.roles) {
1935
+ const role = guild.roles.find((r) => r.id === roleId);
1936
+ if (role) permissions |= BigInt(role.permissions);
1937
+ }
1938
+ if ((permissions & DISCORD_PERMISSIONS.ADMINISTRATOR) === DISCORD_PERMISSIONS.ADMINISTRATOR) {
1939
+ return PermissionsBitField.ALL;
1940
+ }
1941
+ return permissions;
1942
+ }
1943
+ function computeChannelPermissions(basePermissions, overwrites, memberRoles, memberId) {
1944
+ if ((basePermissions & DISCORD_PERMISSIONS.ADMINISTRATOR) === DISCORD_PERMISSIONS.ADMINISTRATOR) {
1945
+ return PermissionsBitField.ALL;
1946
+ }
1947
+ let permissions = basePermissions;
1948
+ let allow = 0n;
1949
+ let deny = 0n;
1950
+ for (const overwrite of overwrites) {
1951
+ if (overwrite.type === 0) {
1952
+ if (memberRoles.includes(overwrite.id) || overwrites.indexOf(overwrite) === 0) {
1953
+ if (overwrites.indexOf(overwrite) === 0 && !memberRoles.includes(overwrite.id)) {
1954
+ permissions &= ~BigInt(overwrite.deny);
1955
+ permissions |= BigInt(overwrite.allow);
1956
+ } else {
1957
+ allow |= BigInt(overwrite.allow);
1958
+ deny |= BigInt(overwrite.deny);
1959
+ }
1960
+ }
1961
+ }
1962
+ }
1963
+ permissions &= ~deny;
1964
+ permissions |= allow;
1965
+ if (memberId) {
1966
+ const memberOverwrite = overwrites.find((ow) => ow.type === 1 && ow.id === memberId);
1967
+ if (memberOverwrite) {
1968
+ permissions &= ~BigInt(memberOverwrite.deny);
1969
+ permissions |= BigInt(memberOverwrite.allow);
1970
+ }
1971
+ }
1972
+ return permissions;
1973
+ }
1974
+
1557
1975
  // src/commands/command.ts
1558
1976
  function defineSubcommand(def) {
1559
1977
  return def;
1560
1978
  }
1979
+ function defineSubcommandGroup(def) {
1980
+ return def;
1981
+ }
1561
1982
  function defineCommand(def) {
1562
1983
  if (!def.execute && (!def.subcommands || Object.keys(def.subcommands).length === 0)) {
1563
1984
  throw new Error(`Command ${def.name} must have an execute function or subcommands.`);
1564
1985
  }
1565
1986
  return def;
1566
1987
  }
1988
+ function appendOption(optionsDef, name, definition) {
1989
+ return {
1990
+ ...optionsDef ?? {},
1991
+ [name]: definition
1992
+ };
1993
+ }
1994
+ function normalizeChoicesOptions(choicesOrOptions, maybeOptions) {
1995
+ if (Array.isArray(choicesOrOptions)) {
1996
+ return {
1997
+ ...maybeOptions ?? {},
1998
+ choices: choicesOrOptions
1999
+ };
2000
+ }
2001
+ if (choicesOrOptions) {
2002
+ return choicesOrOptions;
2003
+ }
2004
+ return void 0;
2005
+ }
2006
+ var SubcommandDefinitionBuilder = class _SubcommandDefinitionBuilder {
2007
+ constructor(description, optionsDef) {
2008
+ this.description = description;
2009
+ this.optionsDef = optionsDef;
2010
+ }
2011
+ description;
2012
+ optionsDef;
2013
+ options(options) {
2014
+ return new _SubcommandDefinitionBuilder(this.description, options);
2015
+ }
2016
+ option(name, definition) {
2017
+ return new _SubcommandDefinitionBuilder(
2018
+ this.description,
2019
+ appendOption(this.optionsDef, name, definition)
2020
+ );
2021
+ }
2022
+ string(name, description, choicesOrOptions, maybeOptions) {
2023
+ return this.option(name, opt.string(description, normalizeChoicesOptions(choicesOrOptions, maybeOptions)));
2024
+ }
2025
+ integer(name, description, choicesOrOptions, maybeOptions) {
2026
+ return this.option(name, opt.integer(description, normalizeChoicesOptions(choicesOrOptions, maybeOptions)));
2027
+ }
2028
+ number(name, description, choicesOrOptions, maybeOptions) {
2029
+ return this.option(name, opt.number(description, normalizeChoicesOptions(choicesOrOptions, maybeOptions)));
2030
+ }
2031
+ boolean(name, description, options) {
2032
+ return this.option(name, opt.boolean(description, options));
2033
+ }
2034
+ user(name, description, options) {
2035
+ return this.option(name, opt.user(description, options));
2036
+ }
2037
+ channel(name, description, options) {
2038
+ return this.option(name, opt.channel(description, options));
2039
+ }
2040
+ role(name, description, options) {
2041
+ return this.option(name, opt.role(description, options));
2042
+ }
2043
+ mentionable(name, description, options) {
2044
+ return this.option(name, opt.mentionable(description, options));
2045
+ }
2046
+ attachment(name, description, options) {
2047
+ return this.option(name, opt.attachment(description, options));
2048
+ }
2049
+ execute(execute) {
2050
+ return defineSubcommand({
2051
+ description: this.description,
2052
+ ...this.optionsDef ? { options: this.optionsDef } : {},
2053
+ execute
2054
+ });
2055
+ }
2056
+ handle(execute) {
2057
+ return this.execute(execute);
2058
+ }
2059
+ };
2060
+ var SubcommandGroupDefinitionBuilder = class _SubcommandGroupDefinitionBuilder {
2061
+ constructor(description, subcommandsDef) {
2062
+ this.description = description;
2063
+ this.subcommandsDef = subcommandsDef;
2064
+ }
2065
+ description;
2066
+ subcommandsDef;
2067
+ subcommands(subcommands) {
2068
+ return new _SubcommandGroupDefinitionBuilder(this.description, subcommands);
2069
+ }
2070
+ subcommand(name, subcommand2) {
2071
+ return new _SubcommandGroupDefinitionBuilder(
2072
+ this.description,
2073
+ {
2074
+ ...this.subcommandsDef ?? {},
2075
+ [name]: subcommand2
2076
+ }
2077
+ );
2078
+ }
2079
+ toGroup() {
2080
+ return defineSubcommandGroup({
2081
+ description: this.description,
2082
+ subcommands: this.subcommandsDef ?? {}
2083
+ });
2084
+ }
2085
+ build() {
2086
+ return this.toGroup();
2087
+ }
2088
+ };
2089
+ var CommandDefinitionBuilder = class _CommandDefinitionBuilder {
2090
+ constructor(name, description, optionsDef, subcommandsDef, metadata = {}) {
2091
+ this.name = name;
2092
+ this.description = description;
2093
+ this.optionsDef = optionsDef;
2094
+ this.subcommandsDef = subcommandsDef;
2095
+ this.metadata = metadata;
2096
+ }
2097
+ name;
2098
+ description;
2099
+ optionsDef;
2100
+ subcommandsDef;
2101
+ metadata;
2102
+ options(options) {
2103
+ return new _CommandDefinitionBuilder(this.name, this.description, options, this.subcommandsDef, this.metadata);
2104
+ }
2105
+ option(name, definition) {
2106
+ return new _CommandDefinitionBuilder(
2107
+ this.name,
2108
+ this.description,
2109
+ appendOption(this.optionsDef, name, definition),
2110
+ this.subcommandsDef,
2111
+ this.metadata
2112
+ );
2113
+ }
2114
+ string(name, description, choicesOrOptions, maybeOptions) {
2115
+ return this.option(name, opt.string(description, normalizeChoicesOptions(choicesOrOptions, maybeOptions)));
2116
+ }
2117
+ integer(name, description, choicesOrOptions, maybeOptions) {
2118
+ return this.option(name, opt.integer(description, normalizeChoicesOptions(choicesOrOptions, maybeOptions)));
2119
+ }
2120
+ number(name, description, choicesOrOptions, maybeOptions) {
2121
+ return this.option(name, opt.number(description, normalizeChoicesOptions(choicesOrOptions, maybeOptions)));
2122
+ }
2123
+ boolean(name, description, options) {
2124
+ return this.option(name, opt.boolean(description, options));
2125
+ }
2126
+ user(name, description, options) {
2127
+ return this.option(name, opt.user(description, options));
2128
+ }
2129
+ channel(name, description, options) {
2130
+ return this.option(name, opt.channel(description, options));
2131
+ }
2132
+ role(name, description, options) {
2133
+ return this.option(name, opt.role(description, options));
2134
+ }
2135
+ mentionable(name, description, options) {
2136
+ return this.option(name, opt.mentionable(description, options));
2137
+ }
2138
+ attachment(name, description, options) {
2139
+ return this.option(name, opt.attachment(description, options));
2140
+ }
2141
+ subcommands(subcommands) {
2142
+ return new _CommandDefinitionBuilder(this.name, this.description, this.optionsDef, subcommands, this.metadata);
2143
+ }
2144
+ subcommand(name, subcommand2) {
2145
+ return new _CommandDefinitionBuilder(
2146
+ this.name,
2147
+ this.description,
2148
+ this.optionsDef,
2149
+ {
2150
+ ...this.subcommandsDef ?? {},
2151
+ [name]: subcommand2
2152
+ },
2153
+ this.metadata
2154
+ );
2155
+ }
2156
+ group(name, group) {
2157
+ const normalized = typeof group.toGroup === "function" ? group.toGroup() : group;
2158
+ return new _CommandDefinitionBuilder(
2159
+ this.name,
2160
+ this.description,
2161
+ this.optionsDef,
2162
+ {
2163
+ ...this.subcommandsDef ?? {},
2164
+ [name]: normalized
2165
+ },
2166
+ this.metadata
2167
+ );
2168
+ }
2169
+ setPermissions(permissions) {
2170
+ return new _CommandDefinitionBuilder(
2171
+ this.name,
2172
+ this.description,
2173
+ this.optionsDef,
2174
+ this.subcommandsDef,
2175
+ {
2176
+ ...this.metadata,
2177
+ defaultMemberPermissions: permissions === null ? null : PermissionsBitField.resolve(permissions).toString()
2178
+ }
2179
+ );
2180
+ }
2181
+ setDefaultMemberPermissions(permissions) {
2182
+ return this.setPermissions(permissions);
2183
+ }
2184
+ execute(execute) {
2185
+ return defineCommand({
2186
+ name: this.name,
2187
+ description: this.description,
2188
+ ...this.optionsDef ? { options: this.optionsDef } : {},
2189
+ ...this.subcommandsDef ? { subcommands: this.subcommandsDef } : {},
2190
+ ...this.metadata.defaultMemberPermissions !== void 0 ? { defaultMemberPermissions: this.metadata.defaultMemberPermissions } : {},
2191
+ execute
2192
+ });
2193
+ }
2194
+ handle(execute) {
2195
+ return this.execute(execute);
2196
+ }
2197
+ toCommand() {
2198
+ return defineCommand({
2199
+ name: this.name,
2200
+ description: this.description,
2201
+ ...this.optionsDef ? { options: this.optionsDef } : {},
2202
+ ...this.subcommandsDef ? { subcommands: this.subcommandsDef } : {},
2203
+ ...this.metadata.defaultMemberPermissions !== void 0 ? { defaultMemberPermissions: this.metadata.defaultMemberPermissions } : {}
2204
+ });
2205
+ }
2206
+ build() {
2207
+ return this.toCommand();
2208
+ }
2209
+ };
2210
+ function command(name, description) {
2211
+ return new CommandDefinitionBuilder(name, description);
2212
+ }
2213
+ function subcommand(description) {
2214
+ return new SubcommandDefinitionBuilder(description);
2215
+ }
2216
+ function subcommandGroup(description) {
2217
+ return new SubcommandGroupDefinitionBuilder(description);
2218
+ }
1567
2219
 
1568
2220
  // src/commands/interactions.ts
1569
2221
  var ModalContext = class extends BaseInteractionContext {
1570
2222
  customId;
2223
+ attachments = {};
1571
2224
  _fields = /* @__PURE__ */ new Map();
1572
2225
  constructor(client, raw, user, guild, channel) {
1573
2226
  super(client, raw, user, guild, channel);
1574
- this.customId = raw.data?.custom_id ?? "";
1575
- const rows = raw.data?.components ?? [];
1576
- for (const row of rows) {
1577
- for (const comp of row.components ?? []) {
1578
- if (comp.custom_id && comp.value !== void 0) {
1579
- this._fields.set(comp.custom_id, comp.value);
2227
+ const data = raw.data ?? {};
2228
+ this.customId = data.custom_id ?? "";
2229
+ const rows = data.components ?? [];
2230
+ const resolvedAttachments = data.resolved?.attachments ?? {};
2231
+ const extractFields = (components) => {
2232
+ for (const comp of components) {
2233
+ if (comp.custom_id) {
2234
+ if (comp.values !== void 0) {
2235
+ this._fields.set(comp.custom_id, comp.values);
2236
+ if (Array.isArray(comp.values)) {
2237
+ this.attachments[comp.custom_id] = comp.values.map((id) => resolvedAttachments[id]).filter((attachment) => attachment !== void 0);
2238
+ }
2239
+ } else if (comp.value !== void 0) {
2240
+ this._fields.set(comp.custom_id, comp.value);
2241
+ }
2242
+ }
2243
+ if (Array.isArray(comp.components)) {
2244
+ extractFields(comp.components);
2245
+ }
2246
+ if (comp.component && typeof comp.component === "object") {
2247
+ extractFields([comp.component]);
1580
2248
  }
1581
2249
  }
1582
- }
2250
+ };
2251
+ extractFields(rows);
1583
2252
  }
1584
2253
  // Get a text input value by its customId
1585
2254
  // values from a select menu interaction
@@ -1608,28 +2277,43 @@ var ComponentContext = class extends BaseInteractionContext {
1608
2277
  this.values = data?.values ?? [];
1609
2278
  const fields = {};
1610
2279
  if (data?.components) {
1611
- for (const row of data.components) {
1612
- for (const comp of row.components) {
1613
- fields[comp.custom_id] = comp.value;
2280
+ const extractFields = (components) => {
2281
+ for (const comp of components) {
2282
+ if (comp.custom_id !== void 0) {
2283
+ if (comp.values !== void 0) {
2284
+ fields[comp.custom_id] = comp.values;
2285
+ } else if (comp.value !== void 0) {
2286
+ fields[comp.custom_id] = comp.value;
2287
+ }
2288
+ }
2289
+ if (comp.components) {
2290
+ extractFields(comp.components);
2291
+ }
2292
+ if (comp.component) {
2293
+ extractFields([comp.component]);
2294
+ }
1614
2295
  }
1615
- }
2296
+ };
2297
+ extractFields(data.components);
1616
2298
  }
1617
2299
  this.fields = fields;
1618
2300
  }
1619
2301
  async deferUpdate() {
1620
2302
  if (this._replied || this._deferred) throw new Error("Interaction already acknowledged.");
1621
- await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
2303
+ const result = await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1622
2304
  type: 6 /* DEFERRED_UPDATE_MESSAGE */
1623
2305
  });
2306
+ this._assertOk(result, "deferUpdate");
1624
2307
  this._deferred = true;
1625
2308
  }
1626
2309
  async update(payload) {
1627
2310
  if (this._replied || this._deferred) throw new Error("Interaction already acknowledged.");
1628
2311
  const data = this._resolvePayload(payload);
1629
- await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
2312
+ const result = await this._client.rest.post(`/interactions/${this.interactionId}/${this.interactionToken}/callback`, {
1630
2313
  type: 7 /* UPDATE_MESSAGE */,
1631
2314
  data
1632
2315
  });
2316
+ this._assertOk(result, "update");
1633
2317
  this._replied = true;
1634
2318
  }
1635
2319
  };
@@ -1637,6 +2321,9 @@ var ComponentContext = class extends BaseInteractionContext {
1637
2321
  // src/commands/manager.ts
1638
2322
  import * as fs from "fs";
1639
2323
  import * as path from "path";
2324
+ function isSubcommandGroup(candidate) {
2325
+ return "subcommands" in candidate;
2326
+ }
1640
2327
  var CommandManager = class {
1641
2328
  _commands = /* @__PURE__ */ new Map();
1642
2329
  _components = [];
@@ -1646,16 +2333,18 @@ var CommandManager = class {
1646
2333
  this._client = client;
1647
2334
  }
1648
2335
  register(...commands) {
1649
- for (const cmd of commands) {
2336
+ const normalized = commands.map((cmd) => this._normalizeCommand(cmd));
2337
+ for (const cmd of normalized) {
1650
2338
  this._commands.set(cmd.name, cmd);
1651
2339
  }
1652
- this._deployCommands(commands).catch(console.error);
2340
+ this._deployCommands(normalized).catch(console.error);
1653
2341
  }
1654
2342
  registerGuild(guildId, ...commands) {
1655
- for (const cmd of commands) {
2343
+ const normalized = commands.map((cmd) => this._normalizeCommand(cmd));
2344
+ for (const cmd of normalized) {
1656
2345
  this._commands.set(cmd.name, cmd);
1657
2346
  }
1658
- this._deployCommands(commands, guildId).catch(console.error);
2347
+ this._deployCommands(normalized, guildId).catch(console.error);
1659
2348
  }
1660
2349
  registerComponent(handler) {
1661
2350
  this._components.push(handler);
@@ -1675,9 +2364,9 @@ var CommandManager = class {
1675
2364
  const filePath = path.join(fullPath, file);
1676
2365
  try {
1677
2366
  const module = await import(`file://${filePath}`);
1678
- const command = module.default;
1679
- if (command && typeof command.name === "string") {
1680
- commands.push(command);
2367
+ const command2 = module.default;
2368
+ if (command2 && (typeof command2.name === "string" || typeof command2.toCommand === "function")) {
2369
+ commands.push(command2);
1681
2370
  }
1682
2371
  } catch (err) {
1683
2372
  console.error(`[Chameleon] Failed to load command from ${file}:`, err);
@@ -1714,15 +2403,54 @@ var CommandManager = class {
1714
2403
  return 7;
1715
2404
  case "role":
1716
2405
  return 8;
2406
+ case "mentionable":
2407
+ return 9;
1717
2408
  case "number":
1718
2409
  return 10;
2410
+ case "attachment":
2411
+ return 11;
1719
2412
  default:
1720
2413
  return 3;
1721
2414
  }
1722
2415
  };
1723
2416
  const options = [];
1724
2417
  if (cmd.subcommands) {
1725
- for (const [subName, subDef] of Object.entries(cmd.subcommands)) {
2418
+ for (const [subName, subDefRaw] of Object.entries(cmd.subcommands)) {
2419
+ const candidate = subDefRaw;
2420
+ if (isSubcommandGroup(candidate)) {
2421
+ const nested = Object.entries(candidate.subcommands).map(([nestedName, nestedDefRaw]) => {
2422
+ const nestedDef = nestedDefRaw;
2423
+ const nestedOptions = nestedDef.options ? Object.entries(nestedDef.options).map(([optName, optDefRaw]) => {
2424
+ const optDef = optDefRaw;
2425
+ return {
2426
+ type: mapType(optDef.type),
2427
+ name: optName,
2428
+ description: optDef.description,
2429
+ required: optDef.required,
2430
+ choices: optDef.choices,
2431
+ channel_types: optDef.channelTypes,
2432
+ min_value: optDef.min,
2433
+ max_value: optDef.max,
2434
+ min_length: optDef.minLength,
2435
+ max_length: optDef.maxLength
2436
+ };
2437
+ }) : [];
2438
+ return {
2439
+ type: 1 /* SUB_COMMAND */,
2440
+ name: nestedName,
2441
+ description: nestedDef.description,
2442
+ options: nestedOptions
2443
+ };
2444
+ });
2445
+ options.push({
2446
+ type: 2 /* SUB_COMMAND_GROUP */,
2447
+ name: subName,
2448
+ description: candidate.description,
2449
+ options: nested
2450
+ });
2451
+ continue;
2452
+ }
2453
+ const subDef = candidate;
1726
2454
  const subOpts = [];
1727
2455
  if (subDef.options) {
1728
2456
  for (const [optName, optDefRaw] of Object.entries(subDef.options)) {
@@ -1733,8 +2461,11 @@ var CommandManager = class {
1733
2461
  description: optDef.description,
1734
2462
  required: optDef.required,
1735
2463
  choices: optDef.choices,
2464
+ channel_types: optDef.channelTypes,
1736
2465
  min_value: optDef.min,
1737
- max_value: optDef.max
2466
+ max_value: optDef.max,
2467
+ min_length: optDef.minLength,
2468
+ max_length: optDef.maxLength
1738
2469
  });
1739
2470
  }
1740
2471
  }
@@ -1754,17 +2485,27 @@ var CommandManager = class {
1754
2485
  description: optDef.description,
1755
2486
  required: optDef.required,
1756
2487
  choices: optDef.choices,
2488
+ channel_types: optDef.channelTypes,
1757
2489
  min_value: optDef.min,
1758
- max_value: optDef.max
2490
+ max_value: optDef.max,
2491
+ min_length: optDef.minLength,
2492
+ max_length: optDef.maxLength
1759
2493
  });
1760
2494
  }
1761
2495
  }
1762
2496
  return {
1763
2497
  name: cmd.name,
1764
2498
  description: cmd.description,
2499
+ default_member_permissions: cmd.defaultMemberPermissions ?? void 0,
1765
2500
  options: options.length ? options : void 0
1766
2501
  };
1767
2502
  }
2503
+ _normalizeCommand(command2) {
2504
+ if (typeof command2.toCommand === "function") {
2505
+ return command2.toCommand();
2506
+ }
2507
+ return command2;
2508
+ }
1768
2509
  async handleInteraction(raw) {
1769
2510
  const data = raw.data;
1770
2511
  if (!data) return;
@@ -1773,17 +2514,29 @@ var CommandManager = class {
1773
2514
  if (raw.type !== 2 /* APPLICATION_COMMAND */) return;
1774
2515
  const name = data.name;
1775
2516
  if (!name) return;
1776
- const command = this._commands.get(name);
1777
- if (!command) return;
2517
+ const command2 = this._commands.get(name);
2518
+ if (!command2) return;
1778
2519
  const parsedOptions = {};
1779
- let targetExecute = command.execute;
2520
+ let targetExecute = command2.execute;
1780
2521
  const rawOptions = data.options || [];
1781
2522
  let actualOptions = rawOptions;
1782
- if (rawOptions.length > 0 && rawOptions[0].type === 1 /* SUB_COMMAND */) {
2523
+ if (rawOptions.length > 0 && rawOptions[0].type === 2 /* SUB_COMMAND_GROUP */) {
2524
+ const groupName = rawOptions[0].name;
2525
+ const groupOption = rawOptions[0];
2526
+ const nestedSubcommand = groupOption.options?.[0];
2527
+ if (nestedSubcommand) {
2528
+ actualOptions = nestedSubcommand.options || [];
2529
+ const group = command2.subcommands?.[groupName];
2530
+ const targetSubcommand = group?.subcommands?.[nestedSubcommand.name];
2531
+ if (targetSubcommand) {
2532
+ targetExecute = targetSubcommand.execute;
2533
+ }
2534
+ }
2535
+ } else if (rawOptions.length > 0 && rawOptions[0].type === 1 /* SUB_COMMAND */) {
1783
2536
  const subcommandName = rawOptions[0].name;
1784
2537
  actualOptions = rawOptions[0].options || [];
1785
- if (command.subcommands && command.subcommands[subcommandName]) {
1786
- targetExecute = command.subcommands[subcommandName].execute;
2538
+ if (command2.subcommands && command2.subcommands[subcommandName]) {
2539
+ targetExecute = command2.subcommands[subcommandName].execute;
1787
2540
  }
1788
2541
  }
1789
2542
  for (const opt2 of actualOptions) {
@@ -1793,6 +2546,16 @@ var CommandManager = class {
1793
2546
  parsedOptions[opt2.name] = resolveChannel(opt2.value, this._client);
1794
2547
  } else if (opt2.type === 8 /* ROLE */ && data.resolved?.roles?.[opt2.value]) {
1795
2548
  parsedOptions[opt2.name] = resolveRole(opt2.value, this._client, raw.guild_id);
2549
+ } else if (opt2.type === 9 /* MENTIONABLE */) {
2550
+ if (data.resolved?.users?.[opt2.value]) {
2551
+ parsedOptions[opt2.name] = resolveUser(opt2.value, this._client);
2552
+ } else if (data.resolved?.roles?.[opt2.value]) {
2553
+ parsedOptions[opt2.name] = resolveRole(opt2.value, this._client, raw.guild_id);
2554
+ } else {
2555
+ parsedOptions[opt2.name] = opt2.value;
2556
+ }
2557
+ } else if (opt2.type === 11 /* ATTACHMENT */ && data.resolved?.attachments?.[opt2.value]) {
2558
+ parsedOptions[opt2.name] = data.resolved.attachments[opt2.value];
1796
2559
  } else {
1797
2560
  parsedOptions[opt2.name] = opt2.value;
1798
2561
  }
@@ -1863,50 +2626,6 @@ var CommandManager = class {
1863
2626
  }
1864
2627
  };
1865
2628
 
1866
- // src/components/define.ts
1867
- function resolveButtonStyle(style) {
1868
- if (typeof style === "number") return style;
1869
- const map = { primary: 1, secondary: 2, success: 3, danger: 4, link: 5, premium: 6 };
1870
- return map[style] ?? 1;
1871
- }
1872
- function defineButton(def) {
1873
- return { ...def, type: "button" };
1874
- }
1875
- function defineStringSelect(def) {
1876
- return { ...def, type: "string_select" };
1877
- }
1878
- function defineUserSelect(def) {
1879
- return { ...def, type: "user_select" };
1880
- }
1881
- function defineRoleSelect(def) {
1882
- return { ...def, type: "role_select" };
1883
- }
1884
- function defineChannelSelect(def) {
1885
- return { ...def, type: "channel_select" };
1886
- }
1887
- function defineMentionableSelect(def) {
1888
- return { ...def, type: "mentionable_select" };
1889
- }
1890
- var field = {
1891
- short: (id, label, options) => ({
1892
- id,
1893
- type: 1 /* SHORT */,
1894
- label,
1895
- required: options?.required ?? true,
1896
- ...options
1897
- }),
1898
- paragraph: (id, label, options) => ({
1899
- id,
1900
- type: 2 /* PARAGRAPH */,
1901
- label,
1902
- required: options?.required ?? true,
1903
- ...options
1904
- })
1905
- };
1906
- function defineModal(def) {
1907
- return { ...def, type: "modal" };
1908
- }
1909
-
1910
2629
  // src/components/actionRow.ts
1911
2630
  var ActionRow = {
1912
2631
  of: (...components) => {
@@ -1968,6 +2687,38 @@ var ActionRow = {
1968
2687
  value: field2.value
1969
2688
  };
1970
2689
  }
2690
+ if ("type" in c && c.type === 23 /* CHECKBOX */) {
2691
+ const field2 = c;
2692
+ return {
2693
+ type: 23 /* CHECKBOX */,
2694
+ custom_id: field2.id,
2695
+ label: field2.label,
2696
+ required: field2.required,
2697
+ value: field2.value
2698
+ };
2699
+ }
2700
+ if ("type" in c && c.type === 21 /* RADIO_GROUP */) {
2701
+ const field2 = c;
2702
+ return {
2703
+ type: 21 /* RADIO_GROUP */,
2704
+ custom_id: field2.id,
2705
+ label: field2.label,
2706
+ required: field2.required,
2707
+ options: field2.options
2708
+ };
2709
+ }
2710
+ if ("type" in c && c.type === 22 /* CHECKBOX_GROUP */) {
2711
+ const field2 = c;
2712
+ return {
2713
+ type: 22 /* CHECKBOX_GROUP */,
2714
+ custom_id: field2.id,
2715
+ label: field2.label,
2716
+ required: field2.required,
2717
+ min_values: field2.minValues,
2718
+ max_values: field2.maxValues,
2719
+ options: field2.options
2720
+ };
2721
+ }
1971
2722
  return c;
1972
2723
  }).map((obj) => {
1973
2724
  const clean = {};
@@ -2074,7 +2825,7 @@ var UserManager = class extends BaseManager {
2074
2825
  async createDM(userId) {
2075
2826
  const result = await this.rest.post("/users/@me/channels", { recipient_id: userId });
2076
2827
  if (!result.ok) return result;
2077
- return { ok: true, data: (await import("./builders-WHD6LQWX.js")).buildChannel(result.data) };
2828
+ return { ok: true, data: (await import("./builders-S6W5F64D.js")).buildChannel(result.data) };
2078
2829
  }
2079
2830
  async editCurrent(payload) {
2080
2831
  const result = await this.rest.patch("/users/@me", toSnakeCase(payload));
@@ -2108,7 +2859,7 @@ var RoleManager = class {
2108
2859
  }
2109
2860
  const target = roles.find((r) => r.id === roleId);
2110
2861
  if (target) return { ok: true, data: target };
2111
- return { ok: false, status: 404, message: "Role not found" };
2862
+ return { ok: false, status: 404, error: "Role not found", message: "Role not found" };
2112
2863
  }
2113
2864
  async list() {
2114
2865
  const result = await this.rest.get(`/guilds/${this.guildId}/roles`);
@@ -2467,7 +3218,7 @@ var ChannelManager = class extends BaseManager {
2467
3218
  }
2468
3219
  async clone(channelId, options, reason) {
2469
3220
  const cached = this.store.channels.get(channelId);
2470
- if (!cached) return { ok: false, status: 404, message: "Channel not found in cache" };
3221
+ if (!cached) return { ok: false, status: 404, error: "Channel not found in cache", message: "Channel not found in cache" };
2471
3222
  const payload = { ...options };
2472
3223
  if (cached.name !== void 0) payload.name = cached.name;
2473
3224
  if (cached.type !== void 0) payload.type = cached.type;
@@ -2479,7 +3230,7 @@ var ChannelManager = class extends BaseManager {
2479
3230
  if (cached.position !== void 0) payload.position = cached.position;
2480
3231
  if (cached.parentId !== void 0) payload.parentId = cached.parentId;
2481
3232
  if (cached.permissionOverwrites !== void 0) payload.permissionOverwrites = cached.permissionOverwrites;
2482
- if (!cached.guildId) return { ok: false, status: 400, message: "Cannot clone a DM channel" };
3233
+ if (!cached.guildId) return { ok: false, status: 400, error: "Cannot clone a DM channel", message: "Cannot clone a DM channel" };
2483
3234
  return this.create(cached.guildId, payload, reason);
2484
3235
  }
2485
3236
  async setPositions(guildId, positions, reason) {
@@ -3331,7 +4082,7 @@ var ApplicationManager = class {
3331
4082
  }
3332
4083
  async fetchRoleConnectionMetadata() {
3333
4084
  if (!this._client.user?.id) {
3334
- return { ok: false, status: 400, message: "Client not ready" };
4085
+ return { ok: false, status: 400, error: "Client not ready", message: "Client not ready" };
3335
4086
  }
3336
4087
  const result = await this.rest.get(`/applications/${this._client.user.id}/role-connections/metadata`);
3337
4088
  if (!result.ok) return result;
@@ -3339,7 +4090,7 @@ var ApplicationManager = class {
3339
4090
  }
3340
4091
  async editRoleConnectionMetadata(records) {
3341
4092
  if (!this._client.user?.id) {
3342
- return { ok: false, status: 400, message: "Client not ready" };
4093
+ return { ok: false, status: 400, error: "Client not ready", message: "Client not ready" };
3343
4094
  }
3344
4095
  const result = await this.rest.put(`/applications/${this._client.user.id}/role-connections/metadata`, records);
3345
4096
  if (!result.ok) return result;
@@ -4042,8 +4793,10 @@ var Client = class {
4042
4793
  case "INTERACTION_CREATE": {
4043
4794
  if (d.type === 2 /* APPLICATION_COMMAND */ || d.type === 4 /* APPLICATION_COMMAND_AUTOCOMPLETE */) {
4044
4795
  this.commands.handleInteraction(d).catch(console.error);
4045
- } else if (d.type === 3 /* MESSAGE_COMPONENT */ || d.type === 5 /* MODAL_SUBMIT */) {
4796
+ } else if (d.type === 3 /* MESSAGE_COMPONENT */) {
4046
4797
  this.components.handleInteraction(d).catch(console.error);
4798
+ } else if (d.type === 5 /* MODAL_SUBMIT */) {
4799
+ this.commands.handleInteraction(d).catch(console.error);
4047
4800
  }
4048
4801
  this.dispatch("INTERACTION_CREATE", {
4049
4802
  type: "INTERACTION_CREATE",
@@ -4428,180 +5181,6 @@ var Chameleon = class {
4428
5181
  }
4429
5182
  };
4430
5183
 
4431
- // src/utils/bitfield.ts
4432
- var BitField = class _BitField {
4433
- static FLAGS = {};
4434
- bitfield;
4435
- constructor(bits = 0n) {
4436
- this.bitfield = this.constructor.resolve(bits);
4437
- }
4438
- has(bit) {
4439
- const resolved = this.constructor.resolve(bit);
4440
- return (this.bitfield & resolved) === resolved;
4441
- }
4442
- any(bit) {
4443
- const resolved = this.constructor.resolve(bit);
4444
- return (this.bitfield & resolved) !== 0n;
4445
- }
4446
- add(...bits) {
4447
- let total = 0n;
4448
- for (const bit of bits) {
4449
- total |= this.constructor.resolve(bit);
4450
- }
4451
- this.bitfield |= total;
4452
- return this;
4453
- }
4454
- remove(...bits) {
4455
- let total = 0n;
4456
- for (const bit of bits) {
4457
- total |= this.constructor.resolve(bit);
4458
- }
4459
- this.bitfield &= ~total;
4460
- return this;
4461
- }
4462
- toArray() {
4463
- const flags = this.constructor.FLAGS;
4464
- return Object.keys(flags).filter((flag) => this.has(flags[flag]));
4465
- }
4466
- serialize() {
4467
- const flags = this.constructor.FLAGS;
4468
- const result = {};
4469
- for (const [flag, value] of Object.entries(flags)) {
4470
- result[flag] = this.has(value);
4471
- }
4472
- return result;
4473
- }
4474
- equals(other) {
4475
- return this.bitfield === this.constructor.resolve(other);
4476
- }
4477
- freeze() {
4478
- return Object.freeze(this);
4479
- }
4480
- toString() {
4481
- return this.bitfield.toString();
4482
- }
4483
- toJSON() {
4484
- return this.toString();
4485
- }
4486
- static resolve(bit) {
4487
- if (typeof bit === "bigint") return bit;
4488
- if (typeof bit === "number") return BigInt(bit);
4489
- if (bit instanceof _BitField) return bit.bitfield;
4490
- if (typeof bit === "string") {
4491
- const flag = this.FLAGS[bit];
4492
- if (flag !== void 0) return flag;
4493
- const parsed = BigInt(bit);
4494
- return parsed;
4495
- }
4496
- if (Array.isArray(bit)) {
4497
- return bit.reduce((acc, b) => acc | this.resolve(b), 0n);
4498
- }
4499
- throw new TypeError(`Cannot resolve BitField from: ${bit}`);
4500
- }
4501
- };
4502
-
4503
- // src/types/permissions.ts
4504
- var PermissionsBitField = class _PermissionsBitField extends BitField {
4505
- static FLAGS = { ...DISCORD_PERMISSIONS };
4506
- static ALL = Object.values(DISCORD_PERMISSIONS).reduce((a, b) => a | b, 0n);
4507
- get isAdmin() {
4508
- return this.has("ADMINISTRATOR");
4509
- }
4510
- static from(bits) {
4511
- return new _PermissionsBitField(bits);
4512
- }
4513
- };
4514
- var UserFlagsBitField = class extends BitField {
4515
- static FLAGS = {
4516
- STAFF: 1n << 0n,
4517
- PARTNER: 1n << 1n,
4518
- HYPESQUAD: 1n << 2n,
4519
- BUG_HUNTER_LEVEL_1: 1n << 3n,
4520
- HYPESQUAD_ONLINE_HOUSE_1: 1n << 6n,
4521
- HYPESQUAD_ONLINE_HOUSE_2: 1n << 7n,
4522
- HYPESQUAD_ONLINE_HOUSE_3: 1n << 8n,
4523
- PREMIUM_EARLY_SUPPORTER: 1n << 9n,
4524
- TEAM_PSEUDO_USER: 1n << 10n,
4525
- BUG_HUNTER_LEVEL_2: 1n << 14n,
4526
- VERIFIED_BOT: 1n << 16n,
4527
- VERIFIED_DEVELOPER: 1n << 17n,
4528
- CERTIFIED_MODERATOR: 1n << 18n,
4529
- BOT_HTTP_INTERACTIONS: 1n << 19n,
4530
- ACTIVE_DEVELOPER: 1n << 22n
4531
- };
4532
- };
4533
- var IntentsBitField = class extends BitField {
4534
- static FLAGS = {
4535
- Guilds: 1n << 0n,
4536
- GuildMembers: 1n << 1n,
4537
- GuildModeration: 1n << 2n,
4538
- GuildEmojisAndStickers: 1n << 3n,
4539
- GuildIntegrations: 1n << 4n,
4540
- GuildWebhooks: 1n << 5n,
4541
- GuildInvites: 1n << 6n,
4542
- GuildVoiceStates: 1n << 7n,
4543
- GuildPresences: 1n << 8n,
4544
- GuildMessages: 1n << 9n,
4545
- GuildMessageReactions: 1n << 10n,
4546
- GuildMessageTyping: 1n << 11n,
4547
- DirectMessages: 1n << 12n,
4548
- DirectMessageReactions: 1n << 13n,
4549
- DirectMessageTyping: 1n << 14n,
4550
- MessageContent: 1n << 15n,
4551
- GuildScheduledEvents: 1n << 16n,
4552
- AutoModerationConfiguration: 1n << 20n,
4553
- AutoModerationExecution: 1n << 21n,
4554
- GuildMessagePolls: 1n << 24n,
4555
- DirectMessagePolls: 1n << 25n
4556
- };
4557
- };
4558
- function computeBasePermissions(member, guild) {
4559
- if (member.roles === void 0) return 0n;
4560
- const userId = member.user?.id;
4561
- if (userId && userId === guild.ownerId) return PermissionsBitField.ALL;
4562
- const everyoneRole = guild.roles.find((r) => r.id === guild.id);
4563
- let permissions = everyoneRole ? BigInt(everyoneRole.permissions) : 0n;
4564
- for (const roleId of member.roles) {
4565
- const role = guild.roles.find((r) => r.id === roleId);
4566
- if (role) permissions |= BigInt(role.permissions);
4567
- }
4568
- if ((permissions & DISCORD_PERMISSIONS.ADMINISTRATOR) === DISCORD_PERMISSIONS.ADMINISTRATOR) {
4569
- return PermissionsBitField.ALL;
4570
- }
4571
- return permissions;
4572
- }
4573
- function computeChannelPermissions(basePermissions, overwrites, memberRoles, memberId) {
4574
- if ((basePermissions & DISCORD_PERMISSIONS.ADMINISTRATOR) === DISCORD_PERMISSIONS.ADMINISTRATOR) {
4575
- return PermissionsBitField.ALL;
4576
- }
4577
- let permissions = basePermissions;
4578
- let allow = 0n;
4579
- let deny = 0n;
4580
- for (const overwrite of overwrites) {
4581
- if (overwrite.type === 0) {
4582
- if (memberRoles.includes(overwrite.id) || overwrites.indexOf(overwrite) === 0) {
4583
- if (overwrites.indexOf(overwrite) === 0 && !memberRoles.includes(overwrite.id)) {
4584
- permissions &= ~BigInt(overwrite.deny);
4585
- permissions |= BigInt(overwrite.allow);
4586
- } else {
4587
- allow |= BigInt(overwrite.allow);
4588
- deny |= BigInt(overwrite.deny);
4589
- }
4590
- }
4591
- }
4592
- }
4593
- permissions &= ~deny;
4594
- permissions |= allow;
4595
- if (memberId) {
4596
- const memberOverwrite = overwrites.find((ow) => ow.type === 1 && ow.id === memberId);
4597
- if (memberOverwrite) {
4598
- permissions &= ~BigInt(memberOverwrite.deny);
4599
- permissions |= BigInt(memberOverwrite.allow);
4600
- }
4601
- }
4602
- return permissions;
4603
- }
4604
-
4605
5184
  // src/sharding/manager.ts
4606
5185
  import { EventEmitter } from "events";
4607
5186
  import { fork } from "child_process";
@@ -4745,6 +5324,7 @@ export {
4745
5324
  BaseInteractionContext,
4746
5325
  BaseManager,
4747
5326
  BitField,
5327
+ Button,
4748
5328
  ButtonBuilder,
4749
5329
  ButtonStyle,
4750
5330
  CHAMELEON_SELF_MAP,
@@ -4760,10 +5340,12 @@ export {
4760
5340
  CollectorManager,
4761
5341
  Colors,
4762
5342
  CommandContext,
5343
+ CommandDefinitionBuilder,
4763
5344
  CommandManager,
4764
5345
  ComponentContext,
4765
5346
  ComponentManager,
4766
5347
  ComponentType,
5348
+ Container,
4767
5349
  DISCORD_GATEWAY_OPCODES,
4768
5350
  DISCORD_PERMISSIONS,
4769
5351
  DefaultMessageNotificationLevel,
@@ -4787,6 +5369,7 @@ export {
4787
5369
  InviteManager,
4788
5370
  InviteTargetType,
4789
5371
  InviteType,
5372
+ Label,
4790
5373
  LobbyMemberFlag,
4791
5374
  MFALevel,
4792
5375
  MemberManager,
@@ -4796,12 +5379,16 @@ export {
4796
5379
  MessageReferenceType,
4797
5380
  MessageType,
4798
5381
  ModalBuilder,
5382
+ ModalContext,
5383
+ ModalDefinitionBuilder,
4799
5384
  PermissionsBitField,
4800
5385
  PremiumTier,
4801
5386
  PremiumType,
4802
5387
  RoleManager,
4803
5388
  ScheduledEventManager,
5389
+ Section,
4804
5390
  SelectMenuBuilder,
5391
+ Separator,
4805
5392
  Shard,
4806
5393
  SkuFlag,
4807
5394
  SkuType,
@@ -4811,10 +5398,14 @@ export {
4811
5398
  StagePrivacyLevel,
4812
5399
  StickerFormatType,
4813
5400
  StickerType,
5401
+ SubcommandDefinitionBuilder,
5402
+ SubcommandGroupDefinitionBuilder,
4814
5403
  SubscriptionStatus,
4815
5404
  SystemChannelFlag,
4816
5405
  TemplateManager,
5406
+ TextDisplay,
4817
5407
  TextInputBuilder,
5408
+ Thumbnail,
4818
5409
  Tongue,
4819
5410
  TongueStore,
4820
5411
  UserFlag,
@@ -4843,7 +5434,10 @@ export {
4843
5434
  buildUser,
4844
5435
  buildVoiceState,
4845
5436
  buildWebhook,
5437
+ choice,
5438
+ choices,
4846
5439
  combinePermissions,
5440
+ command,
4847
5441
  computeBasePermissions,
4848
5442
  computeChannelPermissions,
4849
5443
  defineButton,
@@ -4854,17 +5448,21 @@ export {
4854
5448
  defineRoleSelect,
4855
5449
  defineStringSelect,
4856
5450
  defineSubcommand,
5451
+ defineSubcommandGroup,
4857
5452
  defineUserSelect,
4858
5453
  field,
4859
5454
  hasAllPermissions,
4860
5455
  hasAnyPermission,
4861
5456
  hasPermission,
4862
5457
  listPermissions,
5458
+ modal,
4863
5459
  opt,
4864
5460
  resolveButtonStyle,
4865
5461
  resolveChannel,
4866
5462
  resolveGuild,
4867
5463
  resolveRole,
4868
5464
  resolveUser,
4869
- serializeComponent
5465
+ serializeComponent,
5466
+ subcommand,
5467
+ subcommandGroup
4870
5468
  };