disgroove 2.2.6 → 2.2.7-dev.19963da
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/lib/Client.d.ts +46 -52
- package/dist/lib/Client.js +88 -59
- package/dist/lib/constants.d.ts +33 -22
- package/dist/lib/constants.js +36 -24
- package/dist/lib/gateway/Shard.js +14 -0
- package/dist/lib/rest/Endpoints.d.ts +4 -0
- package/dist/lib/rest/Endpoints.js +10 -1
- package/dist/lib/rest/RequestManager.d.ts +1 -3
- package/dist/lib/transformers/Components.d.ts +13 -3
- package/dist/lib/transformers/Components.js +238 -135
- package/dist/lib/transformers/Interactions.js +130 -38
- package/dist/lib/transformers/Lobbies.d.ts +7 -0
- package/dist/lib/transformers/Lobbies.js +38 -0
- package/dist/lib/transformers/Messages.d.ts +4 -3
- package/dist/lib/transformers/Messages.js +20 -34
- package/dist/lib/transformers/index.d.ts +2 -1
- package/dist/lib/transformers/index.js +2 -1
- package/dist/lib/types/gateway-events.d.ts +20 -0
- package/dist/lib/types/guild.d.ts +7 -5
- package/dist/lib/types/interaction.d.ts +14 -8
- package/dist/lib/types/invite.d.ts +2 -2
- package/dist/lib/types/lobby.d.ts +29 -0
- package/dist/lib/types/lobby.js +2 -0
- package/dist/lib/types/message-components.d.ts +306 -118
- package/dist/lib/types/message.d.ts +2 -4
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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,76 @@ class Interactions {
|
|
|
57
59
|
type: interaction.type,
|
|
58
60
|
data: interaction.data !== undefined
|
|
59
61
|
? {
|
|
60
|
-
id: interaction.data
|
|
61
|
-
name: interaction.data
|
|
62
|
-
type: interaction.data
|
|
63
|
-
resolved: interaction.data
|
|
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
|
|
67
|
-
guildID: interaction.data
|
|
68
|
-
targetID: interaction.data
|
|
69
|
-
customID: interaction.data
|
|
70
|
-
componentType: interaction.data
|
|
71
|
-
values: interaction.data
|
|
72
|
-
components: interaction.data
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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 {
|
|
78
|
+
type: constants_1.ComponentTypes.ActionRow,
|
|
79
|
+
components: component.components.map((c) => {
|
|
80
|
+
switch (c.type) {
|
|
81
|
+
case constants_1.ComponentTypes.StringSelect:
|
|
82
|
+
return {
|
|
83
|
+
type: c.type,
|
|
84
|
+
componentType: c.component_type,
|
|
85
|
+
id: c.id,
|
|
86
|
+
customID: c.custom_id,
|
|
87
|
+
values: c.values,
|
|
88
|
+
};
|
|
89
|
+
case constants_1.ComponentTypes.TextInput:
|
|
90
|
+
return {
|
|
91
|
+
type: c.type,
|
|
92
|
+
id: c.id,
|
|
93
|
+
customID: c.custom_id,
|
|
94
|
+
value: c.value,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
case constants_1.ComponentTypes.TextDisplay:
|
|
100
|
+
return Components_1.Components.textDisplayFromRaw(component);
|
|
101
|
+
case constants_1.ComponentTypes.Label: {
|
|
102
|
+
let c;
|
|
103
|
+
switch (component.component.type) {
|
|
104
|
+
case constants_1.ComponentTypes.StringSelect:
|
|
105
|
+
c = {
|
|
106
|
+
type: component.component.type,
|
|
107
|
+
componentType: component.component.component_type,
|
|
108
|
+
id: component.component.id,
|
|
109
|
+
customID: component.component.custom_id,
|
|
110
|
+
values: component.component.values,
|
|
111
|
+
};
|
|
112
|
+
break;
|
|
113
|
+
case constants_1.ComponentTypes.TextInput:
|
|
114
|
+
c = {
|
|
115
|
+
type: component.component.type,
|
|
116
|
+
id: component.component.id,
|
|
117
|
+
customID: component.component.custom_id,
|
|
118
|
+
value: component.component.value,
|
|
119
|
+
};
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
type: component.type,
|
|
124
|
+
id: component.id,
|
|
125
|
+
label: component.label,
|
|
126
|
+
description: component.description,
|
|
127
|
+
component: c,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
86
132
|
}
|
|
87
133
|
: undefined,
|
|
88
134
|
guild: interaction.guild !== undefined
|
|
@@ -117,6 +163,7 @@ class Interactions {
|
|
|
117
163
|
"1": interaction.authorizing_integration_owners[1],
|
|
118
164
|
},
|
|
119
165
|
context: interaction.context,
|
|
166
|
+
attachmentSizeLimit: interaction.attachment_size_limit,
|
|
120
167
|
};
|
|
121
168
|
}
|
|
122
169
|
static interactionMetadataFromRaw(interactionMetadata) {
|
|
@@ -170,20 +217,64 @@ class Interactions {
|
|
|
170
217
|
custom_id: interaction.data.customID,
|
|
171
218
|
component_type: interaction.data.componentType,
|
|
172
219
|
values: interaction.data.values,
|
|
173
|
-
components: interaction.data
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
220
|
+
components: interaction.data?.components?.map((component) => {
|
|
221
|
+
switch (component.type) {
|
|
222
|
+
case constants_1.ComponentTypes.ActionRow:
|
|
223
|
+
return {
|
|
224
|
+
type: constants_1.ComponentTypes.ActionRow,
|
|
225
|
+
components: component.components.map((c) => {
|
|
226
|
+
switch (c.type) {
|
|
227
|
+
case constants_1.ComponentTypes.StringSelect:
|
|
228
|
+
return {
|
|
229
|
+
type: c.type,
|
|
230
|
+
component_type: c.componentType,
|
|
231
|
+
id: c.id,
|
|
232
|
+
custom_id: c.customID,
|
|
233
|
+
values: c.values,
|
|
234
|
+
};
|
|
235
|
+
case constants_1.ComponentTypes.TextInput:
|
|
236
|
+
return {
|
|
237
|
+
type: c.type,
|
|
238
|
+
id: c.id,
|
|
239
|
+
custom_id: c.customID,
|
|
240
|
+
value: c.value,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}),
|
|
244
|
+
};
|
|
245
|
+
case constants_1.ComponentTypes.TextDisplay:
|
|
246
|
+
return Components_1.Components.textDisplayToRaw(component);
|
|
247
|
+
case constants_1.ComponentTypes.Label: {
|
|
248
|
+
let c;
|
|
249
|
+
switch (component.component.type) {
|
|
250
|
+
case constants_1.ComponentTypes.StringSelect:
|
|
251
|
+
c = {
|
|
252
|
+
type: component.component.type,
|
|
253
|
+
component_type: component.component.componentType,
|
|
254
|
+
id: component.component.id,
|
|
255
|
+
custom_id: component.component.customID,
|
|
256
|
+
values: component.component.values,
|
|
257
|
+
};
|
|
258
|
+
break;
|
|
259
|
+
case constants_1.ComponentTypes.TextInput:
|
|
260
|
+
c = {
|
|
261
|
+
type: component.component.type,
|
|
262
|
+
id: component.component.id,
|
|
263
|
+
custom_id: component.component.customID,
|
|
264
|
+
value: component.component.value,
|
|
265
|
+
};
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
type: component.type,
|
|
270
|
+
id: component.id,
|
|
271
|
+
label: component.label,
|
|
272
|
+
description: component.description,
|
|
273
|
+
component: c,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}),
|
|
187
278
|
}
|
|
188
279
|
: undefined,
|
|
189
280
|
guild: interaction.guild !== undefined
|
|
@@ -218,6 +309,7 @@ class Interactions {
|
|
|
218
309
|
"1": interaction.authorizingIntegrationOwners[1],
|
|
219
310
|
},
|
|
220
311
|
context: interaction.context,
|
|
312
|
+
attachment_size_limit: interaction.attachmentSizeLimit,
|
|
221
313
|
};
|
|
222
314
|
}
|
|
223
315
|
static resolvedDataFromRaw(resolvedData) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Lobby, LobbyMember, RawLobby, RawLobbyMember } from "../types/lobby";
|
|
2
|
+
export declare class Lobbies {
|
|
3
|
+
static lobbyFromRaw(lobby: RawLobby): Lobby;
|
|
4
|
+
static lobbyMemberFromRaw(lobbyMember: RawLobbyMember): LobbyMember;
|
|
5
|
+
static lobbyMemberToRaw(lobbyMember: LobbyMember): RawLobbyMember;
|
|
6
|
+
static lobbyToRaw(lobby: Lobby): RawLobby;
|
|
7
|
+
}
|