disgroove 2.2.2-dev.db6cb16 → 2.2.3-dev.4f98e3d
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/README.md +5 -9
- package/dist/lib/Client.d.ts +116 -126
- package/dist/lib/Client.js +360 -267
- package/dist/lib/constants.d.ts +85 -74
- package/dist/lib/constants.js +88 -75
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +194 -170
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +6 -6
- package/dist/lib/rest/Endpoints.js +13 -13
- package/dist/lib/rest/RequestManager.d.ts +1 -1
- package/dist/lib/rest/RequestManager.js +1 -1
- package/dist/lib/rest/index.d.ts +0 -1
- package/dist/lib/rest/index.js +1 -2
- package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
- package/dist/lib/transformers/ApplicationCommands.js +90 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
- package/dist/lib/transformers/Applications.d.ts +5 -0
- package/dist/lib/transformers/Applications.js +97 -0
- package/dist/lib/transformers/AuditLogs.d.ts +7 -0
- package/dist/lib/transformers/AuditLogs.js +97 -0
- package/dist/lib/transformers/AutoModeration.d.ts +9 -0
- package/dist/lib/transformers/AutoModeration.js +76 -0
- package/dist/lib/transformers/Channels.d.ts +16 -0
- package/dist/lib/transformers/Channels.js +676 -0
- package/dist/lib/transformers/Emojis.d.ts +5 -0
- package/dist/lib/transformers/Emojis.js +31 -0
- package/dist/lib/transformers/Entitlements.d.ts +7 -0
- package/dist/lib/transformers/Entitlements.js +58 -0
- package/dist/lib/transformers/GuildScheduledEvents.d.ts +5 -0
- package/dist/lib/transformers/GuildScheduledEvents.js +51 -0
- package/dist/lib/transformers/GuildTemplates.d.ts +5 -0
- package/dist/lib/transformers/GuildTemplates.js +38 -0
- package/dist/lib/transformers/Guilds.d.ts +12 -0
- package/dist/lib/transformers/Guilds.js +264 -0
- package/dist/lib/transformers/Interactions.d.ts +10 -0
- package/dist/lib/transformers/Interactions.js +273 -0
- package/dist/lib/transformers/Invites.d.ts +5 -0
- package/dist/lib/transformers/Invites.js +79 -0
- package/dist/lib/transformers/Polls.d.ts +5 -0
- package/dist/lib/transformers/Polls.js +50 -0
- package/dist/lib/transformers/Presences.d.ts +5 -0
- package/dist/lib/transformers/Presences.js +116 -0
- package/dist/lib/transformers/Roles.d.ts +5 -0
- package/dist/lib/transformers/Roles.js +56 -0
- package/dist/lib/transformers/SKUs.d.ts +5 -0
- package/dist/lib/transformers/SKUs.js +26 -0
- package/dist/lib/transformers/StageInstances.d.ts +5 -0
- package/dist/lib/transformers/StageInstances.js +28 -0
- package/dist/lib/transformers/Stickers.d.ts +5 -0
- package/dist/lib/transformers/Stickers.js +41 -0
- package/dist/lib/transformers/Teams.d.ts +5 -0
- package/dist/lib/transformers/Teams.js +35 -0
- package/dist/lib/transformers/Users.d.ts +5 -0
- package/dist/lib/transformers/Users.js +62 -0
- package/dist/lib/transformers/Voice.d.ts +5 -0
- package/dist/lib/transformers/Voice.js +45 -0
- package/dist/lib/transformers/Webhooks.d.ts +5 -0
- package/dist/lib/transformers/Webhooks.js +51 -0
- package/dist/lib/transformers/index.d.ts +23 -0
- package/dist/lib/transformers/index.js +39 -0
- package/dist/lib/types/entitlements.d.ts +0 -6
- package/dist/lib/types/gateway-events.d.ts +21 -8
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/interaction.d.ts +2 -2
- package/dist/lib/types/sku.d.ts +0 -12
- package/dist/lib/types/user.d.ts +2 -2
- package/dist/lib/utils/CDN.d.ts +24 -0
- package/dist/lib/utils/CDN.js +49 -0
- package/dist/lib/utils/errors.d.ts +3 -3
- package/dist/lib/utils/errors.js +10 -12
- package/dist/lib/utils/formatters.d.ts +16 -0
- package/dist/lib/utils/formatters.js +44 -0
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +15 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
- package/dist/lib/rest/CDN.d.ts +0 -22
- package/dist/lib/rest/CDN.js +0 -45
- package/dist/lib/types/voice-connections.d.ts +0 -64
- package/dist/lib/types/voice-connections.js +0 -2
- package/dist/lib/utils/Util.d.ts +0 -94
- package/dist/lib/utils/Util.js +0 -2228
- package/dist/lib/voice/VoiceConnection.d.ts +0 -57
- package/dist/lib/voice/VoiceConnection.js +0 -150
- package/dist/lib/voice/VoiceConnectionManager.d.ts +0 -19
- package/dist/lib/voice/VoiceConnectionManager.js +0 -66
- package/dist/lib/voice/index.d.ts +0 -2
- package/dist/lib/voice/index.js +0 -18
@@ -0,0 +1,676 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Channels = void 0;
|
4
|
+
const constants_1 = require("../constants");
|
5
|
+
const Applications_1 = require("./Applications");
|
6
|
+
const Emojis_1 = require("./Emojis");
|
7
|
+
const Guilds_1 = require("./Guilds");
|
8
|
+
const Interactions_1 = require("./Interactions");
|
9
|
+
const Polls_1 = require("./Polls");
|
10
|
+
const Stickers_1 = require("./Stickers");
|
11
|
+
const Users_1 = require("./Users");
|
12
|
+
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
|
+
static channelFromRaw(channel) {
|
50
|
+
return {
|
51
|
+
id: channel.id,
|
52
|
+
type: channel.type,
|
53
|
+
guildID: channel.guild_id,
|
54
|
+
position: channel.position,
|
55
|
+
permissionOverwrites: channel.permission_overwrites?.map((overwrite) => ({
|
56
|
+
id: overwrite.id,
|
57
|
+
type: overwrite.type,
|
58
|
+
allow: overwrite.allow,
|
59
|
+
deny: overwrite.deny,
|
60
|
+
})),
|
61
|
+
name: channel.name,
|
62
|
+
topic: channel.topic,
|
63
|
+
nsfw: channel.nsfw,
|
64
|
+
lastMessageID: channel.last_message_id,
|
65
|
+
bitrate: channel.bitrate,
|
66
|
+
userLimit: channel.user_limit,
|
67
|
+
rateLimitPerUser: channel.rate_limit_per_user,
|
68
|
+
recipients: channel.recipients?.map((recipient) => Users_1.Users.userFromRaw(recipient)),
|
69
|
+
icon: channel.icon,
|
70
|
+
ownerID: channel.owner_id,
|
71
|
+
applicationID: channel.application_id,
|
72
|
+
managed: channel.managed,
|
73
|
+
parentID: channel.parent_id,
|
74
|
+
lastPinTimestamp: channel.last_pin_timestamp,
|
75
|
+
rtcRegion: channel.rtc_region,
|
76
|
+
videoQualityMode: channel.video_quality_mode,
|
77
|
+
messageCount: channel.member_count,
|
78
|
+
memberCount: channel.member_count,
|
79
|
+
threadMetadata: channel.thread_metadata !== undefined
|
80
|
+
? {
|
81
|
+
archived: channel.thread_metadata?.archived,
|
82
|
+
autoArchiveDuration: channel.thread_metadata?.auto_archive_duration,
|
83
|
+
archiveTimestamp: channel.thread_metadata?.archive_timestamp,
|
84
|
+
locked: channel.thread_metadata?.locked,
|
85
|
+
invitable: channel.thread_metadata?.invitable,
|
86
|
+
createTimestamp: channel.thread_metadata?.create_timestamp,
|
87
|
+
}
|
88
|
+
: undefined,
|
89
|
+
member: channel.member !== undefined
|
90
|
+
? Channels.threadMemberFromRaw(channel.member)
|
91
|
+
: undefined,
|
92
|
+
defaultAutoArchiveDuration: channel.default_auto_archive_duration,
|
93
|
+
permissions: channel.permissions,
|
94
|
+
flags: channel.flags,
|
95
|
+
totalMessageSent: channel.total_message_sent,
|
96
|
+
availableTags: channel.available_tags?.map((availableTag) => ({
|
97
|
+
id: availableTag.id,
|
98
|
+
name: availableTag.name,
|
99
|
+
moderated: availableTag.moderated,
|
100
|
+
emojiID: availableTag.emoji_id,
|
101
|
+
emojiName: availableTag.emoji_name,
|
102
|
+
})),
|
103
|
+
appliedTags: channel.applied_tags,
|
104
|
+
defaultReactionEmoji: channel.default_reaction_emoji !== undefined
|
105
|
+
? channel.default_reaction_emoji !== null
|
106
|
+
? {
|
107
|
+
emojiID: channel.default_reaction_emoji.emoji_id,
|
108
|
+
emojiName: channel.default_reaction_emoji.emoji_name,
|
109
|
+
}
|
110
|
+
: null
|
111
|
+
: undefined,
|
112
|
+
defaultThreadRateLimitPerUser: channel.default_thread_rate_limit_per_user,
|
113
|
+
defaultSortOrder: channel.default_sort_order,
|
114
|
+
defaultForumLayout: channel.default_forum_layout,
|
115
|
+
};
|
116
|
+
}
|
117
|
+
static channelToRaw(channel) {
|
118
|
+
return {
|
119
|
+
id: channel.id,
|
120
|
+
type: channel.type,
|
121
|
+
guild_id: channel.guildID,
|
122
|
+
position: channel.position,
|
123
|
+
permission_overwrites: channel.permissionOverwrites?.map((overwrite) => ({
|
124
|
+
id: overwrite.id,
|
125
|
+
type: overwrite.type,
|
126
|
+
allow: overwrite.allow,
|
127
|
+
deny: overwrite.deny,
|
128
|
+
})),
|
129
|
+
name: channel.name,
|
130
|
+
topic: channel.topic,
|
131
|
+
nsfw: channel.nsfw,
|
132
|
+
last_message_id: channel.lastMessageID,
|
133
|
+
bitrate: channel.bitrate,
|
134
|
+
user_limit: channel.userLimit,
|
135
|
+
rate_limit_per_user: channel.rateLimitPerUser,
|
136
|
+
recipients: channel.recipients?.map((recipient) => Users_1.Users.userToRaw(recipient)),
|
137
|
+
icon: channel.icon,
|
138
|
+
owner_id: channel.ownerID,
|
139
|
+
application_id: channel.applicationID,
|
140
|
+
managed: channel.managed,
|
141
|
+
parent_id: channel.parentID,
|
142
|
+
last_pin_timestamp: channel.lastPinTimestamp,
|
143
|
+
rtc_region: channel.rtcRegion,
|
144
|
+
video_quality_mode: channel.videoQualityMode,
|
145
|
+
message_count: channel.messageCount,
|
146
|
+
member_count: channel.memberCount,
|
147
|
+
thread_metadata: channel.threadMetadata !== undefined
|
148
|
+
? {
|
149
|
+
archived: channel.threadMetadata?.archived,
|
150
|
+
auto_archive_duration: channel.threadMetadata?.autoArchiveDuration,
|
151
|
+
archive_timestamp: channel.threadMetadata?.archiveTimestamp,
|
152
|
+
locked: channel.threadMetadata?.locked,
|
153
|
+
invitable: channel.threadMetadata?.invitable,
|
154
|
+
create_timestamp: channel.threadMetadata?.createTimestamp,
|
155
|
+
}
|
156
|
+
: undefined,
|
157
|
+
member: channel.member !== undefined
|
158
|
+
? Channels.threadMemberToRaw(channel.member)
|
159
|
+
: undefined,
|
160
|
+
default_auto_archive_duration: channel.defaultAutoArchiveDuration,
|
161
|
+
permissions: channel.permissions,
|
162
|
+
flags: channel.flags,
|
163
|
+
total_message_sent: channel.totalMessageSent,
|
164
|
+
available_tags: channel.availableTags?.map((availableTag) => ({
|
165
|
+
id: availableTag.id,
|
166
|
+
name: availableTag.name,
|
167
|
+
moderated: availableTag.moderated,
|
168
|
+
emoji_id: availableTag.emojiID,
|
169
|
+
emoji_name: availableTag.emojiName,
|
170
|
+
})),
|
171
|
+
applied_tags: channel.appliedTags,
|
172
|
+
default_reaction_emoji: channel.defaultReactionEmoji !== undefined
|
173
|
+
? channel.defaultReactionEmoji !== null
|
174
|
+
? {
|
175
|
+
emoji_id: channel.defaultReactionEmoji.emojiID,
|
176
|
+
emoji_name: channel.defaultReactionEmoji.emojiName,
|
177
|
+
}
|
178
|
+
: null
|
179
|
+
: undefined,
|
180
|
+
default_thread_rate_limit_per_user: channel.defaultThreadRateLimitPerUser,
|
181
|
+
default_sort_order: channel.defaultSortOrder,
|
182
|
+
default_forum_layout: channel.defaultForumLayout,
|
183
|
+
};
|
184
|
+
}
|
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
|
+
messageReference: message.message_reference !== undefined
|
503
|
+
? {
|
504
|
+
messageID: message.message_reference.message_id,
|
505
|
+
channelID: message.message_reference.channel_id,
|
506
|
+
guildID: message.message_reference.guild_id,
|
507
|
+
failIfNotExists: message.message_reference.fail_if_not_exists,
|
508
|
+
}
|
509
|
+
: undefined,
|
510
|
+
flags: message.flags,
|
511
|
+
referencedMessage: message.referenced_message !== undefined
|
512
|
+
? message.referenced_message !== null
|
513
|
+
? Channels.messageFromRaw(message.referenced_message)
|
514
|
+
: null
|
515
|
+
: undefined,
|
516
|
+
interactionMetadata: message.interaction_metadata !== undefined
|
517
|
+
? Interactions_1.Interactions.interactionMetadataFromRaw(message.interaction_metadata)
|
518
|
+
: undefined,
|
519
|
+
interaction: message.interaction !== undefined
|
520
|
+
? {
|
521
|
+
id: message.interaction.id,
|
522
|
+
type: message.interaction.type,
|
523
|
+
name: message.interaction.name,
|
524
|
+
user: Users_1.Users.userFromRaw(message.interaction.user),
|
525
|
+
member: message.interaction.member !== undefined
|
526
|
+
? Guilds_1.Guilds.guildMemberFromRaw(message.interaction.member)
|
527
|
+
: undefined,
|
528
|
+
}
|
529
|
+
: undefined,
|
530
|
+
thread: message.thread !== undefined
|
531
|
+
? Channels.channelFromRaw(message.thread)
|
532
|
+
: undefined,
|
533
|
+
components: message.components !== undefined
|
534
|
+
? Channels.componentsFromRaw(message.components)
|
535
|
+
: undefined,
|
536
|
+
stickerItems: message.sticker_items?.map((stickerItem) => ({
|
537
|
+
id: stickerItem.id,
|
538
|
+
name: stickerItem.name,
|
539
|
+
formatType: stickerItem.format_type,
|
540
|
+
})),
|
541
|
+
stickers: message.stickers?.map((sticker) => Stickers_1.Stickers.stickerFromRaw(sticker)),
|
542
|
+
position: message.position,
|
543
|
+
roleSubscriptionData: message.role_subscription_data !== undefined
|
544
|
+
? {
|
545
|
+
roleSubscriptionListingID: message.role_subscription_data.role_subscription_listing_id,
|
546
|
+
tierName: message.role_subscription_data.tier_name,
|
547
|
+
totalMonthsSubscribed: message.role_subscription_data.total_months_subscribed,
|
548
|
+
isRenewal: message.role_subscription_data.is_renewal,
|
549
|
+
}
|
550
|
+
: undefined,
|
551
|
+
resolved: message.resolved !== undefined
|
552
|
+
? Interactions_1.Interactions.resolvedDataFromRaw(message.resolved)
|
553
|
+
: undefined,
|
554
|
+
poll: message.poll !== undefined
|
555
|
+
? Polls_1.Polls.pollFromRaw(message.poll)
|
556
|
+
: undefined,
|
557
|
+
call: message.call,
|
558
|
+
};
|
559
|
+
}
|
560
|
+
static messageToRaw(message) {
|
561
|
+
return {
|
562
|
+
id: message.id,
|
563
|
+
channel_id: message.channelID,
|
564
|
+
author: Users_1.Users.userToRaw(message.author),
|
565
|
+
content: message.content,
|
566
|
+
timestamp: message.timestamp,
|
567
|
+
edited_timestamp: message.editedTimestamp,
|
568
|
+
tts: message.tts,
|
569
|
+
mention_everyone: message.mentionEveryone,
|
570
|
+
mentions: message.mentions.map((user) => Users_1.Users.userToRaw(user)),
|
571
|
+
mention_roles: message.mentionRoles,
|
572
|
+
mention_channels: message.mentionChannels?.map((channelMention) => ({
|
573
|
+
id: channelMention.id,
|
574
|
+
guild_id: channelMention.guildID,
|
575
|
+
type: channelMention.type,
|
576
|
+
name: channelMention.name,
|
577
|
+
})),
|
578
|
+
attachments: message.attachments.map((attachment) => Channels.attachmentToRaw(attachment)),
|
579
|
+
embeds: message.embeds,
|
580
|
+
reactions: message.reactions?.map((reaction) => ({
|
581
|
+
count: reaction.count,
|
582
|
+
count_details: reaction.countDetails,
|
583
|
+
me: reaction.me,
|
584
|
+
me_burst: reaction.meBurst,
|
585
|
+
emoji: Emojis_1.Emojis.emojiToRaw(reaction.emoji),
|
586
|
+
burst_colors: reaction.burstColors,
|
587
|
+
})),
|
588
|
+
nonce: message.nonce,
|
589
|
+
pinned: message.pinned,
|
590
|
+
webhook_id: message.webhookID,
|
591
|
+
type: message.type,
|
592
|
+
activity: message.activity,
|
593
|
+
application: message.application !== undefined
|
594
|
+
? Applications_1.Applications.applicationToRaw(message.application)
|
595
|
+
: undefined,
|
596
|
+
application_id: message.applicationID,
|
597
|
+
message_reference: message.messageReference !== undefined
|
598
|
+
? {
|
599
|
+
message_id: message.messageReference.messageID,
|
600
|
+
channel_id: message.messageReference.channelID,
|
601
|
+
guild_id: message.messageReference.guildID,
|
602
|
+
fail_if_not_exists: message.messageReference.failIfNotExists,
|
603
|
+
}
|
604
|
+
: undefined,
|
605
|
+
flags: message.flags,
|
606
|
+
referenced_message: message.referencedMessage !== undefined
|
607
|
+
? message.referencedMessage !== null
|
608
|
+
? Channels.messageToRaw(message.referencedMessage)
|
609
|
+
: null
|
610
|
+
: undefined,
|
611
|
+
interaction_metadata: message.interactionMetadata !== undefined
|
612
|
+
? Interactions_1.Interactions.interactionMetadataToRaw(message.interactionMetadata)
|
613
|
+
: undefined,
|
614
|
+
interaction: message.interaction !== undefined
|
615
|
+
? {
|
616
|
+
id: message.interaction.id,
|
617
|
+
type: message.interaction.type,
|
618
|
+
name: message.interaction.name,
|
619
|
+
user: Users_1.Users.userToRaw(message.interaction.user),
|
620
|
+
member: message.interaction.member !== undefined
|
621
|
+
? Guilds_1.Guilds.guildMemberToRaw(message.interaction.member)
|
622
|
+
: undefined,
|
623
|
+
}
|
624
|
+
: undefined,
|
625
|
+
thread: message.thread !== undefined
|
626
|
+
? Channels.channelToRaw(message.thread)
|
627
|
+
: undefined,
|
628
|
+
components: message.components !== undefined
|
629
|
+
? Channels.componentsToRaw(message.components)
|
630
|
+
: undefined,
|
631
|
+
sticker_items: message.stickerItems?.map((stickerItem) => ({
|
632
|
+
id: stickerItem.id,
|
633
|
+
name: stickerItem.name,
|
634
|
+
format_type: stickerItem.formatType,
|
635
|
+
})),
|
636
|
+
stickers: message.stickers?.map((sticker) => Stickers_1.Stickers.stickerToRaw(sticker)),
|
637
|
+
position: message.position,
|
638
|
+
role_subscription_data: message.roleSubscriptionData !== undefined
|
639
|
+
? {
|
640
|
+
role_subscription_listing_id: message.roleSubscriptionData.roleSubscriptionListingID,
|
641
|
+
tier_name: message.roleSubscriptionData.tierName,
|
642
|
+
total_months_subscribed: message.roleSubscriptionData.totalMonthsSubscribed,
|
643
|
+
is_renewal: message.roleSubscriptionData.isRenewal,
|
644
|
+
}
|
645
|
+
: undefined,
|
646
|
+
resolved: message.resolved !== undefined
|
647
|
+
? Interactions_1.Interactions.resolvedDataToRaw(message.resolved)
|
648
|
+
: undefined,
|
649
|
+
poll: message.poll !== undefined ? Polls_1.Polls.pollToRaw(message.poll) : undefined,
|
650
|
+
call: message.call,
|
651
|
+
};
|
652
|
+
}
|
653
|
+
static threadMemberFromRaw(threadMember) {
|
654
|
+
return {
|
655
|
+
id: threadMember.id,
|
656
|
+
userID: threadMember.user_id,
|
657
|
+
joinTimestamp: threadMember.join_timestamp,
|
658
|
+
flags: threadMember.flags,
|
659
|
+
member: threadMember.member !== undefined
|
660
|
+
? Guilds_1.Guilds.guildMemberFromRaw(threadMember.member)
|
661
|
+
: undefined,
|
662
|
+
};
|
663
|
+
}
|
664
|
+
static threadMemberToRaw(threadMember) {
|
665
|
+
return {
|
666
|
+
id: threadMember.id,
|
667
|
+
user_id: threadMember.userID,
|
668
|
+
join_timestamp: threadMember.joinTimestamp,
|
669
|
+
flags: threadMember.flags,
|
670
|
+
member: threadMember.member !== undefined
|
671
|
+
? Guilds_1.Guilds.guildMemberToRaw(threadMember.member)
|
672
|
+
: undefined,
|
673
|
+
};
|
674
|
+
}
|
675
|
+
}
|
676
|
+
exports.Channels = Channels;
|