disgroove 2.2.7-dev.4cca8cf → 2.2.7-dev.8886fa2

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.
@@ -8,19 +8,20 @@ class Components {
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_js_1.ComponentTypes.Button:
12
12
  return Components.buttonFromRaw(c);
13
- }
14
- case constants_js_1.ComponentTypes.TextInput: {
13
+ case constants_js_1.ComponentTypes.StringSelect:
14
+ return Components.stringSelectFromRaw(c);
15
+ case constants_js_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
17
  case constants_js_1.ComponentTypes.UserSelect:
21
- case constants_js_1.ComponentTypes.StringSelect: {
22
- return Components.selectMenuFromRaw(c);
23
- }
18
+ return Components.userSelectFromRaw(c);
19
+ case constants_js_1.ComponentTypes.RoleSelect:
20
+ return Components.roleSelectFromRaw(c);
21
+ case constants_js_1.ComponentTypes.MentionableSelect:
22
+ return Components.mentionableSelectFromRaw(c);
23
+ case constants_js_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_js_1.ComponentTypes.Button:
35
36
  return Components.buttonToRaw(c);
36
- }
37
- case constants_js_1.ComponentTypes.TextInput: {
37
+ case constants_js_1.ComponentTypes.StringSelect:
38
+ return Components.stringSelectToRaw(c);
39
+ case constants_js_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
41
  case constants_js_1.ComponentTypes.UserSelect:
44
- case constants_js_1.ComponentTypes.StringSelect: {
45
- return Components.selectMenuToRaw(c);
46
- }
42
+ return Components.userSelectToRaw(c);
43
+ case constants_js_1.ComponentTypes.RoleSelect:
44
+ return Components.roleSelectToRaw(c);
45
+ case constants_js_1.ComponentTypes.MentionableSelect:
46
+ return Components.mentionableSelectToRaw(c);
47
+ case constants_js_1.ComponentTypes.ChannelSelect:
48
+ return Components.channelSelectToRaw(c);
47
49
  }
48
50
  }),
49
51
  id: actionRow.id,
@@ -75,6 +77,32 @@ class Components {
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,
@@ -155,6 +183,42 @@ class Components {
155
183
  size: file.size,
156
184
  };
157
185
  }
186
+ static labelFromRaw(label) {
187
+ let component;
188
+ switch (label.component.type) {
189
+ case constants_js_1.ComponentTypes.StringSelect:
190
+ component = Components.stringSelectFromRaw(label.component);
191
+ break;
192
+ case constants_js_1.ComponentTypes.TextInput:
193
+ component = Components.textInputFromRaw(label.component);
194
+ break;
195
+ }
196
+ return {
197
+ type: label.type,
198
+ id: label.id,
199
+ label: label.label,
200
+ description: label.description,
201
+ component,
202
+ };
203
+ }
204
+ static labelToRaw(label) {
205
+ let component;
206
+ switch (label.component.type) {
207
+ case constants_js_1.ComponentTypes.StringSelect:
208
+ component = Components.stringSelectToRaw(label.component);
209
+ break;
210
+ case constants_js_1.ComponentTypes.TextInput:
211
+ component = Components.textInputToRaw(label.component);
212
+ break;
213
+ }
214
+ return {
215
+ type: label.type,
216
+ id: label.id,
217
+ label: label.label,
218
+ description: label.description,
219
+ component,
220
+ };
221
+ }
158
222
  static mediaGalleryFromRaw(mediaGallery) {
159
223
  return {
160
224
  type: mediaGallery.type,
@@ -177,129 +241,97 @@ class Components {
177
241
  })),
178
242
  };
179
243
  }
