disgroove 2.2.2-dev.db6cb16 → 2.2.3-dev.4f98e3d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -9
- package/dist/lib/Client.d.ts +116 -126
- package/dist/lib/Client.js +360 -267
- package/dist/lib/constants.d.ts +85 -74
- package/dist/lib/constants.js +88 -75
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +194 -170
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +6 -6
- package/dist/lib/rest/Endpoints.js +13 -13
- package/dist/lib/rest/RequestManager.d.ts +1 -1
- package/dist/lib/rest/RequestManager.js +1 -1
- package/dist/lib/rest/index.d.ts +0 -1
- package/dist/lib/rest/index.js +1 -2
- package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
- package/dist/lib/transformers/ApplicationCommands.js +90 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
- package/dist/lib/transformers/Applications.d.ts +5 -0
- package/dist/lib/transformers/Applications.js +97 -0
- package/dist/lib/transformers/AuditLogs.d.ts +7 -0
- package/dist/lib/transformers/AuditLogs.js +97 -0
- package/dist/lib/transformers/AutoModeration.d.ts +9 -0
- package/dist/lib/transformers/AutoModeration.js +76 -0
- package/dist/lib/transformers/Channels.d.ts +16 -0
- package/dist/lib/transformers/Channels.js +676 -0
- package/dist/lib/transformers/Emojis.d.ts +5 -0
- package/dist/lib/transformers/Emojis.js +31 -0
- package/dist/lib/transformers/Entitlements.d.ts +7 -0
- package/dist/lib/transformers/Entitlements.js +58 -0
- package/dist/lib/transformers/GuildScheduledEvents.d.ts +5 -0
- package/dist/lib/transformers/GuildScheduledEvents.js +51 -0
- package/dist/lib/transformers/GuildTemplates.d.ts +5 -0
- package/dist/lib/transformers/GuildTemplates.js +38 -0
- package/dist/lib/transformers/Guilds.d.ts +12 -0
- package/dist/lib/transformers/Guilds.js +264 -0
- package/dist/lib/transformers/Interactions.d.ts +10 -0
- package/dist/lib/transformers/Interactions.js +273 -0
- package/dist/lib/transformers/Invites.d.ts +5 -0
- package/dist/lib/transformers/Invites.js +79 -0
- package/dist/lib/transformers/Polls.d.ts +5 -0
- package/dist/lib/transformers/Polls.js +50 -0
- package/dist/lib/transformers/Presences.d.ts +5 -0
- package/dist/lib/transformers/Presences.js +116 -0
- package/dist/lib/transformers/Roles.d.ts +5 -0
- package/dist/lib/transformers/Roles.js +56 -0
- package/dist/lib/transformers/SKUs.d.ts +5 -0
- package/dist/lib/transformers/SKUs.js +26 -0
- package/dist/lib/transformers/StageInstances.d.ts +5 -0
- package/dist/lib/transformers/StageInstances.js +28 -0
- package/dist/lib/transformers/Stickers.d.ts +5 -0
- package/dist/lib/transformers/Stickers.js +41 -0
- package/dist/lib/transformers/Teams.d.ts +5 -0
- package/dist/lib/transformers/Teams.js +35 -0
- package/dist/lib/transformers/Users.d.ts +5 -0
- package/dist/lib/transformers/Users.js +62 -0
- package/dist/lib/transformers/Voice.d.ts +5 -0
- package/dist/lib/transformers/Voice.js +45 -0
- package/dist/lib/transformers/Webhooks.d.ts +5 -0
- package/dist/lib/transformers/Webhooks.js +51 -0
- package/dist/lib/transformers/index.d.ts +23 -0
- package/dist/lib/transformers/index.js +39 -0
- package/dist/lib/types/entitlements.d.ts +0 -6
- package/dist/lib/types/gateway-events.d.ts +21 -8
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/interaction.d.ts +2 -2
- package/dist/lib/types/sku.d.ts +0 -12
- package/dist/lib/types/user.d.ts +2 -2
- package/dist/lib/utils/CDN.d.ts +24 -0
- package/dist/lib/utils/CDN.js +49 -0
- package/dist/lib/utils/errors.d.ts +3 -3
- package/dist/lib/utils/errors.js +10 -12
- package/dist/lib/utils/formatters.d.ts +16 -0
- package/dist/lib/utils/formatters.js +44 -0
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +15 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
- package/dist/lib/rest/CDN.d.ts +0 -22
- package/dist/lib/rest/CDN.js +0 -45
- package/dist/lib/types/voice-connections.d.ts +0 -64
- package/dist/lib/types/voice-connections.js +0 -2
- package/dist/lib/utils/Util.d.ts +0 -94
- package/dist/lib/utils/Util.js +0 -2228
- package/dist/lib/voice/VoiceConnection.d.ts +0 -57
- package/dist/lib/voice/VoiceConnection.js +0 -150
- package/dist/lib/voice/VoiceConnectionManager.d.ts +0 -19
- package/dist/lib/voice/VoiceConnectionManager.js +0 -66
- package/dist/lib/voice/index.d.ts +0 -2
- package/dist/lib/voice/index.js +0 -18
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,38 @@ 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
|
+
integration_types: command.integrationTypes,
|
129
|
+
contexts: command.contexts,
|
130
|
+
type: command.type,
|
131
|
+
nsfw: command.nsfw,
|
132
|
+
})),
|
125
133
|
});
|
126
|
-
return response.map((c) =>
|
134
|
+
return response.map((c) => transformers_1.ApplicationCommands.applicationCommandFromRaw(c));
|
127
135
|
}
|
128
136
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
129
137
|
async bulkEditGuildApplicationCommands(applicationID, guildID, commands) {
|
130
138
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
131
|
-
json: commands.map((command) =>
|
139
|
+
json: commands.map((command) => ({
|
140
|
+
id: command.id,
|
141
|
+
name: command.name,
|
142
|
+
name_localizations: command.nameLocalizations,
|
143
|
+
description: command.description,
|
144
|
+
description_localizations: command.descriptionLocalizations,
|
145
|
+
options: command.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
146
|
+
default_member_permissions: command.defaultMemberPermissions,
|
147
|
+
type: command.type,
|
148
|
+
nsfw: command.nsfw,
|
149
|
+
})),
|
132
150
|
});
|
133
|
-
return response.map((c) =>
|
151
|
+
return response.map((c) => transformers_1.ApplicationCommands.applicationCommandFromRaw(c));
|
134
152
|
}
|
135
153
|
/** https://discord.com/developers/docs/topics/gateway#connections */
|
136
154
|
async connect() {
|
@@ -153,22 +171,17 @@ class Client extends node_events_1.default {
|
|
153
171
|
name: options.name,
|
154
172
|
event_type: options.eventType,
|
155
173
|
trigger_type: options.triggerType,
|
156
|
-
trigger_metadata: options.triggerMetadata
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
channel_id: action.metadata.channelID,
|
161
|
-
duration_seconds: action.metadata.durationSeconds,
|
162
|
-
custom_message: action.metadata.customMessage,
|
163
|
-
},
|
164
|
-
})),
|
174
|
+
trigger_metadata: options.triggerMetadata !== undefined
|
175
|
+
? transformers_1.AutoModeration.triggerMetadataToRaw(options.triggerMetadata)
|
176
|
+
: undefined,
|
177
|
+
actions: options.actions.map((action) => transformers_1.AutoModeration.actionToRaw(action)),
|
165
178
|
enabled: options.enabled,
|
166
179
|
exempt_roles: options.exemptRoles,
|
167
180
|
exempt_channels: options.exemptChannels,
|
168
181
|
},
|
169
182
|
reason,
|
170
183
|
});
|
171
|
-
return
|
184
|
+
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
172
185
|
}
|
173
186
|
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
174
187
|
async createChannel(guildID, options, reason) {
|
@@ -202,7 +215,7 @@ class Client extends node_events_1.default {
|
|
202
215
|
},
|
203
216
|
reason,
|
204
217
|
});
|
205
|
-
return
|
218
|
+
return transformers_1.Channels.channelFromRaw(response);
|
206
219
|
}
|
207
220
|
/** https://discord.com/developers/docs/resources/channel#create-channel-invite */
|
208
221
|
async createChannelInvite(channelID, options, reason) {
|
@@ -218,7 +231,7 @@ class Client extends node_events_1.default {
|
|
218
231
|
},
|
219
232
|
reason,
|
220
233
|
});
|
221
|
-
return
|
234
|
+
return transformers_1.Invites.inviteFromRaw(response);
|
222
235
|
}
|
223
236
|
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
224
237
|
async createChannelWebhook(channelID, options, reason) {
|
@@ -229,7 +242,7 @@ class Client extends node_events_1.default {
|
|
229
242
|
},
|
230
243
|
reason,
|
231
244
|
});
|
232
|
-
return
|
245
|
+
return transformers_1.Webhooks.webhookFromRaw(response);
|
233
246
|
}
|
234
247
|
/** https://discord.com/developers/docs/resources/user#create-dm */
|
235
248
|
async createDM(options) {
|
@@ -238,31 +251,41 @@ class Client extends node_events_1.default {
|
|
238
251
|
recipient_id: options.recipientID,
|
239
252
|
},
|
240
253
|
});
|
241
|
-
return
|
254
|
+
return transformers_1.Channels.channelFromRaw(response);
|
242
255
|
}
|
243
256
|
/** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
|
244
257
|
async createGlobalApplicationCommand(applicationID, options) {
|
245
258
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationCommands(applicationID), {
|
246
|
-
json:
|
259
|
+
json: {
|
260
|
+
name: options.name,
|
261
|
+
name_localizations: options.nameLocalizations,
|
262
|
+
description: options.description,
|
263
|
+
description_localizations: options.descriptionLocalizations,
|
264
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
265
|
+
default_member_permissions: options.defaultMemberPermissions,
|
266
|
+
integration_types: options.integrationTypes,
|
267
|
+
contexts: options.contexts,
|
268
|
+
type: options.type,
|
269
|
+
nsfw: options.nsfw,
|
270
|
+
},
|
247
271
|
});
|
248
|
-
return
|
272
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
249
273
|
}
|
250
274
|
/** https://discord.com/developers/docs/resources/user#create-group-dm */
|
251
|
-
async
|
275
|
+
async createGroup(options) {
|
252
276
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.userChannels(), {
|
253
277
|
json: {
|
254
278
|
access_tokens: options.accessTokens,
|
255
279
|
nicks: options.nicks,
|
256
280
|
},
|
257
281
|
});
|
258
|
-
return
|
282
|
+
return transformers_1.Channels.channelFromRaw(response);
|
259
283
|
}
|
260
284
|
/** https://discord.com/developers/docs/resources/guild#create-guild */
|
261
285
|
async createGuild(options) {
|
262
286
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guilds(), {
|
263
287
|
json: {
|
264
288
|
name: options.name,
|
265
|
-
region: options.region,
|
266
289
|
icon: options.icon,
|
267
290
|
verification_level: options.verificationLevel,
|
268
291
|
default_message_notifications: options.defaultMessageNotifications,
|
@@ -276,20 +299,35 @@ class Client extends node_events_1.default {
|
|
276
299
|
permissions: role.permissions,
|
277
300
|
mentionable: role.mentionable,
|
278
301
|
})),
|
302
|
+
channels: options.channels?.map((channel) => ({
|
303
|
+
name: channel.name,
|
304
|
+
type: channel.type,
|
305
|
+
id: channel.id,
|
306
|
+
parent_id: channel.id,
|
307
|
+
})),
|
279
308
|
afk_channel_id: options.afkChannelID,
|
280
309
|
afk_timeout: options.afkTimeout,
|
281
310
|
system_channel_id: options.systemChannelID,
|
282
311
|
system_channel_flags: options.systemChannelFlags,
|
283
312
|
},
|
284
313
|
});
|
285
|
-
return
|
314
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
286
315
|
}
|
287
316
|
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
288
317
|
async createGuildApplicationCommand(applicationID, guildID, options) {
|
289
318
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
290
|
-
json:
|
319
|
+
json: {
|
320
|
+
name: options.name,
|
321
|
+
name_localizations: options.nameLocalizations,
|
322
|
+
description: options.description,
|
323
|
+
description_localizations: options.descriptionLocalizations,
|
324
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
325
|
+
default_member_permissions: options.defaultMemberPermissions,
|
326
|
+
type: options.type,
|
327
|
+
nsfw: options.nsfw,
|
328
|
+
},
|
291
329
|
});
|
292
|
-
return
|
330
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
293
331
|
}
|
294
332
|
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
295
333
|
createGuildBan(guildID, userID, options, reason) {
|
@@ -311,7 +349,7 @@ class Client extends node_events_1.default {
|
|
311
349
|
},
|
312
350
|
reason,
|
313
351
|
});
|
314
|
-
return
|
352
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
315
353
|
}
|
316
354
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template */
|
317
355
|
async createGuildFromTemplate(code, options) {
|
@@ -321,7 +359,7 @@ class Client extends node_events_1.default {
|
|
321
359
|
icon: options.icon,
|
322
360
|
},
|
323
361
|
});
|
324
|
-
return
|
362
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
325
363
|
}
|
326
364
|
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
327
365
|
async createGuildRole(guildID, options, reason) {
|
@@ -337,7 +375,7 @@ class Client extends node_events_1.default {
|
|
337
375
|
},
|
338
376
|
reason,
|
339
377
|
});
|
340
|
-
return
|
378
|
+
return transformers_1.Roles.roleFromRaw(response);
|
341
379
|
}
|
342
380
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
343
381
|
async createGuildScheduledEvent(guildID, options, reason) {
|
@@ -355,7 +393,7 @@ class Client extends node_events_1.default {
|
|
355
393
|
},
|
356
394
|
reason,
|
357
395
|
});
|
358
|
-
return
|
396
|
+
return transformers_1.GuildScheduledEvents.guildScheduledEventFromRaw(response);
|
359
397
|
}
|
360
398
|
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
|
361
399
|
async createGuildSticker(guildID, options, reason) {
|
@@ -368,7 +406,7 @@ class Client extends node_events_1.default {
|
|
368
406
|
form: formData,
|
369
407
|
reason,
|
370
408
|
});
|
371
|
-
return
|
409
|
+
return transformers_1.Stickers.stickerFromRaw(response);
|
372
410
|
}
|
373
411
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
374
412
|
async createGuildTemplate(guildID, options) {
|
@@ -378,7 +416,7 @@ class Client extends node_events_1.default {
|
|
378
416
|
description: options.description,
|
379
417
|
},
|
380
418
|
});
|
381
|
-
return
|
419
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
382
420
|
}
|
383
421
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message */
|
384
422
|
async createInteractionFollowupMessage(applicationID, interactionToken, options) {
|
@@ -386,9 +424,7 @@ class Client extends node_events_1.default {
|
|
386
424
|
json: {
|
387
425
|
content: options.content,
|
388
426
|
tts: options.tts,
|
389
|
-
embeds: options.embeds
|
390
|
-
? options.embeds?.map((embed) => this.util.embedToRaw(embed))
|
391
|
-
: null,
|
427
|
+
embeds: options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
392
428
|
allowed_mentions: options.allowedMentions !== undefined
|
393
429
|
? options.allowedMentions !== null
|
394
430
|
? {
|
@@ -400,11 +436,9 @@ class Client extends node_events_1.default {
|
|
400
436
|
: null
|
401
437
|
: undefined,
|
402
438
|
components: options.components !== undefined
|
403
|
-
? options.components
|
404
|
-
? this.util.messageComponentsToRaw(options.components)
|
405
|
-
: null
|
439
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
406
440
|
: undefined,
|
407
|
-
attachments: options.attachments
|
441
|
+
attachments: options.attachments,
|
408
442
|
flags: options.flags,
|
409
443
|
thread_name: options.threadName,
|
410
444
|
poll: options.poll !== undefined
|
@@ -422,7 +456,7 @@ class Client extends node_events_1.default {
|
|
422
456
|
},
|
423
457
|
files: options.files,
|
424
458
|
});
|
425
|
-
return
|
459
|
+
return transformers_1.Channels.messageFromRaw(response);
|
426
460
|
}
|
427
461
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
|
428
462
|
createInteractionResponse(interactionID, interactionToken, options) {
|
@@ -436,7 +470,7 @@ class Client extends node_events_1.default {
|
|
436
470
|
data: {
|
437
471
|
content: options.data?.content,
|
438
472
|
embeds: options.data?.embeds !== undefined
|
439
|
-
? options.data.embeds.map((embed) =>
|
473
|
+
? options.data.embeds.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
440
474
|
: undefined,
|
441
475
|
allowed_mentions: options.data?.allowedMentions !== undefined
|
442
476
|
? {
|
@@ -448,9 +482,9 @@ class Client extends node_events_1.default {
|
|
448
482
|
: undefined,
|
449
483
|
flags: options.data?.flags,
|
450
484
|
components: options.data?.components !== undefined
|
451
|
-
?
|
485
|
+
? transformers_1.Channels.componentsToRaw(options.data.components)
|
452
486
|
: undefined,
|
453
|
-
attachments: options.data?.attachments
|
487
|
+
attachments: options.data?.attachments,
|
454
488
|
poll: options.data?.poll !== undefined
|
455
489
|
? {
|
456
490
|
question: options.data.poll.question,
|
@@ -506,7 +540,7 @@ class Client extends node_events_1.default {
|
|
506
540
|
data: {
|
507
541
|
custom_id: options.data?.customID,
|
508
542
|
components: options.data?.components !== undefined
|
509
|
-
?
|
543
|
+
? transformers_1.Channels.componentsToRaw(options.data.components)
|
510
544
|
: undefined,
|
511
545
|
title: options.data?.title,
|
512
546
|
},
|
@@ -533,7 +567,7 @@ class Client extends node_events_1.default {
|
|
533
567
|
content: options.content,
|
534
568
|
nonce: options.nonce,
|
535
569
|
tts: options.tts,
|
536
|
-
embeds: options.embeds?.map((embed) =>
|
570
|
+
embeds: options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
537
571
|
allowed_mentions: options.allowedMentions !== undefined
|
538
572
|
? {
|
539
573
|
parse: options.allowedMentions.parse,
|
@@ -542,12 +576,19 @@ class Client extends node_events_1.default {
|
|
542
576
|
replied_user: options.allowedMentions.repliedUser,
|
543
577
|
}
|
544
578
|
: undefined,
|
545
|
-
message_reference: options.messageReference
|
579
|
+
message_reference: options.messageReference !== undefined
|
580
|
+
? {
|
581
|
+
message_id: options.messageReference.messageID,
|
582
|
+
channel_id: options.messageReference.channelID,
|
583
|
+
guild_id: options.messageReference.guildID,
|
584
|
+
fail_if_not_exists: options.messageReference.failIfNotExists,
|
585
|
+
}
|
586
|
+
: undefined,
|
546
587
|
components: options.components !== undefined
|
547
|
-
?
|
588
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
548
589
|
: undefined,
|
549
590
|
stickers_ids: options.stickersIDs,
|
550
|
-
attachments: options.attachments
|
591
|
+
attachments: options.attachments,
|
551
592
|
flags: options.flags,
|
552
593
|
enforce_nonce: options.enforceNonce,
|
553
594
|
poll: options.poll !== undefined
|
@@ -565,7 +606,7 @@ class Client extends node_events_1.default {
|
|
565
606
|
},
|
566
607
|
files: options.files,
|
567
608
|
});
|
568
|
-
return
|
609
|
+
return transformers_1.Channels.messageFromRaw(response);
|
569
610
|
}
|
570
611
|
/** https://discord.com/developers/docs/resources/channel#create-reaction */
|
571
612
|
createMessageReaction(channelID, messageID, emoji) {
|
@@ -583,7 +624,7 @@ class Client extends node_events_1.default {
|
|
583
624
|
},
|
584
625
|
reason,
|
585
626
|
});
|
586
|
-
return
|
627
|
+
return transformers_1.StageInstances.stageInstanceFromRaw(response);
|
587
628
|
}
|
588
629
|
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
|
589
630
|
async createTestEntitlement(applicationID, options) {
|
@@ -594,7 +635,7 @@ class Client extends node_events_1.default {
|
|
594
635
|
owner_type: options.ownerType,
|
595
636
|
},
|
596
637
|
});
|
597
|
-
return
|
638
|
+
return transformers_1.Entitlements.testEntitlementFromRaw(response);
|
598
639
|
}
|
599
640
|
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel */
|
600
641
|
async createThread(channelID, options, reason) {
|
@@ -605,24 +646,25 @@ class Client extends node_events_1.default {
|
|
605
646
|
rate_limit_per_user: options.rateLimitPerUser,
|
606
647
|
message: {
|
607
648
|
content: options.message.content,
|
608
|
-
embeds: options.message.embeds?.map((embed) =>
|
649
|
+
embeds: options.message.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
609
650
|
allowed_mentions: options.message.allowedMentions !== undefined
|
610
|
-
?
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
}
|
617
|
-
: null
|
651
|
+
? {
|
652
|
+
parse: options.message.allowedMentions.parse,
|
653
|
+
roles: options.message.allowedMentions.roles,
|
654
|
+
users: options.message.allowedMentions.users,
|
655
|
+
replied_user: options.message.allowedMentions.repliedUser,
|
656
|
+
}
|
618
657
|
: undefined,
|
658
|
+
sticker_ids: options.message.stickerIDs,
|
659
|
+
attachments: options.message.attachments,
|
660
|
+
flags: options.message.flags,
|
619
661
|
},
|
620
662
|
applied_tags: options.appliedTags,
|
621
663
|
},
|
622
|
-
files: options.files,
|
664
|
+
files: options.message.files,
|
623
665
|
reason,
|
624
666
|
});
|
625
|
-
return
|
667
|
+
return transformers_1.Channels.channelFromRaw(response);
|
626
668
|
}
|
627
669
|
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
|
628
670
|
async createThreadFromMessage(channelID, messageID, options, reason) {
|
@@ -634,7 +676,7 @@ class Client extends node_events_1.default {
|
|
634
676
|
},
|
635
677
|
reason,
|
636
678
|
});
|
637
|
-
return
|
679
|
+
return transformers_1.Channels.channelFromRaw(response);
|
638
680
|
}
|
639
681
|
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message */
|
640
682
|
async createThreadWithoutMessage(channelID, options, reason) {
|
@@ -648,12 +690,12 @@ class Client extends node_events_1.default {
|
|
648
690
|
},
|
649
691
|
reason,
|
650
692
|
});
|
651
|
-
return
|
693
|
+
return transformers_1.Channels.channelFromRaw(response);
|
652
694
|
}
|
653
695
|
/** https://discord.com/developers/docs/resources/channel#crosspost-message */
|
654
696
|
async crosspostMessage(channelID, messageID) {
|
655
697
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessage(channelID, messageID));
|
656
|
-
return
|
698
|
+
return transformers_1.Channels.messageFromRaw(response);
|
657
699
|
}
|
658
700
|
/** https://discord.com/developers/docs/resources/channel#delete-all-reactions */
|
659
701
|
deleteAllMessageReactions(channelID, messageID, emoji) {
|
@@ -670,7 +712,7 @@ class Client extends node_events_1.default {
|
|
670
712
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channel(channelID), {
|
671
713
|
reason,
|
672
714
|
});
|
673
|
-
return
|
715
|
+
return transformers_1.Channels.channelFromRaw(response);
|
674
716
|
}
|
675
717
|
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
676
718
|
deleteChannelPermission(channelID, overwriteID, reason) {
|
@@ -721,14 +763,14 @@ class Client extends node_events_1.default {
|
|
721
763
|
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
722
764
|
async deleteGuildTemplate(guildID, code) {
|
723
765
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildTemplate(guildID, code));
|
724
|
-
return
|
766
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
725
767
|
}
|
726
768
|
/** https://discord.com/developers/docs/resources/invite#delete-invite */
|
727
769
|
async deleteInvite(code, reason) {
|
728
770
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.invite(code), {
|
729
771
|
reason,
|
730
772
|
});
|
731
|
-
return
|
773
|
+
return transformers_1.Invites.inviteFromRaw(response);
|
732
774
|
}
|
733
775
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message */
|
734
776
|
deleteInteractionFollowupMessage(applicationID, interactionToken, messageID) {
|
@@ -789,43 +831,44 @@ class Client extends node_events_1.default {
|
|
789
831
|
name: options.name,
|
790
832
|
event_type: options.eventType,
|
791
833
|
trigger_type: options.triggerType,
|
792
|
-
trigger_metadata: options.triggerMetadata
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
channel_id: action.metadata.channelID,
|
797
|
-
duration_seconds: action.metadata.durationSeconds,
|
798
|
-
custom_message: action.metadata.customMessage,
|
799
|
-
},
|
800
|
-
})),
|
834
|
+
trigger_metadata: options.triggerMetadata !== undefined
|
835
|
+
? transformers_1.AutoModeration.triggerMetadataToRaw(options.triggerMetadata)
|
836
|
+
: undefined,
|
837
|
+
actions: options.actions?.map((action) => transformers_1.AutoModeration.actionToRaw(action)),
|
801
838
|
enabled: options.enabled,
|
802
839
|
exempt_roles: options.exemptRoles,
|
803
840
|
exempt_channels: options.exemptChannels,
|
804
841
|
},
|
805
842
|
reason,
|
806
843
|
});
|
807
|
-
return
|
844
|
+
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
808
845
|
}
|
809
846
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
|
810
847
|
async editApplicationCommandPermissions(applicationID, guildID, commandID, options) {
|
811
848
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID), {
|
812
849
|
json: {
|
813
|
-
permissions: options.permissions.map((permission) =>
|
850
|
+
permissions: options.permissions.map((permission) => ({
|
851
|
+
id: permission.type,
|
852
|
+
type: permission.type,
|
853
|
+
permission: permission.permission,
|
854
|
+
})),
|
814
855
|
},
|
815
856
|
});
|
816
|
-
return
|
857
|
+
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
817
858
|
}
|
818
859
|
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
819
860
|
async editChannel(channelID, options, reason) {
|
820
861
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channel(channelID), {
|
821
862
|
json: {
|
822
863
|
name: options.name,
|
864
|
+
icon: options.icon,
|
823
865
|
type: options.type,
|
824
866
|
position: options.position,
|
825
867
|
topic: options.topic,
|
826
868
|
nsfw: options.nsfw,
|
827
869
|
rate_limit_per_user: options.rateLimitPerUser,
|
828
870
|
bitrate: options.bitrate,
|
871
|
+
user_limit: options.userLimit,
|
829
872
|
permission_overwrites: options.permissionOverwrites,
|
830
873
|
parent_id: options.parentID,
|
831
874
|
rtc_region: options.rtcRegion,
|
@@ -833,7 +876,14 @@ class Client extends node_events_1.default {
|
|
833
876
|
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
834
877
|
flags: options.flags,
|
835
878
|
available_tags: options.availableTags,
|
836
|
-
default_reaction_emoji: options.defaultReactionEmoji
|
879
|
+
default_reaction_emoji: options.defaultReactionEmoji !== undefined
|
880
|
+
? options.defaultReactionEmoji !== null
|
881
|
+
? {
|
882
|
+
emoji_id: options.defaultReactionEmoji.emojiID,
|
883
|
+
emoji_name: options.defaultReactionEmoji.emojiName,
|
884
|
+
}
|
885
|
+
: null
|
886
|
+
: undefined,
|
837
887
|
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
838
888
|
default_sort_order: options.defaultSortOrder,
|
839
889
|
default_forum_layout: options.defaultForumLayout,
|
@@ -845,7 +895,7 @@ class Client extends node_events_1.default {
|
|
845
895
|
},
|
846
896
|
reason,
|
847
897
|
});
|
848
|
-
return
|
898
|
+
return transformers_1.Channels.channelFromRaw(response);
|
849
899
|
}
|
850
900
|
/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions */
|
851
901
|
editChannelPermissions(channelID, overwriteID, options, reason) {
|
@@ -874,7 +924,7 @@ class Client extends node_events_1.default {
|
|
874
924
|
banner: options.banner,
|
875
925
|
},
|
876
926
|
});
|
877
|
-
return
|
927
|
+
return transformers_1.Users.userFromRaw(response);
|
878
928
|
}
|
879
929
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
880
930
|
async editCurrentGuildMember(guildID, options, reason) {
|
@@ -884,7 +934,7 @@ class Client extends node_events_1.default {
|
|
884
934
|
},
|
885
935
|
reason,
|
886
936
|
});
|
887
|
-
return
|
937
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
888
938
|
}
|
889
939
|
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
890
940
|
editCurrentUserVoiceState(guildID, options) {
|
@@ -898,12 +948,22 @@ class Client extends node_events_1.default {
|
|
898
948
|
}
|
899
949
|
/** https://discord.com/developers/docs/resources/application#edit-current-application */
|
900
950
|
async editCurrentApplication(options) {
|
901
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.
|
951
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationUser(), {
|
902
952
|
json: {
|
903
953
|
custom_install_url: options.customInstallURL,
|
904
954
|
description: options.description,
|
905
955
|
role_connections_verification_url: options.roleConnectionsVerificationURL,
|
906
956
|
install_params: options.installParams,
|
957
|
+
integration_types_config: options.integrationTypesConfig !== undefined
|
958
|
+
? {
|
959
|
+
"0": {
|
960
|
+
oauth2_install_params: options.integrationTypesConfig?.[0].oauth2InstallParams,
|
961
|
+
},
|
962
|
+
"1": {
|
963
|
+
oauth2_install_params: options.integrationTypesConfig?.[1].oauth2InstallParams,
|
964
|
+
},
|
965
|
+
}
|
966
|
+
: undefined,
|
907
967
|
flags: options.flags,
|
908
968
|
icon: options.icon,
|
909
969
|
cover_image: options.coverImage,
|
@@ -911,21 +971,30 @@ class Client extends node_events_1.default {
|
|
911
971
|
tags: options.tags,
|
912
972
|
},
|
913
973
|
});
|
914
|
-
return
|
974
|
+
return transformers_1.Applications.applicationFromRaw(response);
|
915
975
|
}
|
916
976
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
|
917
977
|
async editGlobalApplicationCommand(applicationID, commandID, options) {
|
918
978
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationCommand(applicationID, commandID), {
|
919
|
-
json:
|
979
|
+
json: {
|
980
|
+
name: options.name,
|
981
|
+
name_localizations: options.nameLocalizations,
|
982
|
+
description: options.description,
|
983
|
+
description_localizations: options.descriptionLocalizations,
|
984
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
985
|
+
default_member_permissions: options.defaultMemberPermissions,
|
986
|
+
integration_types: options.integrationTypes,
|
987
|
+
contexts: options.contexts,
|
988
|
+
nsfw: options.nsfw,
|
989
|
+
},
|
920
990
|
});
|
921
|
-
return
|
991
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
922
992
|
}
|
923
993
|
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
924
994
|
async editGuild(guildID, options, reason) {
|
925
995
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guild(guildID), {
|
926
996
|
json: {
|
927
997
|
name: options.name,
|
928
|
-
region: options.region,
|
929
998
|
verification_level: options.verificationLevel,
|
930
999
|
default_message_notifications: options.defaultMessageNotifications,
|
931
1000
|
explicit_content_filter: options.explicitContentFilter,
|
@@ -948,14 +1017,22 @@ class Client extends node_events_1.default {
|
|
948
1017
|
},
|
949
1018
|
reason,
|
950
1019
|
});
|
951
|
-
return
|
1020
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
952
1021
|
}
|
953
1022
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
954
1023
|
async editGuildApplicationCommand(applicationID, guildID, commandID, options) {
|
955
1024
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID), {
|
956
|
-
json:
|
1025
|
+
json: {
|
1026
|
+
name: options.name,
|
1027
|
+
name_localizations: options.nameLocalizations,
|
1028
|
+
description: options.description,
|
1029
|
+
description_localizations: options.descriptionLocalizations,
|
1030
|
+
options: options.options?.map((option) => transformers_1.ApplicationCommands.optionToRaw(option)),
|
1031
|
+
default_member_permissions: options.defaultMemberPermissions,
|
1032
|
+
nsfw: options.nsfw,
|
1033
|
+
},
|
957
1034
|
});
|
958
|
-
return
|
1035
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
959
1036
|
}
|
960
1037
|
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
961
1038
|
async editGuildEmoji(guildID, emojiID, options, reason) {
|
@@ -966,7 +1043,7 @@ class Client extends node_events_1.default {
|
|
966
1043
|
},
|
967
1044
|
reason,
|
968
1045
|
});
|
969
|
-
return
|
1046
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
970
1047
|
}
|
971
1048
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
972
1049
|
async editGuildMember(guildID, userID, options, reason) {
|
@@ -982,7 +1059,7 @@ class Client extends node_events_1.default {
|
|
982
1059
|
},
|
983
1060
|
reason,
|
984
1061
|
});
|
985
|
-
return
|
1062
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
986
1063
|
}
|
987
1064
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
988
1065
|
editGuildMFALevel(guildID, options, reason) {
|
@@ -1005,7 +1082,7 @@ class Client extends node_events_1.default {
|
|
1005
1082
|
channel_ids: promptOption.channelIDs,
|
1006
1083
|
role_ids: promptOption.roleIDs,
|
1007
1084
|
emoji: promptOption.emoji !== undefined
|
1008
|
-
?
|
1085
|
+
? transformers_1.Emojis.emojiToRaw(promptOption.emoji)
|
1009
1086
|
: undefined,
|
1010
1087
|
emoji_id: promptOption.emojiID,
|
1011
1088
|
emoji_name: promptOption.emojiName,
|
@@ -1036,14 +1113,15 @@ class Client extends node_events_1.default {
|
|
1036
1113
|
},
|
1037
1114
|
reason,
|
1038
1115
|
});
|
1039
|
-
return
|
1116
|
+
return transformers_1.Roles.roleFromRaw(response);
|
1040
1117
|
}
|
1041
1118
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
1042
|
-
async editGuildRolePositions(guildID, options) {
|
1119
|
+
async editGuildRolePositions(guildID, options, reason) {
|
1043
1120
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildRoles(guildID), {
|
1044
1121
|
json: options,
|
1122
|
+
reason,
|
1045
1123
|
});
|
1046
|
-
return response.map((role) =>
|
1124
|
+
return response.map((role) => transformers_1.Roles.roleFromRaw(role));
|
1047
1125
|
}
|
1048
1126
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
1049
1127
|
async editGuildScheduledEvent(guildID, guildScheduledEventID, options, reason) {
|
@@ -1062,7 +1140,7 @@ class Client extends node_events_1.default {
|
|
1062
1140
|
},
|
1063
1141
|
reason,
|
1064
1142
|
});
|
1065
|
-
return
|
1143
|
+
return transformers_1.GuildScheduledEvents.guildScheduledEventFromRaw(response);
|
1066
1144
|
}
|
1067
1145
|
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
1068
1146
|
async editGuildSticker(guildID, stickerID, options, reason) {
|
@@ -1074,7 +1152,7 @@ class Client extends node_events_1.default {
|
|
1074
1152
|
},
|
1075
1153
|
reason,
|
1076
1154
|
});
|
1077
|
-
return
|
1155
|
+
return transformers_1.Stickers.stickerFromRaw(response);
|
1078
1156
|
}
|
1079
1157
|
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
1080
1158
|
async editGuildTemplate(guildID, code, options) {
|
@@ -1084,14 +1162,19 @@ class Client extends node_events_1.default {
|
|
1084
1162
|
description: options.description,
|
1085
1163
|
},
|
1086
1164
|
});
|
1087
|
-
return
|
1165
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
1088
1166
|
}
|
1089
1167
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
1090
1168
|
async editGuildWelcomeScreen(guildID, options, reason) {
|
1091
1169
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildWelcomeScreen(guildID), {
|
1092
1170
|
json: {
|
1093
1171
|
enabled: options.enabled,
|
1094
|
-
welcome_channels: options.welcomeChannels
|
1172
|
+
welcome_channels: options.welcomeChannels?.map((welcomeChannel) => ({
|
1173
|
+
channel_id: welcomeChannel.channelID,
|
1174
|
+
description: welcomeChannel.description,
|
1175
|
+
emoji_id: welcomeChannel.emojiID,
|
1176
|
+
emoji_name: welcomeChannel.emojiName,
|
1177
|
+
})),
|
1095
1178
|
description: options.description,
|
1096
1179
|
},
|
1097
1180
|
reason,
|
@@ -1126,7 +1209,7 @@ class Client extends node_events_1.default {
|
|
1126
1209
|
json: {
|
1127
1210
|
content: options.content,
|
1128
1211
|
embeds: options.embeds !== null
|
1129
|
-
? options.embeds?.map((embed) =>
|
1212
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1130
1213
|
: null,
|
1131
1214
|
allowed_mentions: options.allowedMentions !== undefined
|
1132
1215
|
? options.allowedMentions !== null
|
@@ -1140,15 +1223,15 @@ class Client extends node_events_1.default {
|
|
1140
1223
|
: undefined,
|
1141
1224
|
components: options.components !== undefined
|
1142
1225
|
? options.components !== null
|
1143
|
-
?
|
1226
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1144
1227
|
: null
|
1145
1228
|
: undefined,
|
1146
|
-
attachments: options.attachments?.map((attachment) =>
|
1229
|
+
attachments: options.attachments?.map((attachment) => transformers_1.Channels.attachmentToRaw(attachment)),
|
1147
1230
|
flags: options.flags,
|
1148
1231
|
},
|
1149
1232
|
files: options.files,
|
1150
1233
|
});
|
1151
|
-
return
|
1234
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1152
1235
|
}
|
1153
1236
|
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance */
|
1154
1237
|
async editStageInstance(channelID, options, reason) {
|
@@ -1159,7 +1242,7 @@ class Client extends node_events_1.default {
|
|
1159
1242
|
},
|
1160
1243
|
reason,
|
1161
1244
|
});
|
1162
|
-
return
|
1245
|
+
return transformers_1.StageInstances.stageInstanceFromRaw(response);
|
1163
1246
|
}
|
1164
1247
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message */
|
1165
1248
|
async editInteractionFollowupMessage(applicationID, interactionToken, messageID, options) {
|
@@ -1167,7 +1250,7 @@ class Client extends node_events_1.default {
|
|
1167
1250
|
json: {
|
1168
1251
|
content: options.content,
|
1169
1252
|
embeds: options.embeds !== null
|
1170
|
-
? options.embeds?.map((embed) =>
|
1253
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1171
1254
|
: null,
|
1172
1255
|
allowed_mentions: options.allowedMentions !== undefined
|
1173
1256
|
? options.allowedMentions !== null
|
@@ -1181,18 +1264,32 @@ class Client extends node_events_1.default {
|
|
1181
1264
|
: undefined,
|
1182
1265
|
components: options.components !== undefined
|
1183
1266
|
? options.components !== null
|
1184
|
-
?
|
1267
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1185
1268
|
: null
|
1186
1269
|
: undefined,
|
1187
|
-
attachments: options.attachments?.map((attachment) =>
|
1188
|
-
|
1270
|
+
attachments: options.attachments?.map((attachment) => ({
|
1271
|
+
id: attachment.id,
|
1272
|
+
filename: attachment.filename,
|
1273
|
+
title: attachment.title,
|
1274
|
+
description: attachment.description,
|
1275
|
+
content_type: attachment.contentType,
|
1276
|
+
size: attachment.size,
|
1277
|
+
url: attachment.url,
|
1278
|
+
proxy_url: attachment.proxyURL,
|
1279
|
+
height: attachment.height,
|
1280
|
+
width: attachment.width,
|
1281
|
+
ephemeral: attachment.ephemeral,
|
1282
|
+
duration_secs: attachment.durationSecs,
|
1283
|
+
waveform: attachment.waveform,
|
1284
|
+
flags: attachment.flags,
|
1285
|
+
})),
|
1189
1286
|
},
|
1190
1287
|
files: options.files,
|
1191
1288
|
query: {
|
1192
1289
|
thread_id: options.threadID,
|
1193
1290
|
},
|
1194
1291
|
});
|
1195
|
-
return
|
1292
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1196
1293
|
}
|
1197
1294
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response */
|
1198
1295
|
async editInteractionResponse(applicationID, interactionToken, options) {
|
@@ -1200,7 +1297,7 @@ class Client extends node_events_1.default {
|
|
1200
1297
|
json: {
|
1201
1298
|
content: options.content,
|
1202
1299
|
embeds: options.embeds !== null
|
1203
|
-
? options.embeds?.map((embed) =>
|
1300
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1204
1301
|
: null,
|
1205
1302
|
allowed_mentions: options.allowedMentions !== undefined
|
1206
1303
|
? options.allowedMentions !== null
|
@@ -1214,18 +1311,32 @@ class Client extends node_events_1.default {
|
|
1214
1311
|
: undefined,
|
1215
1312
|
components: options.components !== undefined
|
1216
1313
|
? options.components !== null
|
1217
|
-
?
|
1314
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1218
1315
|
: null
|
1219
1316
|
: undefined,
|
1220
|
-
attachments: options.attachments?.map((attachment) =>
|
1221
|
-
|
1317
|
+
attachments: options.attachments?.map((attachment) => ({
|
1318
|
+
id: attachment.id,
|
1319
|
+
filename: attachment.filename,
|
1320
|
+
title: attachment.title,
|
1321
|
+
description: attachment.description,
|
1322
|
+
content_type: attachment.contentType,
|
1323
|
+
size: attachment.size,
|
1324
|
+
url: attachment.url,
|
1325
|
+
proxy_url: attachment.proxyURL,
|
1326
|
+
height: attachment.height,
|
1327
|
+
width: attachment.width,
|
1328
|
+
ephemeral: attachment.ephemeral,
|
1329
|
+
duration_secs: attachment.durationSecs,
|
1330
|
+
waveform: attachment.waveform,
|
1331
|
+
flags: attachment.flags,
|
1332
|
+
})),
|
1222
1333
|
},
|
1223
1334
|
files: options.files,
|
1224
1335
|
query: {
|
1225
1336
|
thread_id: options.threadID,
|
1226
1337
|
},
|
1227
1338
|
});
|
1228
|
-
return
|
1339
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1229
1340
|
}
|
1230
1341
|
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
1231
1342
|
editUserVoiceState(guildID, userID, options) {
|
@@ -1233,7 +1344,6 @@ class Client extends node_events_1.default {
|
|
1233
1344
|
json: {
|
1234
1345
|
channel_id: options.channelID,
|
1235
1346
|
suppress: options.suppress,
|
1236
|
-
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
1237
1347
|
},
|
1238
1348
|
});
|
1239
1349
|
}
|
@@ -1247,7 +1357,7 @@ class Client extends node_events_1.default {
|
|
1247
1357
|
},
|
1248
1358
|
reason,
|
1249
1359
|
});
|
1250
|
-
return
|
1360
|
+
return transformers_1.Webhooks.webhookFromRaw(response);
|
1251
1361
|
}
|
1252
1362
|
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
|
1253
1363
|
async editWebhookMessage(webhookID, webhookToken, messageID, options) {
|
@@ -1255,7 +1365,7 @@ class Client extends node_events_1.default {
|
|
1255
1365
|
json: {
|
1256
1366
|
content: options.content,
|
1257
1367
|
embeds: options.embeds !== null
|
1258
|
-
? options.embeds?.map((embed) =>
|
1368
|
+
? options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed))
|
1259
1369
|
: null,
|
1260
1370
|
allowed_mentions: options.allowedMentions !== undefined
|
1261
1371
|
? options.allowedMentions !== null
|
@@ -1269,18 +1379,32 @@ class Client extends node_events_1.default {
|
|
1269
1379
|
: undefined,
|
1270
1380
|
components: options.components !== undefined
|
1271
1381
|
? options.components !== null
|
1272
|
-
?
|
1382
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1273
1383
|
: null
|
1274
1384
|
: undefined,
|
1275
|
-
attachments: options.attachments?.map((attachment) =>
|
1276
|
-
|
1385
|
+
attachments: options.attachments?.map((attachment) => ({
|
1386
|
+
id: attachment.id,
|
1387
|
+
filename: attachment.filename,
|
1388
|
+
title: attachment.title,
|
1389
|
+
description: attachment.description,
|
1390
|
+
content_type: attachment.contentType,
|
1391
|
+
size: attachment.size,
|
1392
|
+
url: attachment.url,
|
1393
|
+
proxy_url: attachment.proxyURL,
|
1394
|
+
height: attachment.height,
|
1395
|
+
width: attachment.width,
|
1396
|
+
ephemeral: attachment.ephemeral,
|
1397
|
+
duration_secs: attachment.durationSecs,
|
1398
|
+
waveform: attachment.waveform,
|
1399
|
+
flags: attachment.flags,
|
1400
|
+
})),
|
1277
1401
|
},
|
1278
1402
|
files: options.files,
|
1279
1403
|
query: {
|
1280
1404
|
thread_id: options.threadID,
|
1281
1405
|
},
|
1282
1406
|
});
|
1283
|
-
return
|
1407
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1284
1408
|
}
|
1285
1409
|
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
|
1286
1410
|
async editWebhookWithToken(webhookID, webhookToken, options, reason) {
|
@@ -1292,12 +1416,12 @@ class Client extends node_events_1.default {
|
|
1292
1416
|
reason,
|
1293
1417
|
authorization: false,
|
1294
1418
|
});
|
1295
|
-
return
|
1419
|
+
return transformers_1.Webhooks.webhookFromRaw(response);
|
1296
1420
|
}
|
1297
1421
|
/** https://discord.com/developers/docs/resources/poll#end-poll */
|
1298
1422
|
async endPoll(channelID, messageID) {
|
1299
1423
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.pollExpire(channelID, messageID));
|
1300
|
-
return
|
1424
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1301
1425
|
}
|
1302
1426
|
/** https://discord.com/developers/docs/resources/webhook#execute-webhook */
|
1303
1427
|
async executeWebhook(webhookID, webhookToken, options) {
|
@@ -1305,27 +1429,21 @@ class Client extends node_events_1.default {
|
|
1305
1429
|
json: {
|
1306
1430
|
content: options.content,
|
1307
1431
|
username: options.username,
|
1308
|
-
|
1432
|
+
avatar_url: options.avatarURL,
|
1309
1433
|
tts: options.tts,
|
1310
|
-
embeds: options.embeds
|
1311
|
-
? options.embeds?.map((embed) => this.util.embedToRaw(embed))
|
1312
|
-
: null,
|
1434
|
+
embeds: options.embeds?.map((embed) => transformers_1.Channels.embedToRaw(embed)),
|
1313
1435
|
allowed_mentions: options.allowedMentions !== undefined
|
1314
|
-
?
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
}
|
1321
|
-
: null
|
1436
|
+
? {
|
1437
|
+
parse: options.allowedMentions.parse,
|
1438
|
+
roles: options.allowedMentions.roles,
|
1439
|
+
users: options.allowedMentions.users,
|
1440
|
+
replied_user: options.allowedMentions.repliedUser,
|
1441
|
+
}
|
1322
1442
|
: undefined,
|
1323
1443
|
components: options.components !== undefined
|
1324
|
-
? options.components
|
1325
|
-
? this.util.messageComponentsToRaw(options.components)
|
1326
|
-
: null
|
1444
|
+
? transformers_1.Channels.componentsToRaw(options.components)
|
1327
1445
|
: undefined,
|
1328
|
-
attachments: options.attachments
|
1446
|
+
attachments: options.attachments,
|
1329
1447
|
flags: options.flags,
|
1330
1448
|
thread_name: options.threadName,
|
1331
1449
|
applied_tags: options.appliedTags,
|
@@ -1348,7 +1466,7 @@ class Client extends node_events_1.default {
|
|
1348
1466
|
thread_id: options.threadID,
|
1349
1467
|
},
|
1350
1468
|
});
|
1351
|
-
return response !== null ?
|
1469
|
+
return response !== null ? transformers_1.Channels.messageFromRaw(response) : response;
|
1352
1470
|
}
|
1353
1471
|
/**
|
1354
1472
|
* https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook
|
@@ -1363,7 +1481,7 @@ class Client extends node_events_1.default {
|
|
1363
1481
|
},
|
1364
1482
|
json: options,
|
1365
1483
|
});
|
1366
|
-
return response !== null ?
|
1484
|
+
return response !== null ? transformers_1.Channels.messageFromRaw(response) : null;
|
1367
1485
|
}
|
1368
1486
|
/** https://discord.com/developers/docs/resources/channel#follow-announcement-channel */
|
1369
1487
|
async followChannel(channelID, options, reason) {
|
@@ -1382,8 +1500,8 @@ class Client extends node_events_1.default {
|
|
1382
1500
|
async getActiveGuildThreads(guildID) {
|
1383
1501
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildActiveThreads(guildID));
|
1384
1502
|
return {
|
1385
|
-
threads: response.threads.map((thread) =>
|
1386
|
-
members: response.members.map((threadMember) =>
|
1503
|
+
threads: response.threads.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
1504
|
+
members: response.members.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember)),
|
1387
1505
|
};
|
1388
1506
|
}
|
1389
1507
|
/** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
|
@@ -1395,8 +1513,8 @@ class Client extends node_events_1.default {
|
|
1395
1513
|
},
|
1396
1514
|
});
|
1397
1515
|
return {
|
1398
|
-
threads: response.threads.map((thread) =>
|
1399
|
-
members: response.members.map((threadMember) =>
|
1516
|
+
threads: response.threads.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
1517
|
+
members: response.members.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember)),
|
1400
1518
|
hasMore: response.has_more,
|
1401
1519
|
};
|
1402
1520
|
}
|
@@ -1411,59 +1529,52 @@ class Client extends node_events_1.default {
|
|
1411
1529
|
limit: options?.limit,
|
1412
1530
|
},
|
1413
1531
|
});
|
1414
|
-
return
|
1532
|
+
return transformers_1.AuditLogs.auditLogFromRaw(response);
|
1415
1533
|
}
|
1416
1534
|
/** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
|
1417
1535
|
async getAutoModerationRule(guildID, ruleID) {
|
1418
1536
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRule(guildID, ruleID));
|
1419
|
-
return
|
1537
|
+
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
1420
1538
|
}
|
1421
1539
|
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
1422
1540
|
async getAutoModerationRules(guildID) {
|
1423
1541
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRules(guildID));
|
1424
|
-
return response.map((autoModerationRule) =>
|
1542
|
+
return response.map((autoModerationRule) => transformers_1.AutoModeration.autoModerationRuleFromRaw(autoModerationRule));
|
1425
1543
|
}
|
1426
1544
|
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
1427
1545
|
async getApplicationCommandPermissions(applicationID, guildID, commandID) {
|
1428
1546
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID));
|
1429
|
-
return
|
1547
|
+
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
1430
1548
|
}
|
1431
1549
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
1432
1550
|
async getApplicationRoleConnectionMetadataRecords(applicationID) {
|
1433
1551
|
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
|
-
}));
|
1552
|
+
return response.map((applicationRoleConnectionMetadata) => transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(applicationRoleConnectionMetadata));
|
1442
1553
|
}
|
1443
1554
|
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
1444
1555
|
async getChannel(channelID) {
|
1445
1556
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channel(channelID));
|
1446
|
-
return
|
1557
|
+
return transformers_1.Channels.channelFromRaw(response);
|
1447
1558
|
}
|
1448
1559
|
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
1449
1560
|
async getChannels(guildID) {
|
1450
1561
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildChannels(guildID));
|
1451
|
-
return response.map((channel) =>
|
1562
|
+
return response.map((channel) => transformers_1.Channels.channelFromRaw(channel));
|
1452
1563
|
}
|
1453
1564
|
/** https://discord.com/developers/docs/resources/channel#get-channel-invites */
|
1454
1565
|
async getChannelInvites(channelID) {
|
1455
1566
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelInvites(channelID));
|
1456
|
-
return response.map((invite) =>
|
1567
|
+
return response.map((invite) => transformers_1.Invites.inviteFromRaw(invite));
|
1457
1568
|
}
|
1458
1569
|
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
1459
1570
|
async getChannelWebhooks(channelID) {
|
1460
1571
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelWebhooks(channelID));
|
1461
|
-
return response.map((webhook) =>
|
1572
|
+
return response.map((webhook) => transformers_1.Webhooks.webhookFromRaw(webhook));
|
1462
1573
|
}
|
1463
1574
|
/** https://discord.com/developers/docs/resources/application#get-current-application */
|
1464
1575
|
async getCurrentApplication() {
|
1465
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.
|
1466
|
-
return
|
1576
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationUser());
|
1577
|
+
return transformers_1.Applications.applicationFromRaw(response);
|
1467
1578
|
}
|
1468
1579
|
/** https://discord.com/developers/docs/resources/user#get-current-user-application-role-connection */
|
1469
1580
|
async getCurrentApplicationRoleConnection(applicationID) {
|
@@ -1471,20 +1582,13 @@ class Client extends node_events_1.default {
|
|
1471
1582
|
return {
|
1472
1583
|
platformName: response.platform_name,
|
1473
1584
|
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
|
-
},
|
1585
|
+
metadata: transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(response.metadata),
|
1482
1586
|
};
|
1483
1587
|
}
|
1484
1588
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guild-member */
|
1485
1589
|
async getCurrentGuildMember(guildID) {
|
1486
1590
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(guildID));
|
1487
|
-
return
|
1591
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
1488
1592
|
}
|
1489
1593
|
/** https://discord.com/developers/docs/resources/user#get-current-user-connections */
|
1490
1594
|
async getCurrentUserConnections() {
|
@@ -1494,7 +1598,7 @@ class Client extends node_events_1.default {
|
|
1494
1598
|
name: connection.name,
|
1495
1599
|
type: connection.type,
|
1496
1600
|
revoked: connection.revoked,
|
1497
|
-
integrations: connection.integrations?.map((integration) =>
|
1601
|
+
integrations: connection.integrations?.map((integration) => transformers_1.Guilds.integrationFromRaw(integration)),
|
1498
1602
|
verified: connection.verified,
|
1499
1603
|
friendSync: connection.friend_sync,
|
1500
1604
|
showActivity: connection.show_activity,
|
@@ -1515,7 +1619,7 @@ class Client extends node_events_1.default {
|
|
1515
1619
|
exclude_ended: options?.excludeEnded,
|
1516
1620
|
},
|
1517
1621
|
});
|
1518
|
-
return response.map((entitlement) =>
|
1622
|
+
return response.map((entitlement) => transformers_1.Entitlements.entitlementFromRaw(entitlement));
|
1519
1623
|
}
|
1520
1624
|
/** https://discord.com/developers/docs/topics/gateway#get-gateway */
|
1521
1625
|
getGateway() {
|
@@ -1538,7 +1642,7 @@ class Client extends node_events_1.default {
|
|
1538
1642
|
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
|
1539
1643
|
async getGlobalApplicationCommand(applicationID, commandID) {
|
1540
1644
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommand(applicationID, commandID));
|
1541
|
-
return
|
1645
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
1542
1646
|
}
|
1543
1647
|
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
|
1544
1648
|
async getGlobalApplicationCommands(applicationID, options) {
|
@@ -1547,7 +1651,7 @@ class Client extends node_events_1.default {
|
|
1547
1651
|
with_localizations: options.withLocalizations,
|
1548
1652
|
},
|
1549
1653
|
});
|
1550
|
-
return response.map((applicationCommand) =>
|
1654
|
+
return response.map((applicationCommand) => transformers_1.ApplicationCommands.applicationCommandFromRaw(applicationCommand));
|
1551
1655
|
}
|
1552
1656
|
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
1553
1657
|
async getGuild(guildID, options) {
|
@@ -1556,7 +1660,7 @@ class Client extends node_events_1.default {
|
|
1556
1660
|
with_counts: options?.withCounts,
|
1557
1661
|
},
|
1558
1662
|
});
|
1559
|
-
return
|
1663
|
+
return transformers_1.Guilds.guildFromRaw(response);
|
1560
1664
|
}
|
1561
1665
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guilds */
|
1562
1666
|
async getGuilds(options) {
|
@@ -1568,12 +1672,21 @@ class Client extends node_events_1.default {
|
|
1568
1672
|
with_counts: options?.withCounts,
|
1569
1673
|
},
|
1570
1674
|
});
|
1571
|
-
return response.map((guild) =>
|
1675
|
+
return response.map((guild) => ({
|
1676
|
+
id: guild.id,
|
1677
|
+
name: guild.name,
|
1678
|
+
icon: guild.icon,
|
1679
|
+
owner: guild.owner,
|
1680
|
+
permissions: guild.permissions,
|
1681
|
+
features: guild.features,
|
1682
|
+
approximate_member_count: guild.approximate_member_count,
|
1683
|
+
approximate_presence_count: guild.approximate_presence_count,
|
1684
|
+
}));
|
1572
1685
|
}
|
1573
1686
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
1574
1687
|
async getGuildApplicationCommand(applicationID, guildID, commandID) {
|
1575
1688
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID));
|
1576
|
-
return
|
1689
|
+
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
1577
1690
|
}
|
1578
1691
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
1579
1692
|
async getGuildApplicationCommands(applicationID, guildID, options) {
|
@@ -1582,19 +1695,19 @@ class Client extends node_events_1.default {
|
|
1582
1695
|
with_localizations: options?.withLocalizations,
|
1583
1696
|
},
|
1584
1697
|
});
|
1585
|
-
return response.map((applicationCommand) =>
|
1698
|
+
return response.map((applicationCommand) => transformers_1.ApplicationCommands.applicationCommandFromRaw(applicationCommand));
|
1586
1699
|
}
|
1587
1700
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
1588
1701
|
async getGuildApplicationCommandPermissions(applicationID, guildID) {
|
1589
1702
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildApplicationCommandsPermissions(applicationID, guildID));
|
1590
|
-
return
|
1703
|
+
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
1591
1704
|
}
|
1592
1705
|
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
1593
1706
|
async getGuildBan(guildID, userID) {
|
1594
1707
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildBan(guildID, userID));
|
1595
1708
|
return {
|
1596
1709
|
reason: response.reason,
|
1597
|
-
user:
|
1710
|
+
user: transformers_1.Users.userFromRaw(response.user),
|
1598
1711
|
};
|
1599
1712
|
}
|
1600
1713
|
/** https://discord.com/developers/docs/resources/guild#get-guild-bans */
|
@@ -1608,38 +1721,38 @@ class Client extends node_events_1.default {
|
|
1608
1721
|
});
|
1609
1722
|
return response.map((ban) => ({
|
1610
1723
|
reason: ban.reason,
|
1611
|
-
user:
|
1724
|
+
user: transformers_1.Users.userFromRaw(ban.user),
|
1612
1725
|
}));
|
1613
1726
|
}
|
1614
1727
|
/** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
|
1615
1728
|
async getGuildEmoji(guildID, emojiID) {
|
1616
1729
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmoji(guildID, emojiID));
|
1617
|
-
return
|
1730
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
1618
1731
|
}
|
1619
1732
|
/** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
|
1620
1733
|
async getGuildEmojis(guildID) {
|
1621
1734
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmojis(guildID));
|
1622
|
-
return response.map((emoji) =>
|
1735
|
+
return response.map((emoji) => transformers_1.Emojis.emojiFromRaw(emoji));
|
1623
1736
|
}
|
1624
1737
|
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
1625
1738
|
async getGuildIntegrations(guildID) {
|
1626
1739
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildIntegrations(guildID));
|
1627
|
-
return response.map((integration) =>
|
1740
|
+
return response.map((integration) => transformers_1.Guilds.integrationFromRaw(integration));
|
1628
1741
|
}
|
1629
1742
|
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
1630
1743
|
async getGuildInvites(guildID) {
|
1631
1744
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildInvites(guildID));
|
1632
|
-
return response.map((invite) =>
|
1745
|
+
return response.map((invite) => transformers_1.Invites.inviteFromRaw(invite));
|
1633
1746
|
}
|
1634
1747
|
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
1635
1748
|
async getGuildMember(guildID, userID) {
|
1636
1749
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(guildID, userID));
|
1637
|
-
return
|
1750
|
+
return transformers_1.Guilds.guildMemberFromRaw(response);
|
1638
1751
|
}
|
1639
1752
|
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
1640
1753
|
async getGuildMembers(guildID) {
|
1641
1754
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMembers(guildID));
|
1642
|
-
return response.map((guildMember) =>
|
1755
|
+
return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
|
1643
1756
|
}
|
1644
1757
|
/** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
|
1645
1758
|
async getGuildOnboarding(guildID) {
|
@@ -1654,7 +1767,7 @@ class Client extends node_events_1.default {
|
|
1654
1767
|
channelIDs: promptOption.channel_ids,
|
1655
1768
|
roleIDs: promptOption.role_ids,
|
1656
1769
|
emoji: promptOption.emoji !== undefined
|
1657
|
-
?
|
1770
|
+
? transformers_1.Emojis.emojiFromRaw(promptOption.emoji)
|
1658
1771
|
: undefined,
|
1659
1772
|
emojiID: promptOption.emoji_id,
|
1660
1773
|
emojiName: promptOption.emoji_name,
|
@@ -1681,12 +1794,12 @@ class Client extends node_events_1.default {
|
|
1681
1794
|
icon: response.icon,
|
1682
1795
|
splash: response.splash,
|
1683
1796
|
discoverySplash: response.discovery_splash,
|
1684
|
-
emojis: response.emojis.map((emoji) =>
|
1797
|
+
emojis: response.emojis.map((emoji) => transformers_1.Emojis.emojiFromRaw(emoji)),
|
1685
1798
|
features: response.features,
|
1686
1799
|
approximateMemberCount: response.approximate_member_count,
|
1687
1800
|
approximatePresenceCount: response.approximate_presence_count,
|
1688
1801
|
description: response.description,
|
1689
|
-
stickers: response.stickers?.map((sticker) =>
|
1802
|
+
stickers: response.stickers?.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker)),
|
1690
1803
|
};
|
1691
1804
|
}
|
1692
1805
|
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
@@ -1701,7 +1814,7 @@ class Client extends node_events_1.default {
|
|
1701
1814
|
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
1702
1815
|
async getGuildRoles(guildID) {
|
1703
1816
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildRoles(guildID));
|
1704
|
-
return response.map((role) =>
|
1817
|
+
return response.map((role) => transformers_1.Roles.roleFromRaw(role));
|
1705
1818
|
}
|
1706
1819
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
|
1707
1820
|
async getGuildScheduledEvents(guildID, options) {
|
@@ -1710,7 +1823,7 @@ class Client extends node_events_1.default {
|
|
1710
1823
|
with_user_count: options?.withUserCount,
|
1711
1824
|
},
|
1712
1825
|
});
|
1713
|
-
return response.map((guildScheduledEvent) =>
|
1826
|
+
return response.map((guildScheduledEvent) => transformers_1.GuildScheduledEvents.guildScheduledEventFromRaw(guildScheduledEvent));
|
1714
1827
|
}
|
1715
1828
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
1716
1829
|
async getGuildScheduledEventUsers(guildID, guildScheduledEventID, options) {
|
@@ -1724,31 +1837,31 @@ class Client extends node_events_1.default {
|
|
1724
1837
|
});
|
1725
1838
|
return response.map((guildScheduledEventUser) => ({
|
1726
1839
|
guildScheduledEventID: guildScheduledEventUser.guild_scheduled_event_id,
|
1727
|
-
user:
|
1840
|
+
user: transformers_1.Users.userFromRaw(guildScheduledEventUser.user),
|
1728
1841
|
member: guildScheduledEventUser.member !== undefined
|
1729
|
-
?
|
1842
|
+
? transformers_1.Guilds.guildMemberFromRaw(guildScheduledEventUser.member)
|
1730
1843
|
: undefined,
|
1731
1844
|
}));
|
1732
1845
|
}
|
1733
1846
|
/** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
|
1734
1847
|
async getGuildSticker(guildID, stickerID) {
|
1735
1848
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSticker(guildID, stickerID));
|
1736
|
-
return
|
1849
|
+
return transformers_1.Stickers.stickerFromRaw(response);
|
1737
1850
|
}
|
1738
1851
|
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
1739
1852
|
async getGuildStickers(guildID) {
|
1740
1853
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildStickers(guildID));
|
1741
|
-
return response.map((sticker) =>
|
1854
|
+
return response.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker));
|
1742
1855
|
}
|
1743
1856
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
1744
1857
|
async getGuildTemplate(guildID, code) {
|
1745
1858
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplate(guildID, code));
|
1746
|
-
return
|
1859
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
1747
1860
|
}
|
1748
1861
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
|
1749
1862
|
async getGuildTemplates(guildID) {
|
1750
1863
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplates(guildID));
|
1751
|
-
return response.map((guildTemplate) =>
|
1864
|
+
return response.map((guildTemplate) => transformers_1.GuildTemplates.guildTemplateFromRaw(guildTemplate));
|
1752
1865
|
}
|
1753
1866
|
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
1754
1867
|
getGuildVanityURL(guildID) {
|
@@ -1785,8 +1898,8 @@ class Client extends node_events_1.default {
|
|
1785
1898
|
id: response.id,
|
1786
1899
|
name: response.name,
|
1787
1900
|
instantInvite: response.instant_invite,
|
1788
|
-
channels: response.channels.map((channel) =>
|
1789
|
-
members: response.members.map((member) =>
|
1901
|
+
channels: response.channels.map((channel) => transformers_1.Channels.channelFromRaw(channel)),
|
1902
|
+
members: response.members.map((member) => transformers_1.Users.userFromRaw(member)),
|
1790
1903
|
presenceCount: response.presence_count,
|
1791
1904
|
};
|
1792
1905
|
}
|
@@ -1813,7 +1926,7 @@ class Client extends node_events_1.default {
|
|
1813
1926
|
thread_id: options?.threadID,
|
1814
1927
|
},
|
1815
1928
|
});
|
1816
|
-
return
|
1929
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1817
1930
|
}
|
1818
1931
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response */
|
1819
1932
|
async getInteractionResponse(applicationID, interactionToken, options) {
|
@@ -1822,7 +1935,7 @@ class Client extends node_events_1.default {
|
|
1822
1935
|
thread_id: options?.threadID,
|
1823
1936
|
},
|
1824
1937
|
});
|
1825
|
-
return
|
1938
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1826
1939
|
}
|
1827
1940
|
/** https://discord.com/developers/docs/resources/invite#get-invite */
|
1828
1941
|
async getInvite(code, options) {
|
@@ -1833,7 +1946,7 @@ class Client extends node_events_1.default {
|
|
1833
1946
|
guild_scheduled_event_id: options?.guildScheduledEventID,
|
1834
1947
|
},
|
1835
1948
|
});
|
1836
|
-
return
|
1949
|
+
return transformers_1.Invites.inviteFromRaw(response);
|
1837
1950
|
}
|
1838
1951
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
1839
1952
|
async getJoinedPrivateArchivedThreads(channelID, options) {
|
@@ -1844,15 +1957,15 @@ class Client extends node_events_1.default {
|
|
1844
1957
|
},
|
1845
1958
|
});
|
1846
1959
|
return {
|
1847
|
-
threads: response.threads.map((thread) =>
|
1848
|
-
members: response.members.map((threadMember) =>
|
1960
|
+
threads: response.threads.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
1961
|
+
members: response.members.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember)),
|
1849
1962
|
hasMore: response.has_more,
|
1850
1963
|
};
|
1851
1964
|
}
|
1852
1965
|
/** https://discord.com/developers/docs/resources/channel#get-channel-message */
|
1853
1966
|
async getMessage(channelID, messageID) {
|
1854
1967
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(channelID, messageID));
|
1855
|
-
return
|
1968
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1856
1969
|
}
|
1857
1970
|
/** https://discord.com/developers/docs/resources/channel#get-reactions */
|
1858
1971
|
async getMessageReactions(channelID, messageID, emoji, options) {
|
@@ -1863,7 +1976,7 @@ class Client extends node_events_1.default {
|
|
1863
1976
|
limit: options?.limit,
|
1864
1977
|
},
|
1865
1978
|
});
|
1866
|
-
return response.map((user) =>
|
1979
|
+
return response.map((user) => transformers_1.Users.userFromRaw(user));
|
1867
1980
|
}
|
1868
1981
|
/** https://discord.com/developers/docs/resources/channel#get-channel-messages */
|
1869
1982
|
async getMessages(channelID, options) {
|
@@ -1875,29 +1988,29 @@ class Client extends node_events_1.default {
|
|
1875
1988
|
limit: options.limit,
|
1876
1989
|
},
|
1877
1990
|
});
|
1878
|
-
return response.map((message) =>
|
1991
|
+
return response.map((message) => transformers_1.Channels.messageFromRaw(message));
|
1879
1992
|
}
|
1880
1993
|
/** https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information */
|
1881
1994
|
async getOAuth2Application() {
|
1882
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.
|
1883
|
-
return
|
1995
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.oauth2Application());
|
1996
|
+
return transformers_1.Applications.applicationFromRaw(response);
|
1884
1997
|
}
|
1885
1998
|
/** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information */
|
1886
1999
|
async getOAuth2Authorization() {
|
1887
2000
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.oauth2Authorization());
|
1888
2001
|
return {
|
1889
|
-
application:
|
2002
|
+
application: transformers_1.Applications.applicationFromRaw(response.application),
|
1890
2003
|
scopes: response.scopes,
|
1891
2004
|
expires: response.expires,
|
1892
2005
|
user: response.user !== undefined
|
1893
|
-
?
|
2006
|
+
? transformers_1.Users.userFromRaw(response.user)
|
1894
2007
|
: undefined,
|
1895
2008
|
};
|
1896
2009
|
}
|
1897
2010
|
/** https://discord.com/developers/docs/resources/channel#get-pinned-messages */
|
1898
2011
|
async getPinnedMessages(channelID) {
|
1899
2012
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelPins(channelID));
|
1900
|
-
return response.map((message) =>
|
2013
|
+
return response.map((message) => transformers_1.Channels.messageFromRaw(message));
|
1901
2014
|
}
|
1902
2015
|
/** https://discord.com/developers/docs/resources/poll#get-answer-voters */
|
1903
2016
|
async getPollAnswerVoters(channelID, messageID, answerID, options) {
|
@@ -1908,18 +2021,18 @@ class Client extends node_events_1.default {
|
|
1908
2021
|
},
|
1909
2022
|
});
|
1910
2023
|
return {
|
1911
|
-
users: response.users.map((user) =>
|
2024
|
+
users: response.users.map((user) => transformers_1.Users.userFromRaw(user)),
|
1912
2025
|
};
|
1913
2026
|
}
|
1914
2027
|
/** https://discord.com/developers/docs/monetization/skus#list-skus */
|
1915
2028
|
async getSKUs(applicationID) {
|
1916
2029
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationSKUs(applicationID));
|
1917
|
-
return response.map((sku) =>
|
2030
|
+
return response.map((sku) => transformers_1.SKUs.skuFromRaw(sku));
|
1918
2031
|
}
|
1919
2032
|
/** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
|
1920
2033
|
async getStageInstance(channelID) {
|
1921
2034
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.stageInstance(channelID));
|
1922
|
-
return
|
2035
|
+
return transformers_1.StageInstances.stageInstanceFromRaw(response);
|
1923
2036
|
}
|
1924
2037
|
/** https://discord.com/developers/docs/resources/sticker#list-sticker-packs */
|
1925
2038
|
async getStickerPacks() {
|
@@ -1927,7 +2040,7 @@ class Client extends node_events_1.default {
|
|
1927
2040
|
return {
|
1928
2041
|
stickerPacks: response.sticker_packs.map((stickerPack) => ({
|
1929
2042
|
id: stickerPack.id,
|
1930
|
-
stickers: stickerPack.stickers.map((sticker) =>
|
2043
|
+
stickers: stickerPack.stickers.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker)),
|
1931
2044
|
name: stickerPack.name,
|
1932
2045
|
skuID: stickerPack.sku_id,
|
1933
2046
|
coverStickerID: stickerPack.cover_sticker_id,
|
@@ -1943,15 +2056,7 @@ class Client extends node_events_1.default {
|
|
1943
2056
|
with_member: options?.withMember,
|
1944
2057
|
},
|
1945
2058
|
});
|
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
|
-
};
|
2059
|
+
return transformers_1.Channels.threadMemberFromRaw(response);
|
1955
2060
|
}
|
1956
2061
|
/** https://discord.com/developers/docs/resources/channel#list-thread-members */
|
1957
2062
|
async getThreadMembers(channelID, options) {
|
@@ -1962,12 +2067,12 @@ class Client extends node_events_1.default {
|
|
1962
2067
|
limit: options?.limit,
|
1963
2068
|
},
|
1964
2069
|
});
|
1965
|
-
return response.map((threadMember) =>
|
2070
|
+
return response.map((threadMember) => transformers_1.Channels.threadMemberFromRaw(threadMember));
|
1966
2071
|
}
|
1967
2072
|
/** https://discord.com/developers/docs/resources/user#get-user */
|
1968
2073
|
async getUser(userID) {
|
1969
2074
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.user(userID));
|
1970
|
-
return
|
2075
|
+
return transformers_1.Users.userFromRaw(response);
|
1971
2076
|
}
|
1972
2077
|
/** https://discord.com/developers/docs/resources/voice#list-voice-regions */
|
1973
2078
|
async getVoiceRegions() {
|
@@ -1987,16 +2092,16 @@ class Client extends node_events_1.default {
|
|
1987
2092
|
thread_id: options?.threadID,
|
1988
2093
|
},
|
1989
2094
|
});
|
1990
|
-
return
|
2095
|
+
return transformers_1.Channels.messageFromRaw(response);
|
1991
2096
|
}
|
1992
2097
|
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
1993
2098
|
async getWebhooks(guildID) {
|
1994
2099
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWebhooks(guildID));
|
1995
|
-
return response.map((webhook) =>
|
2100
|
+
return response.map((webhook) => transformers_1.Webhooks.webhookFromRaw(webhook));
|
1996
2101
|
}
|
1997
2102
|
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
1998
2103
|
joinThread(channelID) {
|
1999
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID
|
2104
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID));
|
2000
2105
|
}
|
2001
2106
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
2002
2107
|
joinVoiceChannel(guildID, channelID, options) {
|
@@ -2013,7 +2118,7 @@ class Client extends node_events_1.default {
|
|
2013
2118
|
}
|
2014
2119
|
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
2015
2120
|
leaveThread(channelID) {
|
2016
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID
|
2121
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID));
|
2017
2122
|
}
|
2018
2123
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
2019
2124
|
leaveVoiceChannel(guildID) {
|
@@ -2064,7 +2169,7 @@ class Client extends node_events_1.default {
|
|
2064
2169
|
limit: options.limit,
|
2065
2170
|
},
|
2066
2171
|
});
|
2067
|
-
return response.map((guildMember) =>
|
2172
|
+
return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
|
2068
2173
|
}
|
2069
2174
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
2070
2175
|
setPresence(options) {
|
@@ -2073,7 +2178,7 @@ class Client extends node_events_1.default {
|
|
2073
2178
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
2074
2179
|
async syncGuildTemplate(guildID, code) {
|
2075
2180
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildTemplate(guildID, code));
|
2076
|
-
return
|
2181
|
+
return transformers_1.GuildTemplates.guildTemplateFromRaw(response);
|
2077
2182
|
}
|
2078
2183
|
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
2079
2184
|
triggerTypingIndicator(channelID) {
|
@@ -2082,14 +2187,7 @@ class Client extends node_events_1.default {
|
|
2082
2187
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
2083
2188
|
async updateApplicationRoleConnectionMetadataRecords(applicationID) {
|
2084
2189
|
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
|
-
}));
|
2190
|
+
return response.map((applicationRoleConnectionMetadata) => transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(applicationRoleConnectionMetadata));
|
2093
2191
|
}
|
2094
2192
|
/** https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection */
|
2095
2193
|
async updateCurrentApplicationRoleConnection(applicationID, options) {
|
@@ -2097,20 +2195,15 @@ class Client extends node_events_1.default {
|
|
2097
2195
|
json: {
|
2098
2196
|
platform_name: options.platformName,
|
2099
2197
|
platform_username: options.platformUsername,
|
2100
|
-
metadata: options.metadata
|
2198
|
+
metadata: options.metadata !== undefined
|
2199
|
+
? transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataToRaw(options.metadata)
|
2200
|
+
: undefined,
|
2101
2201
|
},
|
2102
2202
|
});
|
2103
2203
|
return {
|
2104
2204
|
platformName: response.platform_name,
|
2105
2205
|
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
|
-
},
|
2206
|
+
metadata: transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(response.metadata),
|
2114
2207
|
};
|
2115
2208
|
}
|
2116
2209
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|