disgroove 2.2.3 → 2.2.4-dev.194edcf
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 +27 -17
- package/dist/lib/Client.js +80 -46
- package/dist/lib/constants.d.ts +131 -81
- package/dist/lib/constants.js +145 -90
- package/dist/lib/gateway/Shard.js +16 -2
- package/dist/lib/rest/Endpoints.d.ts +2 -1
- package/dist/lib/rest/Endpoints.js +7 -3
- package/dist/lib/transformers/Applications.js +2 -0
- 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/application.d.ts +2 -0
- package/dist/lib/types/channel.d.ts +1 -342
- package/dist/lib/types/gateway-events.d.ts +22 -1
- 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 +366 -0
- package/dist/lib/types/message.js +2 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
@@ -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 {
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { RawAttachment, Attachment, RawEmbed, Embed, RawMessage, Message } from "../types/message";
|
2
|
+
import type { RawActionRow, ActionRow } from "../types/message-components";
|
3
|
+
export declare class Messages {
|
4
|
+
static attachmentFromRaw(attachment: RawAttachment): Attachment;
|
5
|
+
static attachmentToRaw(attachment: Attachment): RawAttachment;
|
6
|
+
static componentsFromRaw(components: Array<RawActionRow>): Array<ActionRow>;
|
7
|
+
static componentsToRaw(components: Array<ActionRow>): Array<RawActionRow>;
|
8
|
+
static embedFromRaw(embed: RawEmbed): Embed;
|
9
|
+
static embedToRaw(embed: Embed): RawEmbed;
|
10
|
+
static messageFromRaw(message: RawMessage): Message;
|
11
|
+
static messageToRaw(message: Message): RawMessage;
|
12
|
+
}
|
@@ -0,0 +1,545 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Messages = void 0;
|
4
|
+
const constants_1 = require("../constants");
|
5
|
+
const Applications_1 = require("./Applications");
|
6
|
+
const Channels_1 = require("./Channels");
|
7
|
+
const Emojis_1 = require("./Emojis");
|
8
|
+
const Guilds_1 = require("./Guilds");
|
9
|
+
const Interactions_1 = require("./Interactions");
|
10
|
+
const Polls_1 = require("./Polls");
|
11
|
+
const Stickers_1 = require("./Stickers");
|
12
|
+
const Users_1 = require("./Users");
|
13
|
+
class Messages {
|
14
|
+
static attachmentFromRaw(attachment) {
|
15
|
+
return {
|
16
|
+
id: attachment.id,
|
17
|
+
filename: attachment.filename,
|
18
|
+
title: attachment.title,
|
19
|
+
description: attachment.description,
|
20
|
+
contentType: attachment.content_type,
|
21
|
+
size: attachment.size,
|
22
|
+
url: attachment.url,
|
23
|
+
proxyURL: attachment.proxy_url,
|
24
|
+
height: attachment.height,
|
25
|
+
width: attachment.width,
|
26
|
+
ephemeral: attachment.ephemeral,
|
27
|
+
durationSecs: attachment.duration_secs,
|
28
|
+
waveform: attachment.waveform,
|
29
|
+
flags: attachment.flags,
|
30
|
+
};
|
31
|
+
}
|
32
|
+
static attachmentToRaw(attachment) {
|
33
|
+
return {
|
34
|
+
id: attachment.id,
|
35
|
+
filename: attachment.filename,
|
36
|
+
title: attachment.title,
|
37
|
+
description: attachment.description,
|
38
|
+
content_type: attachment.contentType,
|
39
|
+
size: attachment.size,
|
40
|
+
url: attachment.url,
|
41
|
+
proxy_url: attachment.proxyURL,
|
42
|
+
height: attachment.height,
|
43
|
+
width: attachment.width,
|
44
|
+
ephemeral: attachment.ephemeral,
|
45
|
+
duration_secs: attachment.durationSecs,
|
46
|
+
waveform: attachment.waveform,
|
47
|
+
flags: attachment.flags,
|
48
|
+
};
|
49
|
+
}
|
50
|
+
static componentsFromRaw(components) {
|
51
|
+
return components.map((component) => ({
|
52
|
+
type: component.type,
|
53
|
+
components: component.components.map((c) => {
|
54
|
+
switch (c.type) {
|
55
|
+
case constants_1.ComponentTypes.Button: {
|
56
|
+
return {
|
57
|
+
type: c.type,
|
58
|
+
style: c.style,
|
59
|
+
label: c.label,
|
60
|
+
emoji: c.emoji !== undefined
|
61
|
+
? {
|
62
|
+
name: c.emoji.name,
|
63
|
+
id: c.emoji.id,
|
64
|
+
animated: c.emoji.animated,
|
65
|
+
}
|
66
|
+
: undefined,
|
67
|
+
customID: c.custom_id,
|
68
|
+
skuID: c.sku_id,
|
69
|
+
url: c.url,
|
70
|
+
disabled: c.disabled,
|
71
|
+
};
|
72
|
+
}
|
73
|
+
case constants_1.ComponentTypes.TextInput: {
|
74
|
+
return {
|
75
|
+
type: c.type,
|
76
|
+
customID: c.custom_id,
|
77
|
+
style: c.style,
|
78
|
+
label: c.label,
|
79
|
+
minLength: c.min_length,
|
80
|
+
maxLength: c.max_length,
|
81
|
+
required: c.required,
|
82
|
+
value: c.value,
|
83
|
+
placeholder: c.placeholder,
|
84
|
+
};
|
85
|
+
}
|
86
|
+
case constants_1.ComponentTypes.ChannelSelect: {
|
87
|
+
return {
|
88
|
+
type: c.type,
|
89
|
+
customID: c.custom_id,
|
90
|
+
channelTypes: c.channel_types,
|
91
|
+
placeholder: c.placeholder,
|
92
|
+
defaultValues: c.default_values,
|
93
|
+
minValues: c.min_values,
|
94
|
+
maxValues: c.max_values,
|
95
|
+
disabled: c.disabled,
|
96
|
+
};
|
97
|
+
}
|
98
|
+
case constants_1.ComponentTypes.StringSelect: {
|
99
|
+
return {
|
100
|
+
type: c.type,
|
101
|
+
customID: c.custom_id,
|
102
|
+
placeholder: c.placeholder,
|
103
|
+
options: c.options?.map((option) => ({
|
104
|
+
label: option.label,
|
105
|
+
value: option.value,
|
106
|
+
description: option.description,
|
107
|
+
emoji: option.emoji !== undefined
|
108
|
+
? {
|
109
|
+
name: option.emoji.name,
|
110
|
+
id: option.emoji.id,
|
111
|
+
animated: option.emoji.animated,
|
112
|
+
}
|
113
|
+
: undefined,
|
114
|
+
default: option.default,
|
115
|
+
})),
|
116
|
+
minValues: c.min_values,
|
117
|
+
maxValues: c.max_values,
|
118
|
+
disabled: c.disabled,
|
119
|
+
};
|
120
|
+
}
|
121
|
+
case constants_1.ComponentTypes.MentionableSelect:
|
122
|
+
case constants_1.ComponentTypes.RoleSelect:
|
123
|
+
case constants_1.ComponentTypes.UserSelect: {
|
124
|
+
return {
|
125
|
+
type: c.type,
|
126
|
+
customID: c.custom_id,
|
127
|
+
placeholder: c.placeholder,
|
128
|
+
defaultValues: c.default_values,
|
129
|
+
minValues: c.min_values,
|
130
|
+
maxValues: c.max_values,
|
131
|
+
disabled: c.disabled,
|
132
|
+
};
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}),
|
136
|
+
}));
|
137
|
+
}
|
138
|
+
static componentsToRaw(components) {
|
139
|
+
return components.map((component) => ({
|
140
|
+
type: component.type,
|
141
|
+
components: component.components.map((c) => {
|
142
|
+
switch (c.type) {
|
143
|
+
case constants_1.ComponentTypes.Button: {
|
144
|
+
return {
|
145
|
+
type: c.type,
|
146
|
+
style: c.style,
|
147
|
+
label: c.label,
|
148
|
+
emoji: c.emoji !== undefined
|
149
|
+
? {
|
150
|
+
name: c.emoji.name,
|
151
|
+
id: c.emoji.id,
|
152
|
+
animated: c.emoji.animated,
|
153
|
+
}
|
154
|
+
: undefined,
|
155
|
+
custom_id: c.customID,
|
156
|
+
sku_id: c.skuID,
|
157
|
+
url: c.url,
|
158
|
+
disabled: c.disabled,
|
159
|
+
};
|
160
|
+
}
|
161
|
+
case constants_1.ComponentTypes.TextInput: {
|
162
|
+
return {
|
163
|
+
type: c.type,
|
164
|
+
custom_id: c.customID,
|
165
|
+
style: c.style,
|
166
|
+
label: c.label,
|
167
|
+
min_length: c.minLength,
|
168
|
+
max_length: c.maxLength,
|
169
|
+
required: c.required,
|
170
|
+
value: c.value,
|
171
|
+
placeholder: c.placeholder,
|
172
|
+
};
|
173
|
+
}
|
174
|
+
case constants_1.ComponentTypes.ChannelSelect: {
|
175
|
+
return {
|
176
|
+
type: c.type,
|
177
|
+
custom_id: c.customID,
|
178
|
+
channel_types: c.channelTypes,
|
179
|
+
placeholder: c.placeholder,
|
180
|
+
default_values: c.defaultValues,
|
181
|
+
min_values: c.minValues,
|
182
|
+
max_values: c.maxValues,
|
183
|
+
disabled: c.disabled,
|
184
|
+
};
|
185
|
+
}
|
186
|
+
case constants_1.ComponentTypes.StringSelect: {
|
187
|
+
return {
|
188
|
+
type: c.type,
|
189
|
+
custom_id: c.customID,
|
190
|
+
placeholder: c.placeholder,
|
191
|
+
options: c.options?.map((option) => ({
|
192
|
+
label: option.label,
|
193
|
+
value: option.value,
|
194
|
+
description: option.description,
|
195
|
+
emoji: option.emoji !== undefined
|
196
|
+
? {
|
197
|
+
name: option.emoji.name,
|
198
|
+
id: option.emoji.id,
|
199
|
+
animated: option.emoji.animated,
|
200
|
+
}
|
201
|
+
: undefined,
|
202
|
+
default: option.default,
|
203
|
+
})),
|
204
|
+
min_values: c.minValues,
|
205
|
+
max_values: c.maxValues,
|
206
|
+
disabled: c.disabled,
|
207
|
+
};
|
208
|
+
}
|
209
|
+
case constants_1.ComponentTypes.MentionableSelect:
|
210
|
+
case constants_1.ComponentTypes.RoleSelect:
|
211
|
+
case constants_1.ComponentTypes.UserSelect: {
|
212
|
+
return {
|
213
|
+
type: c.type,
|
214
|
+
custom_id: c.customID,
|
215
|
+
placeholder: c.placeholder,
|
216
|
+
default_values: c.defaultValues,
|
217
|
+
min_values: c.minValues,
|
218
|
+
max_values: c.maxValues,
|
219
|
+
disabled: c.disabled,
|
220
|
+
};
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}),
|
224
|
+
}));
|
225
|
+
}
|
226
|
+
static embedFromRaw(embed) {
|
227
|
+
return {
|
228
|
+
title: embed.title,
|
229
|
+
type: embed.type,
|
230
|
+
description: embed.description,
|
231
|
+
url: embed.url,
|
232
|
+
timestamp: embed.timestamp,
|
233
|
+
color: embed.color,
|
234
|
+
footer: embed.footer !== undefined
|
235
|
+
? {
|
236
|
+
text: embed.footer.text,
|
237
|
+
iconURL: embed.footer.icon_url,
|
238
|
+
proxyIconURL: embed.footer.proxy_icon_url,
|
239
|
+
}
|
240
|
+
: undefined,
|
241
|
+
image: embed.image !== undefined
|
242
|
+
? {
|
243
|
+
url: embed.image.url,
|
244
|
+
proxyURL: embed.image.proxy_url,
|
245
|
+
height: embed.image.height,
|
246
|
+
width: embed.image.width,
|
247
|
+
}
|
248
|
+
: undefined,
|
249
|
+
thumbnail: embed.thumbnail !== undefined
|
250
|
+
? {
|
251
|
+
url: embed.thumbnail.url,
|
252
|
+
proxyURL: embed.thumbnail.proxy_url,
|
253
|
+
height: embed.thumbnail.height,
|
254
|
+
width: embed.thumbnail.width,
|
255
|
+
}
|
256
|
+
: undefined,
|
257
|
+
video: {
|
258
|
+
url: embed.video?.url,
|
259
|
+
proxyURL: embed.video?.proxy_url,
|
260
|
+
height: embed.video?.height,
|
261
|
+
width: embed.video?.width,
|
262
|
+
},
|
263
|
+
provider: {
|
264
|
+
name: embed.provider?.name,
|
265
|
+
url: embed.provider?.url,
|
266
|
+
},
|
267
|
+
author: embed.author !== undefined
|
268
|
+
? {
|
269
|
+
name: embed.author.name,
|
270
|
+
url: embed.author.url,
|
271
|
+
iconURL: embed.author.icon_url,
|
272
|
+
proxyIconURL: embed.author.proxy_icon_url,
|
273
|
+
}
|
274
|
+
: undefined,
|
275
|
+
fields: embed.fields,
|
276
|
+
};
|
277
|
+
}
|
278
|
+
static embedToRaw(embed) {
|
279
|
+
return {
|
280
|
+
title: embed.title,
|
281
|
+
type: embed.type,
|
282
|
+
description: embed.description,
|
283
|
+
url: embed.url,
|
284
|
+
timestamp: embed.timestamp,
|
285
|
+
color: embed.color,
|
286
|
+
footer: embed.footer !== undefined
|
287
|
+
? {
|
288
|
+
text: embed.footer.text,
|
289
|
+
icon_url: embed.footer.iconURL,
|
290
|
+
proxy_icon_url: embed.footer.proxyIconURL,
|
291
|
+
}
|
292
|
+
: undefined,
|
293
|
+
image: embed.image !== undefined
|
294
|
+
? {
|
295
|
+
url: embed.image.url,
|
296
|
+
proxy_url: embed.image.proxyURL,
|
297
|
+
height: embed.image.height,
|
298
|
+
width: embed.image.width,
|
299
|
+
}
|
300
|
+
: undefined,
|
301
|
+
thumbnail: embed.thumbnail !== undefined
|
302
|
+
? {
|
303
|
+
url: embed.thumbnail.url,
|
304
|
+
proxy_url: embed.thumbnail.proxyURL,
|
305
|
+
height: embed.thumbnail.height,
|
306
|
+
width: embed.thumbnail.width,
|
307
|
+
}
|
308
|
+
: undefined,
|
309
|
+
video: {
|
310
|
+
url: embed.video?.url,
|
311
|
+
proxy_url: embed.video?.proxyURL,
|
312
|
+
height: embed.video?.height,
|
313
|
+
width: embed.video?.width,
|
314
|
+
},
|
315
|
+
provider: {
|
316
|
+
name: embed.provider?.name,
|
317
|
+
url: embed.provider?.url,
|
318
|
+
},
|
319
|
+
author: embed.author !== undefined
|
320
|
+
? {
|
321
|
+
name: embed.author.name,
|
322
|
+
url: embed.author.url,
|
323
|
+
icon_url: embed.author.iconURL,
|
324
|
+
proxy_icon_url: embed.author.proxyIconURL,
|
325
|
+
}
|
326
|
+
: undefined,
|
327
|
+
fields: embed.fields,
|
328
|
+
};
|
329
|
+
}
|
330
|
+
static messageFromRaw(message) {
|
331
|
+
return {
|
332
|
+
id: message.id,
|
333
|
+
channelID: message.channel_id,
|
334
|
+
author: Users_1.Users.userFromRaw(message.author),
|
335
|
+
content: message.content,
|
336
|
+
timestamp: message.timestamp,
|
337
|
+
editedTimestamp: message.edited_timestamp,
|
338
|
+
tts: message.tts,
|
339
|
+
mentionEveryone: message.mention_everyone,
|
340
|
+
mentions: message.mentions.map((user) => Users_1.Users.userFromRaw(user)),
|
341
|
+
mentionRoles: message.mention_roles,
|
342
|
+
mentionChannels: message.mention_channels?.map((channelMention) => ({
|
343
|
+
id: channelMention.id,
|
344
|
+
guildID: channelMention.guild_id,
|
345
|
+
type: channelMention.type,
|
346
|
+
name: channelMention.name,
|
347
|
+
})),
|
348
|
+
attachments: message.attachments.map((attachment) => Messages.attachmentFromRaw(attachment)),
|
349
|
+
embeds: message.embeds,
|
350
|
+
reactions: message.reactions?.map((reaction) => ({
|
351
|
+
count: reaction.count,
|
352
|
+
countDetails: reaction.count_details,
|
353
|
+
me: reaction.me,
|
354
|
+
meBurst: reaction.me_burst,
|
355
|
+
emoji: Emojis_1.Emojis.emojiFromRaw(reaction.emoji),
|
356
|
+
burstColors: reaction.burst_colors,
|
357
|
+
})),
|
358
|
+
nonce: message.nonce,
|
359
|
+
pinned: message.pinned,
|
360
|
+
webhookID: message.webhook_id,
|
361
|
+
type: message.type,
|
362
|
+
activity: message.activity,
|
363
|
+
application: message.application !== undefined
|
364
|
+
? Applications_1.Applications.applicationFromRaw(message.application)
|
365
|
+
: undefined,
|
366
|
+
applicationID: message.application_id,
|
367
|
+
flags: message.flags,
|
368
|
+
messageReference: message.message_reference !== undefined
|
369
|
+
? {
|
370
|
+
messageID: message.message_reference.message_id,
|
371
|
+
channelID: message.message_reference.channel_id,
|
372
|
+
guildID: message.message_reference.guild_id,
|
373
|
+
failIfNotExists: message.message_reference.fail_if_not_exists,
|
374
|
+
}
|
375
|
+
: undefined,
|
376
|
+
messageSnapshots: message.message_snapshots?.map((messageSnapshot) => ({
|
377
|
+
message: {
|
378
|
+
type: messageSnapshot.message.type,
|
379
|
+
content: messageSnapshot.message.content,
|
380
|
+
embeds: messageSnapshot.message.embeds.map((embed) => this.embedFromRaw(embed)),
|
381
|
+
attachments: messageSnapshot.message.attachments.map((attachment) => this.attachmentFromRaw(attachment)),
|
382
|
+
timestamp: messageSnapshot.message.timestamp,
|
383
|
+
editedTimestamp: messageSnapshot.message.edited_timestamp,
|
384
|
+
flags: messageSnapshot.message.flags,
|
385
|
+
mentions: messageSnapshot.message.mentions.map((user) => Users_1.Users.userFromRaw(user)),
|
386
|
+
mentionRoles: messageSnapshot.message.mention_roles,
|
387
|
+
},
|
388
|
+
})),
|
389
|
+
referencedMessage: message.referenced_message !== undefined
|
390
|
+
? message.referenced_message !== null
|
391
|
+
? Messages.messageFromRaw(message.referenced_message)
|
392
|
+
: null
|
393
|
+
: undefined,
|
394
|
+
interactionMetadata: message.interaction_metadata !== undefined
|
395
|
+
? Interactions_1.Interactions.interactionMetadataFromRaw(message.interaction_metadata)
|
396
|
+
: undefined,
|
397
|
+
interaction: message.interaction !== undefined
|
398
|
+
? {
|
399
|
+
id: message.interaction.id,
|
400
|
+
type: message.interaction.type,
|
401
|
+
name: message.interaction.name,
|
402
|
+
user: Users_1.Users.userFromRaw(message.interaction.user),
|
403
|
+
member: message.interaction.member !== undefined
|
404
|
+
? Guilds_1.Guilds.guildMemberFromRaw(message.interaction.member)
|
405
|
+
: undefined,
|
406
|
+
}
|
407
|
+
: undefined,
|
408
|
+
thread: message.thread !== undefined
|
409
|
+
? Channels_1.Channels.channelFromRaw(message.thread)
|
410
|
+
: undefined,
|
411
|
+
components: message.components !== undefined
|
412
|
+
? Messages.componentsFromRaw(message.components)
|
413
|
+
: undefined,
|
414
|
+
stickerItems: message.sticker_items?.map((stickerItem) => ({
|
415
|
+
id: stickerItem.id,
|
416
|
+
name: stickerItem.name,
|
417
|
+
formatType: stickerItem.format_type,
|
418
|
+
})),
|
419
|
+
stickers: message.stickers?.map((sticker) => Stickers_1.Stickers.stickerFromRaw(sticker)),
|
420
|
+
position: message.position,
|
421
|
+
roleSubscriptionData: message.role_subscription_data !== undefined
|
422
|
+
? {
|
423
|
+
roleSubscriptionListingID: message.role_subscription_data.role_subscription_listing_id,
|
424
|
+
tierName: message.role_subscription_data.tier_name,
|
425
|
+
totalMonthsSubscribed: message.role_subscription_data.total_months_subscribed,
|
426
|
+
isRenewal: message.role_subscription_data.is_renewal,
|
427
|
+
}
|
428
|
+
: undefined,
|
429
|
+
resolved: message.resolved !== undefined
|
430
|
+
? Interactions_1.Interactions.resolvedDataFromRaw(message.resolved)
|
431
|
+
: undefined,
|
432
|
+
poll: message.poll !== undefined
|
433
|
+
? Polls_1.Polls.pollFromRaw(message.poll)
|
434
|
+
: undefined,
|
435
|
+
call: message.call,
|
436
|
+
};
|
437
|
+
}
|
438
|
+
static messageToRaw(message) {
|
439
|
+
return {
|
440
|
+
id: message.id,
|
441
|
+
channel_id: message.channelID,
|
442
|
+
author: Users_1.Users.userToRaw(message.author),
|
443
|
+
content: message.content,
|
444
|
+
timestamp: message.timestamp,
|
445
|
+
edited_timestamp: message.editedTimestamp,
|
446
|
+
tts: message.tts,
|
447
|
+
mention_everyone: message.mentionEveryone,
|
448
|
+
mentions: message.mentions.map((user) => Users_1.Users.userToRaw(user)),
|
449
|
+
mention_roles: message.mentionRoles,
|
450
|
+
mention_channels: message.mentionChannels?.map((channelMention) => ({
|
451
|
+
id: channelMention.id,
|
452
|
+
guild_id: channelMention.guildID,
|
453
|
+
type: channelMention.type,
|
454
|
+
name: channelMention.name,
|
455
|
+
})),
|
456
|
+
attachments: message.attachments.map((attachment) => Messages.attachmentToRaw(attachment)),
|
457
|
+
embeds: message.embeds,
|
458
|
+
reactions: message.reactions?.map((reaction) => ({
|
459
|
+
count: reaction.count,
|
460
|
+
count_details: reaction.countDetails,
|
461
|
+
me: reaction.me,
|
462
|
+
me_burst: reaction.meBurst,
|
463
|
+
emoji: Emojis_1.Emojis.emojiToRaw(reaction.emoji),
|
464
|
+
burst_colors: reaction.burstColors,
|
465
|
+
})),
|
466
|
+
nonce: message.nonce,
|
467
|
+
pinned: message.pinned,
|
468
|
+
webhook_id: message.webhookID,
|
469
|
+
type: message.type,
|
470
|
+
activity: message.activity,
|
471
|
+
application: message.application !== undefined
|
472
|
+
? Applications_1.Applications.applicationToRaw(message.application)
|
473
|
+
: undefined,
|
474
|
+
application_id: message.applicationID,
|
475
|
+
flags: message.flags,
|
476
|
+
message_reference: message.messageReference !== undefined
|
477
|
+
? {
|
478
|
+
message_id: message.messageReference.messageID,
|
479
|
+
channel_id: message.messageReference.channelID,
|
480
|
+
guild_id: message.messageReference.guildID,
|
481
|
+
fail_if_not_exists: message.messageReference.failIfNotExists,
|
482
|
+
}
|
483
|
+
: undefined,
|
484
|
+
message_snapshots: message.messageSnapshots?.map((messageSnapshot) => ({
|
485
|
+
message: {
|
486
|
+
type: messageSnapshot.message.type,
|
487
|
+
content: messageSnapshot.message.content,
|
488
|
+
embeds: messageSnapshot.message.embeds.map((embed) => this.embedToRaw(embed)),
|
489
|
+
attachments: messageSnapshot.message.attachments.map((attachment) => this.attachmentToRaw(attachment)),
|
490
|
+
timestamp: messageSnapshot.message.timestamp,
|
491
|
+
edited_timestamp: messageSnapshot.message.editedTimestamp,
|
492
|
+
flags: messageSnapshot.message.flags,
|
493
|
+
mentions: messageSnapshot.message.mentions.map((user) => Users_1.Users.userToRaw(user)),
|
494
|
+
mention_roles: messageSnapshot.message.mentionRoles,
|
495
|
+
},
|
496
|
+
})),
|
497
|
+
referenced_message: message.referencedMessage !== undefined
|
498
|
+
? message.referencedMessage !== null
|
499
|
+
? Messages.messageToRaw(message.referencedMessage)
|
500
|
+
: null
|
501
|
+
: undefined,
|
502
|
+
interaction_metadata: message.interactionMetadata !== undefined
|
503
|
+
? Interactions_1.Interactions.interactionMetadataToRaw(message.interactionMetadata)
|
504
|
+
: undefined,
|
505
|
+
interaction: message.interaction !== undefined
|
506
|
+
? {
|
507
|
+
id: message.interaction.id,
|
508
|
+
type: message.interaction.type,
|
509
|
+
name: message.interaction.name,
|
510
|
+
user: Users_1.Users.userToRaw(message.interaction.user),
|
511
|
+
member: message.interaction.member !== undefined
|
512
|
+
? Guilds_1.Guilds.guildMemberToRaw(message.interaction.member)
|
513
|
+
: undefined,
|
514
|
+
}
|
515
|
+
: undefined,
|
516
|
+
thread: message.thread !== undefined
|
517
|
+
? Channels_1.Channels.channelToRaw(message.thread)
|
518
|
+
: undefined,
|
519
|
+
components: message.components !== undefined
|
520
|
+
? Messages.componentsToRaw(message.components)
|
521
|
+
: undefined,
|
522
|
+
sticker_items: message.stickerItems?.map((stickerItem) => ({
|
523
|
+
id: stickerItem.id,
|
524
|
+
name: stickerItem.name,
|
525
|
+
format_type: stickerItem.formatType,
|
526
|
+
})),
|
527
|
+
stickers: message.stickers?.map((sticker) => Stickers_1.Stickers.stickerToRaw(sticker)),
|
528
|
+
position: message.position,
|
529
|
+
role_subscription_data: message.roleSubscriptionData !== undefined
|
530
|
+
? {
|
531
|
+
role_subscription_listing_id: message.roleSubscriptionData.roleSubscriptionListingID,
|
532
|
+
tier_name: message.roleSubscriptionData.tierName,
|
533
|
+
total_months_subscribed: message.roleSubscriptionData.totalMonthsSubscribed,
|
534
|
+
is_renewal: message.roleSubscriptionData.isRenewal,
|
535
|
+
}
|
536
|
+
: undefined,
|
537
|
+
resolved: message.resolved !== undefined
|
538
|
+
? Interactions_1.Interactions.resolvedDataToRaw(message.resolved)
|
539
|
+
: undefined,
|
540
|
+
poll: message.poll !== undefined ? Polls_1.Polls.pollToRaw(message.poll) : undefined,
|
541
|
+
call: message.call,
|
542
|
+
};
|
543
|
+
}
|
544
|
+
}
|
545
|
+
exports.Messages = Messages;
|
@@ -27,6 +27,7 @@ __exportStar(require("./GuildScheduledEvents"), exports);
|
|
27
27
|
__exportStar(require("./GuildTemplates"), exports);
|
28
28
|
__exportStar(require("./Interactions"), exports);
|
29
29
|
__exportStar(require("./Invites"), exports);
|
30
|
+
__exportStar(require("./Messages"), exports);
|
30
31
|
__exportStar(require("./Polls"), exports);
|
31
32
|
__exportStar(require("./Presences"), exports);
|
32
33
|
__exportStar(require("./Roles"), exports);
|
@@ -24,6 +24,7 @@ export interface RawApplication {
|
|
24
24
|
cover_image?: string;
|
25
25
|
flags?: ApplicationFlags;
|
26
26
|
approximate_guild_count?: number;
|
27
|
+
approximate_user_install_count?: number;
|
27
28
|
redirect_uris?: Array<string>;
|
28
29
|
interactions_endpoint_url?: string;
|
29
30
|
role_connections_verification_url?: string;
|
@@ -61,6 +62,7 @@ export interface Application {
|
|
61
62
|
coverImage?: string;
|
62
63
|
flags?: ApplicationFlags;
|
63
64
|
approximateGuildCount?: number;
|
65
|
+
approximateUserInstallCount?: number;
|
64
66
|
redirectURIs?: Array<string>;
|
65
67
|
interactionsEndpointURL?: string;
|
66
68
|
roleConnectionsVerificationURL?: string;
|