244
+ static mentionableSelectFromRaw(mentionableSelect) {
245
+ return {
246
+ type: mentionableSelect.type,
247
+ id: mentionableSelect.id,
248
+ customID: mentionableSelect.custom_id,
249
+ placeholder: mentionableSelect.placeholder,
250
+ defaultValues: mentionableSelect.default_values,
251
+ minValues: mentionableSelect.min_values,
252
+ maxValues: mentionableSelect.max_values,
253
+ disabled: mentionableSelect.disabled,
254
+ };
255
+ }
256
+ static mentionableSelectToRaw(mentionableSelect) {
257
+ return {
258
+ type: mentionableSelect.type,
259
+ id: mentionableSelect.id,
260
+ custom_id: mentionableSelect.customID,
261
+ placeholder: mentionableSelect.placeholder,
262
+ default_values: mentionableSelect.defaultValues,
263
+ min_values: mentionableSelect.minValues,
264
+ max_values: mentionableSelect.maxValues,
265
+ disabled: mentionableSelect.disabled,
266
+ };
267
+ }
268
+ static roleSelectFromRaw(roleSelect) {
269
+ return {
270
+ type: roleSelect.type,
271
+ id: roleSelect.id,
272
+ customID: roleSelect.custom_id,
273
+ placeholder: roleSelect.placeholder,
274
+ defaultValues: roleSelect.default_values,
275
+ minValues: roleSelect.min_values,
276
+ maxValues: roleSelect.max_values,
277
+ disabled: roleSelect.disabled,
278
+ };
279
+ }
280
+ static roleSelectToRaw(roleSelect) {
281
+ return {
282
+ type: roleSelect.type,
283
+ id: roleSelect.id,
284
+ custom_id: roleSelect.customID,
285
+ placeholder: roleSelect.placeholder,
286
+ default_values: roleSelect.defaultValues,
287
+ min_values: roleSelect.minValues,
288
+ max_values: roleSelect.maxValues,
289
+ disabled: roleSelect.disabled,
290
+ };
291
+ }
180
292
  static sectionFromRaw(section) {
293
+ let accessory;
294
+ switch (section.accessory.type) {
295
+ case constants_js_1.ComponentTypes.Button:
296
+ accessory = Components.buttonFromRaw(section.accessory);
297
+ break;
298
+ case constants_js_1.ComponentTypes.Thumbnail:
299
+ accessory = Components.thumbnailFromRaw(section.accessory);
300
+ break;
301
+ }
181
302
  return {
182
303
  type: section.type,
183
304
  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),
305
+ components: section.components.map((component) => {
306
+ switch (component.type) {
307
+ case constants_js_1.ComponentTypes.TextDisplay:
308
+ return Components.textDisplayFromRaw(component);
309
+ }
310
+ }),
311
+ accessory,
188
312
  };
189
313
  }
190
314
  static sectionToRaw(section) {
315
+ let accessory;
316
+ switch (section.accessory.type) {
317
+ case constants_js_1.ComponentTypes.Button:
318
+ accessory = Components.buttonToRaw(section.accessory);
319
+ break;
320
+ case constants_js_1.ComponentTypes.Thumbnail:
321
+ accessory = Components.thumbnailToRaw(section.accessory);
322
+ break;
323
+ }
191
324
  return {
192
325
  type: section.type,
193
326
  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
- }
327
+ components: section.components.map((component) => {
328
+ switch (component.type) {
329
+ case constants_js_1.ComponentTypes.TextDisplay:
330
+ return Components.textDisplayToRaw(component);
331
+ }
332
+ }),
333
+ accessory,
334
+ };
303
335
  }
