disgroove 2.2.2-dev.db6cb16 → 2.2.3-dev.933ac5e
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 +113 -118
- package/dist/lib/Client.js +377 -250
- package/dist/lib/constants.d.ts +85 -74
- package/dist/lib/constants.js +88 -75
- package/dist/lib/gateway/Shard.js +188 -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 +5 -0
- package/dist/lib/transformers/AutoModeration.js +64 -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 +248 -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 +8 -0
- package/dist/lib/transformers/Presences.js +108 -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 +48 -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/interaction.d.ts +2 -2
- package/dist/lib/types/sku.d.ts +0 -12
- 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 +6 -8
- package/dist/lib/utils/formatters.d.ts +9 -0
- package/dist/lib/utils/formatters.js +38 -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
package/dist/lib/Client.js
CHANGED
@@ -5,12 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.Client = void 0;
|
7
7
|
const constants_1 = require("./constants");
|
8
|
-
const utils_1 = require("./utils");
|
9
8
|
const rest_1 = require("./rest");
|
10
9
|
const node_events_1 = __importDefault(require("node:events"));
|
11
10
|
const gateway_1 = require("./gateway");
|
11
|
+
const transformers_1 = require("./transformers");
|
12
12
|
class Client extends node_events_1.default {
|
13
13
|
token;
|
14
|
+
properties;
|
14
15
|
compress;
|
15
16
|
largeThreshold;
|
16
17
|
presence;
|
@@ -19,7 +20,6 @@ class Client extends node_events_1.default {
|
|
19
20
|
auth;
|
20
21
|
shards;
|
21
22
|
rest;
|
22
|
-
util;
|
23
23
|
guildShardMap;
|
24
24
|
user;
|
25
25
|
guilds;
|
@@ -28,24 +28,20 @@ class Client extends node_events_1.default {
|
|
28
28
|
constructor(token, options) {
|
29
29
|
super();
|
30
30
|
this.token = token;
|
31
|
+
this.properties = options?.gateway?.properties;
|
31
32
|
this.compress = options?.gateway?.compress;
|
32
33
|
this.largeThreshold = options?.gateway?.largeThreshold;
|
33
|
-
this.presence =
|
34
|
-
activities: options?.gateway?.presence?.activities,
|
35
|
-
status: options?.gateway?.presence?.status ?? constants_1.StatusTypes.Online,
|
36
|
-
afk: !!options?.gateway?.presence?.afk,
|
37
|
-
};
|
34
|
+
this.presence = options?.gateway?.presence;
|
38
35
|
this.intents =
|
39
36
|
options?.gateway?.intents !== undefined
|
40
37
|
? Array.isArray(options.gateway.intents)
|
41
38
|
? options.gateway.intents.reduce((sum, num) => sum + num, 0)
|
42
39
|
: options.gateway.intents
|
43
|
-
:
|
40
|
+
: 0;
|
44
41
|
this.shardsCount = options?.shardsCount ?? "auto";
|
45
42
|
this.auth = options?.auth ?? "Bot";
|
46
43
|
this.shards = new gateway_1.ShardManager();
|
47
44
|
this.rest = new rest_1.RequestManager(token, this.auth);
|
48
|
-
this.util = new utils_1.Util();
|
49
45
|
this.guildShardMap = {};
|
50
46
|
this.user = null;
|
51
47
|
this.guilds = new Map();
|
@@ -72,7 +68,7 @@ class Client extends node_events_1.default {
|
|
72
68
|
deaf: options.deaf,
|
73
69
|
},
|
74
70
|
});
|
75
|
-
return response !== null ?
|
71
|
+
return response !== null ? transformers_1.Guilds.guildMemberFromRaw(response) : null;
|
76
72
|
}
|
77
73
|
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
78
74
|
addGuildMemberRole(guildID, userID, roleID, reason) {
|
@@ -97,7 +93,7 @@ class Client extends node_events_1.default {
|
|
97
93
|
}
|
98
94
|
/** https://discord.com/developers/docs/resources/guild#bulk-guild-ban */
|
99
95
|
async bulkGuildBan(guildID, options, reason) {
|
100
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.
|
96
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildBulkBan(guildID), {
|
101
97
|
json: {
|
102
98
|
user_ids: options.userIDs,
|
103
99
|
delete_message_seconds: options.deleteMessageSeconds,
|
@@ -121,16 +117,40 @@ class Client extends node_events_1.default {
|
|
121
117
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
122
118
|
async bulkEditGlobalApplicationCommands(applicationID, commands) {
|
123
119
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommands(applicationID), {
|
124
|
-
json: commands.map((command) =>
|
120
|
+
json: commands.map((command) => ({
|
121
|
+
id: command.id,
|
122
|
+
name: command.name,
|
123
|
+
name_localizations: command.nameLocalizations,
|
124
|
+
description: command.description,
|
125
|
+
description_localizations: command.descriptionLocalizations,
|
126
|
+
options: command.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
127
|
+
default_member_permissions: command.defaultMemberPermissions,
|
128
|
+
default_permissions: command.defaultPermission,
|
129
|
+
integration_types: command.integrationTypes,
|
130
|
+
contexts: command.contexts,
|
131
|
+
type: command.type,
|
132
|
+
nsfw: command.nsfw,
|
133
|
+
})),
|
125
134
|
});
|
126
|
-
return response.map((c) =>
|
135
|
+
return response.map((c) => transformers_1.ApplicationCommands.applicationCommandFromRaw(c));
|
127
136
|
}
|
128
137
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
129
138
|
async bulkEditGuildApplicationCommands(applicationID, guildID, commands) {
|
130
139
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
131
|
-
json: commands.map((command) =>
|
140
|
+
json: commands.map((command) => ({
|
141
|
+
id: command.id,
|
142
|
+
name: command.name,
|
143
|
+
name_localizations: command.nameLocalizations,
|
144
|
+
description: command.description,
|
145
|
+
description_localizations: command.descriptionLocalizations,
|
146
|
+
options: command.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
147
|
+
default_member_permissions: command.defaultMemberPermissions,
|
148
|
+
default_permissions: command.defaultPermission,
|
149
|
+
type: command.type,
|
150
|
+
nsfw: command.nsfw,
|
151
|
+
})),
|
132
152
|
});
|
133
|
-
return response.map((c) =>
|
153
|
+
return response.map((c) => transformers_1.ApplicationCommands.applicationCommandFromRaw(c));
|
134
154
|
}
|
135
155
|
/** https://discord.com/developers/docs/topics/gateway#connections */
|
136
156
|
async connect() {
|
@@ -153,7 +173,16 @@ class Client extends node_events_1.default {
|
|
153
173
|
name: options.name,
|
154
174
|
event_type: options.eventType,
|
155
175
|
trigger_type: options.triggerType,
|
156
|
-
trigger_metadata: options.triggerMetadata
|
176
|
+
trigger_metadata: options.triggerMetadata !== undefined
|
177
|
+
? {
|
178
|
+
keyword_filter: options.triggerMetadata.keywordFilter,
|
179
|
+
regex_patterns: options.triggerMetadata.regexPatterns,
|
180
|
+
presets: options.triggerMetadata.presets,
|
181
|
+
allow_list: options.triggerMetadata.allowList,
|
182
|
+
mention_total_limit: options.triggerMetadata.mentionTotalLimit,
|
183
|
+
mention_raid_protection: options.triggerMetadata.mentionRaidProtection,
|
184
|
+
}
|
185
|
+
: undefined,
|
157
186
|
actions: options.actions.map((action) => ({
|
158
187
|
type: action.type,
|
159
188
|
metadata: {
|
@@ -168,7 +197,7 @@ class Client extends node_events_1.default {
|
|
168
197
|
},
|
169
198
|
reason,
|
170
199
|
});
|
171
|
-
return
|
200
|
+
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
172
201
|
}
|
173
202
|
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
174
203
|
async createChannel(guildID, options, reason) {
|
@@ -202,7 +231,7 @@ class Client extends node_events_1.default {
|
|
202
231
|
},
|
203
232
|
reason,
|
204
233
|
});
|
205
|
-
return
|
234
|
+
return transformers_1.Channels.channelFromRaw(response);
|
206
235
|
}
|
207
236
|
/** https://discord.com/developers/docs/resources/channel#create-channel-invite */
|
208
237
|
async createChannelInvite(channelID, options, reason) {
|
@@ -218,7 +247,7 @@ class Client extends node_events_1.default {
|
|
218
247
|
},
|
219
248
|
reason,
|
220
249
|
});
|
221
|
-
return
|
250
|
+
return transformers_1.Invites.inviteFromRaw(response);
|
222
251
|
}
|
223
252
|
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
224
253
|
async createChannelWebhook(channelID, options, reason) {
|
@@ -229,7 +258,7 @@ class Client extends node_events_1.default {
|
|
229
258
|
},
|
230
259
|
reason,
|
231
260
|
});
|
232
|
-
return
|
261
|
+
return transformers_1.Webhooks.webhookFromRaw(response);
|
233
262
|
}
|
234
263
|
/** https://discord.com/developers/docs/resources/user#create-dm */
|
235
264
|
async createDM(options) {
|
@@ -238,14 +267,26 @@ class Client extends node_events_1.default {
|
|
238
267
|
recipient_id: options.recipientID,
|
239
268
|
},
|
240
269
|
});
|
241
|
-
return
|
270
|
+
return transformers_1.Channels.channelFromRaw(response);
|
242
271
|
}
|
243
272
|
/** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
|
244
273
|
async createGlobalApplicationCommand(applicationID, options) {
|
245
274
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationCommands(applicationID), {
|
246
|
-
json:
|
275
|
+
json: {
|
276
|
+
name: options.name,
|
277
|
+
name_localizations: options.nameLocalizations,
|
278
|
+
description: options.description,
|
279
|
+
description_localizations: options.descriptionLocalizations,
|
280
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
281
|
+
default_member_permissions: options.defaultMemberPermissions,
|
282
|
+
default_permissions: options.defaultPermission,
|
283
|
+
integration_types: options.integrationTypes,
|
284
|
+
contexts: options.contexts,
|
285
|
+
type: options.type,
|
286
|
+
nsfw: options.nsfw,
|
287
|
+
},
|
247
288
|
});
|
248
|
-
return
|
289
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
249
290
|
}
|
250
291
|
/** https://discord.com/developers/docs/resources/user#create-group-dm */
|
251
292
|
async createGroupDM(options) {
|
@@ -255,14 +296,13 @@ class Client extends node_events_1.default {
|
|
255
296
|
nicks: options.nicks,
|
256
297
|
},
|
257
298
|
});
|
258
|
-
return
|
299
|
+
return transformers_1.Channels.channelFromRaw(response);
|
259
300
|
}
|
260
301
|
/** https://discord.com/developers/docs/resources/guild#create-guild */
|
261
302
|
async createGuild(options) {
|
262
303
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guilds(), {
|
263
304
|
json: {
|
264
305
|
name: options.name,
|
265
|
-
region: options.region,
|
266
306
|
icon: options.icon,
|
267
307
|
verification_level: options.verificationLevel,
|
268
308
|
default_message_notifications: options.defaultMessageNotifications,
|
@@ -276,20 +316,36 @@ class Client extends node_events_1.default {
|
|
276
316
|
permissions: role.permissions,
|
277
317
|
mentionable: role.mentionable,
|
278
318
|
})),
|
319
|
+
channels: options.channels?.map((channel) => ({
|
320
|
+
name: channel.name,
|
321
|
+
type: channel.type,
|
322
|
+
id: channel.id,
|
323
|
+
parent_id: channel.id,
|
324
|
+
})),
|
279
325
|
afk_channel_id: options.afkChannelID,
|
280
326
|
afk_timeout: options.afkTimeout,
|
281
327
|
system_channel_id: options.systemChannelID,
|
282
328
|
system_channel_flags: options.systemChannelFlags,
|
283
329
|
},
|
284
330
|
});
|
285
|
-
return
|
331
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
286
332
|
}
|
287
333
|
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
288
334
|
async createGuildApplicationCommand(applicationID, guildID, options) {
|
289
335
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
290
|
-
json:
|
336
|
+
json: {
|
337
|
+
name: options.name,
|
338
|
+
name_localizations: options.nameLocalizations,
|
339
|
+
description: options.description,
|
340
|
+
description_localizations: options.descriptionLocalizations,
|
341
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
342
|
+
default_member_permissions: options.defaultMemberPermissions,
|
343
|
+
default_permissions: options.defaultPermission,
|
344
|
+
type: options.type,
|
345
|
+
nsfw: options.nsfw,
|
346
|
+
},
|
291
347
|
});
|
292
|
-
return
|
348
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
293
349
|
}
|
294
350
|
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
295
351
|
createGuildBan(guildID, userID, options, reason) {
|
@@ -311,7 +367,7 @@ class Client extends node_events_1.default {
|
|
311
367
|
},
|
312
368
|
reason,
|
313
369
|
});
|
314
|
-
return
|
370
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
315
371
|
}
|
316
372
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template */
|
317
373
|
async createGuildFromTemplate(code, options) {
|
@@ -321,7 +377,7 @@ class Client extends node_events_1.default {
|
|
321
377
|
icon: options.icon,
|
322
378
|
},
|
323
379
|
});
|
324
|
-
return
|
380
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
325
381
|
}
|
326
382
|
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
327
383
|
async createGuildRole(guildID, options, reason) {
|
@@ -337,7 +393,7 @@ class Client extends node_events_1.default {
|
|
337
393
|
},
|
338
394
|
reason,
|
339
395
|
});
|
340
|
-
return
|
396
|
+
return transformers_1.Roles.roleFromRaw(response);
|
341
397
|
}
|
342
398
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
343
399
|
async createGuildScheduledEvent(guildID, options, reason) {
|
@@ -355,7 +411,7 @@ class Client extends node_events_1.default {
|
|
355
411
|
},
|
356
412
|
reason,
|
357
413
|
});
|
358
|
-
return
|
414
|
+
return transformers_1.GuildScheduledEvents.guildScheduledEventFromRaw(response);
|
359
415
|
}
|
360
416
|
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
|
361
417
|
async createGuildSticker(guildID, options, reason) {
|
@@ -368,7 +424,7 @@ class Client extends node_events_1.default {
|
|
368
424
|
form: formData,
|
369
425
|
reason,
|
370
426
|
});
|
371
|
-
return
|
427
|
+
return transformers_1.Stickers.stickerFromRaw(response);
|
372
428
|
}
|
373
429
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
374
430
|
async createGuildTemplate(guildID, options) {
|
@@ -378,7 +434,7 @@ class Client extends node_events_1.default {
|
|
378
434
|
description: options.description,
|
379
435
|
},
|
380
436
|
});
|
381
|
-
return
|
437
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
382
438
|
}
|
383
439
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message */
|
384
440
|
async createInteractionFollowupMessage(applicationID, interactionToken, options) {
|
@@ -386,9 +442,7 @@ class Client extends node_events_1.default {
|
|
386
442
|
json: {
|
387
443
|
content: options.content,
|
388
444
|
tts: options.tts,
|
389
|
-
embeds: options.embeds
|
390
|
-
? options.embeds?.map((embed) => this.util.embedToRaw(embed))
|
391
|
-
: null,
|
445
|
+
embeds: options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
392
446
|
allowed_mentions: options.allowedMentions !== undefined
|
393
447
|
? options.allowedMentions !== null
|
394
448
|
? {
|
@@ -400,11 +454,9 @@ class Client extends node_events_1.default {
|
|
400
454
|
: null
|
401
455
|
: undefined,
|
402
456
|
components: options.components !== undefined
|
403
|
-
? options.components
|
404
|
-
? this.util.messageComponentsToRaw(options.components)
|
405
|
-
: null
|
457
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
406
458
|
: undefined,
|
407
|
-
attachments: options.attachments
|
459
|
+
attachments: options.attachments,
|
408
460
|
flags: options.flags,
|
409
461
|
thread_name: options.threadName,
|
410
462
|
poll: options.poll !== undefined
|
@@ -422,7 +474,7 @@ class Client extends node_events_1.default {
|
|
422
474
|
},
|
423
475
|
files: options.files,
|
424
476
|
});
|
425
|
-
return
|
477
|
+
return transformers_1.Channels.messageFromRaw(response);
|
426
478
|
}
|
427
479
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
|
428
480
|
createInteractionResponse(interactionID, interactionToken, options) {
|
@@ -436,7 +488,7 @@ class Client extends node_events_1.default {
|
|
436
488
|
data: {
|
437
489
|
content: options.data?.content,
|
438
490
|
embeds: options.data?.embeds !== undefined
|
439
|
-
? options.data.embeds.map((embed) =>
|
491
|
+
? options.data.embeds.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
440
492
|
: undefined,
|
441
493
|
allowed_mentions: options.data?.allowedMentions !== undefined
|
442
494
|
? {
|
@@ -448,9 +500,9 @@ class Client extends node_events_1.default {
|
|
448
500
|
: undefined,
|
449
501
|
flags: options.data?.flags,
|
450
502
|
components: options.data?.components !== undefined
|
451
|
-
?
|
503
|
+
? transformers_1.Channels.componentsToRaw(options.data.components)
|
452
504
|
: undefined,
|
453
|
-
attachments: options.data?.attachments
|
505
|
+
attachments: options.data?.attachments,
|
454
506
|
poll: options.data?.poll !== undefined
|
455
507
|
? {
|
456
508
|
question: options.data.poll.question,
|
@@ -506,7 +558,7 @@ class Client extends node_events_1.default {
|
|
506
558
|
data: {
|
507
559
|
custom_id: options.data?.customID,
|
508
560
|
components: options.data?.components !== undefined
|
509
|
-
?
|
561
|
+
? transformers_1.Channels.componentsToRaw(options.data.components)
|
510
562
|
: undefined,
|
511
563
|
title: options.data?.title,
|
512
564
|
},
|
@@ -533,7 +585,7 @@ class Client extends node_events_1.default {
|
|
533
585
|
content: options.content,
|
534
586
|
nonce: options.nonce,
|
535
587
|
tts: options.tts,
|
536
|
-
embeds: options.embeds?.map((embed) =>
|
588
|
+
embeds: options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
537
589
|
allowed_mentions: options.allowedMentions !== undefined
|
538
590
|
? {
|
539
591
|
parse: options.allowedMentions.parse,
|
@@ -542,12 +594,19 @@ class Client extends node_events_1.default {
|
|
542
594
|
replied_user: options.allowedMentions.repliedUser,
|
543
595
|
}
|
544
596
|
: undefined,
|
545
|
-
message_reference: options.messageReference
|
597
|
+
message_reference: options.messageReference !== undefined
|
598
|
+
? {
|
599
|
+
message_id: options.messageReference.messageID,
|
600
|
+
channel_id: options.messageReference.channelID,
|
601
|
+
guild_id: options.messageReference.guildID,
|
602
|
+
fail_if_not_exists: options.messageReference.failIfNotExists,
|
603
|
+
}
|
604
|
+
: undefined,
|
546
605
|
components: options.components !== undefined
|
547
|
-
?
|
606
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
548
607
|
: undefined,
|
549
608
|
stickers_ids: options.stickersIDs,
|
550
|
-
attachments: options.attachments
|
609
|
+
attachments: options.attachments,
|
551
610
|
flags: options.flags,
|
552
611
|
enforce_nonce: options.enforceNonce,
|
553
612
|
poll: options.poll !== undefined
|
@@ -565,7 +624,7 @@ class Client extends node_events_1.default {
|
|
565
624
|
},
|
566
625
|
files: options.files,
|
567
626
|
});
|
568
|
-
return
|
627
|
+
return transformers_1.Channels.messageFromRaw(response);
|
569
628
|
}
|
570
629
|
/** https://discord.com/developers/docs/resources/channel#create-reaction */
|
571
630
|
createMessageReaction(channelID, messageID, emoji) {
|
@@ -583,7 +642,7 @@ class Client extends node_events_1.default {
|
|
583
642
|
},
|
584
643
|
reason,
|
585
644
|
});
|
586
|
-
return
|
645
|
+
return transformers_1.StageInstances.stageInstanceFromRaw(response);
|
587
646
|
}
|
588
647
|
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
|
589
648
|
async createTestEntitlement(applicationID, options) {
|
@@ -594,7 +653,7 @@ class Client extends node_events_1.default {
|
|
594
653
|
owner_type: options.ownerType,
|
595
654
|
},
|
596
655
|
});
|
597
|
-
return
|
656
|
+
return transformers_1.Entitlements.testEntitlementFromRaw(response);
|
598
657
|
}
|
599
658
|
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel */
|
600
659
|
async createThread(channelID, options, reason) {
|
@@ -605,24 +664,25 @@ class Client extends node_events_1.default {
|
|
605
664
|
rate_limit_per_user: options.rateLimitPerUser,
|
606
665
|
message: {
|
607
666
|
content: options.message.content,
|
608
|
-
embeds: options.message.embeds?.map((embed) =>
|
667
|
+
embeds: options.message.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
609
668
|
allowed_mentions: options.message.allowedMentions !== undefined
|
610
|
-
?
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
}
|
617
|
-
: null
|
669
|
+
? {
|
670
|
+
parse: options.message.allowedMentions.parse,
|
671
|
+
roles: options.message.allowedMentions.roles,
|
672
|
+
users: options.message.allowedMentions.users,
|
673
|
+
replied_user: options.message.allowedMentions.repliedUser,
|
674
|
+
}
|
618
675
|
: undefined,
|
676
|
+
sticker_ids: options.message.stickerIDs,
|
677
|
+
attachments: options.message.attachments,
|
678
|
+
flags: options.message.flags,
|
619
679
|
},
|
620
680
|
applied_tags: options.appliedTags,
|
621
681
|
},
|
622
|
-
files: options.files,
|
682
|
+
files: options.message.files,
|
623
683
|
reason,
|
624
684
|
});
|
625
|
-
return
|
685
|
+
return transformers_1.Channels.channelFromRaw(response);
|
626
686
|
}
|
627
687
|
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
|
628
688
|
async createThreadFromMessage(channelID, messageID, options, reason) {
|
@@ -634,7 +694,7 @@ class Client extends node_events_1.default {
|
|
634
694
|
},
|
635
695
|
reason,
|
636
696
|
});
|
637
|
-
return
|
697
|
+
return transformers_1.Channels.channelFromRaw(response);
|
638
698
|
}
|
639
699
|
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message */
|
640
700
|
async createThreadWithoutMessage(channelID, options, reason) {
|
@@ -648,12 +708,12 @@ class Client extends node_events_1.default {
|
|
648
708
|
},
|
649
709
|
reason,
|
650
710
|
});
|
651
|
-
return
|
711
|
+
return transformers_1.Channels.channelFromRaw(response);
|
652
712
|
}
|
653
713
|
/** https://discord.com/developers/docs/resources/channel#crosspost-message */
|
654
714
|
async crosspostMessage(channelID, messageID) {
|
655
715
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessage(channelID, messageID));
|
656
|
-
return
|
716
|
+
return transformers_1.Channels.messageFromRaw(response);
|
657
717
|
}
|
658
718
|
/** https://discord.com/developers/docs/resources/channel#delete-all-reactions */
|
659
719
|
deleteAllMessageReactions(channelID, messageID, emoji) {
|
@@ -670,7 +730,7 @@ class Client extends node_events_1.default {
|
|
670
730
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channel(channelID), {
|
671
731
|
reason,
|
672
732
|
});
|
673
|
-
return
|
733
|
+
return transformers_1.Channels.channelFromRaw(response);
|
674
734
|
}
|
675
735
|
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
676
736
|
deleteChannelPermission(channelID, overwriteID, reason) {
|
@@ -721,14 +781,14 @@ class Client extends node_events_1.default {
|
|
721
781
|
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
722
782
|
async deleteGuildTemplate(guildID, code) {
|
723
783
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildTemplate(guildID, code));
|
724
|
-
return
|
784
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
725
785
|
}
|
726
786
|
/** https://discord.com/developers/docs/resources/invite#delete-invite */
|
727
787
|
async deleteInvite(code, reason) {
|
728
788
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.invite(code), {
|
729
789
|
reason,
|
730
790
|
});
|
731
|
-
return
|
791
|
+
return transformers_1.Invites.inviteFromRaw(response);
|
732
792
|
}
|
733
793
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message */
|
734
794
|
deleteInteractionFollowupMessage(applicationID, interactionToken, messageID) {
|
@@ -789,7 +849,16 @@ class Client extends node_events_1.default {
|
|
789
849
|
name: options.name,
|
790
850
|
event_type: options.eventType,
|
791
851
|
trigger_type: options.triggerType,
|
792
|
-
trigger_metadata: options.triggerMetadata
|
852
|
+
trigger_metadata: options.triggerMetadata !== undefined
|
853
|
+
? {
|
854
|
+
keyword_filter: options.triggerMetadata.keywordFilter,
|
855
|
+
regex_patterns: options.triggerMetadata.regexPatterns,
|
856
|
+
presets: options.triggerMetadata.presets,
|
857
|
+
allow_list: options.triggerMetadata.allowList,
|
858
|
+
mention_total_limit: options.triggerMetadata.mentionTotalLimit,
|
859
|
+
mention_raid_protection: options.triggerMetadata.mentionRaidProtection,
|
860
|
+
}
|
861
|
+
: undefined,
|
793
862
|
actions: options.actions?.map((action) => ({
|
794
863
|
type: action.type,
|
795
864
|
metadata: {
|
@@ -804,28 +873,34 @@ class Client extends node_events_1.default {
|
|
804
873
|
},
|
805
874
|
reason,
|
806
875
|
});
|
807
|
-
return
|
876
|
+
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
808
877
|
}
|
809
878
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
|
810
879
|
async editApplicationCommandPermissions(applicationID, guildID, commandID, options) {
|
811
880
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID), {
|
812
881
|
json: {
|
813
|
-
permissions: options.permissions.map((permission) =>
|
882
|
+
permissions: options.permissions.map((permission) => ({
|
883
|
+
id: permission.type,
|
884
|
+
type: permission.type,
|
885
|
+
permission: permission.permission,
|
886
|
+
})),
|
814
887
|
},
|
815
888
|
});
|
816
|
-
return
|
889
|
+
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
817
890
|
}
|
818
891
|
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
819
892
|
async editChannel(channelID, options, reason) {
|
820
893
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channel(channelID), {
|
821
894
|
json: {
|
822
895
|
name: options.name,
|
896
|
+
icon: options.icon,
|
823
897
|
type: options.type,
|
824
898
|
position: options.position,
|
825
899
|
topic: options.topic,
|
826
900
|
nsfw: options.nsfw,
|
827
901
|
rate_limit_per_user: options.rateLimitPerUser,
|
828
902
|
bitrate: options.bitrate,
|
903
|
+
user_limit: options.userLimit,
|
829
904
|
permission_overwrites: options.permissionOverwrites,
|
830
905
|
parent_id: options.parentID,
|
831
906
|
rtc_region: options.rtcRegion,
|
@@ -833,7 +908,14 @@ class Client extends node_events_1.default {
|
|
833
908
|
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
834
909
|
flags: options.flags,
|
835
910
|
available_tags: options.availableTags,
|
836
|
-
default_reaction_emoji: options.defaultReactionEmoji
|
911
|
+
default_reaction_emoji: options.defaultReactionEmoji !== undefined
|
912
|
+
? options.defaultReactionEmoji !== null
|
913
|
+
? {
|
914
|
+
emoji_id: options.defaultReactionEmoji.emojiID,
|
915
|
+
emoji_name: options.defaultReactionEmoji.emojiName,
|
916
|
+
}
|
917
|
+
: null
|
918
|
+
: undefined,
|
837
919
|
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
838
920
|
default_sort_order: options.defaultSortOrder,
|
839
921
|
default_forum_layout: options.defaultForumLayout,
|
@@ -845,7 +927,7 @@ class Client extends node_events_1.default {
|
|
845
927
|
},
|
846
928
|
reason,
|
847
929
|
});
|
848
|
-
return
|
930
|
+
return transformers_1.Channels.channelFromRaw(response);
|
849
931
|
}
|
850
932
|
/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions */
|
851
933
|
editChannelPermissions(channelID, overwriteID, options, reason) {
|
@@ -874,7 +956,7 @@ class Client extends node_events_1.default {
|
|
874
956
|
banner: options.banner,
|
875
957
|
},
|
876
958
|
});
|
877
|
-
return
|
959
|
+
return transformers_1.Users.userFromRaw(response);
|
878
960
|
}
|
879
961
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
880
962
|
async editCurrentGuildMember(guildID, options, reason) {
|
@@ -884,7 +966,7 @@ class Client extends node_events_1.default {
|
|
884
966
|
},
|
885
967
|
reason,
|
886
968
|
});
|
887
|
-
return
|
969
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
888
970
|
}
|
889
971
|
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
890
972
|
editCurrentUserVoiceState(guildID, options) {
|
@@ -898,12 +980,22 @@ class Client extends node_events_1.default {
|
|
898
980
|
}
|
899
981
|
/** https://discord.com/developers/docs/resources/application#edit-current-application */
|
900
982
|
async editCurrentApplication(options) {
|
901
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.
|
983
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationUser(), {
|
902
984
|
json: {
|
903
985
|
custom_install_url: options.customInstallURL,
|
904
986
|
description: options.description,
|
905
987
|
role_connections_verification_url: options.roleConnectionsVerificationURL,
|
906
988
|
install_params: options.installParams,
|
989
|
+
integration_types_config: options.integrationTypesConfig !== undefined
|
990
|
+
? {
|
991
|
+
"0": {
|
992
|
+
oauth2_install_params: options.integrationTypesConfig?.[0].oauth2InstallParams,
|
993
|
+
},
|
994
|
+
"1": {
|
995
|
+
oauth2_install_params: options.integrationTypesConfig?.[1].oauth2InstallParams,
|
996
|
+
},
|
997
|
+
}
|
998
|
+
: undefined,
|
907
999
|
flags: options.flags,
|
908
1000
|
icon: options.icon,
|
909
1001
|
cover_image: options.coverImage,
|
@@ -911,21 +1003,31 @@ class Client extends node_events_1.default {
|
|
911
1003
|
tags: options.tags,
|
912
1004
|
},
|
913
1005
|
});
|
914
|
-
return
|
1006
|
+
return transformers_1.Applications.applicationFromRaw(response);
|
915
1007
|
}
|
916
1008
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
|
917
1009
|
async editGlobalApplicationCommand(applicationID, commandID, options) {
|
918
1010
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationCommand(applicationID, commandID), {
|
919
|
-
json:
|
1011
|
+
json: {
|
1012
|
+
name: options.name,
|
1013
|
+
name_localizations: options.nameLocalizations,
|
1014
|
+
description: options.description,
|
1015
|
+
description_localizations: options.descriptionLocalizations,
|
1016
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
1017
|
+
default_member_permissions: options.defaultMemberPermissions,
|
1018
|
+
default_permissions: options.defaultPermission,
|
1019
|
+
integration_types: options.integrationTypes,
|
1020
|
+
contexts: options.contexts,
|
1021
|
+
nsfw: options.nsfw,
|
1022
|
+
},
|
920
1023
|
});
|
921
|
-
return
|
1024
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
922
1025
|
}
|
923
1026
|
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
924
1027
|
async editGuild(guildID, options, reason) {
|
925
1028
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guild(guildID), {
|
926
1029
|
json: {
|
927
1030
|
name: options.name,
|
928
|
-
region: options.region,
|
929
1031
|
verification_level: options.verificationLevel,
|
930
1032
|
default_message_notifications: options.defaultMessageNotifications,
|
931
1033
|
explicit_content_filter: options.explicitContentFilter,
|
@@ -948,14 +1050,23 @@ class Client extends node_events_1.default {
|
|
948
1050
|
},
|
949
1051
|
reason,
|
950
1052
|
});
|
951
|
-
return
|
1053
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
952
1054
|
}
|
953
1055
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
954
1056
|
async editGuildApplicationCommand(applicationID, guildID, commandID, options) {
|
955
1057
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID), {
|
956
|
-
json:
|
1058
|
+
json: {
|
1059
|
+
name: options.name,
|
1060
|
+
name_localizations: options.nameLocalizations,
|
1061
|
+
description: options.description,
|
1062
|
+
description_localizations: options.descriptionLocalizations,
|
1063
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
1064
|
+
default_member_permissions: options.defaultMemberPermissions,
|
1065
|
+
default_permissions: options.defaultPermission,
|
1066
|
+
nsfw: options.nsfw,
|
1067
|
+
},
|
957
1068
|
});
|
958
|
-
return
|
1069
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
959
1070
|
}
|
960
1071
|
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
961
1072
|
async editGuildEmoji(guildID, emojiID, options, reason) {
|
@@ -966,7 +1077,7 @@ class Client extends node_events_1.default {
|
|
966
1077
|
},
|
967
1078
|
reason,
|
968
1079
|
});
|
969
|
-
return
|
1080
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
970
1081
|
}
|
971
1082
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
972
1083
|
async editGuildMember(guildID, userID, options, reason) {
|
@@ -982,7 +1093,7 @@ class Client extends node_events_1.default {
|
|
982
1093
|
},
|
983
1094
|
reason,
|
984
1095
|
});
|
985
|
-
return
|
1096
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
986
1097
|
}
|
987
1098
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
988
1099
|
editGuildMFALevel(guildID, options, reason) {
|
@@ -1005,7 +1116,7 @@ class Client extends node_events_1.default {
|
|
1005
1116
|
channel_ids: promptOption.channelIDs,
|
1006
1117
|
role_ids: promptOption.roleIDs,
|
1007
1118
|
emoji: promptOption.emoji !== undefined
|
1008
|
-
?
|
1119
|
+
? transformers_1.Emojis.emojiToRaw(promptOption.emoji)
|
1009
1120
|
: undefined,
|
1010
1121
|
emoji_id: promptOption.emojiID,
|
1011
1122
|
emoji_name: promptOption.emojiName,
|
@@ -1036,14 +1147,15 @@ class Client extends node_events_1.default {
|
|
1036
1147
|
},
|
1037
1148
|
reason,
|
1038
1149
|
});
|
1039
|
-
return
|
1150
|
+
return transformers_1.Roles.roleFromRaw(response);
|
1040
1151
|
}
|
1041
1152
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
1042
|
-
async editGuildRolePositions(guildID, options) {
|
1153
|
+
async editGuildRolePositions(guildID, options, reason) {
|
1043
1154
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildRoles(guildID), {
|
1044
1155
|
json: options,
|
1156
|
+
reason,
|
1045
1157
|
});
|
1046
|
-
return response.map((role) =>
|
1158
|
+
return response.map((role) => transformers_1.Roles.roleFromRaw(role));
|
1047
1159
|
}
|
1048
1160
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
1049
1161
|
async editGuildScheduledEvent(guildID, guildScheduledEventID, options, reason) {
|
@@ -1062,7 +1174,7 @@ class Client extends node_events_1.default {
|
|
1062
1174
|
},
|
1063
1175
|
reason,
|
1064
1176
|
});
|
1065
|
-
return
|
1177
|
+
return transformers_1.GuildScheduledEvents.guildScheduledEventFromRaw(response);
|
1066
1178
|
}
|
1067
1179
|
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
1068
1180
|
async editGuildSticker(guildID, stickerID, options, reason) {
|
@@ -1074,7 +1186,7 @@ class Client extends node_events_1.default {
|
|
1074
1186
|
},
|
1075
1187
|
reason,
|
1076
1188
|
});
|
1077
|
-
return
|
1189
|
+
return transformers_1.Stickers.stickerFromRaw(response);
|
1078
1190
|
}
|
1079
1191
|
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
1080
1192
|
async editGuildTemplate(guildID, code, options) {
|
@@ -1084,14 +1196,19 @@ class Client extends node_events_1.default {
|
|
1084
1196
|
description: options.description,
|
1085
1197
|
},
|
1086
1198
|
});
|
1087
|
-
return
|
1199
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
1088
1200
|
}
|
1089
1201
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
1090
1202
|
async editGuildWelcomeScreen(guildID, options, reason) {
|
1091
1203
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildWelcomeScreen(guildID), {
|
1092
1204
|
json: {
|
1093
1205
|
enabled: options.enabled,
|
1094
|
-
welcome_channels: options.welcomeChannels
|
1206
|
+
welcome_channels: options.welcomeChannels?.map((welcomeChannel) => ({
|
1207
|
+
channel_id: welcomeChannel.channelID,
|
1208
|
+
description: welcomeChannel.description,
|
1209
|
+
emoji_id: welcomeChannel.emojiID,
|
1210
|
+
emoji_name: welcomeChannel.emojiName,
|
1211
|
+
})),
|
1095
1212
|
description: options.description,
|
1096
1213
|
},
|
1097
1214
|
reason,
|
@@ -1126,7 +1243,7 @@ class Client extends node_events_1.default {
|
|
1126
1243
|
json: {
|
1127
1244
|
content: options.content,
|
1128
1245
|
embeds: options.embeds !== null
|
1129
|
-
? options.embeds?.map((embed) =>
|
1246
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1130
1247
|
: null,
|
1131
1248
|
allowed_mentions: options.allowedMentions !== undefined
|
1132
1249
|
? options.allowedMentions !== null
|
@@ -1140,15 +1257,15 @@ class Client extends node_events_1.default {
|
|
1140
1257
|
: undefined,
|
1141
1258
|
components: options.components !== undefined
|
1142
1259
|
? options.components !== null
|
1143
|
-
?
|
1260
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1144
1261
|
: null
|
1145
1262
|
: undefined,
|
1146
|
-
attachments: options.attachments?.map((attachment) =>
|
1263
|
+
attachments: options.attachments?.map((attachment) => transformers_1.Channels.attachmentToRaw(attachment)),
|
1147
1264
|
flags: options.flags,
|
1148
1265
|
},
|
1149
1266
|
files: options.files,
|
1150
1267
|
});
|
1151
|
-
return
|
1268
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1152
1269
|
}
|
1153
1270
|
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance */
|
1154
1271
|
async editStageInstance(channelID, options, reason) {
|
@@ -1159,7 +1276,7 @@ class Client extends node_events_1.default {
|
|
1159
1276
|
},
|
1160
1277
|
reason,
|
1161
1278
|
});
|
1162
|
-
return
|
1279
|
+
return transformers_1.StageInstances.stageInstanceFromRaw(response);
|
1163
1280
|
}
|
1164
1281
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message */
|
1165
1282
|
async editInteractionFollowupMessage(applicationID, interactionToken, messageID, options) {
|
@@ -1167,7 +1284,7 @@ class Client extends node_events_1.default {
|
|
1167
1284
|
json: {
|
1168
1285
|
content: options.content,
|
1169
1286
|
embeds: options.embeds !== null
|
1170
|
-
? options.embeds?.map((embed) =>
|
1287
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1171
1288
|
: null,
|
1172
1289
|
allowed_mentions: options.allowedMentions !== undefined
|
1173
1290
|
? options.allowedMentions !== null
|
@@ -1181,18 +1298,32 @@ class Client extends node_events_1.default {
|
|
1181
1298
|
: undefined,
|
1182
1299
|
components: options.components !== undefined
|
1183
1300
|
? options.components !== null
|
1184
|
-
?
|
1301
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1185
1302
|
: null
|
1186
1303
|
: undefined,
|
1187
|
-
attachments: options.attachments?.map((attachment) =>
|
1188
|
-
|
1304
|
+
attachments: options.attachments?.map((attachment) => ({
|
1305
|
+
id: attachment.id,
|
1306
|
+
filename: attachment.filename,
|
1307
|
+
title: attachment.title,
|
1308
|
+
description: attachment.description,
|
1309
|
+
content_type: attachment.contentType,
|
1310
|
+
size: attachment.size,
|
1311
|
+
url: attachment.url,
|
1312
|
+
proxy_url: attachment.proxyURL,
|
1313
|
+
height: attachment.height,
|
1314
|
+
width: attachment.width,
|
1315
|
+
ephemeral: attachment.ephemeral,
|
1316
|
+
duration_secs: attachment.durationSecs,
|
1317
|
+
waveform: attachment.waveform,
|
1318
|
+
flags: attachment.flags,
|
1319
|
+
})),
|
1189
1320
|
},
|
1190
1321
|
files: options.files,
|
1191
1322
|
query: {
|
1192
1323
|
thread_id: options.threadID,
|
1193
1324
|
},
|
1194
1325
|
});
|
1195
|
-
return
|
1326
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1196
1327
|
}
|
1197
1328
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response */
|
1198
1329
|
async editInteractionResponse(applicationID, interactionToken, options) {
|
@@ -1200,7 +1331,7 @@ class Client extends node_events_1.default {
|
|
1200
1331
|
json: {
|
1201
1332
|
content: options.content,
|
1202
1333
|
embeds: options.embeds !== null
|
1203
|
-
? options.embeds?.map((embed) =>
|
1334
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1204
1335
|
: null,
|
1205
1336
|
allowed_mentions: options.allowedMentions !== undefined
|
1206
1337
|
? options.allowedMentions !== null
|
@@ -1214,18 +1345,32 @@ class Client extends node_events_1.default {
|
|
1214
1345
|
: undefined,
|
1215
1346
|
components: options.components !== undefined
|
1216
1347
|
? options.components !== null
|
1217
|
-
?
|
1348
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1218
1349
|
: null
|
1219
1350
|
: undefined,
|
1220
|
-
attachments: options.attachments?.map((attachment) =>
|
1221
|
-
|
1351
|
+
attachments: options.attachments?.map((attachment) => ({
|
1352
|
+
id: attachment.id,
|
1353
|
+
filename: attachment.filename,
|
1354
|
+
title: attachment.title,
|
1355
|
+
description: attachment.description,
|
1356
|
+
content_type: attachment.contentType,
|
1357
|
+
size: attachment.size,
|
1358
|
+
url: attachment.url,
|
1359
|
+
proxy_url: attachment.proxyURL,
|
1360
|
+
height: attachment.height,
|
1361
|
+
width: attachment.width,
|
1362
|
+
ephemeral: attachment.ephemeral,
|
1363
|
+
duration_secs: attachment.durationSecs,
|
1364
|
+
waveform: attachment.waveform,
|
1365
|
+
flags: attachment.flags,
|
1366
|
+
})),
|
1222
1367
|
},
|
1223
1368
|
files: options.files,
|
1224
1369
|
query: {
|
1225
1370
|
thread_id: options.threadID,
|
1226
1371
|
},
|
1227
1372
|
});
|
1228
|
-
return
|
1373
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1229
1374
|
}
|
1230
1375
|
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
1231
1376
|
editUserVoiceState(guildID, userID, options) {
|
@@ -1233,7 +1378,6 @@ class Client extends node_events_1.default {
|
|
1233
1378
|
json: {
|
1234
1379
|
channel_id: options.channelID,
|
1235
1380
|
suppress: options.suppress,
|
1236
|
-
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
1237
1381
|
},
|
1238
1382
|
});
|
1239
1383
|
}
|
@@ -1247,7 +1391,7 @@ class Client extends node_events_1.default {
|
|
1247
1391
|
},
|
1248
1392
|
reason,
|
1249
1393
|
});
|
1250
|
-
return
|
1394
|
+
return transformers_1.Webhooks.webhookFromRaw(response);
|
1251
1395
|
}
|
1252
1396
|
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
|
1253
1397
|
async editWebhookMessage(webhookID, webhookToken, messageID, options) {
|
@@ -1255,7 +1399,7 @@ class Client extends node_events_1.default {
|
|
1255
1399
|
json: {
|
1256
1400
|
content: options.content,
|
1257
1401
|
embeds: options.embeds !== null
|
1258
|
-
? options.embeds?.map((embed) =>
|
1402
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1259
1403
|
: null,
|
1260
1404
|
allowed_mentions: options.allowedMentions !== undefined
|
1261
1405
|
? options.allowedMentions !== null
|
@@ -1269,18 +1413,32 @@ class Client extends node_events_1.default {
|
|
1269
1413
|
: undefined,
|
1270
1414
|
components: options.components !== undefined
|
1271
1415
|
? options.components !== null
|
1272
|
-
?
|
1416
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1273
1417
|
: null
|
1274
1418
|
: undefined,
|
1275
|
-
attachments: options.attachments?.map((attachment) =>
|
1276
|
-
|
1419
|
+
attachments: options.attachments?.map((attachment) => ({
|
1420
|
+
id: attachment.id,
|
1421
|
+
filename: attachment.filename,
|
1422
|
+
title: attachment.title,
|
1423
|
+
description: attachment.description,
|
1424
|
+
content_type: attachment.contentType,
|
1425
|
+
size: attachment.size,
|
1426
|
+
url: attachment.url,
|
1427
|
+
proxy_url: attachment.proxyURL,
|
1428
|
+
height: attachment.height,
|
1429
|
+
width: attachment.width,
|
1430
|
+
ephemeral: attachment.ephemeral,
|
1431
|
+
duration_secs: attachment.durationSecs,
|
1432
|
+
waveform: attachment.waveform,
|
1433
|
+
flags: attachment.flags,
|
1434
|
+
})),
|
1277
1435
|
},
|
1278
1436
|
files: options.files,
|
1279
1437
|
query: {
|
1280
1438
|
thread_id: options.threadID,
|
1281
1439
|
},
|
1282
1440
|
});
|
1283
|
-
return
|
1441
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1284
1442
|
}
|
1285
1443
|
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
|
1286
1444
|
async editWebhookWithToken(webhookID, webhookToken, options, reason) {
|
@@ -1292,12 +1450,12 @@ class Client extends node_events_1.default {
|
|
1292
1450
|
reason,
|
1293
1451
|
authorization: false,
|
1294
1452
|
});
|
1295
|
-
return
|
1453
|
+
return transformers_1.Webhooks.webhookFromRaw(response);
|
1296
1454
|
}
|
1297
1455
|
/** https://discord.com/developers/docs/resources/poll#end-poll */
|
1298
1456
|
async endPoll(channelID, messageID) {
|
1299
1457
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.pollExpire(channelID, messageID));
|
1300
|
-
return
|
1458
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1301
1459
|
}
|
1302
1460
|
/** https://discord.com/developers/docs/resources/webhook#execute-webhook */
|
1303
1461
|
async executeWebhook(webhookID, webhookToken, options) {
|
@@ -1305,27 +1463,21 @@ class Client extends node_events_1.default {
|
|
1305
1463
|
json: {
|
1306
1464
|
content: options.content,
|
1307
1465
|
username: options.username,
|
1308
|
-
|
1466
|
+
avatar_url: options.avatarURL,
|
1309
1467
|
tts: options.tts,
|
1310
|
-
embeds: options.embeds
|
1311
|
-
? options.embeds?.map((embed) => this.util.embedToRaw(embed))
|
1312
|
-
: null,
|
1468
|
+
embeds: options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
1313
1469
|
allowed_mentions: options.allowedMentions !== undefined
|
1314
|
-
?
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
}
|
1321
|
-
: null
|
1470
|
+
? {
|
1471
|
+
parse: options.allowedMentions.parse,
|
1472
|
+
roles: options.allowedMentions.roles,
|
1473
|
+
users: options.allowedMentions.users,
|
1474
|
+
replied_user: options.allowedMentions.repliedUser,
|
1475
|
+
}
|
1322
1476
|
: undefined,
|
1323
1477
|
components: options.components !== undefined
|
1324
|
-
? options.components
|
1325
|
-
? this.util.messageComponentsToRaw(options.components)
|
1326
|
-
: null
|
1478
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1327
1479
|
: undefined,
|
1328
|
-
attachments: options.attachments
|
1480
|
+
attachments: options.attachments,
|
1329
1481
|
flags: options.flags,
|
1330
1482
|
thread_name: options.threadName,
|
1331
1483
|
applied_tags: options.appliedTags,
|
@@ -1348,7 +1500,7 @@ class Client extends node_events_1.default {
|
|
1348
1500
|
thread_id: options.threadID,
|
1349
1501
|
},
|
1350
1502
|
});
|
1351
|
-
return response !== null ?
|
1503
|
+
return response !== null ? transformers_1.Channels.messageFromRaw(response) : response;
|
1352
1504
|
}
|
1353
1505
|
/**
|
1354
1506
|
* https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook
|
@@ -1363,7 +1515,7 @@ class Client extends node_events_1.default {
|
|
1363
1515
|
},
|
1364
1516
|
json: options,
|
1365
1517
|
});
|
1366
|
-
return response !== null ?
|
1518
|
+
return response !== null ? transformers_1.Channels.messageFromRaw(response) : null;
|
1367
1519
|
}
|
1368
1520
|
/** https://discord.com/developers/docs/resources/channel#follow-announcement-channel */
|
1369
1521
|
async followChannel(channelID, options, reason) {
|
@@ -1382,8 +1534,8 @@ class Client extends node_events_1.default {
|
|
1382
1534
|
async getActiveGuildThreads(guildID) {
|
1383
1535
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildActiveThreads(guildID));
|
1384
1536
|
return {
|
1385
|
-
threads: response.threads.map((thread) =>
|
1386
|
-
members: response.members.map((threadMember) =>
|
1537
|
+
threads: response.threads.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
1538
|
+
members: response.members.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember)),
|
1387
1539
|
};
|
1388
1540
|
}
|
1389
1541
|
/** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
|
@@ -1395,8 +1547,8 @@ class Client extends node_events_1.default {
|
|
1395
1547
|
},
|
1396
1548
|
});
|
1397
1549
|
return {
|
1398
|
-
threads: response.threads.map((thread) =>
|
1399
|
-
members: response.members.map((threadMember) =>
|
1550
|
+
threads: response.threads.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
1551
|
+
members: response.members.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember)),
|
1400
1552
|
hasMore: response.has_more,
|
1401
1553
|
};
|
1402
1554
|
}
|
@@ -1411,59 +1563,52 @@ class Client extends node_events_1.default {
|
|
1411
1563
|
limit: options?.limit,
|
1412
1564
|
},
|
1413
1565
|
});
|
1414
|
-
return
|
1566
|
+
return transformers_1.AuditLogs.auditLogFromRaw(response);
|
1415
1567
|
}
|
1416
1568
|
/** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
|
1417
1569
|
async getAutoModerationRule(guildID, ruleID) {
|
1418
1570
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRule(guildID, ruleID));
|
1419
|
-
return
|
1571
|
+
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
1420
1572
|
}
|
1421
1573
|
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
1422
1574
|
async getAutoModerationRules(guildID) {
|
1423
1575
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRules(guildID));
|
1424
|
-
return response.map((autoModerationRule) =>
|
1576
|
+
return response.map((autoModerationRule) => transformers_1.AutoModeration.autoModerationRuleFromRaw(autoModerationRule));
|
1425
1577
|
}
|
1426
1578
|
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
1427
1579
|
async getApplicationCommandPermissions(applicationID, guildID, commandID) {
|
1428
1580
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID));
|
1429
|
-
return
|
1581
|
+
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
1430
1582
|
}
|
1431
1583
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
1432
1584
|
async getApplicationRoleConnectionMetadataRecords(applicationID) {
|
1433
1585
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationID));
|
1434
|
-
return response.map((applicationRoleConnectionMetadata) => (
|
1435
|
-
type: applicationRoleConnectionMetadata.type,
|
1436
|
-
key: applicationRoleConnectionMetadata.key,
|
1437
|
-
name: applicationRoleConnectionMetadata.name,
|
1438
|
-
nameLocalizations: applicationRoleConnectionMetadata.name_localizations,
|
1439
|
-
description: applicationRoleConnectionMetadata.description,
|
1440
|
-
descriptionLocalizations: applicationRoleConnectionMetadata.description_localizations,
|
1441
|
-
}));
|
1586
|
+
return response.map((applicationRoleConnectionMetadata) => transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(applicationRoleConnectionMetadata));
|
1442
1587
|
}
|
1443
1588
|
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
1444
1589
|
async getChannel(channelID) {
|
1445
1590
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channel(channelID));
|
1446
|
-
return
|
1591
|
+
return transformers_1.Channels.channelFromRaw(response);
|
1447
1592
|
}
|
1448
1593
|
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
1449
1594
|
async getChannels(guildID) {
|
1450
1595
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildChannels(guildID));
|
1451
|
-
return response.map((channel) =>
|
1596
|
+
return response.map((channel) => transformers_1.Channels.channelFromRaw(channel));
|
1452
1597
|
}
|
1453
1598
|
/** https://discord.com/developers/docs/resources/channel#get-channel-invites */
|
1454
1599
|
async getChannelInvites(channelID) {
|
1455
1600
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelInvites(channelID));
|
1456
|
-
return response.map((invite) =>
|
1601
|
+
return response.map((invite) => transformers_1.Invites.inviteFromRaw(invite));
|
1457
1602
|
}
|
1458
1603
|
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
1459
1604
|
async getChannelWebhooks(channelID) {
|
1460
1605
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelWebhooks(channelID));
|
1461
|
-
return response.map((webhook) =>
|
1606
|
+
return response.map((webhook) => transformers_1.Webhooks.webhookFromRaw(webhook));
|
1462
1607
|
}
|
1463
1608
|
/** https://discord.com/developers/docs/resources/application#get-current-application */
|
1464
1609
|
async getCurrentApplication() {
|
1465
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.
|
1466
|
-
return
|
1610
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationUser());
|
1611
|
+
return transformers_1.Applications.applicationFromRaw(response);
|
1467
1612
|
}
|
1468
1613
|
/** https://discord.com/developers/docs/resources/user#get-current-user-application-role-connection */
|
1469
1614
|
async getCurrentApplicationRoleConnection(applicationID) {
|
@@ -1471,20 +1616,13 @@ class Client extends node_events_1.default {
|
|
1471
1616
|
return {
|
1472
1617
|
platformName: response.platform_name,
|
1473
1618
|
platformUsername: response.platform_username,
|
1474
|
-
metadata:
|
1475
|
-
type: response.metadata.type,
|
1476
|
-
key: response.metadata.key,
|
1477
|
-
name: response.metadata.name,
|
1478
|
-
nameLocalizations: response.metadata.name_localizations,
|
1479
|
-
description: response.metadata.description,
|
1480
|
-
descriptionLocalizations: response.metadata.description_localizations,
|
1481
|
-
},
|
1619
|
+
metadata: transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(response.metadata),
|
1482
1620
|
};
|
1483
1621
|
}
|
1484
1622
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guild-member */
|
1485
1623
|
async getCurrentGuildMember(guildID) {
|
1486
1624
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(guildID));
|
1487
|
-
return
|
1625
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
1488
1626
|
}
|
1489
1627
|
/** https://discord.com/developers/docs/resources/user#get-current-user-connections */
|
1490
1628
|
async getCurrentUserConnections() {
|
@@ -1494,7 +1632,7 @@ class Client extends node_events_1.default {
|
|
1494
1632
|
name: connection.name,
|
1495
1633
|
type: connection.type,
|
1496
1634
|
revoked: connection.revoked,
|
1497
|
-
integrations: connection.integrations?.map((integration) =>
|
1635
|
+
integrations: connection.integrations?.map((integration) => transformers_1.Guilds.integrationFromRaw(integration)),
|
1498
1636
|
verified: connection.verified,
|
1499
1637
|
friendSync: connection.friend_sync,
|
1500
1638
|
showActivity: connection.show_activity,
|
@@ -1515,7 +1653,7 @@ class Client extends node_events_1.default {
|
|
1515
1653
|
exclude_ended: options?.excludeEnded,
|
1516
1654
|
},
|
1517
1655
|
});
|
1518
|
-
return response.map((entitlement) =>
|
1656
|
+
return response.map((entitlement) => transformers_1.Entitlements.entitlementFromRaw(entitlement));
|
1519
1657
|
}
|
1520
1658
|
/** https://discord.com/developers/docs/topics/gateway#get-gateway */
|
1521
1659
|
getGateway() {
|
@@ -1538,7 +1676,7 @@ class Client extends node_events_1.default {
|
|
1538
1676
|
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
|
1539
1677
|
async getGlobalApplicationCommand(applicationID, commandID) {
|
1540
1678
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommand(applicationID, commandID));
|
1541
|
-
return
|
1679
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
1542
1680
|
}
|
1543
1681
|
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
|
1544
1682
|
async getGlobalApplicationCommands(applicationID, options) {
|
@@ -1547,7 +1685,7 @@ class Client extends node_events_1.default {
|
|
1547
1685
|
with_localizations: options.withLocalizations,
|
1548
1686
|
},
|
1549
1687
|
});
|
1550
|
-
return response.map((applicationCommand) =>
|
1688
|
+
return response.map((applicationCommand) => transformers_1.ApplicationCommands.applicationCommandFromRaw(applicationCommand));
|
1551
1689
|
}
|
1552
1690
|
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
1553
1691
|
async getGuild(guildID, options) {
|
@@ -1556,7 +1694,7 @@ class Client extends node_events_1.default {
|
|
1556
1694
|
with_counts: options?.withCounts,
|
1557
1695
|
},
|
1558
1696
|
});
|
1559
|
-
return
|
1697
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
1560
1698
|
}
|
1561
1699
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guilds */
|
1562
1700
|
async getGuilds(options) {
|
@@ -1568,12 +1706,21 @@ class Client extends node_events_1.default {
|
|
1568
1706
|
with_counts: options?.withCounts,
|
1569
1707
|
},
|
1570
1708
|
});
|
1571
|
-
return response.map((guild) =>
|
1709
|
+
return response.map((guild) => ({
|
1710
|
+
id: guild.id,
|
1711
|
+
name: guild.name,
|
1712
|
+
icon: guild.icon,
|
1713
|
+
owner: guild.owner,
|
1714
|
+
permissions: guild.permissions,
|
1715
|
+
features: guild.features,
|
1716
|
+
approximate_member_count: guild.approximate_member_count,
|
1717
|
+
approximate_presence_count: guild.approximate_presence_count,
|
1718
|
+
}));
|
1572
1719
|
}
|
1573
1720
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
1574
1721
|
async getGuildApplicationCommand(applicationID, guildID, commandID) {
|
1575
1722
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID));
|
1576
|
-
return
|
1723
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
1577
1724
|
}
|
1578
1725
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
1579
1726
|
async getGuildApplicationCommands(applicationID, guildID, options) {
|
@@ -1582,19 +1729,19 @@ class Client extends node_events_1.default {
|
|
1582
1729
|
with_localizations: options?.withLocalizations,
|
1583
1730
|
},
|
1584
1731
|
});
|
1585
|
-
return response.map((applicationCommand) =>
|
1732
|
+
return response.map((applicationCommand) => transformers_1.ApplicationCommands.applicationCommandFromRaw(applicationCommand));
|
1586
1733
|
}
|
1587
1734
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
1588
1735
|
async getGuildApplicationCommandPermissions(applicationID, guildID) {
|
1589
1736
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildApplicationCommandsPermissions(applicationID, guildID));
|
1590
|
-
return
|
1737
|
+
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
1591
1738
|
}
|
1592
1739
|
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
1593
1740
|
async getGuildBan(guildID, userID) {
|
1594
1741
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildBan(guildID, userID));
|
1595
1742
|
return {
|
1596
1743
|
reason: response.reason,
|
1597
|
-
user:
|
1744
|
+
user: transformers_1.Users.userFromRaw(response.user),
|
1598
1745
|
};
|
1599
1746
|
}
|
1600
1747
|
/** https://discord.com/developers/docs/resources/guild#get-guild-bans */
|
@@ -1608,38 +1755,38 @@ class Client extends node_events_1.default {
|
|
1608
1755
|
});
|
1609
1756
|
return response.map((ban) => ({
|
1610
1757
|
reason: ban.reason,
|
1611
|
-
user:
|
1758
|
+
user: transformers_1.Users.userFromRaw(ban.user),
|
1612
1759
|
}));
|
1613
1760
|
}
|
1614
1761
|
/** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
|
1615
1762
|
async getGuildEmoji(guildID, emojiID) {
|
1616
1763
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmoji(guildID, emojiID));
|
1617
|
-
return
|
1764
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
1618
1765
|
}
|
1619
1766
|
/** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
|
1620
1767
|
async getGuildEmojis(guildID) {
|
1621
1768
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmojis(guildID));
|
1622
|
-
return response.map((emoji) =>
|
1769
|
+
return response.map((emoji) => transformers_1.Emojis.emojiFromRaw(emoji));
|
1623
1770
|
}
|
1624
1771
|
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
1625
1772
|
async getGuildIntegrations(guildID) {
|
1626
1773
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildIntegrations(guildID));
|
1627
|
-
return response.map((integration) =>
|
1774
|
+
return response.map((integration) => transformers_1.Guilds.integrationFromRaw(integration));
|
1628
1775
|
}
|
1629
1776
|
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
1630
1777
|
async getGuildInvites(guildID) {
|
1631
1778
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildInvites(guildID));
|
1632
|
-
return response.map((invite) =>
|
1779
|
+
return response.map((invite) => transformers_1.Invites.inviteFromRaw(invite));
|
1633
1780
|
}
|
1634
1781
|
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
1635
1782
|
async getGuildMember(guildID, userID) {
|
1636
1783
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(guildID, userID));
|
1637
|
-
return
|
1784
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
1638
1785
|
}
|
1639
1786
|
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
1640
1787
|
async getGuildMembers(guildID) {
|
1641
1788
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMembers(guildID));
|
1642
|
-
return response.map((guildMember) =>
|
1789
|
+
return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
|
1643
1790
|
}
|
1644
1791
|
/** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
|
1645
1792
|
async getGuildOnboarding(guildID) {
|
@@ -1654,7 +1801,7 @@ class Client extends node_events_1.default {
|
|
1654
1801
|
channelIDs: promptOption.channel_ids,
|
1655
1802
|
roleIDs: promptOption.role_ids,
|
1656
1803
|
emoji: promptOption.emoji !== undefined
|
1657
|
-
?
|
1804
|
+
? transformers_1.Emojis.emojiFromRaw(promptOption.emoji)
|
1658
1805
|
: undefined,
|
1659
1806
|
emojiID: promptOption.emoji_id,
|
1660
1807
|
emojiName: promptOption.emoji_name,
|
@@ -1681,12 +1828,12 @@ class Client extends node_events_1.default {
|
|
1681
1828
|
icon: response.icon,
|
1682
1829
|
splash: response.splash,
|
1683
1830
|
discoverySplash: response.discovery_splash,
|
1684
|
-
emojis: response.emojis.map((emoji) =>
|
1831
|
+
emojis: response.emojis.map((emoji) => transformers_1.Emojis.emojiFromRaw(emoji)),
|
1685
1832
|
features: response.features,
|
1686
1833
|
approximateMemberCount: response.approximate_member_count,
|
1687
1834
|
approximatePresenceCount: response.approximate_presence_count,
|
1688
1835
|
description: response.description,
|
1689
|
-
stickers: response.stickers?.map((sticker) =>
|
1836
|
+
stickers: response.stickers?.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker)),
|
1690
1837
|
};
|
1691
1838
|
}
|
1692
1839
|
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
@@ -1701,7 +1848,7 @@ class Client extends node_events_1.default {
|
|
1701
1848
|
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
1702
1849
|
async getGuildRoles(guildID) {
|
1703
1850
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildRoles(guildID));
|
1704
|
-
return response.map((role) =>
|
1851
|
+
return response.map((role) => transformers_1.Roles.roleFromRaw(role));
|
1705
1852
|
}
|
1706
1853
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
|
1707
1854
|
async getGuildScheduledEvents(guildID, options) {
|
@@ -1710,7 +1857,7 @@ class Client extends node_events_1.default {
|
|
1710
1857
|
with_user_count: options?.withUserCount,
|
1711
1858
|
},
|
1712
1859
|
});
|
1713
|
-
return response.map((guildScheduledEvent) =>
|
1860
|
+
return response.map((guildScheduledEvent) => transformers_1.GuildScheduledEvents.guildScheduledEventFromRaw(guildScheduledEvent));
|
1714
1861
|
}
|
1715
1862
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
1716
1863
|
async getGuildScheduledEventUsers(guildID, guildScheduledEventID, options) {
|
@@ -1724,31 +1871,31 @@ class Client extends node_events_1.default {
|
|
1724
1871
|
});
|
1725
1872
|
return response.map((guildScheduledEventUser) => ({
|
1726
1873
|
guildScheduledEventID: guildScheduledEventUser.guild_scheduled_event_id,
|
1727
|
-
user:
|
1874
|
+
user: transformers_1.Users.userFromRaw(guildScheduledEventUser.user),
|
1728
1875
|
member: guildScheduledEventUser.member !== undefined
|
1729
|
-
?
|
1876
|
+
? transformers_1.Guilds.guildMemberFromRaw(guildScheduledEventUser.member)
|
1730
1877
|
: undefined,
|
1731
1878
|
}));
|
1732
1879
|
}
|
1733
1880
|
/** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
|
1734
1881
|
async getGuildSticker(guildID, stickerID) {
|
1735
1882
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSticker(guildID, stickerID));
|
1736
|
-
return
|
1883
|
+
return transformers_1.Stickers.stickerFromRaw(response);
|
1737
1884
|
}
|
1738
1885
|
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
1739
1886
|
async getGuildStickers(guildID) {
|
1740
1887
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildStickers(guildID));
|
1741
|
-
return response.map((sticker) =>
|
1888
|
+
return response.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker));
|
1742
1889
|
}
|
1743
1890
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
1744
1891
|
async getGuildTemplate(guildID, code) {
|
1745
1892
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplate(guildID, code));
|
1746
|
-
return
|
1893
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
1747
1894
|
}
|
1748
1895
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
|
1749
1896
|
async getGuildTemplates(guildID) {
|
1750
1897
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplates(guildID));
|
1751
|
-
return response.map((guildTemplate) =>
|
1898
|
+
return response.map((guildTemplate) => transformers_1.GuildTemplates.guildTemplateFromRaw(guildTemplate));
|
1752
1899
|
}
|
1753
1900
|
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
1754
1901
|
getGuildVanityURL(guildID) {
|
@@ -1785,8 +1932,8 @@ class Client extends node_events_1.default {
|
|
1785
1932
|
id: response.id,
|
1786
1933
|
name: response.name,
|
1787
1934
|
instantInvite: response.instant_invite,
|
1788
|
-
channels: response.channels.map((channel) =>
|
1789
|
-
members: response.members.map((member) =>
|
1935
|
+
channels: response.channels.map((channel) => transformers_1.Channels.channelFromRaw(channel)),
|
1936
|
+
members: response.members.map((member) => transformers_1.Users.userFromRaw(member)),
|
1790
1937
|
presenceCount: response.presence_count,
|
1791
1938
|
};
|
1792
1939
|
}
|
@@ -1813,7 +1960,7 @@ class Client extends node_events_1.default {
|
|
1813
1960
|
thread_id: options?.threadID,
|
1814
1961
|
},
|
1815
1962
|
});
|
1816
|
-
return
|
1963
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1817
1964
|
}
|
1818
1965
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response */
|
1819
1966
|
async getInteractionResponse(applicationID, interactionToken, options) {
|
@@ -1822,7 +1969,7 @@ class Client extends node_events_1.default {
|
|
1822
1969
|
thread_id: options?.threadID,
|
1823
1970
|
},
|
1824
1971
|
});
|
1825
|
-
return
|
1972
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1826
1973
|
}
|
1827
1974
|
/** https://discord.com/developers/docs/resources/invite#get-invite */
|
1828
1975
|
async getInvite(code, options) {
|
@@ -1833,7 +1980,7 @@ class Client extends node_events_1.default {
|
|
1833
1980
|
guild_scheduled_event_id: options?.guildScheduledEventID,
|
1834
1981
|
},
|
1835
1982
|
});
|
1836
|
-
return
|
1983
|
+
return transformers_1.Invites.inviteFromRaw(response);
|
1837
1984
|
}
|
1838
1985
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
1839
1986
|
async getJoinedPrivateArchivedThreads(channelID, options) {
|
@@ -1844,15 +1991,15 @@ class Client extends node_events_1.default {
|
|
1844
1991
|
},
|
1845
1992
|
});
|
1846
1993
|
return {
|
1847
|
-
threads: response.threads.map((thread) =>
|
1848
|
-
members: response.members.map((threadMember) =>
|
1994
|
+
threads: response.threads.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
1995
|
+
members: response.members.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember)),
|
1849
1996
|
hasMore: response.has_more,
|
1850
1997
|
};
|
1851
1998
|
}
|
1852
1999
|
/** https://discord.com/developers/docs/resources/channel#get-channel-message */
|
1853
2000
|
async getMessage(channelID, messageID) {
|
1854
2001
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(channelID, messageID));
|
1855
|
-
return
|
2002
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1856
2003
|
}
|
1857
2004
|
/** https://discord.com/developers/docs/resources/channel#get-reactions */
|
1858
2005
|
async getMessageReactions(channelID, messageID, emoji, options) {
|
@@ -1863,7 +2010,7 @@ class Client extends node_events_1.default {
|
|
1863
2010
|
limit: options?.limit,
|
1864
2011
|
},
|
1865
2012
|
});
|
1866
|
-
return response.map((user) =>
|
2013
|
+
return response.map((user) => transformers_1.Users.userFromRaw(user));
|
1867
2014
|
}
|
1868
2015
|
/** https://discord.com/developers/docs/resources/channel#get-channel-messages */
|
1869
2016
|
async getMessages(channelID, options) {
|
@@ -1875,29 +2022,29 @@ class Client extends node_events_1.default {
|
|
1875
2022
|
limit: options.limit,
|
1876
2023
|
},
|
1877
2024
|
});
|
1878
|
-
return response.map((message) =>
|
2025
|
+
return response.map((message) => transformers_1.Channels.messageFromRaw(message));
|
1879
2026
|
}
|
1880
2027
|
/** https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information */
|
1881
2028
|
async getOAuth2Application() {
|
1882
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.
|
1883
|
-
return
|
2029
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.oauth2Application());
|
2030
|
+
return transformers_1.Applications.applicationFromRaw(response);
|
1884
2031
|
}
|
1885
2032
|
/** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information */
|
1886
2033
|
async getOAuth2Authorization() {
|
1887
2034
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.oauth2Authorization());
|
1888
2035
|
return {
|
1889
|
-
application:
|
2036
|
+
application: transformers_1.Applications.applicationFromRaw(response.application),
|
1890
2037
|
scopes: response.scopes,
|
1891
2038
|
expires: response.expires,
|
1892
2039
|
user: response.user !== undefined
|
1893
|
-
?
|
2040
|
+
? transformers_1.Users.userFromRaw(response.user)
|
1894
2041
|
: undefined,
|
1895
2042
|
};
|
1896
2043
|
}
|
1897
2044
|
/** https://discord.com/developers/docs/resources/channel#get-pinned-messages */
|
1898
2045
|
async getPinnedMessages(channelID) {
|
1899
2046
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelPins(channelID));
|
1900
|
-
return response.map((message) =>
|
2047
|
+
return response.map((message) => transformers_1.Channels.messageFromRaw(message));
|
1901
2048
|
}
|
1902
2049
|
/** https://discord.com/developers/docs/resources/poll#get-answer-voters */
|
1903
2050
|
async getPollAnswerVoters(channelID, messageID, answerID, options) {
|
@@ -1908,18 +2055,18 @@ class Client extends node_events_1.default {
|
|
1908
2055
|
},
|
1909
2056
|
});
|
1910
2057
|
return {
|
1911
|
-
users: response.users.map((user) =>
|
2058
|
+
users: response.users.map((user) => transformers_1.Users.userFromRaw(user)),
|
1912
2059
|
};
|
1913
2060
|
}
|
1914
2061
|
/** https://discord.com/developers/docs/monetization/skus#list-skus */
|
1915
2062
|
async getSKUs(applicationID) {
|
1916
2063
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationSKUs(applicationID));
|
1917
|
-
return response.map((sku) =>
|
2064
|
+
return response.map((sku) => transformers_1.SKUs.skuFromRaw(sku));
|
1918
2065
|
}
|
1919
2066
|
/** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
|
1920
2067
|
async getStageInstance(channelID) {
|
1921
2068
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.stageInstance(channelID));
|
1922
|
-
return
|
2069
|
+
return transformers_1.StageInstances.stageInstanceFromRaw(response);
|
1923
2070
|
}
|
1924
2071
|
/** https://discord.com/developers/docs/resources/sticker#list-sticker-packs */
|
1925
2072
|
async getStickerPacks() {
|
@@ -1927,7 +2074,7 @@ class Client extends node_events_1.default {
|
|
1927
2074
|
return {
|
1928
2075
|
stickerPacks: response.sticker_packs.map((stickerPack) => ({
|
1929
2076
|
id: stickerPack.id,
|
1930
|
-
stickers: stickerPack.stickers.map((sticker) =>
|
2077
|
+
stickers: stickerPack.stickers.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker)),
|
1931
2078
|
name: stickerPack.name,
|
1932
2079
|
skuID: stickerPack.sku_id,
|
1933
2080
|
coverStickerID: stickerPack.cover_sticker_id,
|
@@ -1943,15 +2090,7 @@ class Client extends node_events_1.default {
|
|
1943
2090
|
with_member: options?.withMember,
|
1944
2091
|
},
|
1945
2092
|
});
|
1946
|
-
return
|
1947
|
-
id: response.id,
|
1948
|
-
userID: response.user_id,
|
1949
|
-
joinTimestamp: response.join_timestamp,
|
1950
|
-
flags: response.flags,
|
1951
|
-
member: response.member !== undefined
|
1952
|
-
? this.util.guildMemberFromRaw(response.member)
|
1953
|
-
: undefined,
|
1954
|
-
};
|
2093
|
+
return transformers_1.Channels.threadMemberFromRaw(response);
|
1955
2094
|
}
|
1956
2095
|
/** https://discord.com/developers/docs/resources/channel#list-thread-members */
|
1957
2096
|
async getThreadMembers(channelID, options) {
|
@@ -1962,12 +2101,12 @@ class Client extends node_events_1.default {
|
|
1962
2101
|
limit: options?.limit,
|
1963
2102
|
},
|
1964
2103
|
});
|
1965
|
-
return response.map((threadMember) =>
|
2104
|
+
return response.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember));
|
1966
2105
|
}
|
1967
2106
|
/** https://discord.com/developers/docs/resources/user#get-user */
|
1968
2107
|
async getUser(userID) {
|
1969
2108
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.user(userID));
|
1970
|
-
return
|
2109
|
+
return transformers_1.Users.userFromRaw(response);
|
1971
2110
|
}
|
1972
2111
|
/** https://discord.com/developers/docs/resources/voice#list-voice-regions */
|
1973
2112
|
async getVoiceRegions() {
|
@@ -1987,16 +2126,16 @@ class Client extends node_events_1.default {
|
|
1987
2126
|
thread_id: options?.threadID,
|
1988
2127
|
},
|
1989
2128
|
});
|
1990
|
-
return
|
2129
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1991
2130
|
}
|
1992
2131
|
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
1993
2132
|
async getWebhooks(guildID) {
|
1994
2133
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWebhooks(guildID));
|
1995
|
-
return response.map((webhook) =>
|
2134
|
+
return response.map((webhook) => transformers_1.Webhooks.webhookFromRaw(webhook));
|
1996
2135
|
}
|
1997
2136
|
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
1998
2137
|
joinThread(channelID) {
|
1999
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID
|
2138
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID));
|
2000
2139
|
}
|
2001
2140
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
2002
2141
|
joinVoiceChannel(guildID, channelID, options) {
|
@@ -2013,7 +2152,7 @@ class Client extends node_events_1.default {
|
|
2013
2152
|
}
|
2014
2153
|
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
2015
2154
|
leaveThread(channelID) {
|
2016
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID
|
2155
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID));
|
2017
2156
|
}
|
2018
2157
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
2019
2158
|
leaveVoiceChannel(guildID) {
|
@@ -2064,7 +2203,7 @@ class Client extends node_events_1.default {
|
|
2064
2203
|
limit: options.limit,
|
2065
2204
|
},
|
2066
2205
|
});
|
2067
|
-
return response.map((guildMember) =>
|
2206
|
+
return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
|
2068
2207
|
}
|
2069
2208
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
2070
2209
|
setPresence(options) {
|
@@ -2073,7 +2212,7 @@ class Client extends node_events_1.default {
|
|
2073
2212
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
2074
2213
|
async syncGuildTemplate(guildID, code) {
|
2075
2214
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildTemplate(guildID, code));
|
2076
|
-
return
|
2215
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
2077
2216
|
}
|
2078
2217
|
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
2079
2218
|
triggerTypingIndicator(channelID) {
|
@@ -2082,14 +2221,7 @@ class Client extends node_events_1.default {
|
|
2082
2221
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
2083
2222
|
async updateApplicationRoleConnectionMetadataRecords(applicationID) {
|
2084
2223
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationID));
|
2085
|
-
return response.map((applicationRoleConnectionMetadata) => (
|
2086
|
-
type: applicationRoleConnectionMetadata.type,
|
2087
|
-
key: applicationRoleConnectionMetadata.key,
|
2088
|
-
name: applicationRoleConnectionMetadata.name,
|
2089
|
-
nameLocalizations: applicationRoleConnectionMetadata.name_localizations,
|
2090
|
-
description: applicationRoleConnectionMetadata.description,
|
2091
|
-
descriptionLocalizations: applicationRoleConnectionMetadata.description_localizations,
|
2092
|
-
}));
|
2224
|
+
return response.map((applicationRoleConnectionMetadata) => transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(applicationRoleConnectionMetadata));
|
2093
2225
|
}
|
2094
2226
|
/** https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection */
|
2095
2227
|
async updateCurrentApplicationRoleConnection(applicationID, options) {
|
@@ -2097,20 +2229,15 @@ class Client extends node_events_1.default {
|
|
2097
2229
|
json: {
|
2098
2230
|
platform_name: options.platformName,
|
2099
2231
|
platform_username: options.platformUsername,
|
2100
|
-
metadata: options.metadata
|
2232
|
+
metadata: options.metadata !== undefined
|
2233
|
+
? transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataToRaw(options.metadata)
|
2234
|
+
: undefined,
|
2101
2235
|
},
|
2102
2236
|
});
|
2103
2237
|
return {
|
2104
2238
|
platformName: response.platform_name,
|
2105
2239
|
platformUsername: response.platform_username,
|
2106
|
-
metadata:
|
2107
|
-
type: response.metadata.type,
|
2108
|
-
key: response.metadata.key,
|
2109
|
-
name: response.metadata.name,
|
2110
|
-
nameLocalizations: response.metadata.name_localizations,
|
2111
|
-
description: response.metadata.description,
|
2112
|
-
descriptionLocalizations: response.metadata.description_localizations,
|
2113
|
-
},
|
2240
|
+
metadata: transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(response.metadata),
|
2114
2241
|
};
|
2115
2242
|
}
|
2116
2243
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|