disgroove 2.2.7-dev.fca4921 → 3.0.0-dev.a714eda
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 +291 -254
- package/dist/lib/Client.js +554 -460
- package/dist/lib/constants.d.ts +29 -21
- package/dist/lib/constants.js +33 -24
- package/dist/lib/gateway/Shard.d.ts +5 -3
- package/dist/lib/gateway/Shard.js +183 -120
- package/dist/lib/index.d.ts +5 -1
- package/dist/lib/index.js +5 -1
- package/dist/lib/rest/Endpoints.d.ts +95 -91
- package/dist/lib/rest/Endpoints.js +111 -102
- package/dist/lib/rest/RequestManager.d.ts +1 -3
- package/dist/lib/transformers/ApplicationCommands.js +4 -4
- package/dist/lib/transformers/Applications.js +14 -6
- package/dist/lib/transformers/AuditLogs.js +10 -10
- package/dist/lib/transformers/AutoModeration.js +6 -6
- package/dist/lib/transformers/Channels.js +16 -16
- package/dist/lib/transformers/Components.d.ts +13 -3
- package/dist/lib/transformers/Components.js +283 -156
- package/dist/lib/transformers/Entitlements.d.ts +2 -2
- package/dist/lib/transformers/Entitlements.js +16 -16
- package/dist/lib/transformers/GuildScheduledEvents.js +8 -8
- package/dist/lib/transformers/GuildTemplates.js +4 -4
- package/dist/lib/transformers/Guilds.js +28 -28
- package/dist/lib/transformers/Interactions.js +300 -55
- 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 +36 -50
- package/dist/lib/transformers/Polls.js +2 -2
- package/dist/lib/transformers/Presences.js +6 -6
- package/dist/lib/transformers/Roles.js +8 -8
- package/dist/lib/transformers/SKUs.js +2 -2
- package/dist/lib/transformers/Soundboards.js +6 -6
- package/dist/lib/transformers/StageInstances.js +6 -6
- package/dist/lib/transformers/Stickers.js +3 -3
- package/dist/lib/transformers/Subscriptions.js +8 -8
- package/dist/lib/transformers/Teams.js +4 -4
- package/dist/lib/transformers/Users.js +6 -6
- package/dist/lib/transformers/Voice.js +8 -8
- package/dist/lib/transformers/Webhooks.js +6 -6
- package/dist/lib/transformers/index.d.ts +2 -1
- package/dist/lib/transformers/index.js +2 -1
- package/dist/lib/types/application-command.d.ts +9 -4
- package/dist/lib/types/application-role-connection-metadata.d.ts +1 -0
- package/dist/lib/types/application.d.ts +14 -9
- package/dist/lib/types/audit-log.d.ts +9 -5
- package/dist/lib/types/auto-moderation.d.ts +7 -3
- package/dist/lib/types/channel.d.ts +17 -23
- package/dist/lib/types/common.d.ts +2 -0
- package/dist/lib/types/components.d.ts +478 -0
- package/dist/lib/types/components.js +2 -0
- package/dist/lib/types/emoji.d.ts +1 -0
- package/dist/lib/types/entitlements.d.ts +5 -4
- package/dist/lib/types/gateway-events.d.ts +203 -130
- package/dist/lib/types/guild-scheduled-event.d.ts +10 -5
- package/dist/lib/types/guild-template.d.ts +3 -2
- package/dist/lib/types/guild.d.ts +40 -22
- package/dist/lib/types/interaction.d.ts +35 -18
- package/dist/lib/types/invite.d.ts +5 -2
- package/dist/lib/types/lobby.d.ts +31 -0
- package/dist/lib/types/lobby.js +2 -0
- package/dist/lib/types/message-components.d.ts +334 -118
- package/dist/lib/types/message.d.ts +30 -18
- package/dist/lib/types/poll.d.ts +7 -1
- package/dist/lib/types/role.d.ts +8 -5
- package/dist/lib/types/sku.d.ts +2 -1
- package/dist/lib/types/soundboard.d.ts +4 -3
- package/dist/lib/types/stage-instance.d.ts +4 -3
- package/dist/lib/types/sticker.d.ts +8 -5
- package/dist/lib/types/subscription.d.ts +6 -5
- package/dist/lib/types/team.d.ts +4 -2
- package/dist/lib/types/user.d.ts +10 -3
- package/dist/lib/types/voice.d.ts +6 -4
- package/dist/lib/types/webhook.d.ts +4 -3
- package/dist/lib/utils/CDN.d.ts +22 -22
- package/dist/lib/utils/CDN.js +22 -22
- package/dist/lib/utils/formatters.d.ts +7 -7
- package/dist/lib/utils/formatters.js +19 -19
- package/dist/package.json +4 -4
- package/package.json +4 -4
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Components = void 0;
|
|
4
|
-
const
|
|
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
|
|
11
|
+
case constants_1.ComponentTypes.Button:
|
|
12
12
|
return Components.buttonFromRaw(c);
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
18
|
-
case
|
|
19
|
-
|
|
20
|
-
case
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
35
|
+
case constants_1.ComponentTypes.Button:
|
|
35
36
|
return Components.buttonToRaw(c);
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
41
|
-
case
|
|
42
|
-
|
|
43
|
-
case
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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.
|
|
72
|
-
sku_id: button.
|
|
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
|
|
112
|
+
case constants_1.ComponentTypes.ActionRow: {
|
|
85
113
|
return Components.actionRowFromRaw(c);
|
|
86
114
|
}
|
|
87
|
-
case
|
|
115
|
+
case constants_1.ComponentTypes.TextDisplay: {
|
|
88
116
|
return Components.textDisplayFromRaw(c);
|
|
89
117
|
}
|
|
90
|
-
case
|
|
118
|
+
case constants_1.ComponentTypes.Section: {
|
|
91
119
|
return Components.sectionFromRaw(c);
|
|
92
120
|
}
|
|
93
|
-
case
|
|
121
|
+
case constants_1.ComponentTypes.MediaGallery: {
|
|
94
122
|
return Components.mediaGalleryFromRaw(c);
|
|
95
123
|
}
|
|
96
|
-
case
|
|
124
|
+
case constants_1.ComponentTypes.File: {
|
|
97
125
|
return Components.fileFromRaw(c);
|
|
98
126
|
}
|
|
99
|
-
case
|
|
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
|
|
142
|
+
case constants_1.ComponentTypes.ActionRow: {
|
|
115
143
|
return Components.actionRowToRaw(c);
|
|
116
144
|
}
|
|
117
|
-
case
|
|
145
|
+
case constants_1.ComponentTypes.TextDisplay: {
|
|
118
146
|
return Components.textDisplayToRaw(c);
|
|
119
147
|
}
|
|
120
|
-
case
|
|
148
|
+
case constants_1.ComponentTypes.Section: {
|
|
121
149
|
return Components.sectionToRaw(c);
|
|
122
150
|
}
|
|
123
|
-
case
|
|
151
|
+
case constants_1.ComponentTypes.MediaGallery: {
|
|
124
152
|
return Components.mediaGalleryToRaw(c);
|
|
125
153
|
}
|
|
126
|
-
case
|
|
154
|
+
case constants_1.ComponentTypes.File: {
|
|
127
155
|
return Components.fileToRaw(c);
|
|
128
156
|
}
|
|
129
|
-
case
|
|
157
|
+
case constants_1.ComponentTypes.Separator: {
|
|
130
158
|
return Components.separatorToRaw(c);
|
|
131
159
|
}
|
|
132
160
|
}
|
|
@@ -155,6 +183,66 @@ 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_1.ComponentTypes.TextInput:
|
|
190
|
+
component = Components.textInputFromRaw(label.component);
|
|
191
|
+
break;
|
|
192
|
+
case constants_1.ComponentTypes.StringSelect:
|
|
193
|
+
component = Components.stringSelectFromRaw(label.component);
|
|
194
|
+
break;
|
|
195
|
+
case constants_1.ComponentTypes.UserSelect:
|
|
196
|
+
component = Components.userSelectFromRaw(label.component);
|
|
197
|
+
break;
|
|
198
|
+
case constants_1.ComponentTypes.RoleSelect:
|
|
199
|
+
component = Components.roleSelectFromRaw(label.component);
|
|
200
|
+
break;
|
|
201
|
+
case constants_1.ComponentTypes.MentionableSelect:
|
|
202
|
+
component = Components.mentionableSelectFromRaw(label.component);
|
|
203
|
+
break;
|
|
204
|
+
case constants_1.ComponentTypes.ChannelSelect:
|
|
205
|
+
component = Components.channelSelectFromRaw(label.component);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
type: label.type,
|
|
210
|
+
id: label.id,
|
|
211
|
+
label: label.label,
|
|
212
|
+
description: label.description,
|
|
213
|
+
component,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
static labelToRaw(label) {
|
|
217
|
+
let component;
|
|
218
|
+
switch (label.component.type) {
|
|
219
|
+
case constants_1.ComponentTypes.TextInput:
|
|
220
|
+
component = Components.textInputToRaw(label.component);
|
|
221
|
+
break;
|
|
222
|
+
case constants_1.ComponentTypes.StringSelect:
|
|
223
|
+
component = Components.stringSelectToRaw(label.component);
|
|
224
|
+
break;
|
|
225
|
+
case constants_1.ComponentTypes.UserSelect:
|
|
226
|
+
component = Components.userSelectToRaw(label.component);
|
|
227
|
+
break;
|
|
228
|
+
case constants_1.ComponentTypes.RoleSelect:
|
|
229
|
+
component = Components.roleSelectToRaw(label.component);
|
|
230
|
+
break;
|
|
231
|
+
case constants_1.ComponentTypes.MentionableSelect:
|
|
232
|
+
component = Components.mentionableSelectToRaw(label.component);
|
|
233
|
+
break;
|
|
234
|
+
case constants_1.ComponentTypes.ChannelSelect:
|
|
235
|
+
component = Components.channelSelectToRaw(label.component);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
type: label.type,
|
|
240
|
+
id: label.id,
|
|
241
|
+
label: label.label,
|
|
242
|
+
description: label.description,
|
|
243
|
+
component,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
158
246
|
static mediaGalleryFromRaw(mediaGallery) {
|
|
159
247
|
return {
|
|
160
248
|
type: mediaGallery.type,
|
|
@@ -177,129 +265,97 @@ class Components {
|
|
|
177
265
|
})),
|
|
178
266
|
};
|
|
179
267
|
}
|
|
268
|
+
static mentionableSelectFromRaw(mentionableSelect) {
|
|
269
|
+
return {
|
|
270
|
+
type: mentionableSelect.type,
|
|
271
|
+
id: mentionableSelect.id,
|
|
272
|
+
customId: mentionableSelect.custom_id,
|
|
273
|
+
placeholder: mentionableSelect.placeholder,
|
|
274
|
+
defaultValues: mentionableSelect.default_values,
|
|
275
|
+
minValues: mentionableSelect.min_values,
|
|
276
|
+
maxValues: mentionableSelect.max_values,
|
|
277
|
+
disabled: mentionableSelect.disabled,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
static mentionableSelectToRaw(mentionableSelect) {
|
|
281
|
+
return {
|
|
282
|
+
type: mentionableSelect.type,
|
|
283
|
+
id: mentionableSelect.id,
|
|
284
|
+
custom_id: mentionableSelect.customId,
|
|
285
|
+
placeholder: mentionableSelect.placeholder,
|
|
286
|
+
default_values: mentionableSelect.defaultValues,
|
|
287
|
+
min_values: mentionableSelect.minValues,
|
|
288
|
+
max_values: mentionableSelect.maxValues,
|
|
289
|
+
disabled: mentionableSelect.disabled,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
static roleSelectFromRaw(roleSelect) {
|
|
293
|
+
return {
|
|
294
|
+
type: roleSelect.type,
|
|
295
|
+
id: roleSelect.id,
|
|
296
|
+
customId: roleSelect.custom_id,
|
|
297
|
+
placeholder: roleSelect.placeholder,
|
|
298
|
+
defaultValues: roleSelect.default_values,
|
|
299
|
+
minValues: roleSelect.min_values,
|
|
300
|
+
maxValues: roleSelect.max_values,
|
|
301
|
+
disabled: roleSelect.disabled,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
static roleSelectToRaw(roleSelect) {
|
|
305
|
+
return {
|
|
306
|
+
type: roleSelect.type,
|
|
307
|
+
id: roleSelect.id,
|
|
308
|
+
custom_id: roleSelect.customId,
|
|
309
|
+
placeholder: roleSelect.placeholder,
|
|
310
|
+
default_values: roleSelect.defaultValues,
|
|
311
|
+
min_values: roleSelect.minValues,
|
|
312
|
+
max_values: roleSelect.maxValues,
|
|
313
|
+
disabled: roleSelect.disabled,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
180
316
|
static sectionFromRaw(section) {
|
|
317
|
+
let accessory;
|
|
318
|
+
switch (section.accessory.type) {
|
|
319
|
+
case constants_1.ComponentTypes.Button:
|
|
320
|
+
accessory = Components.buttonFromRaw(section.accessory);
|
|
321
|
+
break;
|
|
322
|
+
case constants_1.ComponentTypes.Thumbnail:
|
|
323
|
+
accessory = Components.thumbnailFromRaw(section.accessory);
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
181
326
|
return {
|
|
182
327
|
type: section.type,
|
|
183
328
|
id: section.id,
|
|
184
|
-
components:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
329
|
+
components: section.components.map((component) => {
|
|
330
|
+
switch (component.type) {
|
|
331
|
+
case constants_1.ComponentTypes.TextDisplay:
|
|
332
|
+
return Components.textDisplayFromRaw(component);
|
|
333
|
+
}
|
|
334
|
+
}),
|
|
335
|
+
accessory,
|
|
188
336
|
};
|
|
189
337
|
}
|
|
190
338
|
static sectionToRaw(section) {
|
|
339
|
+
let accessory;
|
|
340
|
+
switch (section.accessory.type) {
|
|
341
|
+
case constants_1.ComponentTypes.Button:
|
|
342
|
+
accessory = Components.buttonToRaw(section.accessory);
|
|
343
|
+
break;
|
|
344
|
+
case constants_1.ComponentTypes.Thumbnail:
|
|
345
|
+
accessory = Components.thumbnailToRaw(section.accessory);
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
191
348
|
return {
|
|
192
349
|
type: section.type,
|
|
193
350
|
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
|
-
}
|
|
351
|
+
components: section.components.map((component) => {
|
|
352
|
+
switch (component.type) {
|
|
353
|
+
case constants_1.ComponentTypes.TextDisplay:
|
|
354
|
+
return Components.textDisplayToRaw(component);
|
|
355
|
+
}
|
|
356
|
+
}),
|
|
357
|
+
accessory,
|
|
358
|
+
};
|
|
303
359
|
}
|
|
304
360
|
static separatorFromRaw(separator) {
|
|
305
361
|
return {
|
|
@@ -317,6 +373,53 @@ class Components {
|
|
|
317
373
|
spacing: separator.spacing,
|
|
318
374
|
};
|
|
319
375
|
}
|
|
376
|
+
static stringSelectFromRaw(stringSelect) {
|
|
377
|
+
return {
|
|
378
|
+
type: stringSelect.type,
|
|
379
|
+
id: stringSelect.id,
|
|
380
|
+
customId: stringSelect.custom_id,
|
|
381
|
+
placeholder: stringSelect.placeholder,
|
|
382
|
+
options: stringSelect.options?.map((option) => ({
|
|
383
|
+
label: option.label,
|
|
384
|
+
value: option.value,
|
|
385
|
+
description: option.description,
|
|
386
|
+
emoji: option.emoji !== undefined
|
|
387
|
+
? {
|
|
388
|
+
name: option.emoji.name,
|
|
389
|
+
id: option.emoji.id,
|
|
390
|
+
animated: option.emoji.animated,
|
|
391
|
+
}
|
|
392
|
+
: undefined,
|
|
393
|
+
default: option.default,
|
|
394
|
+
})),
|
|
395
|
+
minValues: stringSelect.min_values,
|
|
396
|
+
maxValues: stringSelect.max_values,
|
|
397
|
+
disabled: stringSelect.disabled,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
static stringSelectToRaw(stringSelect) {
|
|
401
|
+
return {
|
|
402
|
+
type: stringSelect.type,
|
|
403
|
+
custom_id: stringSelect.customId,
|
|
404
|
+
placeholder: stringSelect.placeholder,
|
|
405
|
+
options: stringSelect.options?.map((option) => ({
|
|
406
|
+
label: option.label,
|
|
407
|
+
value: option.value,
|
|
408
|
+
description: option.description,
|
|
409
|
+
emoji: option.emoji !== undefined
|
|
410
|
+
? {
|
|
411
|
+
name: option.emoji.name,
|
|
412
|
+
id: option.emoji.id,
|
|
413
|
+
animated: option.emoji.animated,
|
|
414
|
+
}
|
|
415
|
+
: undefined,
|
|
416
|
+
default: option.default,
|
|
417
|
+
})),
|
|
418
|
+
min_values: stringSelect.minValues,
|
|
419
|
+
max_values: stringSelect.maxValues,
|
|
420
|
+
disabled: stringSelect.disabled,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
320
423
|
static textDisplayFromRaw(textDisplay) {
|
|
321
424
|
return {
|
|
322
425
|
type: textDisplay.type,
|
|
@@ -334,29 +437,29 @@ class Components {
|
|
|
334
437
|
static textInputFromRaw(textInput) {
|
|
335
438
|
return {
|
|
336
439
|
type: textInput.type,
|
|
337
|
-
|
|
440
|
+
customId: textInput.custom_id,
|
|
338
441
|
style: textInput.style,
|
|
339
|
-
label: textInput.label,
|
|
340
442
|
minLength: textInput.min_length,
|
|
341
443
|
maxLength: textInput.max_length,
|
|
342
444
|
required: textInput.required,
|
|
343
445
|
value: textInput.value,
|
|
344
446
|
placeholder: textInput.placeholder,
|
|
345
447
|
id: textInput.id,
|
|
448
|
+
label: textInput.label,
|
|
346
449
|
};
|
|
347
450
|
}
|
|
348
451
|
static textInputToRaw(textInput) {
|
|
349
452
|
return {
|
|
350
453
|
type: textInput.type,
|
|
351
|
-
custom_id: textInput.
|
|
454
|
+
custom_id: textInput.customId,
|
|
352
455
|
style: textInput.style,
|
|
353
|
-
label: textInput.label,
|
|
354
456
|
min_length: textInput.minLength,
|
|
355
457
|
max_length: textInput.maxLength,
|
|
356
458
|
required: textInput.required,
|
|
357
459
|
value: textInput.value,
|
|
358
460
|
placeholder: textInput.placeholder,
|
|
359
461
|
id: textInput.id,
|
|
462
|
+
label: textInput.label,
|
|
360
463
|
};
|
|
361
464
|
}
|
|
362
465
|
static thumbnailFromRaw(thumbnail) {
|
|
@@ -395,5 +498,29 @@ class Components {
|
|
|
395
498
|
content_type: unfurledMediaItem.contentType,
|
|
396
499
|
};
|
|
397
500
|
}
|
|
501
|
+
static userSelectFromRaw(userSelect) {
|
|
502
|
+
return {
|
|
503
|
+
type: userSelect.type,
|
|
504
|
+
id: userSelect.id,
|
|
505
|
+
customId: userSelect.custom_id,
|
|
506
|
+
placeholder: userSelect.placeholder,
|
|
507
|
+
defaultValues: userSelect.default_values,
|
|
508
|
+
minValues: userSelect.min_values,
|
|
509
|
+
maxValues: userSelect.max_values,
|
|
510
|
+
disabled: userSelect.disabled,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
static userSelectToRaw(userSelect) {
|
|
514
|
+
return {
|
|
515
|
+
type: userSelect.type,
|
|
516
|
+
id: userSelect.id,
|
|
517
|
+
custom_id: userSelect.customId,
|
|
518
|
+
placeholder: userSelect.placeholder,
|
|
519
|
+
default_values: userSelect.defaultValues,
|
|
520
|
+
min_values: userSelect.minValues,
|
|
521
|
+
max_values: userSelect.maxValues,
|
|
522
|
+
disabled: userSelect.disabled,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
398
525
|
}
|
|
399
526
|
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" | "
|
|
6
|
-
static testEntitlementToRaw(entitlement: Omit<Entitlement, "startsAt" | "endsAt" | "
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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.
|
|
23
|
-
application_id: entitlement.
|
|
24
|
-
user_id: entitlement.
|
|
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.
|
|
30
|
+
guild_id: entitlement.guildId,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
static testEntitlementFromRaw(entitlement) {
|
|
34
34
|
return {
|
|
35
35
|
id: entitlement.id,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
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.
|
|
49
|
-
application_id: entitlement.
|
|
50
|
-
user_id: entitlement.
|
|
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.
|
|
54
|
+
guild_id: entitlement.guildId,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
}
|