304
336
  static separatorFromRaw(separator) {
305
337
  return {
@@ -317,6 +349,53 @@ class Components {
317
349
  spacing: separator.spacing,
318
350
  };
319
351
  }
352
+ static stringSelectFromRaw(stringSelect) {
353
+ return {
354
+ type: stringSelect.type,
355
+ id: stringSelect.id,
356
+ customID: stringSelect.custom_id,
357
+ placeholder: stringSelect.placeholder,
358
+ options: stringSelect.options?.map((option) => ({
359
+ label: option.label,
360
+ value: option.value,
361
+ description: option.description,
362
+ emoji: option.emoji !== undefined
363
+ ? {
364
+ name: option.emoji.name,
365
+ id: option.emoji.id,
366
+ animated: option.emoji.animated,
367
+ }
368
+ : undefined,
369
+ default: option.default,
370
+ })),
371
+ minValues: stringSelect.min_values,
372
+ maxValues: stringSelect.max_values,
373
+ disabled: stringSelect.disabled,
374
+ };
375
+ }
376
+ static stringSelectToRaw(stringSelect) {
377
+ return {
378
+ type: stringSelect.type,
379
+ custom_id: stringSelect.customID,
380
+ placeholder: stringSelect.placeholder,
381
+ options: stringSelect.options?.map((option) => ({
382
+ label: option.label,
383
+ value: option.value,
384
+ description: option.description,
385
+ emoji: option.emoji !== undefined
386
+ ? {
387
+ name: option.emoji.name,
388
+ id: option.emoji.id,
389
+ animated: option.emoji.animated,
390
+ }
391
+ : undefined,
392
+ default: option.default,
393
+ })),
394
+ min_values: stringSelect.minValues,
395
+ max_values: stringSelect.maxValues,
396
+ disabled: stringSelect.disabled,
397
+ };
398
+ }
320
399
  static textDisplayFromRaw(textDisplay) {
321
400
  return {
322
401
  type: textDisplay.type,
@@ -336,13 +415,13 @@ class Components {
336
415
  type: textInput.type,
337
416
  customID: textInput.custom_id,
338
417
  style: textInput.style,
339
- label: textInput.label,
340
418
  minLength: textInput.min_length,
341
419
  maxLength: textInput.max_length,
342
420
  required: textInput.required,
343
421
  value: textInput.value,
344
422
  placeholder: textInput.placeholder,
345
423
  id: textInput.id,
424
+ label: textInput.label,
346
425
  };
347
426
  }
348
427
  static textInputToRaw(textInput) {
@@ -350,13 +429,13 @@ class Components {
350
429
  type: textInput.type,
351
430
  custom_id: textInput.customID,
352
431
  style: textInput.style,
353
- label: textInput.label,
354
432
  min_length: textInput.minLength,
355
433
  max_length: textInput.maxLength,
356
434
  required: textInput.required,
357
435
  value: textInput.value,
358
436
  placeholder: textInput.placeholder,
359
437
  id: textInput.id,
438
+ label: textInput.label,
360
439
  };
361
440
  }
362
441
  static thumbnailFromRaw(thumbnail) {
@@ -395,5 +474,29 @@ class Components {
395
474
  content_type: unfurledMediaItem.contentType,
396
475
  };
397
476
  }
477
+ static userSelectFromRaw(userSelect) {
478
+ return {
479
+ type: userSelect.type,
480
+ id: userSelect.id,
481
+ customID: userSelect.custom_id,
482
+ placeholder: userSelect.placeholder,
483
+ defaultValues: userSelect.default_values,
484
+ minValues: userSelect.min_values,
485
+ maxValues: userSelect.max_values,
486
+ disabled: userSelect.disabled,
487
+ };
488
+ }
489
+ static userSelectToRaw(userSelect) {
490
+ return {
491
+ type: userSelect.type,
492
+ id: userSelect.id,
493
+ custom_id: userSelect.customID,
494
+ placeholder: userSelect.placeholder,
495
+ default_values: userSelect.defaultValues,
496
+ min_values: userSelect.minValues,
497
+ max_values: userSelect.maxValues,
498
+ disabled: userSelect.disabled,
499
+ };
500
+ }
398
501
  }
399
502
  exports.Components = Components;
@@ -7,6 +7,8 @@ const Users_1 = require("./Users");
7
7
  const Entitlements_1 = require("./Entitlements");
8
8
  const Roles_1 = require("./Roles");
9
9
  const Messages_1 = require("./Messages");
10
+ const constants_1 = require("../constants");
11
+ const Components_1 = require("./Components");
10
12
  class Interactions {
11
13
  static interactionCallbackResponseFromRaw(interactionCallbackResponse) {
12
14
  return {
@@ -57,32 +59,28 @@ class Interactions {
57
59
  type: interaction.type,
58
60
  data: interaction.data !== undefined
59
61
  ? {
60
- id: interaction.data.id,
61
- name: interaction.data.name,
62
- type: interaction.data.type,
63
- resolved: interaction.data.resolved !== undefined
62
+ id: interaction.data?.id,
63
+ name: interaction.data?.name,
64
+ type: interaction.data?.type,
65
+ resolved: interaction.data?.resolved !== undefined
64
66
  ? Interactions.resolvedDataFromRaw(interaction.data.resolved)
65
67
  : undefined,
66
- options: interaction.data.options,
67
- guildID: interaction.data.guild_id,
68
- targetID: interaction.data.target_id,
69
- customID: interaction.data.custom_id,
70
- componentType: interaction.data.component_type,
71
- values: interaction.data.values,
72
- components: interaction.data.components?.map((component) => ({
73
- type: component.type,
74
- components: component.components?.map((c) => ({
75
- type: c.type,
76
- customID: c.custom_id,
77
- style: c.style,
78
- label: c.label,
79
- minLength: c.min_length,
80
- maxLength: c.max_length,
81
- required: c.required,
82
- value: c.value,
83
- placeholder: c.placeholder,
84
- })),
85
- })),
68
+ options: interaction.data?.options,
69
+ guildID: interaction.data?.guild_id,
70
+ targetID: interaction.data?.target_id,
71
+ customID: interaction.data?.custom_id,
72
+ componentType: interaction.data?.component_type,
73
+ values: interaction.data?.values,
74
+ components: interaction.data?.components?.map((component) => {
75
+ switch (component.type) {
76
+ case constants_1.ComponentTypes.ActionRow:
77
+ return Components_1.Components.actionRowFromRaw(component);
78
+ case constants_1.ComponentTypes.TextDisplay:
79
+ return Components_1.Components.textDisplayFromRaw(component);
80
+ case constants_1.ComponentTypes.Label:
81
+ return Components_1.Components.labelFromRaw(component);
82
+ }
83
+ }),
86
84
  }
87
85
  : undefined,
88
86
  guild: interaction.guild !== undefined
@@ -170,20 +168,16 @@ class Interactions {
170
168
  custom_id: interaction.data.customID,
171
169
  component_type: interaction.data.componentType,
172
170
  values: interaction.data.values,
173
- components: interaction.data.components?.map((component) => ({
174
- type: component.type,
175
- components: component.components?.map((c) => ({
176
- type: c.type,
177
- custom_id: c.customID,
178
- style: c.style,
179
- label: c.label,
180
- min_length: c.minLength,
181
- max_length: c.maxLength,
182
- required: c.required,
183
- value: c.value,
184
- placeholder: c.placeholder,
185
- })),
186
- })),
171
+ components: interaction.data?.components?.map((component) => {
172
+ switch (component.type) {
173
+ case constants_1.ComponentTypes.ActionRow:
174
+ return Components_1.Components.actionRowToRaw(component);
175
+ case constants_1.ComponentTypes.TextDisplay:
176
+ return Components_1.Components.textDisplayToRaw(component);
177
+ case constants_1.ComponentTypes.Label:
178
+ return Components_1.Components.labelToRaw(component);
179
+ }
180
+ }),
187
181
  }
188
182
  : undefined,
189
183
  guild: interaction.guild !== undefined
@@ -1,9 +1,10 @@
1
- import { RawAttachment, Attachment, RawEmbed, Embed, RawMessage, Message, MessageTopLevelComponent, RawMessageTopLevelComponent } from "../types/message";
1
+ import { RawAttachment, Attachment, RawEmbed, Embed, RawMessage, Message } from "../types/message";
2
+ import type { ActionRow, Container, File, MediaGallery, RawActionRow, RawContainer, RawFile, RawMediaGallery, RawSection, RawSeparator, RawTextDisplay, Section, Separator, TextDisplay } from "../types/message-components";
2
3
  export declare class Messages {
3
4
  static attachmentFromRaw(attachment: RawAttachment): Attachment;
4
5
  static attachmentToRaw(attachment: Attachment): RawAttachment;
5
- static componentsFromRaw(components: Array<RawMessageTopLevelComponent>): Array<MessageTopLevelComponent>;
6
- static componentsToRaw(components: Array<MessageTopLevelComponent>): Array<RawMessageTopLevelComponent>;
6
+ static componentsFromRaw(components: Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer>): Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
7
+ static componentsToRaw(components: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>): Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer>;
7
8
  static embedFromRaw(embed: RawEmbed): Embed;
8
9
  static embedToRaw(embed: Embed): RawEmbed;
9
10
  static messageFromRaw(message: RawMessage): Message;
@@ -51,54 +51,40 @@ class Messages {
51
51
  static componentsFromRaw(components) {
52
52
  return components.map((component) => {
53
53
  switch (component.type) {
54
- case constants_1.ComponentTypes.ActionRow: {
54
+ case constants_1.ComponentTypes.ActionRow:
55
55
  return Components_js_1.Components.actionRowFromRaw(component);
56
- }
57
- case constants_1.ComponentTypes.TextDisplay: {
56
+ case constants_1.ComponentTypes.Section:
57
+ return Components_js_1.Components.sectionFromRaw(component);
58
+ case constants_1.ComponentTypes.TextDisplay:
58
59
  return Components_js_1.Components.textDisplayFromRaw(component);
59
- }
60
- case constants_1.ComponentTypes.Container: {
61
- return Components_js_1.Components.containerFromRaw(component);
62
- }
63
- case constants_1.ComponentTypes.File: {
60
+ case constants_1.ComponentTypes.MediaGallery:
61
+ return Components_js_1.Components.mediaGalleryFromRaw(component);
62
+ case constants_1.ComponentTypes.File:
64
63
  return Components_js_1.Components.fileFromRaw(component);
65
- }
66
- case constants_1.ComponentTypes.Section: {
67
- return Components_js_1.Components.sectionFromRaw(component);
68
- }
69
- case constants_1.ComponentTypes.Separator: {
64
+ case constants_1.ComponentTypes.Separator:
70
65
  return Components_js_1.Components.separatorFromRaw(component);
71
- }
72
- case constants_1.ComponentTypes.MediaGallery: {
73
- return Components_js_1.Components.mediaGalleryFromRaw(component);
74
- }
66
+ case constants_1.ComponentTypes.Container:
67
+ return Components_js_1.Components.containerFromRaw(component);
75
68
  }
76
69
  });
77
70
  }
78
71
  static componentsToRaw(components) {
79
72
  return components.map((component) => {
80
73
  switch (component.type) {
81
- case constants_1.ComponentTypes.ActionRow: {
74
+ case constants_1.ComponentTypes.ActionRow:
82
75
  return Components_js_1.Components.actionRowToRaw(component);
83
- }
84
- case constants_1.ComponentTypes.TextDisplay: {
76
+ case constants_1.ComponentTypes.Section:
77
+ return Components_js_1.Components.sectionToRaw(component);
78
+ case constants_1.ComponentTypes.TextDisplay:
85
79
  return Components_js_1.Components.textDisplayToRaw(component);
86
- }
87
- case constants_1.ComponentTypes.Container: {
88
- return Components_js_1.Components.containerToRaw(component);
89
- }
90
- case constants_1.ComponentTypes.File: {
80
+ case constants_1.ComponentTypes.MediaGallery:
81
+ return Components_js_1.Components.mediaGalleryToRaw(component);
82
+ case constants_1.ComponentTypes.File:
91
83
  return Components_js_1.Components.fileToRaw(component);
92
- }
93
- case constants_1.ComponentTypes.Section: {
94
- return Components_js_1.Components.sectionToRaw(component);
95
- }
96
- case constants_1.ComponentTypes.Separator: {
84
+ case constants_1.ComponentTypes.Separator:
97
85
  return Components_js_1.Components.separatorToRaw(component);
98
- }
99
- case constants_1.ComponentTypes.MediaGallery: {
100
- return Components_js_1.Components.mediaGalleryToRaw(component);
101
- }
86
+ case constants_1.ComponentTypes.Container:
87
+ return Components_js_1.Components.containerToRaw(component);
102
88
  }
103
89
  });
104
90
  }
@@ -375,6 +375,17 @@ export interface RawMessagePollVoteRemoveFields {
375
375
  guild_id?: snowflake;
376
376
  answer_id: number;
377
377
  }
378
+ /** https://discord.com/developers/docs/events/gateway-events#rate-limited-rate-limited-fields */
379
+ export interface RawRateLimitedFields {
380
+ opcode: GatewayOPCodes;
381
+ retry_after: number;
382
+ meta: RawRequestGuildMembersRateLimitMetadata;
383
+ }
384
+ /** https://discord.com/developers/docs/events/gateway-events#rate-limited-rate-limit-metadata-for-opcode-structure */
385
+ export interface RawRequestGuildMembersRateLimitMetadata {
386
+ guild_id: snowflake;
387
+ nonce?: string;
388
+ }
378
389
  export interface Payload {
379
390
  op: GatewayOPCodes;
380
391
  d: any | null;
@@ -691,3 +702,12 @@ export interface MessagePollVoteRemoveFields {
691
702
  guildID?: snowflake;
692
703
  answerID: number;
693
704
  }
705
+ export interface RateLimitedFields {
706
+ opcode: GatewayOPCodes;
707
+ retryAfter: number;
708
+ meta: RequestGuildMembersRateLimitMetadata;
709
+ }
710
+ export interface RequestGuildMembersRateLimitMetadata {
711
+ guildID: snowflake;
712
+ nonce?: string;
713
+ }