disgroove 2.2.7-dev.fca4921 → 3.0.0-dev.2cf2b90

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 (98) hide show
  1. package/LICENSE +9 -9
  2. package/README.md +48 -48
  3. package/dist/lib/Client.d.ts +332 -301
  4. package/dist/lib/Client.js +562 -462
  5. package/dist/lib/constants.d.ts +35 -24
  6. package/dist/lib/constants.js +39 -27
  7. package/dist/lib/gateway/Dispatcher.d.ts +104 -0
  8. package/dist/lib/gateway/Dispatcher.js +471 -0
  9. package/dist/lib/gateway/Shard.d.ts +12 -21
  10. package/dist/lib/gateway/Shard.js +121 -570
  11. package/dist/lib/gateway/Transmitter.d.ts +22 -0
  12. package/dist/lib/gateway/Transmitter.js +93 -0
  13. package/dist/lib/gateway/WebSocketManager.d.ts +22 -0
  14. package/dist/lib/gateway/WebSocketManager.js +93 -0
  15. package/dist/lib/index.d.ts +5 -1
  16. package/dist/lib/index.js +5 -1
  17. package/dist/lib/rest/Endpoints.d.ts +95 -91
  18. package/dist/lib/rest/Endpoints.js +111 -102
  19. package/dist/lib/rest/RequestManager.d.ts +1 -3
  20. package/dist/lib/rest/RequestManager.js +17 -7
  21. package/dist/lib/rest/index.js +17 -7
  22. package/dist/lib/transformers/ApplicationCommands.js +4 -4
  23. package/dist/lib/transformers/Applications.d.ts +2 -0
  24. package/dist/lib/transformers/Applications.js +110 -4
  25. package/dist/lib/transformers/AuditLogs.js +10 -10
  26. package/dist/lib/transformers/AutoModeration.js +6 -6
  27. package/dist/lib/transformers/Channels.js +16 -16
  28. package/dist/lib/transformers/Components.d.ts +15 -3
  29. package/dist/lib/transformers/Components.js +309 -156
  30. package/dist/lib/transformers/Entitlements.d.ts +2 -2
  31. package/dist/lib/transformers/Entitlements.js +16 -16
  32. package/dist/lib/transformers/GuildScheduledEvents.js +8 -8
  33. package/dist/lib/transformers/GuildTemplates.js +4 -4
  34. package/dist/lib/transformers/Guilds.js +28 -28
  35. package/dist/lib/transformers/Interactions.js +330 -55
  36. package/dist/lib/transformers/Lobbies.d.ts +7 -0
  37. package/dist/lib/transformers/Lobbies.js +38 -0
  38. package/dist/lib/transformers/Messages.d.ts +4 -3
  39. package/dist/lib/transformers/Messages.js +38 -52
  40. package/dist/lib/transformers/Polls.js +2 -2
  41. package/dist/lib/transformers/Presences.d.ts +3 -3
  42. package/dist/lib/transformers/Presences.js +6 -6
  43. package/dist/lib/transformers/Roles.js +8 -8
  44. package/dist/lib/transformers/SKUs.js +2 -2
  45. package/dist/lib/transformers/Soundboards.js +6 -6
  46. package/dist/lib/transformers/StageInstances.js +6 -6
  47. package/dist/lib/transformers/Stickers.js +3 -3
  48. package/dist/lib/transformers/Subscriptions.js +8 -8
  49. package/dist/lib/transformers/Teams.js +4 -4
  50. package/dist/lib/transformers/Users.js +6 -6
  51. package/dist/lib/transformers/Voice.js +8 -8
  52. package/dist/lib/transformers/Webhooks.js +6 -6
  53. package/dist/lib/transformers/index.d.ts +2 -1
  54. package/dist/lib/transformers/index.js +2 -1
  55. package/dist/lib/types/application-command.d.ts +9 -4
  56. package/dist/lib/types/application-role-connection-metadata.d.ts +1 -0
  57. package/dist/lib/types/application.d.ts +12 -7
  58. package/dist/lib/types/audit-log.d.ts +9 -5
  59. package/dist/lib/types/auto-moderation.d.ts +7 -3
  60. package/dist/lib/types/channel.d.ts +17 -23
  61. package/dist/lib/types/common.d.ts +2 -0
  62. package/dist/lib/types/components.d.ts +510 -0
  63. package/dist/lib/types/emoji.d.ts +1 -0
  64. package/dist/lib/types/entitlements.d.ts +5 -4
  65. package/dist/lib/types/gateway-events.d.ts +406 -207
  66. package/dist/lib/types/guild-scheduled-event.d.ts +10 -5
  67. package/dist/lib/types/guild-template.d.ts +3 -2
  68. package/dist/lib/types/guild.d.ts +40 -22
  69. package/dist/lib/types/interaction.d.ts +35 -18
  70. package/dist/lib/types/invite.d.ts +5 -2
  71. package/dist/lib/types/lobby.d.ts +31 -0
  72. package/dist/lib/types/lobby.js +2 -0
  73. package/dist/lib/types/message.d.ts +32 -20
  74. package/dist/lib/types/poll.d.ts +7 -1
  75. package/dist/lib/types/role.d.ts +8 -5
  76. package/dist/lib/types/sku.d.ts +2 -1
  77. package/dist/lib/types/soundboard.d.ts +4 -3
  78. package/dist/lib/types/stage-instance.d.ts +4 -3
  79. package/dist/lib/types/sticker.d.ts +8 -5
  80. package/dist/lib/types/subscription.d.ts +6 -5
  81. package/dist/lib/types/team.d.ts +4 -2
  82. package/dist/lib/types/user.d.ts +10 -3
  83. package/dist/lib/types/voice.d.ts +6 -4
  84. package/dist/lib/types/webhook.d.ts +4 -3
  85. package/dist/lib/utils/CDN.d.ts +22 -22
  86. package/dist/lib/utils/CDN.js +22 -22
  87. package/dist/lib/utils/errors.d.ts +3 -1
  88. package/dist/lib/utils/errors.js +4 -0
  89. package/dist/lib/utils/formatters.d.ts +7 -7
  90. package/dist/lib/utils/formatters.js +28 -29
  91. package/dist/lib/utils/index.d.ts +1 -0
  92. package/dist/lib/utils/index.js +18 -7
  93. package/dist/lib/utils/permissions.d.ts +2 -0
  94. package/dist/lib/utils/permissions.js +7 -0
  95. package/dist/package.json +4 -4
  96. package/package.json +5 -5
  97. package/dist/lib/types/message-components.d.ts +0 -234
  98. /package/dist/lib/types/{message-components.js → components.js} +0 -0
