disgroove 2.2.4-dev.9d40266 → 2.2.4-dev.e509559
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 +20 -13
- package/dist/lib/Client.js +62 -46
- package/dist/lib/constants.d.ts +113 -81
- package/dist/lib/constants.js +125 -90
- package/dist/lib/gateway/Shard.js +2 -2
- package/dist/lib/transformers/Channels.d.ts +1 -10
- package/dist/lib/transformers/Channels.js +0 -536
- package/dist/lib/transformers/GuildScheduledEvents.d.ts +3 -1
- package/dist/lib/transformers/GuildScheduledEvents.js +34 -0
- package/dist/lib/transformers/Interactions.d.ts +1 -1
- package/dist/lib/transformers/Interactions.js +7 -6
- package/dist/lib/transformers/Messages.d.ts +12 -0
- package/dist/lib/transformers/Messages.js +545 -0
- package/dist/lib/transformers/index.d.ts +1 -0
- package/dist/lib/transformers/index.js +1 -0
- package/dist/lib/types/channel.d.ts +1 -342
- package/dist/lib/types/guild-scheduled-event.d.ts +37 -1
- package/dist/lib/types/interaction.d.ts +2 -1
- package/dist/lib/types/message.d.ts +345 -0
- package/dist/lib/types/message.js +2 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
@@ -1,51 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Channels = void 0;
|
4
|
-
const constants_1 = require("../constants");
|
5
|
-
const Applications_1 = require("./Applications");
|
6
|
-
const Emojis_1 = require("./Emojis");
|
7
4
|
const Guilds_1 = require("./Guilds");
|
8
|
-
const Interactions_1 = require("./Interactions");
|
9
|
-
const Polls_1 = require("./Polls");
|
10
|
-
const Stickers_1 = require("./Stickers");
|
11
5
|
const Users_1 = require("./Users");
|
12
6
|
class Channels {
|
13
|
-
static attachmentFromRaw(attachment) {
|
14
|
-
return {
|
15
|
-
id: attachment.id,
|
16
|
-
filename: attachment.filename,
|
17
|
-
title: attachment.title,
|
18
|
-
description: attachment.description,
|
19
|
-
contentType: attachment.content_type,
|
20
|
-
size: attachment.size,
|
21
|
-
url: attachment.url,
|
22
|
-
proxyURL: attachment.proxy_url,
|
23
|
-
height: attachment.height,
|
24
|
-
width: attachment.width,
|
25
|
-
ephemeral: attachment.ephemeral,
|
26
|
-
durationSecs: attachment.duration_secs,
|
27
|
-
waveform: attachment.waveform,
|
28
|
-
flags: attachment.flags,
|
29
|
-
};
|
30
|
-
}
|
31
|
-
static attachmentToRaw(attachment) {
|
32
|
-
return {
|
33
|
-
id: attachment.id,
|
34
|
-
filename: attachment.filename,
|
35
|
-
title: attachment.title,
|
36
|
-
description: attachment.description,
|
37
|
-
content_type: attachment.contentType,
|
38
|
-
size: attachment.size,
|
39
|
-
url: attachment.url,
|
40
|
-
proxy_url: attachment.proxyURL,
|
41
|
-
height: attachment.height,
|
42
|
-
width: attachment.width,
|
43
|
-
ephemeral: attachment.ephemeral,
|
44
|
-
duration_secs: attachment.durationSecs,
|
45
|
-
waveform: attachment.waveform,
|
46
|
-
flags: attachment.flags,
|
47
|
-
};
|
48
|
-
}
|
49
7
|
static channelFromRaw(channel) {
|
50
8
|
return {
|
51
9
|
id: channel.id,
|
@@ -182,500 +140,6 @@ class Channels {
|
|
182
140
|
default_forum_layout: channel.defaultForumLayout,
|
183
141
|
};
|
184
142
|
}
|
185
|
-
static componentsFromRaw(components) {
|
186
|
-
return components.map((component) => ({
|
187
|
-
type: component.type,
|
188
|
-
components: component.components.map((c) => {
|
189
|
-
switch (c.type) {
|
190
|
-
case constants_1.ComponentTypes.Button: {
|
191
|
-
return {
|
192
|
-
type: c.type,
|
193
|
-
style: c.style,
|
194
|
-
label: c.label,
|
195
|
-
emoji: c.emoji !== undefined
|
196
|
-
? {
|
197
|
-
name: c.emoji.name,
|
198
|
-
id: c.emoji.id,
|
199
|
-
animated: c.emoji.animated,
|
200
|
-
}
|
201
|
-
: undefined,
|
202
|
-
customID: c.custom_id,
|
203
|
-
skuID: c.sku_id,
|
204
|
-
url: c.url,
|
205
|
-
disabled: c.disabled,
|
206
|
-
};
|
207
|
-
}
|
208
|
-
case constants_1.ComponentTypes.TextInput: {
|
209
|
-
return {
|
210
|
-
type: c.type,
|
211
|
-
customID: c.custom_id,
|
212
|
-
style: c.style,
|
213
|
-
label: c.label,
|
214
|
-
minLength: c.min_length,
|
215
|
-
maxLength: c.max_length,
|
216
|
-
required: c.required,
|
217
|
-
value: c.value,
|
218
|
-
placeholder: c.placeholder,
|
219
|
-
};
|
220
|
-
}
|
221
|
-
case constants_1.ComponentTypes.ChannelSelect: {
|
222
|
-
return {
|
223
|
-
type: c.type,
|
224
|
-
customID: c.custom_id,
|
225
|
-
channelTypes: c.channel_types,
|
226
|
-
placeholder: c.placeholder,
|
227
|
-
defaultValues: c.default_values,
|
228
|
-
minValues: c.min_values,
|
229
|
-
maxValues: c.max_values,
|
230
|
-
disabled: c.disabled,
|
231
|
-
};
|
232
|
-
}
|
233
|
-
case constants_1.ComponentTypes.StringSelect: {
|
234
|
-
return {
|
235
|
-
type: c.type,
|
236
|
-
customID: c.custom_id,
|
237
|
-
placeholder: c.placeholder,
|
238
|
-
options: c.options?.map((option) => ({
|
239
|
-
label: option.label,
|
240
|
-
value: option.value,
|
241
|
-
description: option.description,
|
242
|
-
emoji: option.emoji !== undefined
|
243
|
-
? {
|
244
|
-
name: option.emoji.name,
|
245
|
-
id: option.emoji.id,
|
246
|
-
animated: option.emoji.animated,
|
247
|
-
}
|
248
|
-
: undefined,
|
249
|
-
default: option.default,
|
250
|
-
})),
|
251
|
-
minValues: c.min_values,
|
252
|
-
maxValues: c.max_values,
|
253
|
-
disabled: c.disabled,
|
254
|
-
};
|
255
|
-
}
|
256
|
-
case constants_1.ComponentTypes.MentionableSelect:
|
257
|
-
case constants_1.ComponentTypes.RoleSelect:
|
258
|
-
case constants_1.ComponentTypes.UserSelect: {
|
259
|
-
return {
|
260
|
-
type: c.type,
|
261
|
-
customID: c.custom_id,
|
262
|
-
placeholder: c.placeholder,
|
263
|
-
defaultValues: c.default_values,
|
264
|
-
minValues: c.min_values,
|
265
|
-
maxValues: c.max_values,
|
266
|
-
disabled: c.disabled,
|
267
|
-
};
|
268
|
-
}
|
269
|
-
}
|
270
|
-
}),
|
271
|
-
}));
|
272
|
-
}
|
273
|
-
static componentsToRaw(components) {
|
274
|
-
return components.map((component) => ({
|
275
|
-
type: component.type,
|
276
|
-
components: component.components.map((c) => {
|
277
|
-
switch (c.type) {
|
278
|
-
case constants_1.ComponentTypes.Button: {
|
279
|
-
return {
|
280
|
-
type: c.type,
|
281
|
-
style: c.style,
|
282
|
-
label: c.label,
|
283
|
-
emoji: c.emoji !== undefined
|
284
|
-
? {
|
285
|
-
name: c.emoji.name,
|
286
|
-
id: c.emoji.id,
|
287
|
-
animated: c.emoji.animated,
|
288
|
-
}
|
289
|
-
: undefined,
|
290
|
-
custom_id: c.customID,
|
291
|
-
sku_id: c.skuID,
|
292
|
-
url: c.url,
|
293
|
-
disabled: c.disabled,
|
294
|
-
};
|
295
|
-
}
|
296
|
-
case constants_1.ComponentTypes.TextInput: {
|
297
|
-
return {
|
298
|
-
type: c.type,
|
299
|
-
custom_id: c.customID,
|
300
|
-
style: c.style,
|
301
|
-
label: c.label,
|
302
|
-
min_length: c.minLength,
|
303
|
-
max_length: c.maxLength,
|
304
|
-
required: c.required,
|
305
|
-
value: c.value,
|
306
|
-
placeholder: c.placeholder,
|
307
|
-
};
|
308
|
-
}
|
309
|
-
case constants_1.ComponentTypes.ChannelSelect: {
|
310
|
-
return {
|
311
|
-
type: c.type,
|
312
|
-
custom_id: c.customID,
|
313
|
-
channel_types: c.channelTypes,
|
314
|
-
placeholder: c.placeholder,
|
315
|
-
default_values: c.defaultValues,
|
316
|
-
min_values: c.minValues,
|
317
|
-
max_values: c.maxValues,
|
318
|
-
disabled: c.disabled,
|
319
|
-
};
|
320
|
-
}
|
321
|
-
case constants_1.ComponentTypes.StringSelect: {
|
322
|
-
return {
|
323
|
-
type: c.type,
|
324
|
-
custom_id: c.customID,
|
325
|
-
placeholder: c.placeholder,
|
326
|
-
options: c.options?.map((option) => ({
|
327
|
-
label: option.label,
|
328
|
-
value: option.value,
|
329
|
-
description: option.description,
|
330
|
-
emoji: option.emoji !== undefined
|
331
|
-
? {
|
332
|
-
name: option.emoji.name,
|
333
|
-
id: option.emoji.id,
|
334
|
-
animated: option.emoji.animated,
|
335
|
-
}
|
336
|
-
: undefined,
|
337
|
-
default: option.default,
|
338
|
-
})),
|
339
|
-
min_values: c.minValues,
|
340
|
-
max_values: c.maxValues,
|
341
|
-
disabled: c.disabled,
|
342
|
-
};
|
343
|
-
}
|
344
|
-
case constants_1.ComponentTypes.MentionableSelect:
|
345
|
-
case constants_1.ComponentTypes.RoleSelect:
|
346
|
-
case constants_1.ComponentTypes.UserSelect: {
|
347
|
-
return {
|
348
|
-
type: c.type,
|
349
|
-
custom_id: c.customID,
|
350
|
-
placeholder: c.placeholder,
|
351
|
-
default_values: c.defaultValues,
|
352
|
-
min_values: c.minValues,
|
353
|
-
max_values: c.maxValues,
|
354
|
-
disabled: c.disabled,
|
355
|
-
};
|
356
|
-
}
|
357
|
-
}
|
358
|
-
}),
|
359
|
-
}));
|
360
|
-
}
|
361
|
-
static embedFromRaw(embed) {
|
362
|
-
return {
|
363
|
-
title: embed.title,
|
364
|
-
type: embed.type,
|
365
|
-
description: embed.description,
|
366
|
-
url: embed.url,
|
367
|
-
timestamp: embed.timestamp,
|
368
|
-
color: embed.color,
|
369
|
-
footer: embed.footer !== undefined
|
370
|
-
? {
|
371
|
-
text: embed.footer.text,
|
372
|
-
iconURL: embed.footer.icon_url,
|
373
|
-
proxyIconURL: embed.footer.proxy_icon_url,
|
374
|
-
}
|
375
|
-
: undefined,
|
376
|
-
image: embed.image !== undefined
|
377
|
-
? {
|
378
|
-
url: embed.image.url,
|
379
|
-
proxyURL: embed.image.proxy_url,
|
380
|
-
height: embed.image.height,
|
381
|
-
width: embed.image.width,
|
382
|
-
}
|
383
|
-
: undefined,
|
384
|
-
thumbnail: embed.thumbnail !== undefined
|
385
|
-
? {
|
386
|
-
url: embed.thumbnail.url,
|
387
|
-
proxyURL: embed.thumbnail.proxy_url,
|
388
|
-
height: embed.thumbnail.height,
|
389
|
-
width: embed.thumbnail.width,
|
390
|
-
}
|
391
|
-
: undefined,
|
392
|
-
video: {
|
393
|
-
url: embed.video?.url,
|
394
|
-
proxyURL: embed.video?.proxy_url,
|
395
|
-
height: embed.video?.height,
|
396
|
-
width: embed.video?.width,
|
397
|
-
},
|
398
|
-
provider: {
|
399
|
-
name: embed.provider?.name,
|
400
|
-
url: embed.provider?.url,
|
401
|
-
},
|
402
|
-
author: embed.author !== undefined
|
403
|
-
? {
|
404
|
-
name: embed.author.name,
|
405
|
-
url: embed.author.url,
|
406
|
-
iconURL: embed.author.icon_url,
|
407
|
-
proxyIconURL: embed.author.proxy_icon_url,
|
408
|
-
}
|
409
|
-
: undefined,
|
410
|
-
fields: embed.fields,
|
411
|
-
};
|
412
|
-
}
|
413
|
-
static embedToRaw(embed) {
|
414
|
-
return {
|
415
|
-
title: embed.title,
|
416
|
-
type: embed.type,
|
417
|
-
description: embed.description,
|
418
|
-
url: embed.url,
|
419
|
-
timestamp: embed.timestamp,
|
420
|
-
color: embed.color,
|
421
|
-
footer: embed.footer !== undefined
|
422
|
-
? {
|
423
|
-
text: embed.footer.text,
|
424
|
-
icon_url: embed.footer.iconURL,
|
425
|
-
proxy_icon_url: embed.footer.proxyIconURL,
|
426
|
-
}
|
427
|
-
: undefined,
|
428
|
-
image: embed.image !== undefined
|
429
|
-
? {
|
430
|
-
url: embed.image.url,
|
431
|
-
proxy_url: embed.image.proxyURL,
|
432
|
-
height: embed.image.height,
|
433
|
-
width: embed.image.width,
|
434
|
-
}
|
435
|
-
: undefined,
|
436
|
-
thumbnail: embed.thumbnail !== undefined
|
437
|
-
? {
|
438
|
-
url: embed.thumbnail.url,
|
439
|
-
proxy_url: embed.thumbnail.proxyURL,
|
440
|
-
height: embed.thumbnail.height,
|
441
|
-
width: embed.thumbnail.width,
|
442
|
-
}
|
443
|
-
: undefined,
|
444
|
-
video: {
|
445
|
-
url: embed.video?.url,
|
446
|
-
proxy_url: embed.video?.proxyURL,
|
447
|
-
height: embed.video?.height,
|
448
|
-
width: embed.video?.width,
|
449
|
-
},
|
450
|
-
provider: {
|
451
|
-
name: embed.provider?.name,
|
452
|
-
url: embed.provider?.url,
|
453
|
-
},
|
454
|
-
author: embed.author !== undefined
|
455
|
-
? {
|
456
|
-
name: embed.author.name,
|
457
|
-
url: embed.author.url,
|
458
|
-
icon_url: embed.author.iconURL,
|
459
|
-
proxy_icon_url: embed.author.proxyIconURL,
|
460
|
-
}
|
461
|
-
: undefined,
|
462
|
-
fields: embed.fields,
|
463
|
-
};
|
464
|
-
}
|
465
|
-
static messageFromRaw(message) {
|
466
|
-
return {
|
467
|
-
id: message.id,
|
468
|
-
channelID: message.channel_id,
|
469
|
-
author: Users_1.Users.userFromRaw(message.author),
|
470
|
-
content: message.content,
|
471
|
-
timestamp: message.timestamp,
|
472
|
-
editedTimestamp: message.edited_timestamp,
|
473
|
-
tts: message.tts,
|
474
|
-
mentionEveryone: message.mention_everyone,
|
475
|
-
mentions: message.mentions.map((user) => Users_1.Users.userFromRaw(user)),
|
476
|
-
mentionRoles: message.mention_roles,
|
477
|
-
mentionChannels: message.mention_channels?.map((channelMention) => ({
|
478
|
-
id: channelMention.id,
|
479
|
-
guildID: channelMention.guild_id,
|
480
|
-
type: channelMention.type,
|
481
|
-
name: channelMention.name,
|
482
|
-
})),
|
483
|
-
attachments: message.attachments.map((attachment) => Channels.attachmentFromRaw(attachment)),
|
484
|
-
embeds: message.embeds,
|
485
|
-
reactions: message.reactions?.map((reaction) => ({
|
486
|
-
count: reaction.count,
|
487
|
-
countDetails: reaction.count_details,
|
488
|
-
me: reaction.me,
|
489
|
-
meBurst: reaction.me_burst,
|
490
|
-
emoji: Emojis_1.Emojis.emojiFromRaw(reaction.emoji),
|
491
|
-
burstColors: reaction.burst_colors,
|
492
|
-
})),
|
493
|
-
nonce: message.nonce,
|
494
|
-
pinned: message.pinned,
|
495
|
-
webhookID: message.webhook_id,
|
496
|
-
type: message.type,
|
497
|
-
activity: message.activity,
|
498
|
-
application: message.application !== undefined
|
499
|
-
? Applications_1.Applications.applicationFromRaw(message.application)
|
500
|
-
: undefined,
|
501
|
-
applicationID: message.application_id,
|
502
|
-
flags: message.flags,
|
503
|
-
messageReference: message.message_reference !== undefined
|
504
|
-
? {
|
505
|
-
messageID: message.message_reference.message_id,
|
506
|
-
channelID: message.message_reference.channel_id,
|
507
|
-
guildID: message.message_reference.guild_id,
|
508
|
-
failIfNotExists: message.message_reference.fail_if_not_exists,
|
509
|
-
}
|
510
|
-
: undefined,
|
511
|
-
messageSnapshots: message.message_snapshots?.map((messageSnapshot) => ({
|
512
|
-
message: {
|
513
|
-
type: messageSnapshot.message.type,
|
514
|
-
content: messageSnapshot.message.content,
|
515
|
-
embeds: messageSnapshot.message.embeds.map((embed) => this.embedFromRaw(embed)),
|
516
|
-
attachments: messageSnapshot.message.attachments.map((attachment) => this.attachmentFromRaw(attachment)),
|
517
|
-
timestamp: messageSnapshot.message.timestamp,
|
518
|
-
editedTimestamp: messageSnapshot.message.edited_timestamp,
|
519
|
-
flags: messageSnapshot.message.flags,
|
520
|
-
mentions: messageSnapshot.message.mentions.map((user) => Users_1.Users.userFromRaw(user)),
|
521
|
-
mentionRoles: messageSnapshot.message.mention_roles,
|
522
|
-
},
|
523
|
-
})),
|
524
|
-
referencedMessage: message.referenced_message !== undefined
|
525
|
-
? message.referenced_message !== null
|
526
|
-
? Channels.messageFromRaw(message.referenced_message)
|
527
|
-
: null
|
528
|
-
: undefined,
|
529
|
-
interactionMetadata: message.interaction_metadata !== undefined
|
530
|
-
? Interactions_1.Interactions.interactionMetadataFromRaw(message.interaction_metadata)
|
531
|
-
: undefined,
|
532
|
-
interaction: message.interaction !== undefined
|
533
|
-
? {
|
534
|
-
id: message.interaction.id,
|
535
|
-
type: message.interaction.type,
|
536
|
-
name: message.interaction.name,
|
537
|
-
user: Users_1.Users.userFromRaw(message.interaction.user),
|
538
|
-
member: message.interaction.member !== undefined
|
539
|
-
? Guilds_1.Guilds.guildMemberFromRaw(message.interaction.member)
|
540
|
-
: undefined,
|
541
|
-
}
|
542
|
-
: undefined,
|
543
|
-
thread: message.thread !== undefined
|
544
|
-
? Channels.channelFromRaw(message.thread)
|
545
|
-
: undefined,
|
546
|
-
components: message.components !== undefined
|
547
|
-
? Channels.componentsFromRaw(message.components)
|
548
|
-
: undefined,
|
549
|
-
stickerItems: message.sticker_items?.map((stickerItem) => ({
|
550
|
-
id: stickerItem.id,
|
551
|
-
name: stickerItem.name,
|
552
|
-
formatType: stickerItem.format_type,
|
553
|
-
})),
|
554
|
-
stickers: message.stickers?.map((sticker) => Stickers_1.Stickers.stickerFromRaw(sticker)),
|
555
|
-
position: message.position,
|
556
|
-
roleSubscriptionData: message.role_subscription_data !== undefined
|
557
|
-
? {
|
558
|
-
roleSubscriptionListingID: message.role_subscription_data.role_subscription_listing_id,
|
559
|
-
tierName: message.role_subscription_data.tier_name,
|
560
|
-
totalMonthsSubscribed: message.role_subscription_data.total_months_subscribed,
|
561
|
-
isRenewal: message.role_subscription_data.is_renewal,
|
562
|
-
}
|
563
|
-
: undefined,
|
564
|
-
resolved: message.resolved !== undefined
|
565
|
-
? Interactions_1.Interactions.resolvedDataFromRaw(message.resolved)
|
566
|
-
: undefined,
|
567
|
-
poll: message.poll !== undefined
|
568
|
-
? Polls_1.Polls.pollFromRaw(message.poll)
|
569
|
-
: undefined,
|
570
|
-
call: message.call,
|
571
|
-
};
|
572
|
-
}
|
573
|
-
static messageToRaw(message) {
|
574
|
-
return {
|
575
|
-
id: message.id,
|
576
|
-
channel_id: message.channelID,
|
577
|
-
author: Users_1.Users.userToRaw(message.author),
|
578
|
-
content: message.content,
|
579
|
-
timestamp: message.timestamp,
|
580
|
-
edited_timestamp: message.editedTimestamp,
|
581
|
-
tts: message.tts,
|
582
|
-
mention_everyone: message.mentionEveryone,
|
583
|
-
mentions: message.mentions.map((user) => Users_1.Users.userToRaw(user)),
|
584
|
-
mention_roles: message.mentionRoles,
|
585
|
-
mention_channels: message.mentionChannels?.map((channelMention) => ({
|
586
|
-
id: channelMention.id,
|
587
|
-
guild_id: channelMention.guildID,
|
588
|
-
type: channelMention.type,
|
589
|
-
name: channelMention.name,
|
590
|
-
})),
|
591
|
-
attachments: message.attachments.map((attachment) => Channels.attachmentToRaw(attachment)),
|
592
|
-
embeds: message.embeds,
|
593
|
-
reactions: message.reactions?.map((reaction) => ({
|
594
|
-
count: reaction.count,
|
595
|
-
count_details: reaction.countDetails,
|
596
|
-
me: reaction.me,
|
597
|
-
me_burst: reaction.meBurst,
|
598
|
-
emoji: Emojis_1.Emojis.emojiToRaw(reaction.emoji),
|
599
|
-
burst_colors: reaction.burstColors,
|
600
|
-
})),
|
601
|
-
nonce: message.nonce,
|
602
|
-
pinned: message.pinned,
|
603
|
-
webhook_id: message.webhookID,
|
604
|
-
type: message.type,
|
605
|
-
activity: message.activity,
|
606
|
-
application: message.application !== undefined
|
607
|
-
? Applications_1.Applications.applicationToRaw(message.application)
|
608
|
-
: undefined,
|
609
|
-
application_id: message.applicationID,
|
610
|
-
flags: message.flags,
|
611
|
-
message_reference: message.messageReference !== undefined
|
612
|
-
? {
|
613
|
-
message_id: message.messageReference.messageID,
|
614
|
-
channel_id: message.messageReference.channelID,
|
615
|
-
guild_id: message.messageReference.guildID,
|
616
|
-
fail_if_not_exists: message.messageReference.failIfNotExists,
|
617
|
-
}
|
618
|
-
: undefined,
|
619
|
-
message_snapshots: message.messageSnapshots?.map((messageSnapshot) => ({
|
620
|
-
message: {
|
621
|
-
type: messageSnapshot.message.type,
|
622
|
-
content: messageSnapshot.message.content,
|
623
|
-
embeds: messageSnapshot.message.embeds.map((embed) => this.embedToRaw(embed)),
|
624
|
-
attachments: messageSnapshot.message.attachments.map((attachment) => this.attachmentToRaw(attachment)),
|
625
|
-
timestamp: messageSnapshot.message.timestamp,
|
626
|
-
edited_timestamp: messageSnapshot.message.editedTimestamp,
|
627
|
-
flags: messageSnapshot.message.flags,
|
628
|
-
mentions: messageSnapshot.message.mentions.map((user) => Users_1.Users.userToRaw(user)),
|
629
|
-
mention_roles: messageSnapshot.message.mentionRoles,
|
630
|
-
},
|
631
|
-
})),
|
632
|
-
referenced_message: message.referencedMessage !== undefined
|
633
|
-
? message.referencedMessage !== null
|
634
|
-
? Channels.messageToRaw(message.referencedMessage)
|
635
|
-
: null
|
636
|
-
: undefined,
|
637
|
-
interaction_metadata: message.interactionMetadata !== undefined
|
638
|
-
? Interactions_1.Interactions.interactionMetadataToRaw(message.interactionMetadata)
|
639
|
-
: undefined,
|
640
|
-
interaction: message.interaction !== undefined
|
641
|
-
? {
|
642
|
-
id: message.interaction.id,
|
643
|
-
type: message.interaction.type,
|
644
|
-
name: message.interaction.name,
|
645
|
-
user: Users_1.Users.userToRaw(message.interaction.user),
|
646
|
-
member: message.interaction.member !== undefined
|
647
|
-
? Guilds_1.Guilds.guildMemberToRaw(message.interaction.member)
|
648
|
-
: undefined,
|
649
|
-
}
|
650
|
-
: undefined,
|
651
|
-
thread: message.thread !== undefined
|
652
|
-
? Channels.channelToRaw(message.thread)
|
653
|
-
: undefined,
|
654
|
-
components: message.components !== undefined
|
655
|
-
? Channels.componentsToRaw(message.components)
|
656
|
-
: undefined,
|
657
|
-
sticker_items: message.stickerItems?.map((stickerItem) => ({
|
658
|
-
id: stickerItem.id,
|
659
|
-
name: stickerItem.name,
|
660
|
-
format_type: stickerItem.formatType,
|
661
|
-
})),
|
662
|
-
stickers: message.stickers?.map((sticker) => Stickers_1.Stickers.stickerToRaw(sticker)),
|
663
|
-
position: message.position,
|
664
|
-
role_subscription_data: message.roleSubscriptionData !== undefined
|
665
|
-
? {
|
666
|
-
role_subscription_listing_id: message.roleSubscriptionData.roleSubscriptionListingID,
|
667
|
-
tier_name: message.roleSubscriptionData.tierName,
|
668
|
-
total_months_subscribed: message.roleSubscriptionData.totalMonthsSubscribed,
|
669
|
-
is_renewal: message.roleSubscriptionData.isRenewal,
|
670
|
-
}
|
671
|
-
: undefined,
|
672
|
-
resolved: message.resolved !== undefined
|
673
|
-
? Interactions_1.Interactions.resolvedDataToRaw(message.resolved)
|
674
|
-
: undefined,
|
675
|
-
poll: message.poll !== undefined ? Polls_1.Polls.pollToRaw(message.poll) : undefined,
|
676
|
-
call: message.call,
|
677
|
-
};
|
678
|
-
}
|
679
143
|
static threadMemberFromRaw(threadMember) {
|
680
144
|
return {
|
681
145
|
id: threadMember.id,
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import type { RawGuildScheduledEvent, GuildScheduledEvent } from "../types/guild-scheduled-event";
|
1
|
+
import type { RawGuildScheduledEvent, GuildScheduledEvent, RawGuildScheduledEventRecurrenceRule, GuildScheduledEventRecurrenceRule } from "../types/guild-scheduled-event";
|
2
2
|
export declare class GuildScheduledEvents {
|
3
|
+
static guildScheduledEventRecurrenceRuleFromRaw(guildScheduledEventRecurrenceRule: RawGuildScheduledEventRecurrenceRule): GuildScheduledEventRecurrenceRule;
|
4
|
+
static guildScheduledEventRecurrenceRuleToRaw(guildScheduledEventRecurrenceRule: GuildScheduledEventRecurrenceRule): RawGuildScheduledEventRecurrenceRule;
|
3
5
|
static guildScheduledEventFromRaw(guildScheduledEvent: RawGuildScheduledEvent): GuildScheduledEvent;
|
4
6
|
static guildScheduledEventToRaw(guildScheduledEvent: GuildScheduledEvent): RawGuildScheduledEvent;
|
5
7
|
}
|
@@ -3,6 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuildScheduledEvents = void 0;
|
4
4
|
const Users_1 = require("./Users");
|
5
5
|
class GuildScheduledEvents {
|
6
|
+
static guildScheduledEventRecurrenceRuleFromRaw(guildScheduledEventRecurrenceRule) {
|
7
|
+
return {
|
8
|
+
start: guildScheduledEventRecurrenceRule.start,
|
9
|
+
end: guildScheduledEventRecurrenceRule.end,
|
10
|
+
frequency: guildScheduledEventRecurrenceRule.frequency,
|
11
|
+
interval: guildScheduledEventRecurrenceRule.interval,
|
12
|
+
byWeekday: guildScheduledEventRecurrenceRule.by_weekday,
|
13
|
+
byNWeekday: guildScheduledEventRecurrenceRule.by_n_weekday,
|
14
|
+
byMonth: guildScheduledEventRecurrenceRule.by_month,
|
15
|
+
byMonthDay: guildScheduledEventRecurrenceRule.by_month_day,
|
16
|
+
byYearDay: guildScheduledEventRecurrenceRule.by_year_day,
|
17
|
+
count: guildScheduledEventRecurrenceRule.count,
|
18
|
+
};
|
19
|
+
}
|
20
|
+
static guildScheduledEventRecurrenceRuleToRaw(guildScheduledEventRecurrenceRule) {
|
21
|
+
return {
|
22
|
+
start: guildScheduledEventRecurrenceRule.start,
|
23
|
+
end: guildScheduledEventRecurrenceRule.end,
|
24
|
+
frequency: guildScheduledEventRecurrenceRule.frequency,
|
25
|
+
interval: guildScheduledEventRecurrenceRule.interval,
|
26
|
+
by_weekday: guildScheduledEventRecurrenceRule.byWeekday,
|
27
|
+
by_n_weekday: guildScheduledEventRecurrenceRule.byNWeekday,
|
28
|
+
by_month: guildScheduledEventRecurrenceRule.byMonth,
|
29
|
+
by_month_day: guildScheduledEventRecurrenceRule.byMonthDay,
|
30
|
+
by_year_day: guildScheduledEventRecurrenceRule.byYearDay,
|
31
|
+
count: guildScheduledEventRecurrenceRule.count,
|
32
|
+
};
|
33
|
+
}
|
6
34
|
static guildScheduledEventFromRaw(guildScheduledEvent) {
|
7
35
|
return {
|
8
36
|
id: guildScheduledEvent.id,
|
@@ -23,6 +51,9 @@ class GuildScheduledEvents {
|
|
23
51
|
: undefined,
|
24
52
|
userCount: guildScheduledEvent.user_count,
|
25
53
|
image: guildScheduledEvent.image,
|
54
|
+
recurrenceRule: guildScheduledEvent.reccurence_rule !== null
|
55
|
+
? GuildScheduledEvents.guildScheduledEventRecurrenceRuleFromRaw(guildScheduledEvent.reccurence_rule)
|
56
|
+
: null,
|
26
57
|
};
|
27
58
|
}
|
28
59
|
static guildScheduledEventToRaw(guildScheduledEvent) {
|
@@ -45,6 +76,9 @@ class GuildScheduledEvents {
|
|
45
76
|
: undefined,
|
46
77
|
user_count: guildScheduledEvent.userCount,
|
47
78
|
image: guildScheduledEvent.image,
|
79
|
+
reccurence_rule: guildScheduledEvent.recurrenceRule !== null
|
80
|
+
? GuildScheduledEvents.guildScheduledEventRecurrenceRuleToRaw(guildScheduledEvent.recurrenceRule)
|
81
|
+
: null,
|
48
82
|
};
|
49
83
|
}
|
50
84
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { RawMessageInteractionMetadata, MessageInteractionMetadata } from "../types/channel";
|
2
1
|
import type { RawInteraction, Interaction, RawResolvedData, ResolvedData } from "../types/interaction";
|
2
|
+
import type { RawMessageInteractionMetadata, MessageInteractionMetadata } from "../types/message";
|
3
3
|
export declare class Interactions {
|
4
4
|
static interactionFromRaw(interaction: RawInteraction): Interaction;
|
5
5
|
static interactionMetadataFromRaw(interactionMetadata: RawMessageInteractionMetadata): MessageInteractionMetadata;
|
@@ -6,6 +6,7 @@ const Guilds_1 = require("./Guilds");
|
|
6
6
|
const Users_1 = require("./Users");
|
7
7
|
const Entitlements_1 = require("./Entitlements");
|
8
8
|
const Roles_1 = require("./Roles");
|
9
|
+
const Messages_1 = require("./Messages");
|
9
10
|
class Interactions {
|
10
11
|
static interactionFromRaw(interaction) {
|
11
12
|
return {
|
@@ -63,7 +64,7 @@ class Interactions {
|
|
63
64
|
token: interaction.token,
|
64
65
|
version: interaction.version,
|
65
66
|
message: interaction.message !== undefined
|
66
|
-
?
|
67
|
+
? Messages_1.Messages.messageFromRaw(interaction.message)
|
67
68
|
: undefined,
|
68
69
|
appPermissions: interaction.app_permissions,
|
69
70
|
locale: interaction.locale,
|
@@ -164,7 +165,7 @@ class Interactions {
|
|
164
165
|
token: interaction.token,
|
165
166
|
version: interaction.version,
|
166
167
|
message: interaction.message !== undefined
|
167
|
-
?
|
168
|
+
? Messages_1.Messages.messageToRaw(interaction.message)
|
168
169
|
: undefined,
|
169
170
|
app_permissions: interaction.appPermissions,
|
170
171
|
locale: interaction.locale,
|
@@ -206,12 +207,12 @@ class Interactions {
|
|
206
207
|
}
|
207
208
|
if (resolvedData.messages !== undefined) {
|
208
209
|
for (const [key, value] of Object.entries(resolvedData.messages)) {
|
209
|
-
messages[key] =
|
210
|
+
messages[key] = Messages_1.Messages.messageFromRaw(value);
|
210
211
|
}
|
211
212
|
}
|
212
213
|
if (resolvedData.attachments !== undefined) {
|
213
214
|
for (const [key, value] of Object.entries(resolvedData.attachments)) {
|
214
|
-
attachments[key] =
|
215
|
+
attachments[key] = Messages_1.Messages.attachmentFromRaw(value);
|
215
216
|
}
|
216
217
|
}
|
217
218
|
return {
|
@@ -252,12 +253,12 @@ class Interactions {
|
|
252
253
|
}
|
253
254
|
if (resolvedData.messages !== undefined) {
|
254
255
|
for (const [key, value] of Object.entries(resolvedData.messages)) {
|
255
|
-
messages[key] =
|
256
|
+
messages[key] = Messages_1.Messages.messageToRaw(value);
|
256
257
|
}
|
257
258
|
}
|
258
259
|
if (resolvedData.attachments !== undefined) {
|
259
260
|
for (const [key, value] of Object.entries(resolvedData.attachments)) {
|
260
|
-
attachments[key] =
|
261
|
+
attachments[key] = Messages_1.Messages.attachmentToRaw(value);
|
261
262
|
}
|
262
263
|
}
|
263
264
|
return {
|