@@ -1,26 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Components = void 0;
4
- const constants_js_1 = require("../constants.js");
4
+ const constants_1 = require("../constants");
5
5
  class Components {
6
6
  static actionRowFromRaw(actionRow) {
7
7
  return {
8
8
  type: actionRow.type,
9
9
  components: actionRow.components.map((c) => {
10
10
  switch (c.type) {
11
- case constants_js_1.ComponentTypes.Button: {
11
+ case constants_1.ComponentTypes.Button:
12
12
  return Components.buttonFromRaw(c);
13
- }
14
- case constants_js_1.ComponentTypes.TextInput: {
13
+ case constants_1.ComponentTypes.StringSelect:
14
+ return Components.stringSelectFromRaw(c);
15
+ case constants_1.ComponentTypes.TextInput:
15
16
  return Components.textInputFromRaw(c);
16
- }
17
- case constants_js_1.ComponentTypes.ChannelSelect:
18
- case constants_js_1.ComponentTypes.MentionableSelect:
19
- case constants_js_1.ComponentTypes.RoleSelect:
20
- case constants_js_1.ComponentTypes.UserSelect:
21
- case constants_js_1.ComponentTypes.StringSelect: {
22
- return Components.selectMenuFromRaw(c);
23
- }
17
+ case constants_1.ComponentTypes.UserSelect:
18
+ return Components.userSelectFromRaw(c);
19
+ case constants_1.ComponentTypes.RoleSelect:
20
+ return Components.roleSelectFromRaw(c);
21
+ case constants_1.ComponentTypes.MentionableSelect:
22
+ return Components.mentionableSelectFromRaw(c);
23
+ case constants_1.ComponentTypes.ChannelSelect:
24
+ return Components.channelSelectFromRaw(c);
24
25
  }
25
26
  }),
26
27
  id: actionRow.id,
@@ -31,19 +32,20 @@ class Components {
31
32
  type: actionRow.type,
32
33
  components: actionRow.components.map((c) => {
33
34
  switch (c.type) {
34
- case constants_js_1.ComponentTypes.Button: {
35
+ case constants_1.ComponentTypes.Button:
35
36
  return Components.buttonToRaw(c);
36
- }
37
- case constants_js_1.ComponentTypes.TextInput: {
37
+ case constants_1.ComponentTypes.StringSelect:
38
+ return Components.stringSelectToRaw(c);
39
+ case constants_1.ComponentTypes.TextInput:
38
40
  return Components.textInputToRaw(c);
39
- }
40
- case constants_js_1.ComponentTypes.ChannelSelect:
41
- case constants_js_1.ComponentTypes.MentionableSelect:
42
- case constants_js_1.ComponentTypes.RoleSelect:
43
- case constants_js_1.ComponentTypes.UserSelect:
44
- case constants_js_1.ComponentTypes.StringSelect: {
45
- return Components.selectMenuToRaw(c);
46
- }
41
+ case constants_1.ComponentTypes.UserSelect:
42
+ return Components.userSelectToRaw(c);
43
+ case constants_1.ComponentTypes.RoleSelect:
44
+ return Components.roleSelectToRaw(c);
45
+ case constants_1.ComponentTypes.MentionableSelect:
46
+ return Components.mentionableSelectToRaw(c);
47
+ case constants_1.ComponentTypes.ChannelSelect:
48
+ return Components.channelSelectToRaw(c);
47
49
  }
48
50
  }),
49
51
  id: actionRow.id,
@@ -55,8 +57,8 @@ class Components {
55
57
  style: button.style,
56
58
  label: button.label,
57
59
  emoji: button.emoji,
58
- customID: button.custom_id,
59
- skuID: button.sku_id,
60
+ customId: button.custom_id,
61
+ skuId: button.sku_id,
60
62
  url: button.url,
61
63
  disabled: button.disabled,
62
64
  id: button.id,
@@ -68,35 +70,61 @@ class Components {
68
70
  style: button.style,
69
71
  label: button.label,
70
72
  emoji: button.emoji,
71
- custom_id: button.customID,
72
- sku_id: button.skuID,
73
+ custom_id: button.customId,
74
+ sku_id: button.skuId,
73
75
  url: button.url,
74
76
  disabled: button.disabled,
75
77
  id: button.id,
76
78
  };
77
79
  }
80
+ static channelSelectFromRaw(channelSelect) {
81
+ return {
82
+ type: channelSelect.type,
83
+ id: channelSelect.id,
84
+ customId: channelSelect.custom_id,
85
+ channelTypes: channelSelect.channel_types,
86
+ placeholder: channelSelect.placeholder,
87
+ defaultValues: channelSelect.default_values,
88
+ minValues: channelSelect.min_values,
89
+ maxValues: channelSelect.max_values,
90
+ disabled: channelSelect.disabled,
91
+ };
92
+ }
93
+ static channelSelectToRaw(channelSelect) {
94
+ return {
95
+ type: channelSelect.type,
96
+ id: channelSelect.id,
97
+ custom_id: channelSelect.customId,
98
+ channel_types: channelSelect.channelTypes,
99
+ placeholder: channelSelect.placeholder,
100
+ default_values: channelSelect.defaultValues,
101
+ min_values: channelSelect.minValues,
102
+ max_values: channelSelect.maxValues,
103
+ disabled: channelSelect.disabled,
104
+ };
105
+ }
78
106
  static containerFromRaw(container) {
79
107
  return {
80
108
  type: container.type,
81
109
  id: container.id,
82
110
  components: container.components.map((c) => {
83
111
  switch (c.type) {
84
- case constants_js_1.ComponentTypes.ActionRow: {
112
+ case constants_1.ComponentTypes.ActionRow: {
85
113
  return Components.actionRowFromRaw(c);
86
114
  }
87
- case constants_js_1.ComponentTypes.TextDisplay: {
115
+ case constants_1.ComponentTypes.TextDisplay: {
88
116
  return Components.textDisplayFromRaw(c);
89
117
  }
90
- case constants_js_1.ComponentTypes.Section: {
118
+ case constants_1.ComponentTypes.Section: {
91
119
  return Components.sectionFromRaw(c);
92
120
  }
93
- case constants_js_1.ComponentTypes.MediaGallery: {
121
+ case constants_1.ComponentTypes.MediaGallery: {
94
122
  return Components.mediaGalleryFromRaw(c);
95
123
  }
96
- case constants_js_1.ComponentTypes.File: {
124
+ case constants_1.ComponentTypes.File: {
97
125
  return Components.fileFromRaw(c);
98
126
  }
99
- case constants_js_1.ComponentTypes.Separator: {
127
+ case constants_1.ComponentTypes.Separator: {
100
128
  return Components.separatorFromRaw(c);
101
129
  }
102
130
  }
@@ -111,22 +139,22 @@ class Components {
111
139
  id: container.id,
112
140
  components: container.components.map((c) => {
113
141
  switch (c.type) {
114
- case constants_js_1.ComponentTypes.ActionRow: {
142
+ case constants_1.ComponentTypes.ActionRow: {
115
143
  return Components.actionRowToRaw(c);
116
144
  }
117
- case constants_js_1.ComponentTypes.TextDisplay: {
145
+ case constants_1.ComponentTypes.TextDisplay: {
118
146
  return Components.textDisplayToRaw(c);
119
147
  }
120
- case constants_js_1.ComponentTypes.Section: {
148
+ case constants_1.ComponentTypes.Section: {
121
149
  return Components.sectionToRaw(c);
122
150
  }
123
- case constants_js_1.ComponentTypes.MediaGallery: {
151
+ case constants_1.ComponentTypes.MediaGallery: {
124
152
  return Components.mediaGalleryToRaw(c);
125
153
  }
126
- case constants_js_1.ComponentTypes.File: {
154
+ case constants_1.ComponentTypes.File: {
127
155
  return Components.fileToRaw(c);
128
156
  }
129
- case constants_js_1.ComponentTypes.Separator: {
157
+ case constants_1.ComponentTypes.Separator: {
130
158
  return Components.separatorToRaw(c);
131
159
  }
132
160
  }
@@ -155,6 +183,92 @@ class Components {
155
183
  size: file.size,
156
184
  };
157
185
  }
186
+ static fileUploadFromRaw(fileUpload) {
187
+ return {
188
+ type: fileUpload.type,
189
+ id: fileUpload.id,
190
+ customId: fileUpload.custom_id,
191
+ minValues: fileUpload.min_values,
192
+ maxValues: fileUpload.max_values,
193
+ required: fileUpload.required,
194
+ };
195
+ }
196
+ static fileUploadToRaw(fileUpload) {
197
+ return {
198
+ type: fileUpload.type,
199
+ id: fileUpload.id,
200
+ custom_id: fileUpload.customId,
201
+ min_values: fileUpload.minValues,
202
+ max_values: fileUpload.maxValues,
203
+ required: fileUpload.required,
204
+ };
205
+ }
206
+ static labelFromRaw(label) {
207
+ let component;
208
+ switch (label.component.type) {
209
+ case constants_1.ComponentTypes.TextInput:
210
+ component = Components.textInputFromRaw(label.component);
211
+ break;
212
+ case constants_1.ComponentTypes.StringSelect:
213
+ component = Components.stringSelectFromRaw(label.component);
214
+ break;
215
+ case constants_1.ComponentTypes.UserSelect:
216
+ component = Components.userSelectFromRaw(label.component);
217
+ break;
218
+ case constants_1.ComponentTypes.RoleSelect:
219
+ component = Components.roleSelectFromRaw(label.component);
220
+ break;
221
+ case constants_1.ComponentTypes.MentionableSelect:
222
+ component = Components.mentionableSelectFromRaw(label.component);
223
+ break;
224
+ case constants_1.ComponentTypes.ChannelSelect:
225
+ component = Components.channelSelectFromRaw(label.component);
226
+ break;
227
+ case constants_1.ComponentTypes.FileUpload:
228
+ component = Components.fileUploadFromRaw(label.component);
229
+ break;
230
+ }
231
+ return {
232
+ type: label.type,
233
+ id: label.id,
234
+ label: label.label,
235
+ description: label.description,
236
+ component,
237
+ };
238
+ }
239
+ static labelToRaw(label) {
240
+ let component;
241
+ switch (label.component.type) {
242
+ case constants_1.ComponentTypes.TextInput:
243
+ component = Components.textInputToRaw(label.component);
244
+ break;
245
+ case constants_1.ComponentTypes.StringSelect:
246
+ component = Components.stringSelectToRaw(label.component);
247
+ break;
248
+ case constants_1.ComponentTypes.UserSelect:
249
+ component = Components.userSelectToRaw(label.component);
250
+ break;
251
+ case constants_1.ComponentTypes.RoleSelect:
252
+ component = Components.roleSelectToRaw(label.component);
253
+ break;
254
+ case constants_1.ComponentTypes.MentionableSelect:
255
+ component = Components.mentionableSelectToRaw(label.component);
256
+ break;
257
+ case constants_1.ComponentTypes.ChannelSelect:
258
+ component = Components.channelSelectToRaw(label.component);
259
+ break;
260
+ case constants_1.ComponentTypes.FileUpload:
261
+ component = Components.fileUploadToRaw(label.component);
262
+ break;
263
+ }
264
+ return {
265
+ type: label.type,
266
+ id: label.id,
267
+ label: label.label,
268
+ description: label.description,
269
+ component,
270
+ };
271
+ }
158
272
  static mediaGalleryFromRaw(mediaGallery) {
159
273
  return {
160
274
  type: mediaGallery.type,
@@ -177,129 +291,97 @@ class Components {
177
291
  })),
178
292
  };
179
293
  }
294
+ static mentionableSelectFromRaw(mentionableSelect) {
295
+ return {
296
+ type: mentionableSelect.type,
297
+ id: mentionableSelect.id,
298
+ customId: mentionableSelect.custom_id,
299
+ placeholder: mentionableSelect.placeholder,
300
+ defaultValues: mentionableSelect.default_values,
301
+ minValues: mentionableSelect.min_values,
302
+ maxValues: mentionableSelect.max_values,
303
+ disabled: mentionableSelect.disabled,
304
+ };
305
+ }
306
+ static mentionableSelectToRaw(mentionableSelect) {
307
+ return {
308
+ type: mentionableSelect.type,
309
+ id: mentionableSelect.id,
310
+ custom_id: mentionableSelect.customId,
311
+ placeholder: mentionableSelect.placeholder,
312
+ default_values: mentionableSelect.defaultValues,
313
+ min_values: mentionableSelect.minValues,
314
+ max_values: mentionableSelect.maxValues,
315
+ disabled: mentionableSelect.disabled,
316
+ };
317
+ }
318
+ static roleSelectFromRaw(roleSelect) {
319
+ return {
320
+ type: roleSelect.type,
321
+ id: roleSelect.id,
322
+ customId: roleSelect.custom_id,
323
+ placeholder: roleSelect.placeholder,
324
+ defaultValues: roleSelect.default_values,
325
+ minValues: roleSelect.min_values,
326
+ maxValues: roleSelect.max_values,
327
+ disabled: roleSelect.disabled,
328
+ };
329
+ }
330
+ static roleSelectToRaw(roleSelect) {
331
+ return {
332
+ type: roleSelect.type,
333
+ id: roleSelect.id,
334
+ custom_id: roleSelect.customId,
335
+ placeholder: roleSelect.placeholder,
336
+ default_values: roleSelect.defaultValues,
337
+ min_values: roleSelect.minValues,
338
+ max_values: roleSelect.maxValues,
339
+ disabled: roleSelect.disabled,
340
+ };
341
+ }
180
342
  static sectionFromRaw(section) {
343
+ let accessory;
344
+ switch (section.accessory.type) {
345
+ case constants_1.ComponentTypes.Button:
346
+ accessory = Components.buttonFromRaw(section.accessory);
347
+ break;
348
+ case constants_1.ComponentTypes.Thumbnail:
349
+ accessory = Components.thumbnailFromRaw(section.accessory);
350
+ break;
351
+ }
181
352
  return {
182
353
  type: section.type,
183
354
  id: section.id,
184
- components: [],
185
- accessory: section.accessory.type === constants_js_1.ComponentTypes.Button
186
- ? Components.buttonFromRaw(section.accessory)
187
- : Components.thumbnailFromRaw(section.accessory),
355
+ components: section.components.map((component) => {
356
+ switch (component.type) {
357
+ case constants_1.ComponentTypes.TextDisplay:
358
+ return Components.textDisplayFromRaw(component);
359
+ }
360
+ }),
361
+ accessory,
188
362
  };
189
363
  }
190
364
  static sectionToRaw(section) {
365
+ let accessory;
366
+ switch (section.accessory.type) {
367
+ case constants_1.ComponentTypes.Button:
368
+ accessory = Components.buttonToRaw(section.accessory);
369
+ break;
370
+ case constants_1.ComponentTypes.Thumbnail:
371
+ accessory = Components.thumbnailToRaw(section.accessory);
372
+ break;
373
+ }
191
374
  return {
192
375
  type: section.type,
193
376
  id: section.id,
194
- components: [],
195
- accessory: section.accessory.type === constants_js_1.ComponentTypes.Button
196
- ? Components.buttonToRaw(section.accessory)
197
- : Components.thumbnailToRaw(section.accessory),
198
- };
199
- }
200
- static selectMenuFromRaw(selectMenu) {
201
- switch (selectMenu.type) {
202
- case constants_js_1.ComponentTypes.ChannelSelect: {
203
- return {
204
- type: selectMenu.type,
205
- customID: selectMenu.custom_id,
206
- channelTypes: selectMenu.channel_types,
207
- placeholder: selectMenu.placeholder,
208
- defaultValues: selectMenu.default_values,
209
- minValues: selectMenu.min_values,
210
- maxValues: selectMenu.max_values,
211
- disabled: selectMenu.disabled,
212
- };
213
- }
214
- case constants_js_1.ComponentTypes.StringSelect: {
215
- return {
216
- type: selectMenu.type,
217
- customID: selectMenu.custom_id,
218
- placeholder: selectMenu.placeholder,
219
- options: selectMenu.options?.map((option) => ({
220
- label: option.label,
221
- value: option.value,
222
- description: option.description,
223
- emoji: option.emoji !== undefined
224
- ? {
225
- name: option.emoji.name,
226
- id: option.emoji.id,
227
- animated: option.emoji.animated,
228
- }
229
- : undefined,
230
- default: option.default,
231
- })),
232
- minValues: selectMenu.min_values,
233
- maxValues: selectMenu.max_values,
234
- disabled: selectMenu.disabled,
235
- };
236
- }
237
- case constants_js_1.ComponentTypes.MentionableSelect:
238
- case constants_js_1.ComponentTypes.RoleSelect:
239
- case constants_js_1.ComponentTypes.UserSelect: {
240
- return {
241
- type: selectMenu.type,
242
- customID: selectMenu.custom_id,
243
- placeholder: selectMenu.placeholder,
244
- defaultValues: selectMenu.default_values,
245
- minValues: selectMenu.min_values,
246
- maxValues: selectMenu.max_values,
247
- disabled: selectMenu.disabled,
248
- };
249
- }
250
- }
251
- }
252
- static selectMenuToRaw(selectMenu) {
253
- switch (selectMenu.type) {
254
- case constants_js_1.ComponentTypes.ChannelSelect: {
255
- return {
256
- type: selectMenu.type,
257
- custom_id: selectMenu.customID,
258
- channel_types: selectMenu.channelTypes,
259
- placeholder: selectMenu.placeholder,
260
- default_values: selectMenu.defaultValues,
261
- min_values: selectMenu.minValues,
262
- max_values: selectMenu.maxValues,
263
- disabled: selectMenu.disabled,
264
- };
265
- }
266
- case constants_js_1.ComponentTypes.StringSelect: {
267
- return {
268
- type: selectMenu.type,
269
- custom_id: selectMenu.customID,
270
- placeholder: selectMenu.placeholder,
271
- options: selectMenu.options?.map((option) => ({
272
- label: option.label,
273
- value: option.value,
274
- description: option.description,
275
- emoji: option.emoji !== undefined
276
- ? {
277
- name: option.emoji.name,
278
- id: option.emoji.id,
279
- animated: option.emoji.animated,
280
- }
281
- : undefined,
282
- default: option.default,
283
- })),
284
- min_values: selectMenu.minValues,
285
- max_values: selectMenu.maxValues,
286
- disabled: selectMenu.disabled,
287
- };
288
- }
289
- case constants_js_1.ComponentTypes.MentionableSelect:
290
- case constants_js_1.ComponentTypes.RoleSelect:
291
- case constants_js_1.ComponentTypes.UserSelect: {
292
- return {
293
- type: selectMenu.type,
294
- custom_id: selectMenu.customID,
295
- placeholder: selectMenu.placeholder,
296
- default_values: selectMenu.defaultValues,
297
- min_values: selectMenu.minValues,
298
- max_values: selectMenu.maxValues,
299
- disabled: selectMenu.disabled,
300
- };
301
- }
302
- }
377
+ components: section.components.map((component) => {
378
+ switch (component.type) {
379
+ case constants_1.ComponentTypes.TextDisplay:
380
+ return Components.textDisplayToRaw(component);
381
+ }
382
+ }),
383
+ accessory,
384
+ };
303
385
  }
304
386
  static separatorFromRaw(separator) {
305
387
  return {
@@ -317,6 +399,53 @@ class Components {
317
399
  spacing: separator.spacing,
318
400
  };
319
401
  }
402
+ static stringSelectFromRaw(stringSelect) {
403
+ return {
404
+ type: stringSelect.type,
405
+ id: stringSelect.id,
406
+ customId: stringSelect.custom_id,
407
+ placeholder: stringSelect.placeholder,
408
+ options: stringSelect.options?.map((option) => ({
409
+ label: option.label,
410
+ value: option.value,
411
+ description: option.description,
412
+ emoji: option.emoji !== undefined
413
+ ? {
414
+ name: option.emoji.name,
415
+ id: option.emoji.id,
416
+ animated: option.emoji.animated,
417
+ }
418
+ : undefined,
419
+ default: option.default,
420
+ })),
421
+ minValues: stringSelect.min_values,
422
+ maxValues: stringSelect.max_values,
423
+ disabled: stringSelect.disabled,
424
+ };
425
+ }
426
+ static stringSelectToRaw(stringSelect) {
427
+ return {
428
+ type: stringSelect.type,
429
+ custom_id: stringSelect.customId,
430
+ placeholder: stringSelect.placeholder,
431
+ options: stringSelect.options?.map((option) => ({
432
+ label: option.label,
433
+ value: option.value,
434
+ description: option.description,
435
+ emoji: option.emoji !== undefined
436
+ ? {
437
+ name: option.emoji.name,
438
+ id: option.emoji.id,
439
+ animated: option.emoji.animated,
440
+ }
441
+ : undefined,
442
+ default: option.default,
443
+ })),
444
+ min_values: stringSelect.minValues,
445
+ max_values: stringSelect.maxValues,
446
+ disabled: stringSelect.disabled,
447
+ };
448
+ }
320
449
  static textDisplayFromRaw(textDisplay) {
321
450
  return {
322
451
  type: textDisplay.type,
@@ -334,29 +463,29 @@ class Components {
334
463
  static textInputFromRaw(textInput) {
335
464
  return {
336
465
  type: textInput.type,
337
- customID: textInput.custom_id,
466
+ customId: textInput.custom_id,
338
467
  style: textInput.style,
339
- label: textInput.label,
340
468
  minLength: textInput.min_length,
341
469
  maxLength: textInput.max_length,
342
470
  required: textInput.required,
343
471
  value: textInput.value,
344
472
  placeholder: textInput.placeholder,
345
473
  id: textInput.id,
474
+ label: textInput.label,
346
475
  };
347
476
  }
348
477
  static textInputToRaw(textInput) {
349
478
  return {
350
479
  type: textInput.type,
351
- custom_id: textInput.customID,
480
+ custom_id: textInput.customId,
352
481
  style: textInput.style,
353
- label: textInput.label,
354
482
  min_length: textInput.minLength,
355
483
  max_length: textInput.maxLength,
356
484
  required: textInput.required,
357
485
  value: textInput.value,
358
486
  placeholder: textInput.placeholder,
359
487
  id: textInput.id,
488
+ label: textInput.label,
360
489
  };
361
490
  }
362
491
  static thumbnailFromRaw(thumbnail) {
@@ -395,5 +524,29 @@ class Components {
395
524
  content_type: unfurledMediaItem.contentType,
396
525
  };
397
526
  }
527
+ static userSelectFromRaw(userSelect) {
528
+ return {
529
+ type: userSelect.type,
530
+ id: userSelect.id,
531
+ customId: userSelect.custom_id,
532
+ placeholder: userSelect.placeholder,
533
+ defaultValues: userSelect.default_values,
534
+ minValues: userSelect.min_values,
535
+ maxValues: userSelect.max_values,
536
+ disabled: userSelect.disabled,
537
+ };
538
+ }
539
+ static userSelectToRaw(userSelect) {
540
+ return {
541
+ type: userSelect.type,
542
+ id: userSelect.id,
543
+ custom_id: userSelect.customId,
544
+ placeholder: userSelect.placeholder,
545
+ default_values: userSelect.defaultValues,
546
+ min_values: userSelect.minValues,
547
+ max_values: userSelect.maxValues,
548
+ disabled: userSelect.disabled,
549
+ };
550
+ }
398
551
  }
399
552
  exports.Components = Components;
@@ -2,6 +2,6 @@ import type { RawEntitlement, Entitlement } from "../types/entitlements";
2
2
  export declare class Entitlements {
3
3
  static entitlementFromRaw(entitlement: RawEntitlement): Entitlement;
4
4
  static entitlementToRaw(entitlement: Entitlement): RawEntitlement;
5
- static testEntitlementFromRaw(entitlement: Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">): Omit<Entitlement, "startsAt" | "endsAt" | "subscriptionID">;
6
- static testEntitlementToRaw(entitlement: Omit<Entitlement, "startsAt" | "endsAt" | "subscriptionID">): Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">;
5
+ static testEntitlementFromRaw(entitlement: Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">): Omit<Entitlement, "startsAt" | "endsAt" | "subscriptionId">;
6
+ static testEntitlementToRaw(entitlement: Omit<Entitlement, "startsAt" | "endsAt" | "subscriptionId">): Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">;
7
7
  }
@@ -5,53 +5,53 @@ class Entitlements {
5
5
  static entitlementFromRaw(entitlement) {
6
6
  return {
7
7
  id: entitlement.id,
8
- skuID: entitlement.sku_id,
9
- applicationID: entitlement.application_id,
10
- userID: entitlement.user_id,
8
+ skuId: entitlement.sku_id,
9
+ applicationId: entitlement.application_id,
10
+ userId: entitlement.user_id,
11
11
  type: entitlement.type,
12
12
  deleted: entitlement.deleted,
13
13
  consumed: entitlement.consumed,
14
14
  startsAt: entitlement.starts_at,
15
15
  endsAt: entitlement.ends_at,
16
- guildID: entitlement.guild_id,
16
+ guildId: entitlement.guild_id,
17
17
  };
18
18
  }
19
19
  static entitlementToRaw(entitlement) {
20
20
  return {
21
21
  id: entitlement.id,
22
- sku_id: entitlement.skuID,
23
- application_id: entitlement.applicationID,
24
- user_id: entitlement.userID,
22
+ sku_id: entitlement.skuId,
23
+ application_id: entitlement.applicationId,
24
+ user_id: entitlement.userId,
25
25
  type: entitlement.type,
26
26
  deleted: entitlement.deleted,
27
27
  consumed: entitlement.consumed,
28
28
  starts_at: entitlement.startsAt,
29
29
  ends_at: entitlement.endsAt,
30
- guild_id: entitlement.guildID,
30
+ guild_id: entitlement.guildId,
31
31
  };
32
32
  }
33
33
  static testEntitlementFromRaw(entitlement) {
34
34
  return {
35
35
  id: entitlement.id,
36
- skuID: entitlement.sku_id,
37
- applicationID: entitlement.application_id,
38
- userID: entitlement.user_id,
36
+ skuId: entitlement.sku_id,
37
+ applicationId: entitlement.application_id,
38
+ userId: entitlement.user_id,
39
39
  type: entitlement.type,
40
40
  deleted: entitlement.deleted,
41
41
  consumed: entitlement.consumed,
42
- guildID: entitlement.guild_id,
42
+ guildId: entitlement.guild_id,
43
43
  };
44
44
  }
45
45
  static testEntitlementToRaw(entitlement) {
46
46
  return {
47
47
  id: entitlement.id,
48
- sku_id: entitlement.skuID,
49
- application_id: entitlement.applicationID,
50
- user_id: entitlement.userID,
48
+ sku_id: entitlement.skuId,
49
+ application_id: entitlement.applicationId,
50
+ user_id: entitlement.userId,
51
51
  type: entitlement.type,
52
52
  deleted: entitlement.deleted,
53
53
  consumed: entitlement.consumed,
54
- guild_id: entitlement.guildID,
54
+ guild_id: entitlement.guildId,
55
55
  };
56
56
  }
57
57
  }