disgroove 2.2.1-dev.d0eed5e → 2.2.1
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 +3 -1
- package/dist/lib/Client.d.ts +222 -220
- package/dist/lib/Client.js +412 -415
- package/dist/lib/constants.d.ts +4 -4
- package/dist/lib/constants.js +4 -4
- package/dist/lib/gateway/Shard.d.ts +4 -2
- package/dist/lib/gateway/Shard.js +94 -74
- package/dist/lib/gateway/ShardManager.d.ts +6 -1
- package/dist/lib/gateway/ShardManager.js +6 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/rest/CDN.d.ts +20 -20
- package/dist/lib/rest/CDN.js +20 -20
- package/dist/lib/rest/Endpoints.d.ts +81 -81
- package/dist/lib/rest/Endpoints.js +91 -91
- package/dist/lib/types/application-command.d.ts +4 -4
- package/dist/lib/types/application.d.ts +2 -2
- package/dist/lib/types/audit-log.d.ts +5 -5
- package/dist/lib/types/auto-moderation.d.ts +3 -3
- package/dist/lib/types/channel.d.ts +23 -21
- package/dist/lib/types/entitlements.d.ts +6 -6
- package/dist/lib/types/gateway-events.d.ts +83 -70
- package/dist/lib/types/guild-scheduled-event.d.ts +5 -5
- package/dist/lib/types/guild-template.d.ts +2 -2
- package/dist/lib/types/guild.d.ts +17 -17
- package/dist/lib/types/interaction.d.ts +8 -8
- package/dist/lib/types/message-components.d.ts +4 -4
- package/dist/lib/types/poll.d.ts +1 -1
- package/dist/lib/types/role.d.ts +3 -3
- package/dist/lib/types/sku.d.ts +2 -2
- package/dist/lib/types/stage-instance.d.ts +3 -3
- package/dist/lib/types/sticker.d.ts +5 -5
- package/dist/lib/types/team.d.ts +2 -2
- package/dist/lib/types/user.d.ts +1 -1
- package/dist/lib/types/voice-connections.d.ts +64 -0
- package/dist/lib/types/voice-connections.js +2 -0
- package/dist/lib/types/voice.d.ts +4 -4
- package/dist/lib/types/webhook.d.ts +3 -3
- package/dist/lib/utils/Util.d.ts +2 -2
- package/dist/lib/utils/Util.js +195 -193
- package/dist/lib/voice/VoiceConnection.d.ts +57 -0
- package/dist/lib/voice/VoiceConnection.js +150 -0
- package/dist/lib/voice/VoiceConnectionManager.d.ts +19 -0
- package/dist/lib/voice/VoiceConnectionManager.js +66 -0
- package/dist/lib/voice/index.d.ts +2 -0
- package/dist/lib/voice/index.js +18 -0
- package/dist/package.json +3 -3
- package/package.json +3 -3
package/dist/lib/Client.js
CHANGED
@@ -9,6 +9,7 @@ const utils_1 = require("./utils");
|
|
9
9
|
const rest_1 = require("./rest");
|
10
10
|
const node_events_1 = __importDefault(require("node:events"));
|
11
11
|
const gateway_1 = require("./gateway");
|
12
|
+
const voice_1 = require("./voice");
|
12
13
|
class Client extends node_events_1.default {
|
13
14
|
token;
|
14
15
|
intents;
|
@@ -21,6 +22,7 @@ class Client extends node_events_1.default {
|
|
21
22
|
user;
|
22
23
|
guilds;
|
23
24
|
application;
|
25
|
+
voiceConnections;
|
24
26
|
constructor(token, options) {
|
25
27
|
super();
|
26
28
|
this.token = token;
|
@@ -37,10 +39,11 @@ class Client extends node_events_1.default {
|
|
37
39
|
this.util = new utils_1.Util();
|
38
40
|
this.guildShardMap = {};
|
39
41
|
this.guilds = new Map();
|
42
|
+
this.voiceConnections = new voice_1.VoiceConnectionManager();
|
40
43
|
}
|
41
44
|
/** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient */
|
42
|
-
addGroupRecipient(
|
43
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelRecipient(
|
45
|
+
addGroupRecipient(channelID, userID, options) {
|
46
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelRecipient(channelID, userID), {
|
44
47
|
json: {
|
45
48
|
access_token: options.accessToken,
|
46
49
|
nick: options.nick,
|
@@ -48,8 +51,8 @@ class Client extends node_events_1.default {
|
|
48
51
|
});
|
49
52
|
}
|
50
53
|
/** https://discord.com/developers/docs/resources/guild#add-guild-member */
|
51
|
-
async addGuildMember(
|
52
|
-
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildMember(
|
54
|
+
async addGuildMember(guildID, userID, options) {
|
55
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildMember(guildID, userID), {
|
53
56
|
json: {
|
54
57
|
access_token: options.accessToken,
|
55
58
|
nick: options.nick,
|
@@ -61,18 +64,18 @@ class Client extends node_events_1.default {
|
|
61
64
|
return response !== null ? this.util.guildMemberFromRaw(response) : null;
|
62
65
|
}
|
63
66
|
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
64
|
-
addGuildMemberRole(
|
65
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildMemberRole(
|
67
|
+
addGuildMemberRole(guildID, userID, roleID, reason) {
|
68
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildMemberRole(guildID, userID, roleID), {
|
66
69
|
reason,
|
67
70
|
});
|
68
71
|
}
|
69
72
|
/** https://discord.com/developers/docs/resources/channel#add-thread-member */
|
70
|
-
addThreadMember(
|
71
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(
|
73
|
+
addThreadMember(channelID, userID) {
|
74
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID, userID));
|
72
75
|
}
|
73
76
|
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
74
|
-
beginGuildPrune(
|
75
|
-
return this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildPrune(
|
77
|
+
beginGuildPrune(guildID, options, reason) {
|
78
|
+
return this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildPrune(guildID), {
|
76
79
|
json: {
|
77
80
|
days: options.days,
|
78
81
|
compute_prune_count: options.computePruneCount,
|
@@ -83,10 +86,10 @@ class Client extends node_events_1.default {
|
|
83
86
|
});
|
84
87
|
}
|
85
88
|
/** https://discord.com/developers/docs/resources/guild#bulk-guild-ban */
|
86
|
-
async bulkGuildBan(
|
87
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.bulkGuildBan(
|
89
|
+
async bulkGuildBan(guildID, options, reason) {
|
90
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.bulkGuildBan(guildID), {
|
88
91
|
json: {
|
89
|
-
user_ids: options.
|
92
|
+
user_ids: options.userIDs,
|
90
93
|
delete_message_seconds: options.deleteMessageSeconds,
|
91
94
|
},
|
92
95
|
reason,
|
@@ -97,8 +100,8 @@ class Client extends node_events_1.default {
|
|
97
100
|
};
|
98
101
|
}
|
99
102
|
/** https://discord.com/developers/docs/resources/channel#bulk-delete-messages */
|
100
|
-
bulkDeleteMessages(
|
101
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelBulkDelete(
|
103
|
+
bulkDeleteMessages(channelID, options, reason) {
|
104
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelBulkDelete(channelID), {
|
102
105
|
json: {
|
103
106
|
messages: options?.messages,
|
104
107
|
},
|
@@ -106,15 +109,15 @@ class Client extends node_events_1.default {
|
|
106
109
|
});
|
107
110
|
}
|
108
111
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
109
|
-
async bulkEditGlobalApplicationCommands(
|
110
|
-
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommands(
|
112
|
+
async bulkEditGlobalApplicationCommands(applicationID, commands) {
|
113
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommands(applicationID), {
|
111
114
|
json: commands.map((command) => this.util.partialApplicationCommandToRaw(command)),
|
112
115
|
});
|
113
116
|
return response.map((c) => this.util.applicationCommandFromRaw(c));
|
114
117
|
}
|
115
118
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
116
|
-
async bulkEditGuildApplicationCommands(
|
117
|
-
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationGuildCommands(
|
119
|
+
async bulkEditGuildApplicationCommands(applicationID, guildID, commands) {
|
120
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
118
121
|
json: commands.map((command) => this.util.partialApplicationCommandToRaw(command)),
|
119
122
|
});
|
120
123
|
return response.map((c) => this.util.applicationCommandFromRaw(c));
|
@@ -130,12 +133,12 @@ class Client extends node_events_1.default {
|
|
130
133
|
this.shards.connect();
|
131
134
|
}
|
132
135
|
/** https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement */
|
133
|
-
consumeEntitlement(
|
134
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationEntitlementConsume(
|
136
|
+
consumeEntitlement(applicationID, entitlementID) {
|
137
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationEntitlementConsume(applicationID, entitlementID));
|
135
138
|
}
|
136
139
|
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
|
137
|
-
async createAutoModerationRule(
|
138
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildAutoModerationRules(
|
140
|
+
async createAutoModerationRule(guildID, options, reason) {
|
141
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildAutoModerationRules(guildID), {
|
139
142
|
json: {
|
140
143
|
name: options.name,
|
141
144
|
event_type: options.eventType,
|
@@ -144,7 +147,7 @@ class Client extends node_events_1.default {
|
|
144
147
|
actions: options.actions.map((action) => ({
|
145
148
|
type: action.type,
|
146
149
|
metadata: {
|
147
|
-
channel_id: action.metadata.
|
150
|
+
channel_id: action.metadata.channelID,
|
148
151
|
duration_seconds: action.metadata.durationSeconds,
|
149
152
|
custom_message: action.metadata.customMessage,
|
150
153
|
},
|
@@ -158,8 +161,8 @@ class Client extends node_events_1.default {
|
|
158
161
|
return this.util.autoModerationRuleFromRaw(response);
|
159
162
|
}
|
160
163
|
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
161
|
-
async createChannel(
|
162
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildChannels(
|
164
|
+
async createChannel(guildID, options, reason) {
|
165
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildChannels(guildID), {
|
163
166
|
json: {
|
164
167
|
name: options.name,
|
165
168
|
type: options.type,
|
@@ -169,7 +172,7 @@ class Client extends node_events_1.default {
|
|
169
172
|
rate_limit_per_user: options.rateLimitPerUser,
|
170
173
|
position: options.position,
|
171
174
|
permission_overwrites: options.permissionOverwrites,
|
172
|
-
parent_id: options.
|
175
|
+
parent_id: options.parentID,
|
173
176
|
nsfw: options.nsfw,
|
174
177
|
rtc_region: options.rtcRegion,
|
175
178
|
video_quality_mode: options.videoQualityMode,
|
@@ -177,7 +180,7 @@ class Client extends node_events_1.default {
|
|
177
180
|
default_reaction_emoji: options.defaultReactionEmoji !== undefined
|
178
181
|
? options.defaultReactionEmoji !== null
|
179
182
|
? {
|
180
|
-
emoji_id: options.defaultReactionEmoji.
|
183
|
+
emoji_id: options.defaultReactionEmoji.emojiID,
|
181
184
|
emoji_name: options.defaultReactionEmoji.emojiName,
|
182
185
|
}
|
183
186
|
: null
|
@@ -192,24 +195,24 @@ class Client extends node_events_1.default {
|
|
192
195
|
return this.util.channelFromRaw(response);
|
193
196
|
}
|
194
197
|
/** https://discord.com/developers/docs/resources/channel#create-channel-invite */
|
195
|
-
async createChannelInvite(
|
196
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelInvites(
|
198
|
+
async createChannelInvite(channelID, options, reason) {
|
199
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelInvites(channelID), {
|
197
200
|
json: {
|
198
201
|
max_age: options.maxAge,
|
199
202
|
max_uses: options.maxUses,
|
200
203
|
temporary: options.temporary,
|
201
204
|
unique: options.unique,
|
202
205
|
target_type: options.targetType,
|
203
|
-
target_user_id: options.
|
204
|
-
target_application_id: options.
|
206
|
+
target_user_id: options.targetUserID,
|
207
|
+
target_application_id: options.targetApplicationID,
|
205
208
|
},
|
206
209
|
reason,
|
207
210
|
});
|
208
211
|
return this.util.inviteFromRaw(response);
|
209
212
|
}
|
210
213
|
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
211
|
-
async createChannelWebhook(
|
212
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelWebhooks(
|
214
|
+
async createChannelWebhook(channelID, options, reason) {
|
215
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelWebhooks(channelID), {
|
213
216
|
json: {
|
214
217
|
name: options.name,
|
215
218
|
avatar: options.avatar,
|
@@ -222,14 +225,14 @@ class Client extends node_events_1.default {
|
|
222
225
|
async createDM(options) {
|
223
226
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.userChannels(), {
|
224
227
|
json: {
|
225
|
-
recipient_id: options.
|
228
|
+
recipient_id: options.recipientID,
|
226
229
|
},
|
227
230
|
});
|
228
231
|
return this.util.channelFromRaw(response);
|
229
232
|
}
|
230
233
|
/** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
|
231
|
-
async createGlobalApplicationCommand(
|
232
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationCommands(
|
234
|
+
async createGlobalApplicationCommand(applicationID, options) {
|
235
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationCommands(applicationID), {
|
233
236
|
json: this.util.partialApplicationCommandToRaw(options),
|
234
237
|
});
|
235
238
|
return this.util.applicationCommandFromRaw(response);
|
@@ -263,24 +266,24 @@ class Client extends node_events_1.default {
|
|
263
266
|
permissions: role.permissions,
|
264
267
|
mentionable: role.mentionable,
|
265
268
|
})),
|
266
|
-
afk_channel_id: options.
|
269
|
+
afk_channel_id: options.afkChannelID,
|
267
270
|
afk_timeout: options.afkTimeout,
|
268
|
-
system_channel_id: options.
|
271
|
+
system_channel_id: options.systemChannelID,
|
269
272
|
system_channel_flags: options.systemChannelFlags,
|
270
273
|
},
|
271
274
|
});
|
272
275
|
return this.util.guildFromRaw(response);
|
273
276
|
}
|
274
277
|
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
275
|
-
async createGuildApplicationCommand(
|
276
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationGuildCommands(
|
278
|
+
async createGuildApplicationCommand(applicationID, guildID, options) {
|
279
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
277
280
|
json: this.util.partialApplicationCommandToRaw(options),
|
278
281
|
});
|
279
282
|
return this.util.applicationCommandFromRaw(response);
|
280
283
|
}
|
281
284
|
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
282
|
-
createGuildBan(
|
283
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildBan(
|
285
|
+
createGuildBan(guildID, userID, options, reason) {
|
286
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildBan(guildID, userID), {
|
284
287
|
json: {
|
285
288
|
delete_message_days: options?.deleteMessageDays,
|
286
289
|
delete_message_seconds: options?.deleteMessageSeconds,
|
@@ -289,8 +292,8 @@ class Client extends node_events_1.default {
|
|
289
292
|
});
|
290
293
|
}
|
291
294
|
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
292
|
-
async createGuildEmoji(
|
293
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildEmojis(
|
295
|
+
async createGuildEmoji(guildID, options, reason) {
|
296
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildEmojis(guildID), {
|
294
297
|
json: {
|
295
298
|
name: options.name,
|
296
299
|
image: options.image,
|
@@ -311,8 +314,8 @@ class Client extends node_events_1.default {
|
|
311
314
|
return this.util.guildFromRaw(response);
|
312
315
|
}
|
313
316
|
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
314
|
-
async createGuildRole(
|
315
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildRoles(
|
317
|
+
async createGuildRole(guildID, options, reason) {
|
318
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildRoles(guildID), {
|
316
319
|
json: {
|
317
320
|
name: options.name,
|
318
321
|
permissions: options.permissions,
|
@@ -327,10 +330,10 @@ class Client extends node_events_1.default {
|
|
327
330
|
return this.util.roleFromRaw(response);
|
328
331
|
}
|
329
332
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
330
|
-
async createGuildScheduledEvent(
|
331
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildScheduledEvents(
|
333
|
+
async createGuildScheduledEvent(guildID, options, reason) {
|
334
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildScheduledEvents(guildID), {
|
332
335
|
json: {
|
333
|
-
channel_id: options.
|
336
|
+
channel_id: options.channelID,
|
334
337
|
entity_metadata: options.entityMetadata,
|
335
338
|
name: options.name,
|
336
339
|
privacy_level: options.privacyLevel,
|
@@ -345,21 +348,21 @@ class Client extends node_events_1.default {
|
|
345
348
|
return this.util.guildScheduledEventFromRaw(response);
|
346
349
|
}
|
347
350
|
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
|
348
|
-
async createGuildSticker(
|
351
|
+
async createGuildSticker(guildID, options, reason) {
|
349
352
|
const formData = new FormData();
|
350
353
|
formData.set("name", options.name);
|
351
354
|
formData.set("description", options.description);
|
352
355
|
formData.set("tags", options.tags);
|
353
356
|
formData.set("file", new Blob([options.file.contents]), options.file.name);
|
354
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildStickers(
|
357
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildStickers(guildID), {
|
355
358
|
form: formData,
|
356
359
|
reason,
|
357
360
|
});
|
358
361
|
return this.util.stickerFromRaw(response);
|
359
362
|
}
|
360
363
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
361
|
-
async createGuildTemplate(
|
362
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildTemplates(
|
364
|
+
async createGuildTemplate(guildID, options) {
|
365
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildTemplates(guildID), {
|
363
366
|
json: {
|
364
367
|
name: options.name,
|
365
368
|
description: options.description,
|
@@ -368,8 +371,8 @@ class Client extends node_events_1.default {
|
|
368
371
|
return this.util.guildTemplateFromRaw(response);
|
369
372
|
}
|
370
373
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message */
|
371
|
-
async createInteractionFollowupMessage(
|
372
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhook(
|
374
|
+
async createInteractionFollowupMessage(applicationID, interactionToken, options) {
|
375
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhook(applicationID, interactionToken), {
|
373
376
|
json: {
|
374
377
|
content: options.content,
|
375
378
|
tts: options.tts,
|
@@ -398,7 +401,7 @@ class Client extends node_events_1.default {
|
|
398
401
|
? {
|
399
402
|
question: options.poll.question,
|
400
403
|
answers: options.poll.answers.map((answer) => ({
|
401
|
-
answer_id: answer.
|
404
|
+
answer_id: answer.answerID,
|
402
405
|
poll_media: answer.pollMedia,
|
403
406
|
})),
|
404
407
|
duration: options.poll.duration,
|
@@ -412,12 +415,12 @@ class Client extends node_events_1.default {
|
|
412
415
|
return this.util.messageFromRaw(response);
|
413
416
|
}
|
414
417
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
|
415
|
-
createInteractionResponse(
|
418
|
+
createInteractionResponse(interactionID, interactionToken, options) {
|
416
419
|
switch (options.type) {
|
417
420
|
case constants_1.InteractionCallbackType.ChannelMessageWithSource:
|
418
421
|
case constants_1.InteractionCallbackType.UpdateMessage:
|
419
422
|
{
|
420
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(
|
423
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
421
424
|
json: {
|
422
425
|
type: options.type,
|
423
426
|
data: {
|
@@ -442,7 +445,7 @@ class Client extends node_events_1.default {
|
|
442
445
|
? {
|
443
446
|
question: options.data.poll.question,
|
444
447
|
answers: options.data.poll.answers.map((answer) => ({
|
445
|
-
answer_id: answer.
|
448
|
+
answer_id: answer.answerID,
|
446
449
|
poll_media: answer.pollMedia,
|
447
450
|
})),
|
448
451
|
duration: options.data.poll.duration,
|
@@ -459,7 +462,7 @@ class Client extends node_events_1.default {
|
|
459
462
|
case constants_1.InteractionCallbackType.DeferredChannelMessageWithSource:
|
460
463
|
case constants_1.InteractionCallbackType.DeferredUpdateMessage:
|
461
464
|
{
|
462
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(
|
465
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
463
466
|
json: {
|
464
467
|
type: options.type,
|
465
468
|
data: {
|
@@ -471,7 +474,7 @@ class Client extends node_events_1.default {
|
|
471
474
|
break;
|
472
475
|
case constants_1.InteractionCallbackType.ApplicationCommandAutocompleteResult:
|
473
476
|
{
|
474
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(
|
477
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
475
478
|
json: {
|
476
479
|
type: options.type,
|
477
480
|
data: {
|
@@ -487,11 +490,11 @@ class Client extends node_events_1.default {
|
|
487
490
|
break;
|
488
491
|
case constants_1.InteractionCallbackType.Modal:
|
489
492
|
{
|
490
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(
|
493
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
491
494
|
json: {
|
492
495
|
type: options.type,
|
493
496
|
data: {
|
494
|
-
custom_id: options.data?.
|
497
|
+
custom_id: options.data?.customID,
|
495
498
|
components: options.data?.components !== undefined
|
496
499
|
? this.util.messageComponentsToRaw(options.data.components)
|
497
500
|
: undefined,
|
@@ -503,7 +506,7 @@ class Client extends node_events_1.default {
|
|
503
506
|
break;
|
504
507
|
case constants_1.InteractionCallbackType.PremiumRequired:
|
505
508
|
{
|
506
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(
|
509
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
507
510
|
json: {
|
508
511
|
type: options.type,
|
509
512
|
data: {},
|
@@ -514,8 +517,8 @@ class Client extends node_events_1.default {
|
|
514
517
|
}
|
515
518
|
}
|
516
519
|
/** https://discord.com/developers/docs/resources/channel#create-message */
|
517
|
-
async createMessage(
|
518
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessages(
|
520
|
+
async createMessage(channelID, options) {
|
521
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessages(channelID), {
|
519
522
|
json: {
|
520
523
|
content: options.content,
|
521
524
|
nonce: options.nonce,
|
@@ -533,7 +536,7 @@ class Client extends node_events_1.default {
|
|
533
536
|
components: options.components !== undefined
|
534
537
|
? this.util.messageComponentsToRaw(options.components)
|
535
538
|
: undefined,
|
536
|
-
stickers_ids: options.
|
539
|
+
stickers_ids: options.stickersIDs,
|
537
540
|
attachments: options.attachments?.map((attachment) => this.util.attachmentToRaw(attachment)),
|
538
541
|
flags: options.flags,
|
539
542
|
enforce_nonce: options.enforceNonce,
|
@@ -541,7 +544,7 @@ class Client extends node_events_1.default {
|
|
541
544
|
? {
|
542
545
|
question: options.poll.question,
|
543
546
|
answers: options.poll.answers.map((answer) => ({
|
544
|
-
answer_id: answer.
|
547
|
+
answer_id: answer.answerID,
|
545
548
|
poll_media: answer.pollMedia,
|
546
549
|
})),
|
547
550
|
duration: options.poll.duration,
|
@@ -555,37 +558,37 @@ class Client extends node_events_1.default {
|
|
555
558
|
return this.util.messageFromRaw(response);
|
556
559
|
}
|
557
560
|
/** https://discord.com/developers/docs/resources/channel#create-reaction */
|
558
|
-
createMessageReaction(
|
559
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelMessageReaction(
|
561
|
+
createMessageReaction(channelID, messageID, emoji) {
|
562
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelMessageReaction(channelID, messageID, emoji));
|
560
563
|
}
|
561
564
|
/** https://discord.com/developers/docs/resources/stage-instance#create-stage-instance */
|
562
565
|
async createStageInstance(options, reason) {
|
563
566
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.stageInstances(), {
|
564
567
|
json: {
|
565
|
-
channel_id: options.
|
568
|
+
channel_id: options.channelID,
|
566
569
|
topic: options.topic,
|
567
570
|
privacy_level: options.privacyLevel,
|
568
571
|
send_start_notifications: options.sendStartNotifications,
|
569
|
-
guild_scheduled_event_id: options.
|
572
|
+
guild_scheduled_event_id: options.guildScheduledEventID,
|
570
573
|
},
|
571
574
|
reason,
|
572
575
|
});
|
573
576
|
return this.util.stageInstanceFromRaw(response);
|
574
577
|
}
|
575
578
|
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
|
576
|
-
async createTestEntitlement(
|
577
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationEntitlements(
|
579
|
+
async createTestEntitlement(applicationID, options) {
|
580
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationEntitlements(applicationID), {
|
578
581
|
json: {
|
579
|
-
sku_id: options.
|
580
|
-
owner_id: options.
|
582
|
+
sku_id: options.skuID,
|
583
|
+
owner_id: options.ownerID,
|
581
584
|
owner_type: options.ownerType,
|
582
585
|
},
|
583
586
|
});
|
584
587
|
return this.util.testEntitlementFromRaw(response);
|
585
588
|
}
|
586
589
|
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel */
|
587
|
-
async createThread(
|
588
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.threads(
|
590
|
+
async createThread(channelID, options, reason) {
|
591
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.threads(channelID), {
|
589
592
|
json: {
|
590
593
|
name: options.name,
|
591
594
|
auto_archive_duration: options.autoArchiveDuration,
|
@@ -612,8 +615,8 @@ class Client extends node_events_1.default {
|
|
612
615
|
return this.util.channelFromRaw(response);
|
613
616
|
}
|
614
617
|
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
|
615
|
-
async createThreadFromMessage(
|
616
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.threads(
|
618
|
+
async createThreadFromMessage(channelID, messageID, options, reason) {
|
619
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.threads(channelID, messageID), {
|
617
620
|
json: {
|
618
621
|
name: options.name,
|
619
622
|
auto_archive_duration: options.autoArchiveDuration,
|
@@ -624,8 +627,8 @@ class Client extends node_events_1.default {
|
|
624
627
|
return this.util.channelFromRaw(response);
|
625
628
|
}
|
626
629
|
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message */
|
627
|
-
async createThreadWithoutMessage(
|
628
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.threads(
|
630
|
+
async createThreadWithoutMessage(channelID, options, reason) {
|
631
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.threads(channelID), {
|
629
632
|
json: {
|
630
633
|
name: options.name,
|
631
634
|
auto_archive_duration: options.autoArchiveDuration,
|
@@ -638,76 +641,76 @@ class Client extends node_events_1.default {
|
|
638
641
|
return this.util.channelFromRaw(response);
|
639
642
|
}
|
640
643
|
/** https://discord.com/developers/docs/resources/channel#crosspost-message */
|
641
|
-
async crosspostMessage(
|
642
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessage(
|
644
|
+
async crosspostMessage(channelID, messageID) {
|
645
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessage(channelID, messageID));
|
643
646
|
return this.util.messageFromRaw(response);
|
644
647
|
}
|
645
648
|
/** https://discord.com/developers/docs/resources/channel#delete-all-reactions */
|
646
|
-
deleteAllMessageReactions(
|
647
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessageAllReactions(
|
649
|
+
deleteAllMessageReactions(channelID, messageID, emoji) {
|
650
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessageAllReactions(channelID, messageID, emoji));
|
648
651
|
}
|
649
652
|
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
650
|
-
deleteAutoModerationRule(
|
651
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildAutoModerationRule(
|
653
|
+
deleteAutoModerationRule(guildID, autoModerationRuleID, reason) {
|
654
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildAutoModerationRule(guildID, autoModerationRuleID), {
|
652
655
|
reason,
|
653
656
|
});
|
654
657
|
}
|
655
658
|
/** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
|
656
|
-
async deleteChannel(
|
657
|
-
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channel(
|
659
|
+
async deleteChannel(channelID, reason) {
|
660
|
+
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channel(channelID), {
|
658
661
|
reason,
|
659
662
|
});
|
660
663
|
return this.util.channelFromRaw(response);
|
661
664
|
}
|
662
665
|
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
663
|
-
deleteChannelPermission(
|
664
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPermission(
|
666
|
+
deleteChannelPermission(channelID, overwriteID, reason) {
|
667
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPermission(channelID, overwriteID), {
|
665
668
|
reason,
|
666
669
|
});
|
667
670
|
}
|
668
671
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
669
|
-
deleteGlobalApplicationCommand(
|
670
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationCommand(
|
672
|
+
deleteGlobalApplicationCommand(applicationID, commandID) {
|
673
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationCommand(applicationID, commandID));
|
671
674
|
}
|
672
675
|
/** https://discord.com/developers/docs/resources/guild#delete-guild */
|
673
|
-
deleteGuild(
|
674
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guild(
|
676
|
+
deleteGuild(guildID) {
|
677
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guild(guildID));
|
675
678
|
}
|
676
679
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
677
|
-
deleteGuildApplicationCommand(
|
678
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationGuildCommand(
|
680
|
+
deleteGuildApplicationCommand(applicationID, guildID, commandID) {
|
681
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID));
|
679
682
|
}
|
680
683
|
/** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
|
681
|
-
deleteGuildEmoji(
|
682
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildEmoji(
|
684
|
+
deleteGuildEmoji(guildID, emojiID, reason) {
|
685
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildEmoji(guildID, emojiID), {
|
683
686
|
reason,
|
684
687
|
});
|
685
688
|
}
|
686
689
|
/** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
|
687
|
-
deleteGuildIntegration(
|
688
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildIntegration(
|
690
|
+
deleteGuildIntegration(guildID, integrationID, reason) {
|
691
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildIntegration(guildID, integrationID), {
|
689
692
|
reason,
|
690
693
|
});
|
691
694
|
}
|
692
695
|
/** https://discord.com/developers/docs/resources/guild#delete-guild-role */
|
693
|
-
deleteGuildRole(
|
694
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildRole(
|
696
|
+
deleteGuildRole(guildID, roleID, reason) {
|
697
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildRole(guildID, roleID), {
|
695
698
|
reason,
|
696
699
|
});
|
697
700
|
}
|
698
701
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
|
699
|
-
deleteGuildScheduledEvent(
|
700
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildScheduledEvent(
|
702
|
+
deleteGuildScheduledEvent(guildID, guildScheduledEventID) {
|
703
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildScheduledEvent(guildID, guildScheduledEventID));
|
701
704
|
}
|
702
705
|
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
703
|
-
deleteGuildSticker(
|
704
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildSticker(
|
706
|
+
deleteGuildSticker(guildID, stickerID, reason) {
|
707
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildSticker(guildID, stickerID), {
|
705
708
|
reason,
|
706
709
|
});
|
707
710
|
}
|
708
711
|
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
709
|
-
async deleteGuildTemplate(
|
710
|
-
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildTemplate(
|
712
|
+
async deleteGuildTemplate(guildID, code) {
|
713
|
+
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildTemplate(guildID, code));
|
711
714
|
return this.util.guildTemplateFromRaw(response);
|
712
715
|
}
|
713
716
|
/** https://discord.com/developers/docs/resources/invite#delete-invite */
|
@@ -718,50 +721,50 @@ class Client extends node_events_1.default {
|
|
718
721
|
return this.util.inviteFromRaw(response);
|
719
722
|
}
|
720
723
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message */
|
721
|
-
deleteInteractionFollowupMessage(
|
722
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(
|
724
|
+
deleteInteractionFollowupMessage(applicationID, interactionToken, messageID) {
|
725
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(applicationID, interactionToken, messageID));
|
723
726
|
}
|
724
727
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response */
|
725
|
-
deleteInteractionResponse(
|
726
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(
|
728
|
+
deleteInteractionResponse(applicationID, interactionToken) {
|
729
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(applicationID, interactionToken));
|
727
730
|
}
|
728
731
|
/** https://discord.com/developers/docs/resources/channel#delete-message */
|
729
|
-
deleteMessage(
|
730
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessage(
|
732
|
+
deleteMessage(channelID, messageID, reason) {
|
733
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessage(channelID, messageID), {
|
731
734
|
reason,
|
732
735
|
});
|
733
736
|
}
|
734
737
|
/** https://discord.com/developers/docs/resources/channel#delete-user-reaction */
|
735
|
-
deleteMessageReaction(
|
736
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessageReaction(
|
738
|
+
deleteMessageReaction(channelID, messageID, emoji, userID) {
|
739
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessageReaction(channelID, messageID, emoji, userID));
|
737
740
|
}
|
738
741
|
/** https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance */
|
739
|
-
deleteStageInstance(
|
740
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.stageInstance(
|
742
|
+
deleteStageInstance(channelID, reason) {
|
743
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.stageInstance(channelID), {
|
741
744
|
reason,
|
742
745
|
});
|
743
746
|
}
|
744
747
|
/** https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement */
|
745
|
-
deleteTestEntitlement(
|
746
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationEntitlement(
|
748
|
+
deleteTestEntitlement(applicationID, entitlementID) {
|
749
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationEntitlement(applicationID, entitlementID));
|
747
750
|
}
|
748
751
|
/** https://discord.com/developers/docs/resources/webhook#delete-webhook */
|
749
|
-
deleteWebhook(
|
750
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhook(
|
752
|
+
deleteWebhook(webhookID, reason) {
|
753
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhook(webhookID), {
|
751
754
|
reason,
|
752
755
|
});
|
753
756
|
}
|
754
757
|
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-message */
|
755
|
-
deleteWebhookMessage(
|
756
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(
|
758
|
+
deleteWebhookMessage(webhookID, webhookToken, messageID, options) {
|
759
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(webhookID, webhookToken, messageID), {
|
757
760
|
query: {
|
758
|
-
thread_id: options?.
|
761
|
+
thread_id: options?.threadID,
|
759
762
|
},
|
760
763
|
});
|
761
764
|
}
|
762
765
|
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token */
|
763
|
-
deleteWebhookWithToken(
|
764
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhook(
|
766
|
+
deleteWebhookWithToken(webhookID, webhookToken, reason) {
|
767
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhook(webhookID, webhookToken), {
|
765
768
|
reason,
|
766
769
|
authorization: false,
|
767
770
|
});
|
@@ -770,8 +773,8 @@ class Client extends node_events_1.default {
|
|
770
773
|
this.shards.disconnect();
|
771
774
|
}
|
772
775
|
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
|
773
|
-
async editAutoModerationRule(
|
774
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildAutoModerationRule(
|
776
|
+
async editAutoModerationRule(guildID, autoModerationRuleID, options, reason) {
|
777
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildAutoModerationRule(guildID, autoModerationRuleID), {
|
775
778
|
json: {
|
776
779
|
name: options.name,
|
777
780
|
event_type: options.eventType,
|
@@ -780,7 +783,7 @@ class Client extends node_events_1.default {
|
|
780
783
|
actions: options.actions?.map((action) => ({
|
781
784
|
type: action.type,
|
782
785
|
metadata: {
|
783
|
-
channel_id: action.metadata.
|
786
|
+
channel_id: action.metadata.channelID,
|
784
787
|
duration_seconds: action.metadata.durationSeconds,
|
785
788
|
custom_message: action.metadata.customMessage,
|
786
789
|
},
|
@@ -794,8 +797,8 @@ class Client extends node_events_1.default {
|
|
794
797
|
return this.util.autoModerationRuleFromRaw(response);
|
795
798
|
}
|
796
799
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
|
797
|
-
async editApplicationCommandPermissions(
|
798
|
-
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommandPermissions(
|
800
|
+
async editApplicationCommandPermissions(applicationID, guildID, commandID, options) {
|
801
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID), {
|
799
802
|
json: {
|
800
803
|
permissions: options.permissions.map((permission) => this.util.guildApplicationCommandPermissionsToRaw(permission)),
|
801
804
|
},
|
@@ -803,8 +806,8 @@ class Client extends node_events_1.default {
|
|
803
806
|
return this.util.guildApplicationCommandPermissionsFromRaw(response);
|
804
807
|
}
|
805
808
|
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
806
|
-
async editChannel(
|
807
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channel(
|
809
|
+
async editChannel(channelID, options, reason) {
|
810
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channel(channelID), {
|
808
811
|
json: {
|
809
812
|
name: options.name,
|
810
813
|
type: options.type,
|
@@ -814,7 +817,7 @@ class Client extends node_events_1.default {
|
|
814
817
|
rate_limit_per_user: options.rateLimitPerUser,
|
815
818
|
bitrate: options.bitrate,
|
816
819
|
permission_overwrites: options.permissionOverwrites,
|
817
|
-
parent_id: options.
|
820
|
+
parent_id: options.parentID,
|
818
821
|
rtc_region: options.rtcRegion,
|
819
822
|
video_quality_mode: options.videoQualityMode,
|
820
823
|
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
@@ -835,20 +838,20 @@ class Client extends node_events_1.default {
|
|
835
838
|
return this.util.channelFromRaw(response);
|
836
839
|
}
|
837
840
|
/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions */
|
838
|
-
editChannelPermissions(
|
839
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelPermission(
|
841
|
+
editChannelPermissions(channelID, overwriteID, options, reason) {
|
842
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelPermission(channelID, overwriteID), {
|
840
843
|
json: options,
|
841
844
|
reason,
|
842
845
|
});
|
843
846
|
}
|
844
847
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
845
|
-
editChannelPositions(
|
846
|
-
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildChannels(
|
848
|
+
editChannelPositions(guildID, options) {
|
849
|
+
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildChannels(guildID), {
|
847
850
|
json: options.map((data) => ({
|
848
851
|
id: data.id,
|
849
852
|
position: data.position,
|
850
853
|
lock_permissions: data.lockPermissions,
|
851
|
-
parent_id: data.
|
854
|
+
parent_id: data.parentID,
|
852
855
|
})),
|
853
856
|
});
|
854
857
|
}
|
@@ -864,8 +867,8 @@ class Client extends node_events_1.default {
|
|
864
867
|
return this.util.userFromRaw(response);
|
865
868
|
}
|
866
869
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
867
|
-
async editCurrentGuildMember(
|
868
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildMember(
|
870
|
+
async editCurrentGuildMember(guildID, options, reason) {
|
871
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildMember(guildID), {
|
869
872
|
json: {
|
870
873
|
nick: options.nick,
|
871
874
|
},
|
@@ -874,10 +877,10 @@ class Client extends node_events_1.default {
|
|
874
877
|
return this.util.guildMemberFromRaw(response);
|
875
878
|
}
|
876
879
|
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
877
|
-
editCurrentUserVoiceState(
|
878
|
-
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildVoiceState(
|
880
|
+
editCurrentUserVoiceState(guildID, options) {
|
881
|
+
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildVoiceState(guildID), {
|
879
882
|
json: {
|
880
|
-
channel_id: options.
|
883
|
+
channel_id: options.channelID,
|
881
884
|
suppress: options.suppress,
|
882
885
|
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
883
886
|
},
|
@@ -901,52 +904,52 @@ class Client extends node_events_1.default {
|
|
901
904
|
return this.util.applicationFromRaw(response);
|
902
905
|
}
|
903
906
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
|
904
|
-
async editGlobalApplicationCommand(
|
905
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationCommand(
|
907
|
+
async editGlobalApplicationCommand(applicationID, commandID, options) {
|
908
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationCommand(applicationID, commandID), {
|
906
909
|
json: this.util.partialApplicationCommandToRaw(options),
|
907
910
|
});
|
908
911
|
return this.util.applicationCommandFromRaw(response);
|
909
912
|
}
|
910
913
|
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
911
|
-
async editGuild(
|
912
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guild(
|
914
|
+
async editGuild(guildID, options, reason) {
|
915
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guild(guildID), {
|
913
916
|
json: {
|
914
917
|
name: options.name,
|
915
918
|
region: options.region,
|
916
919
|
verification_level: options.verificationLevel,
|
917
920
|
default_message_notifications: options.defaultMessageNotifications,
|
918
921
|
explicit_content_filter: options.explicitContentFilter,
|
919
|
-
afk_channel_id: options.
|
922
|
+
afk_channel_id: options.afkChannelID,
|
920
923
|
afk_timeout: options.afkTimeout,
|
921
924
|
icon: options.icon,
|
922
|
-
owner_id: options.
|
925
|
+
owner_id: options.ownerID,
|
923
926
|
splash: options.splash,
|
924
927
|
discovery_splash: options.discoverySplash,
|
925
928
|
banner: options.banner,
|
926
|
-
system_channel_id: options.
|
929
|
+
system_channel_id: options.systemChannelID,
|
927
930
|
system_channel_flags: options.systemChannelFlags,
|
928
|
-
rules_channel_id: options.
|
929
|
-
public_updates_channel_id: options.
|
931
|
+
rules_channel_id: options.rulesChannelID,
|
932
|
+
public_updates_channel_id: options.publicUpdatesChannelID,
|
930
933
|
preferred_locale: options.preferredLocale,
|
931
934
|
features: options.features,
|
932
935
|
description: options.description,
|
933
936
|
premium_progress_bar_enabled: options.premiumProgressBarEnabled,
|
934
|
-
safety_alerts_channel_id: options.
|
937
|
+
safety_alerts_channel_id: options.safetyAlertsChannelID,
|
935
938
|
},
|
936
939
|
reason,
|
937
940
|
});
|
938
941
|
return this.util.guildFromRaw(response);
|
939
942
|
}
|
940
943
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
941
|
-
async editGuildApplicationCommand(
|
942
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationGuildCommand(
|
944
|
+
async editGuildApplicationCommand(applicationID, guildID, commandID, options) {
|
945
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID), {
|
943
946
|
json: this.util.partialApplicationCommandToRaw(options),
|
944
947
|
});
|
945
948
|
return this.util.applicationCommandFromRaw(response);
|
946
949
|
}
|
947
950
|
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
948
|
-
async editGuildEmoji(
|
949
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildEmoji(
|
951
|
+
async editGuildEmoji(guildID, emojiID, options, reason) {
|
952
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildEmoji(guildID, emojiID), {
|
950
953
|
json: {
|
951
954
|
name: options.name,
|
952
955
|
roles: options.roles,
|
@@ -956,14 +959,14 @@ class Client extends node_events_1.default {
|
|
956
959
|
return this.util.emojiFromRaw(response);
|
957
960
|
}
|
958
961
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
959
|
-
async editGuildMember(
|
960
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildMember(
|
962
|
+
async editGuildMember(guildID, userID, options, reason) {
|
963
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildMember(guildID, userID), {
|
961
964
|
json: {
|
962
965
|
nick: options.nick,
|
963
966
|
roles: options.roles,
|
964
967
|
mute: options.mute,
|
965
968
|
deaf: options.deaf,
|
966
|
-
channel_id: options.
|
969
|
+
channel_id: options.channelID,
|
967
970
|
communication_disabled_until: options.communicationDisabledUntil,
|
968
971
|
flags: options.flags,
|
969
972
|
},
|
@@ -972,8 +975,8 @@ class Client extends node_events_1.default {
|
|
972
975
|
return this.util.guildMemberFromRaw(response);
|
973
976
|
}
|
974
977
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
975
|
-
editGuildMFALevel(
|
976
|
-
return this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildMFA(
|
978
|
+
editGuildMFALevel(guildID, options, reason) {
|
979
|
+
return this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildMFA(guildID), {
|
977
980
|
json: {
|
978
981
|
level: options.level,
|
979
982
|
},
|
@@ -981,20 +984,20 @@ class Client extends node_events_1.default {
|
|
981
984
|
});
|
982
985
|
}
|
983
986
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
|
984
|
-
editGuildOnboarding(
|
985
|
-
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildOnboarding(
|
987
|
+
editGuildOnboarding(guildID, options, reason) {
|
988
|
+
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildOnboarding(guildID), {
|
986
989
|
json: {
|
987
990
|
prompts: options.prompts.map((prompt) => ({
|
988
991
|
id: prompt.id,
|
989
992
|
type: prompt.type,
|
990
993
|
options: prompt.options.map((promptOption) => ({
|
991
994
|
id: promptOption.id,
|
992
|
-
channel_ids: promptOption.
|
993
|
-
role_ids: promptOption.
|
995
|
+
channel_ids: promptOption.channelIDs,
|
996
|
+
role_ids: promptOption.roleIDs,
|
994
997
|
emoji: promptOption.emoji !== undefined
|
995
998
|
? this.util.emojiToRaw(promptOption.emoji)
|
996
999
|
: undefined,
|
997
|
-
emoji_id: promptOption.
|
1000
|
+
emoji_id: promptOption.emojiID,
|
998
1001
|
emoji_name: promptOption.emojiName,
|
999
1002
|
emoji_animated: promptOption.emojiAnimated,
|
1000
1003
|
title: promptOption.title,
|
@@ -1010,8 +1013,8 @@ class Client extends node_events_1.default {
|
|
1010
1013
|
});
|
1011
1014
|
}
|
1012
1015
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role */
|
1013
|
-
async editGuildRole(
|
1014
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildRole(
|
1016
|
+
async editGuildRole(guildID, roleID, options, reason) {
|
1017
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildRole(guildID, roleID), {
|
1015
1018
|
json: {
|
1016
1019
|
name: options?.name,
|
1017
1020
|
permissions: options?.permissions,
|
@@ -1026,17 +1029,17 @@ class Client extends node_events_1.default {
|
|
1026
1029
|
return this.util.roleFromRaw(response);
|
1027
1030
|
}
|
1028
1031
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
1029
|
-
async editGuildRolePositions(
|
1030
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildRoles(
|
1032
|
+
async editGuildRolePositions(guildID, options) {
|
1033
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildRoles(guildID), {
|
1031
1034
|
json: options,
|
1032
1035
|
});
|
1033
1036
|
return response.map((role) => this.util.roleFromRaw(role));
|
1034
1037
|
}
|
1035
1038
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
1036
|
-
async editGuildScheduledEvent(
|
1037
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildScheduledEvent(
|
1039
|
+
async editGuildScheduledEvent(guildID, guildScheduledEventID, options, reason) {
|
1040
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildScheduledEvent(guildID, guildScheduledEventID), {
|
1038
1041
|
json: {
|
1039
|
-
channel_id: options.
|
1042
|
+
channel_id: options.channelID,
|
1040
1043
|
entity_metadata: options.entityMetadata,
|
1041
1044
|
name: options.name,
|
1042
1045
|
privacy_level: options.privacyLevel,
|
@@ -1052,8 +1055,8 @@ class Client extends node_events_1.default {
|
|
1052
1055
|
return this.util.guildScheduledEventFromRaw(response);
|
1053
1056
|
}
|
1054
1057
|
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
1055
|
-
async editGuildSticker(
|
1056
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildSticker(
|
1058
|
+
async editGuildSticker(guildID, stickerID, options, reason) {
|
1059
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildSticker(guildID, stickerID), {
|
1057
1060
|
json: {
|
1058
1061
|
name: options.name,
|
1059
1062
|
description: options.description,
|
@@ -1064,8 +1067,8 @@ class Client extends node_events_1.default {
|
|
1064
1067
|
return this.util.stickerFromRaw(response);
|
1065
1068
|
}
|
1066
1069
|
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
1067
|
-
async editGuildTemplate(
|
1068
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildTemplate(
|
1070
|
+
async editGuildTemplate(guildID, code, options) {
|
1071
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildTemplate(guildID, code), {
|
1069
1072
|
json: {
|
1070
1073
|
name: options.name,
|
1071
1074
|
description: options.description,
|
@@ -1074,8 +1077,8 @@ class Client extends node_events_1.default {
|
|
1074
1077
|
return this.util.guildTemplateFromRaw(response);
|
1075
1078
|
}
|
1076
1079
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
1077
|
-
async editGuildWelcomeScreen(
|
1078
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildWelcomeScreen(
|
1080
|
+
async editGuildWelcomeScreen(guildID, options, reason) {
|
1081
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildWelcomeScreen(guildID), {
|
1079
1082
|
json: {
|
1080
1083
|
enabled: options.enabled,
|
1081
1084
|
welcome_channels: options.welcomeChannels,
|
@@ -1086,30 +1089,30 @@ class Client extends node_events_1.default {
|
|
1086
1089
|
return {
|
1087
1090
|
description: response.description,
|
1088
1091
|
welcomeChannels: response.welcome_channels.map((welcomeScreenChannel) => ({
|
1089
|
-
|
1092
|
+
channelID: welcomeScreenChannel.channel_id,
|
1090
1093
|
description: welcomeScreenChannel.description,
|
1091
|
-
|
1094
|
+
emojiID: welcomeScreenChannel.emoji_id,
|
1092
1095
|
emojiName: welcomeScreenChannel.emoji_name,
|
1093
1096
|
})),
|
1094
1097
|
};
|
1095
1098
|
}
|
1096
1099
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
|
1097
|
-
async editGuildWidget(
|
1098
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildWidgetSettings(
|
1100
|
+
async editGuildWidget(guildID, options, reason) {
|
1101
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildWidgetSettings(guildID), {
|
1099
1102
|
json: {
|
1100
1103
|
enabled: options.enabled,
|
1101
|
-
channel_id: options.
|
1104
|
+
channel_id: options.channelID,
|
1102
1105
|
},
|
1103
1106
|
reason,
|
1104
1107
|
});
|
1105
1108
|
return {
|
1106
1109
|
enabled: response.enabled,
|
1107
|
-
|
1110
|
+
channelID: response.channel_id,
|
1108
1111
|
};
|
1109
1112
|
}
|
1110
1113
|
/** https://discord.com/developers/docs/resources/channel#edit-message */
|
1111
|
-
async editMessage(
|
1112
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channelMessage(
|
1114
|
+
async editMessage(channelID, messageID, options) {
|
1115
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channelMessage(channelID, messageID), {
|
1113
1116
|
json: {
|
1114
1117
|
content: options.content,
|
1115
1118
|
embeds: options.embeds !== null
|
@@ -1138,8 +1141,8 @@ class Client extends node_events_1.default {
|
|
1138
1141
|
return this.util.messageFromRaw(response);
|
1139
1142
|
}
|
1140
1143
|
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance */
|
1141
|
-
async editStageInstance(
|
1142
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.stageInstance(
|
1144
|
+
async editStageInstance(channelID, options, reason) {
|
1145
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.stageInstance(channelID), {
|
1143
1146
|
json: {
|
1144
1147
|
topic: options.topic,
|
1145
1148
|
privacy_level: options.privacyLevel,
|
@@ -1149,8 +1152,8 @@ class Client extends node_events_1.default {
|
|
1149
1152
|
return this.util.stageInstanceFromRaw(response);
|
1150
1153
|
}
|
1151
1154
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message */
|
1152
|
-
async editInteractionFollowupMessage(
|
1153
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhookMessage(
|
1155
|
+
async editInteractionFollowupMessage(applicationID, interactionToken, messageID, options) {
|
1156
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhookMessage(applicationID, interactionToken, messageID), {
|
1154
1157
|
json: {
|
1155
1158
|
content: options.content,
|
1156
1159
|
embeds: options.embeds !== null
|
@@ -1176,14 +1179,14 @@ class Client extends node_events_1.default {
|
|
1176
1179
|
},
|
1177
1180
|
files: options.files,
|
1178
1181
|
query: {
|
1179
|
-
thread_id: options.
|
1182
|
+
thread_id: options.threadID,
|
1180
1183
|
},
|
1181
1184
|
});
|
1182
1185
|
return this.util.messageFromRaw(response);
|
1183
1186
|
}
|
1184
1187
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response */
|
1185
|
-
async editInteractionResponse(
|
1186
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhookMessage(
|
1188
|
+
async editInteractionResponse(applicationID, interactionToken, options) {
|
1189
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhookMessage(applicationID, interactionToken), {
|
1187
1190
|
json: {
|
1188
1191
|
content: options.content,
|
1189
1192
|
embeds: options.embeds !== null
|
@@ -1209,36 +1212,36 @@ class Client extends node_events_1.default {
|
|
1209
1212
|
},
|
1210
1213
|
files: options.files,
|
1211
1214
|
query: {
|
1212
|
-
thread_id: options.
|
1215
|
+
thread_id: options.threadID,
|
1213
1216
|
},
|
1214
1217
|
});
|
1215
1218
|
return this.util.messageFromRaw(response);
|
1216
1219
|
}
|
1217
1220
|
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
1218
|
-
editUserVoiceState(
|
1219
|
-
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildVoiceState(
|
1221
|
+
editUserVoiceState(guildID, userID, options) {
|
1222
|
+
this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildVoiceState(guildID, userID), {
|
1220
1223
|
json: {
|
1221
|
-
channel_id: options.
|
1224
|
+
channel_id: options.channelID,
|
1222
1225
|
suppress: options.suppress,
|
1223
1226
|
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
1224
1227
|
},
|
1225
1228
|
});
|
1226
1229
|
}
|
1227
1230
|
/** https://discord.com/developers/docs/resources/webhook#modify-webhook */
|
1228
|
-
async editWebhook(
|
1229
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhook(
|
1231
|
+
async editWebhook(webhookID, options, reason) {
|
1232
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhook(webhookID), {
|
1230
1233
|
json: {
|
1231
1234
|
name: options.name,
|
1232
1235
|
avatar: options.avatar,
|
1233
|
-
channel_id: options.
|
1236
|
+
channel_id: options.channelID,
|
1234
1237
|
},
|
1235
1238
|
reason,
|
1236
1239
|
});
|
1237
1240
|
return this.util.webhookFromRaw(response);
|
1238
1241
|
}
|
1239
1242
|
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
|
1240
|
-
async editWebhookMessage(
|
1241
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhookMessage(
|
1243
|
+
async editWebhookMessage(webhookID, webhookToken, messageID, options) {
|
1244
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhookMessage(webhookID, webhookToken, messageID), {
|
1242
1245
|
json: {
|
1243
1246
|
content: options.content,
|
1244
1247
|
embeds: options.embeds !== null
|
@@ -1264,14 +1267,14 @@ class Client extends node_events_1.default {
|
|
1264
1267
|
},
|
1265
1268
|
files: options.files,
|
1266
1269
|
query: {
|
1267
|
-
thread_id: options.
|
1270
|
+
thread_id: options.threadID,
|
1268
1271
|
},
|
1269
1272
|
});
|
1270
1273
|
return this.util.messageFromRaw(response);
|
1271
1274
|
}
|
1272
1275
|
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
|
1273
|
-
async editWebhookWithToken(
|
1274
|
-
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhook(
|
1276
|
+
async editWebhookWithToken(webhookID, webhookToken, options, reason) {
|
1277
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.webhook(webhookID, webhookToken), {
|
1275
1278
|
json: {
|
1276
1279
|
name: options.name,
|
1277
1280
|
avatar: options.avatar,
|
@@ -1282,13 +1285,13 @@ class Client extends node_events_1.default {
|
|
1282
1285
|
return this.util.webhookFromRaw(response);
|
1283
1286
|
}
|
1284
1287
|
/** https://discord.com/developers/docs/resources/poll#end-poll */
|
1285
|
-
async endPoll(
|
1286
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.pollExpire(
|
1288
|
+
async endPoll(channelID, messageID) {
|
1289
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.pollExpire(channelID, messageID));
|
1287
1290
|
return this.util.messageFromRaw(response);
|
1288
1291
|
}
|
1289
1292
|
/** https://discord.com/developers/docs/resources/webhook#execute-webhook */
|
1290
|
-
async executeWebhook(
|
1291
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhook(
|
1293
|
+
async executeWebhook(webhookID, webhookToken, options) {
|
1294
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhook(webhookID, webhookToken), {
|
1292
1295
|
json: {
|
1293
1296
|
content: options.content,
|
1294
1297
|
username: options.username,
|
@@ -1320,7 +1323,7 @@ class Client extends node_events_1.default {
|
|
1320
1323
|
? {
|
1321
1324
|
question: options.poll.question,
|
1322
1325
|
answers: options.poll.answers.map((answer) => ({
|
1323
|
-
answer_id: answer.
|
1326
|
+
answer_id: answer.answerID,
|
1324
1327
|
poll_media: answer.pollMedia,
|
1325
1328
|
})),
|
1326
1329
|
duration: options.poll.duration,
|
@@ -1332,7 +1335,7 @@ class Client extends node_events_1.default {
|
|
1332
1335
|
files: options.files,
|
1333
1336
|
query: {
|
1334
1337
|
wait: options.wait,
|
1335
|
-
thread_id: options.
|
1338
|
+
thread_id: options.threadID,
|
1336
1339
|
},
|
1337
1340
|
});
|
1338
1341
|
return response !== null ? this.util.messageFromRaw(response) : response;
|
@@ -1342,10 +1345,10 @@ class Client extends node_events_1.default {
|
|
1342
1345
|
*
|
1343
1346
|
* https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook
|
1344
1347
|
*/
|
1345
|
-
async executeWebhookPlatform(
|
1346
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhookPlatform(
|
1348
|
+
async executeWebhookPlatform(webhookID, webhookToken, platform, options) {
|
1349
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.webhookPlatform(webhookID, webhookToken, platform), {
|
1347
1350
|
query: {
|
1348
|
-
thread_id: options.
|
1351
|
+
thread_id: options.threadID,
|
1349
1352
|
wait: options.wait,
|
1350
1353
|
},
|
1351
1354
|
json: options,
|
@@ -1353,29 +1356,29 @@ class Client extends node_events_1.default {
|
|
1353
1356
|
return response !== null ? this.util.messageFromRaw(response) : null;
|
1354
1357
|
}
|
1355
1358
|
/** https://discord.com/developers/docs/resources/channel#follow-announcement-channel */
|
1356
|
-
async followChannel(
|
1357
|
-
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelFollowers(
|
1359
|
+
async followChannel(channelID, options, reason) {
|
1360
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelFollowers(channelID), {
|
1358
1361
|
json: {
|
1359
|
-
webhook_channel_id: options.
|
1362
|
+
webhook_channel_id: options.webhookChannelID,
|
1360
1363
|
},
|
1361
1364
|
reason,
|
1362
1365
|
});
|
1363
1366
|
return {
|
1364
|
-
|
1365
|
-
|
1367
|
+
channelID: response.channel_id,
|
1368
|
+
webhookID: response.webhook_id,
|
1366
1369
|
};
|
1367
1370
|
}
|
1368
1371
|
/** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
|
1369
|
-
async getActiveGuildThreads(
|
1370
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildActiveThreads(
|
1372
|
+
async getActiveGuildThreads(guildID) {
|
1373
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildActiveThreads(guildID));
|
1371
1374
|
return {
|
1372
1375
|
threads: response.threads.map((thread) => this.util.channelFromRaw(thread)),
|
1373
1376
|
members: response.members.map((threadMember) => this.util.threadMemberFromRaw(threadMember)),
|
1374
1377
|
};
|
1375
1378
|
}
|
1376
1379
|
/** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
|
1377
|
-
async getArchivedThreads(
|
1378
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelThreads(
|
1380
|
+
async getArchivedThreads(channelID, archivedStatus, options) {
|
1381
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelThreads(channelID, archivedStatus, false), {
|
1379
1382
|
query: {
|
1380
1383
|
before: options?.before,
|
1381
1384
|
limit: options?.limit,
|
@@ -1388,10 +1391,10 @@ class Client extends node_events_1.default {
|
|
1388
1391
|
};
|
1389
1392
|
}
|
1390
1393
|
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
|
1391
|
-
async getAuditLog(
|
1392
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAuditLog(
|
1394
|
+
async getAuditLog(guildID, options) {
|
1395
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAuditLog(guildID), {
|
1393
1396
|
query: {
|
1394
|
-
user_id: options?.
|
1397
|
+
user_id: options?.userID,
|
1395
1398
|
action_type: options?.actionType,
|
1396
1399
|
before: options?.before,
|
1397
1400
|
after: options?.after,
|
@@ -1401,23 +1404,23 @@ class Client extends node_events_1.default {
|
|
1401
1404
|
return this.util.auditLogFromRaw(response);
|
1402
1405
|
}
|
1403
1406
|
/** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
|
1404
|
-
async getAutoModerationRule(
|
1405
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRule(
|
1407
|
+
async getAutoModerationRule(guildID, ruleID) {
|
1408
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRule(guildID, ruleID));
|
1406
1409
|
return this.util.autoModerationRuleFromRaw(response);
|
1407
1410
|
}
|
1408
1411
|
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
1409
|
-
async getAutoModerationRules(
|
1410
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRules(
|
1412
|
+
async getAutoModerationRules(guildID) {
|
1413
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildAutoModerationRules(guildID));
|
1411
1414
|
return response.map((autoModerationRule) => this.util.autoModerationRuleFromRaw(autoModerationRule));
|
1412
1415
|
}
|
1413
1416
|
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
1414
|
-
async getApplicationCommandPermissions(
|
1415
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommandPermissions(
|
1417
|
+
async getApplicationCommandPermissions(applicationID, guildID, commandID) {
|
1418
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID));
|
1416
1419
|
return this.util.guildApplicationCommandPermissionsFromRaw(response);
|
1417
1420
|
}
|
1418
1421
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
1419
|
-
async getApplicationRoleConnectionMetadataRecords(
|
1420
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationRoleConnectionMetadata(
|
1422
|
+
async getApplicationRoleConnectionMetadataRecords(applicationID) {
|
1423
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationID));
|
1421
1424
|
return response.map((applicationRoleConnectionMetadata) => ({
|
1422
1425
|
type: applicationRoleConnectionMetadata.type,
|
1423
1426
|
key: applicationRoleConnectionMetadata.key,
|
@@ -1428,23 +1431,23 @@ class Client extends node_events_1.default {
|
|
1428
1431
|
}));
|
1429
1432
|
}
|
1430
1433
|
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
1431
|
-
async getChannel(
|
1432
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channel(
|
1434
|
+
async getChannel(channelID) {
|
1435
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channel(channelID));
|
1433
1436
|
return this.util.channelFromRaw(response);
|
1434
1437
|
}
|
1435
1438
|
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
1436
|
-
async getChannels(
|
1437
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildChannels(
|
1439
|
+
async getChannels(guildID) {
|
1440
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildChannels(guildID));
|
1438
1441
|
return response.map((channel) => this.util.channelFromRaw(channel));
|
1439
1442
|
}
|
1440
1443
|
/** https://discord.com/developers/docs/resources/channel#get-channel-invites */
|
1441
|
-
async getChannelInvites(
|
1442
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelInvites(
|
1444
|
+
async getChannelInvites(channelID) {
|
1445
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelInvites(channelID));
|
1443
1446
|
return response.map((invite) => this.util.inviteFromRaw(invite));
|
1444
1447
|
}
|
1445
1448
|
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
1446
|
-
async getChannelWebhooks(
|
1447
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelWebhooks(
|
1449
|
+
async getChannelWebhooks(channelID) {
|
1450
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelWebhooks(channelID));
|
1448
1451
|
return response.map((webhook) => this.util.webhookFromRaw(webhook));
|
1449
1452
|
}
|
1450
1453
|
/** https://discord.com/developers/docs/resources/application#get-current-application */
|
@@ -1453,8 +1456,8 @@ class Client extends node_events_1.default {
|
|
1453
1456
|
return this.util.applicationFromRaw(response);
|
1454
1457
|
}
|
1455
1458
|
/** https://discord.com/developers/docs/resources/user#get-current-user-application-role-connection */
|
1456
|
-
async getCurrentApplicationRoleConnection(
|
1457
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.userApplicationRoleConnection(
|
1459
|
+
async getCurrentApplicationRoleConnection(applicationID) {
|
1460
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.userApplicationRoleConnection(applicationID));
|
1458
1461
|
return {
|
1459
1462
|
platformName: response.platform_name,
|
1460
1463
|
platformUsername: response.platform_username,
|
@@ -1469,8 +1472,8 @@ class Client extends node_events_1.default {
|
|
1469
1472
|
};
|
1470
1473
|
}
|
1471
1474
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guild-member */
|
1472
|
-
async getCurrentGuildMember(
|
1473
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(
|
1475
|
+
async getCurrentGuildMember(guildID) {
|
1476
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(guildID));
|
1474
1477
|
return this.util.guildMemberFromRaw(response);
|
1475
1478
|
}
|
1476
1479
|
/** https://discord.com/developers/docs/resources/user#get-current-user-connections */
|
@@ -1490,15 +1493,15 @@ class Client extends node_events_1.default {
|
|
1490
1493
|
}));
|
1491
1494
|
}
|
1492
1495
|
/** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
|
1493
|
-
async getEntitlements(
|
1494
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationEntitlements(
|
1496
|
+
async getEntitlements(applicationID, options) {
|
1497
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationEntitlements(applicationID), {
|
1495
1498
|
query: {
|
1496
|
-
user_id: options?.
|
1497
|
-
sku_ids: options?.
|
1499
|
+
user_id: options?.userID,
|
1500
|
+
sku_ids: options?.skuIDs,
|
1498
1501
|
before: options?.before,
|
1499
1502
|
after: options?.after,
|
1500
1503
|
limit: options?.limit,
|
1501
|
-
guild_id: options?.
|
1504
|
+
guild_id: options?.guildID,
|
1502
1505
|
exclude_ended: options?.excludeEnded,
|
1503
1506
|
},
|
1504
1507
|
});
|
@@ -1523,13 +1526,13 @@ class Client extends node_events_1.default {
|
|
1523
1526
|
};
|
1524
1527
|
}
|
1525
1528
|
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
|
1526
|
-
async getGlobalApplicationCommand(
|
1527
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommand(
|
1529
|
+
async getGlobalApplicationCommand(applicationID, commandID) {
|
1530
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommand(applicationID, commandID));
|
1528
1531
|
return this.util.applicationCommandFromRaw(response);
|
1529
1532
|
}
|
1530
1533
|
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
|
1531
|
-
async getGlobalApplicationCommands(
|
1532
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommands(
|
1534
|
+
async getGlobalApplicationCommands(applicationID, options) {
|
1535
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommands(applicationID), {
|
1533
1536
|
query: {
|
1534
1537
|
with_localizations: options.withLocalizations,
|
1535
1538
|
},
|
@@ -1537,8 +1540,8 @@ class Client extends node_events_1.default {
|
|
1537
1540
|
return response.map((applicationCommand) => this.util.applicationCommandFromRaw(applicationCommand));
|
1538
1541
|
}
|
1539
1542
|
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
1540
|
-
async getGuild(
|
1541
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guild(
|
1543
|
+
async getGuild(guildID, options) {
|
1544
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guild(guildID), {
|
1542
1545
|
query: {
|
1543
1546
|
with_counts: options?.withCounts,
|
1544
1547
|
},
|
@@ -1558,13 +1561,13 @@ class Client extends node_events_1.default {
|
|
1558
1561
|
return response.map((guild) => this.util.guildFromRaw(guild));
|
1559
1562
|
}
|
1560
1563
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
1561
|
-
async getGuildApplicationCommand(
|
1562
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationGuildCommand(
|
1564
|
+
async getGuildApplicationCommand(applicationID, guildID, commandID) {
|
1565
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationGuildCommand(applicationID, guildID, commandID));
|
1563
1566
|
return this.util.applicationCommandFromRaw(response);
|
1564
1567
|
}
|
1565
1568
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
1566
|
-
async getGuildApplicationCommands(
|
1567
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationGuildCommands(
|
1569
|
+
async getGuildApplicationCommands(applicationID, guildID, options) {
|
1570
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationGuildCommands(applicationID, guildID), {
|
1568
1571
|
query: {
|
1569
1572
|
with_localizations: options?.withLocalizations,
|
1570
1573
|
},
|
@@ -1572,21 +1575,21 @@ class Client extends node_events_1.default {
|
|
1572
1575
|
return response.map((applicationCommand) => this.util.applicationCommandFromRaw(applicationCommand));
|
1573
1576
|
}
|
1574
1577
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
1575
|
-
async getGuildApplicationCommandPermissions(
|
1576
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildApplicationCommandsPermissions(
|
1578
|
+
async getGuildApplicationCommandPermissions(applicationID, guildID) {
|
1579
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildApplicationCommandsPermissions(applicationID, guildID));
|
1577
1580
|
return this.util.guildApplicationCommandPermissionsFromRaw(response);
|
1578
1581
|
}
|
1579
1582
|
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
1580
|
-
async getGuildBan(
|
1581
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildBan(
|
1583
|
+
async getGuildBan(guildID, userID) {
|
1584
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildBan(guildID, userID));
|
1582
1585
|
return {
|
1583
1586
|
reason: response.reason,
|
1584
1587
|
user: this.util.userFromRaw(response.user),
|
1585
1588
|
};
|
1586
1589
|
}
|
1587
1590
|
/** https://discord.com/developers/docs/resources/guild#get-guild-bans */
|
1588
|
-
async getGuildBans(
|
1589
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildBans(
|
1591
|
+
async getGuildBans(guildID, options) {
|
1592
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildBans(guildID), {
|
1590
1593
|
query: {
|
1591
1594
|
limit: options?.limit,
|
1592
1595
|
before: options?.before,
|
@@ -1599,51 +1602,51 @@ class Client extends node_events_1.default {
|
|
1599
1602
|
}));
|
1600
1603
|
}
|
1601
1604
|
/** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
|
1602
|
-
async getGuildEmoji(
|
1603
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmoji(
|
1605
|
+
async getGuildEmoji(guildID, emojiID) {
|
1606
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmoji(guildID, emojiID));
|
1604
1607
|
return this.util.emojiFromRaw(response);
|
1605
1608
|
}
|
1606
1609
|
/** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
|
1607
|
-
async getGuildEmojis(
|
1608
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmojis(
|
1610
|
+
async getGuildEmojis(guildID) {
|
1611
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildEmojis(guildID));
|
1609
1612
|
return response.map((emoji) => this.util.emojiFromRaw(emoji));
|
1610
1613
|
}
|
1611
1614
|
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
1612
|
-
async getGuildIntegrations(
|
1613
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildIntegrations(
|
1615
|
+
async getGuildIntegrations(guildID) {
|
1616
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildIntegrations(guildID));
|
1614
1617
|
return response.map((integration) => this.util.integrationFromRaw(integration));
|
1615
1618
|
}
|
1616
1619
|
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
1617
|
-
async getGuildInvites(
|
1618
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildInvites(
|
1620
|
+
async getGuildInvites(guildID) {
|
1621
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildInvites(guildID));
|
1619
1622
|
return response.map((invite) => this.util.inviteFromRaw(invite));
|
1620
1623
|
}
|
1621
1624
|
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
1622
|
-
async getGuildMember(
|
1623
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(
|
1625
|
+
async getGuildMember(guildID, userID) {
|
1626
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMember(guildID, userID));
|
1624
1627
|
return this.util.guildMemberFromRaw(response);
|
1625
1628
|
}
|
1626
1629
|
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
1627
|
-
async getGuildMembers(
|
1628
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMembers(
|
1630
|
+
async getGuildMembers(guildID) {
|
1631
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMembers(guildID));
|
1629
1632
|
return response.map((guildMember) => this.util.guildMemberFromRaw(guildMember));
|
1630
1633
|
}
|
1631
1634
|
/** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
|
1632
|
-
async getGuildOnboarding(
|
1633
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildOnboarding(
|
1635
|
+
async getGuildOnboarding(guildID) {
|
1636
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildOnboarding(guildID));
|
1634
1637
|
return {
|
1635
|
-
|
1638
|
+
guildID: response.guild_id,
|
1636
1639
|
prompts: response.prompts.map((prompt) => ({
|
1637
1640
|
id: prompt.id,
|
1638
1641
|
type: prompt.type,
|
1639
1642
|
options: prompt.options.map((promptOption) => ({
|
1640
1643
|
id: promptOption.id,
|
1641
|
-
|
1642
|
-
|
1644
|
+
channelIDs: promptOption.channel_ids,
|
1645
|
+
roleIDs: promptOption.role_ids,
|
1643
1646
|
emoji: promptOption.emoji !== undefined
|
1644
1647
|
? this.util.emojiFromRaw(promptOption.emoji)
|
1645
1648
|
: undefined,
|
1646
|
-
|
1649
|
+
emojiID: promptOption.emoji_id,
|
1647
1650
|
emojiName: promptOption.emoji_name,
|
1648
1651
|
emojiAnimated: promptOption.emoji_animated,
|
1649
1652
|
title: promptOption.title,
|
@@ -1654,14 +1657,14 @@ class Client extends node_events_1.default {
|
|
1654
1657
|
required: prompt.required,
|
1655
1658
|
inOnboarding: prompt.in_onboarding,
|
1656
1659
|
})),
|
1657
|
-
|
1660
|
+
defaultChannelIDs: response.default_channel_ids,
|
1658
1661
|
enabled: response.enabled,
|
1659
1662
|
mode: response.mode,
|
1660
1663
|
};
|
1661
1664
|
}
|
1662
1665
|
/** https://discord.com/developers/docs/resources/guild#get-guild-preview */
|
1663
|
-
async getGuildPreview(
|
1664
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildPreview(
|
1666
|
+
async getGuildPreview(guildID) {
|
1667
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildPreview(guildID));
|
1665
1668
|
return {
|
1666
1669
|
id: response.id,
|
1667
1670
|
name: response.name,
|
@@ -1677,8 +1680,8 @@ class Client extends node_events_1.default {
|
|
1677
1680
|
};
|
1678
1681
|
}
|
1679
1682
|
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
1680
|
-
getGuildPruneCount(
|
1681
|
-
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildPrune(
|
1683
|
+
getGuildPruneCount(guildID, options) {
|
1684
|
+
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildPrune(guildID), {
|
1682
1685
|
query: {
|
1683
1686
|
days: options.days,
|
1684
1687
|
include_roles: options.includeRoles,
|
@@ -1686,13 +1689,13 @@ class Client extends node_events_1.default {
|
|
1686
1689
|
});
|
1687
1690
|
}
|
1688
1691
|
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
1689
|
-
async getGuildRoles(
|
1690
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildRoles(
|
1692
|
+
async getGuildRoles(guildID) {
|
1693
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildRoles(guildID));
|
1691
1694
|
return response.map((role) => this.util.roleFromRaw(role));
|
1692
1695
|
}
|
1693
1696
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
|
1694
|
-
async getGuildScheduledEvents(
|
1695
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildScheduledEvents(
|
1697
|
+
async getGuildScheduledEvents(guildID, options) {
|
1698
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildScheduledEvents(guildID), {
|
1696
1699
|
query: {
|
1697
1700
|
with_user_count: options?.withUserCount,
|
1698
1701
|
},
|
@@ -1700,8 +1703,8 @@ class Client extends node_events_1.default {
|
|
1700
1703
|
return response.map((guildScheduledEvent) => this.util.guildScheduledEventFromRaw(guildScheduledEvent));
|
1701
1704
|
}
|
1702
1705
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
1703
|
-
async getGuildScheduledEventUsers(
|
1704
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildScheduledEvent(
|
1706
|
+
async getGuildScheduledEventUsers(guildID, guildScheduledEventID, options) {
|
1707
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildScheduledEvent(guildID, guildScheduledEventID), {
|
1705
1708
|
query: {
|
1706
1709
|
limit: options?.limit,
|
1707
1710
|
with_member: options?.withMember,
|
@@ -1710,7 +1713,7 @@ class Client extends node_events_1.default {
|
|
1710
1713
|
},
|
1711
1714
|
});
|
1712
1715
|
return response.map((guildScheduledEventUser) => ({
|
1713
|
-
|
1716
|
+
guildScheduledEventID: guildScheduledEventUser.guild_scheduled_event_id,
|
1714
1717
|
user: this.util.userFromRaw(guildScheduledEventUser.user),
|
1715
1718
|
member: guildScheduledEventUser.member !== undefined
|
1716
1719
|
? this.util.guildMemberFromRaw(guildScheduledEventUser.member)
|
@@ -1718,32 +1721,32 @@ class Client extends node_events_1.default {
|
|
1718
1721
|
}));
|
1719
1722
|
}
|
1720
1723
|
/** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
|
1721
|
-
async getGuildSticker(
|
1722
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSticker(
|
1724
|
+
async getGuildSticker(guildID, stickerID) {
|
1725
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSticker(guildID, stickerID));
|
1723
1726
|
return this.util.stickerFromRaw(response);
|
1724
1727
|
}
|
1725
1728
|
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
1726
|
-
async getGuildStickers(
|
1727
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildStickers(
|
1729
|
+
async getGuildStickers(guildID) {
|
1730
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildStickers(guildID));
|
1728
1731
|
return response.map((sticker) => this.util.stickerFromRaw(sticker));
|
1729
1732
|
}
|
1730
1733
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
1731
|
-
async getGuildTemplate(
|
1732
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplate(
|
1734
|
+
async getGuildTemplate(guildID, code) {
|
1735
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplate(guildID, code));
|
1733
1736
|
return this.util.guildTemplateFromRaw(response);
|
1734
1737
|
}
|
1735
1738
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
|
1736
|
-
async getGuildTemplates(
|
1737
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplates(
|
1739
|
+
async getGuildTemplates(guildID) {
|
1740
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplates(guildID));
|
1738
1741
|
return response.map((guildTemplate) => this.util.guildTemplateFromRaw(guildTemplate));
|
1739
1742
|
}
|
1740
1743
|
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
1741
|
-
getGuildVanityURL(
|
1742
|
-
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVanityURL(
|
1744
|
+
getGuildVanityURL(guildID) {
|
1745
|
+
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVanityURL(guildID));
|
1743
1746
|
}
|
1744
1747
|
/** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
|
1745
|
-
async getGuildVoiceRegions(
|
1746
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVoiceRegions(
|
1748
|
+
async getGuildVoiceRegions(guildID) {
|
1749
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVoiceRegions(guildID));
|
1747
1750
|
return response.map((voiceRegion) => ({
|
1748
1751
|
id: voiceRegion.id,
|
1749
1752
|
name: voiceRegion.name,
|
@@ -1753,21 +1756,21 @@ class Client extends node_events_1.default {
|
|
1753
1756
|
}));
|
1754
1757
|
}
|
1755
1758
|
/** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
|
1756
|
-
async getGuildWelcomeScreen(
|
1757
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWelcomeScreen(
|
1759
|
+
async getGuildWelcomeScreen(guildID) {
|
1760
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWelcomeScreen(guildID));
|
1758
1761
|
return {
|
1759
1762
|
description: response.description,
|
1760
1763
|
welcomeChannels: response.welcome_channels.map((welcomeScreenChannel) => ({
|
1761
|
-
|
1764
|
+
channelID: welcomeScreenChannel.channel_id,
|
1762
1765
|
description: welcomeScreenChannel.description,
|
1763
|
-
|
1766
|
+
emojiID: welcomeScreenChannel.emoji_id,
|
1764
1767
|
emojiName: welcomeScreenChannel.emoji_name,
|
1765
1768
|
})),
|
1766
1769
|
};
|
1767
1770
|
}
|
1768
1771
|
/** https://discord.com/developers/docs/resources/guild#get-guild-widget */
|
1769
|
-
async getGuildWidget(
|
1770
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWidgetJSON(
|
1772
|
+
async getGuildWidget(guildID) {
|
1773
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWidgetJSON(guildID));
|
1771
1774
|
return {
|
1772
1775
|
id: response.id,
|
1773
1776
|
name: response.name,
|
@@ -1778,35 +1781,35 @@ class Client extends node_events_1.default {
|
|
1778
1781
|
};
|
1779
1782
|
}
|
1780
1783
|
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
|
1781
|
-
getGuildWidgetImage(
|
1782
|
-
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWidgetImage(
|
1784
|
+
getGuildWidgetImage(guildID, options) {
|
1785
|
+
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWidgetImage(guildID), {
|
1783
1786
|
query: {
|
1784
1787
|
style: options?.style,
|
1785
1788
|
},
|
1786
1789
|
});
|
1787
1790
|
}
|
1788
1791
|
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
|
1789
|
-
async getGuildWidgetSettings(
|
1790
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWidgetSettings(
|
1792
|
+
async getGuildWidgetSettings(guildID) {
|
1793
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWidgetSettings(guildID));
|
1791
1794
|
return {
|
1792
1795
|
enabled: response.enabled,
|
1793
|
-
|
1796
|
+
channelID: response.channel_id,
|
1794
1797
|
};
|
1795
1798
|
}
|
1796
1799
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message */
|
1797
|
-
async getInteractionFollowupMessage(
|
1798
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.webhookMessage(
|
1800
|
+
async getInteractionFollowupMessage(applicationID, interactionToken, messageID, options) {
|
1801
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.webhookMessage(applicationID, interactionToken, messageID), {
|
1799
1802
|
query: {
|
1800
|
-
thread_id: options?.
|
1803
|
+
thread_id: options?.threadID,
|
1801
1804
|
},
|
1802
1805
|
});
|
1803
1806
|
return this.util.messageFromRaw(response);
|
1804
1807
|
}
|
1805
1808
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response */
|
1806
|
-
async getInteractionResponse(
|
1807
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.webhookMessage(
|
1809
|
+
async getInteractionResponse(applicationID, interactionToken, options) {
|
1810
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.webhookMessage(applicationID, interactionToken), {
|
1808
1811
|
query: {
|
1809
|
-
thread_id: options?.
|
1812
|
+
thread_id: options?.threadID,
|
1810
1813
|
},
|
1811
1814
|
});
|
1812
1815
|
return this.util.messageFromRaw(response);
|
@@ -1817,14 +1820,14 @@ class Client extends node_events_1.default {
|
|
1817
1820
|
query: {
|
1818
1821
|
with_counts: options?.withCounts,
|
1819
1822
|
with_expiration: options?.withExpiration,
|
1820
|
-
guild_scheduled_event_id: options?.
|
1823
|
+
guild_scheduled_event_id: options?.guildScheduledEventID,
|
1821
1824
|
},
|
1822
1825
|
});
|
1823
1826
|
return this.util.inviteFromRaw(response);
|
1824
1827
|
}
|
1825
1828
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
1826
|
-
async getJoinedPrivateArchivedThreads(
|
1827
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelThreads(
|
1829
|
+
async getJoinedPrivateArchivedThreads(channelID, options) {
|
1830
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelThreads(channelID, "private", true), {
|
1828
1831
|
query: {
|
1829
1832
|
before: options?.before,
|
1830
1833
|
limit: options?.limit,
|
@@ -1837,13 +1840,13 @@ class Client extends node_events_1.default {
|
|
1837
1840
|
};
|
1838
1841
|
}
|
1839
1842
|
/** https://discord.com/developers/docs/resources/channel#get-channel-message */
|
1840
|
-
async getMessage(
|
1841
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(
|
1843
|
+
async getMessage(channelID, messageID) {
|
1844
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(channelID, messageID));
|
1842
1845
|
return this.util.messageFromRaw(response);
|
1843
1846
|
}
|
1844
1847
|
/** https://discord.com/developers/docs/resources/channel#get-reactions */
|
1845
|
-
async getMessageReactions(
|
1846
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessageAllReactions(
|
1848
|
+
async getMessageReactions(channelID, messageID, emoji, options) {
|
1849
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessageAllReactions(channelID, messageID, emoji), {
|
1847
1850
|
query: {
|
1848
1851
|
type: options?.type,
|
1849
1852
|
after: options?.after,
|
@@ -1853,8 +1856,8 @@ class Client extends node_events_1.default {
|
|
1853
1856
|
return response.map((user) => this.util.userFromRaw(user));
|
1854
1857
|
}
|
1855
1858
|
/** https://discord.com/developers/docs/resources/channel#get-channel-messages */
|
1856
|
-
async getMessages(
|
1857
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessages(
|
1859
|
+
async getMessages(channelID, options) {
|
1860
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessages(channelID), {
|
1858
1861
|
query: {
|
1859
1862
|
around: options.around,
|
1860
1863
|
before: options.before,
|
@@ -1882,13 +1885,13 @@ class Client extends node_events_1.default {
|
|
1882
1885
|
};
|
1883
1886
|
}
|
1884
1887
|
/** https://discord.com/developers/docs/resources/channel#get-pinned-messages */
|
1885
|
-
async getPinnedMessages(
|
1886
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelPins(
|
1888
|
+
async getPinnedMessages(channelID) {
|
1889
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelPins(channelID));
|
1887
1890
|
return response.map((message) => this.util.messageFromRaw(message));
|
1888
1891
|
}
|
1889
1892
|
/** https://discord.com/developers/docs/resources/poll#get-answer-voters */
|
1890
|
-
async getPollAnswerVoters(
|
1891
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.pollAnswerVoters(
|
1893
|
+
async getPollAnswerVoters(channelID, messageID, answerID, options) {
|
1894
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.pollAnswerVoters(channelID, messageID, answerID), {
|
1892
1895
|
query: {
|
1893
1896
|
after: options?.after,
|
1894
1897
|
limit: options?.limit,
|
@@ -1899,13 +1902,13 @@ class Client extends node_events_1.default {
|
|
1899
1902
|
};
|
1900
1903
|
}
|
1901
1904
|
/** https://discord.com/developers/docs/monetization/skus#list-skus */
|
1902
|
-
async getSKUs(
|
1903
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationSKUs(
|
1905
|
+
async getSKUs(applicationID) {
|
1906
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationSKUs(applicationID));
|
1904
1907
|
return response.map((sku) => this.util.skuFromRaw(sku));
|
1905
1908
|
}
|
1906
1909
|
/** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
|
1907
|
-
async getStageInstance(
|
1908
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.stageInstance(
|
1910
|
+
async getStageInstance(channelID) {
|
1911
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.stageInstance(channelID));
|
1909
1912
|
return this.util.stageInstanceFromRaw(response);
|
1910
1913
|
}
|
1911
1914
|
/** https://discord.com/developers/docs/resources/sticker#list-sticker-packs */
|
@@ -1916,23 +1919,23 @@ class Client extends node_events_1.default {
|
|
1916
1919
|
id: stickerPack.id,
|
1917
1920
|
stickers: stickerPack.stickers.map((sticker) => this.util.stickerFromRaw(sticker)),
|
1918
1921
|
name: stickerPack.name,
|
1919
|
-
|
1920
|
-
|
1922
|
+
skuID: stickerPack.sku_id,
|
1923
|
+
coverStickerID: stickerPack.cover_sticker_id,
|
1921
1924
|
description: stickerPack.description,
|
1922
|
-
|
1925
|
+
bannerAssetID: stickerPack.banner_asset_id,
|
1923
1926
|
})),
|
1924
1927
|
};
|
1925
1928
|
}
|
1926
1929
|
/** https://discord.com/developers/docs/resources/channel#get-thread-member */
|
1927
|
-
async getThreadMember(
|
1928
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.threadMembers(
|
1930
|
+
async getThreadMember(channelID, userID, options) {
|
1931
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.threadMembers(channelID, userID), {
|
1929
1932
|
query: {
|
1930
1933
|
with_member: options?.withMember,
|
1931
1934
|
},
|
1932
1935
|
});
|
1933
1936
|
return {
|
1934
1937
|
id: response.id,
|
1935
|
-
|
1938
|
+
userID: response.user_id,
|
1936
1939
|
joinTimestamp: response.join_timestamp,
|
1937
1940
|
flags: response.flags,
|
1938
1941
|
member: response.member !== undefined
|
@@ -1941,8 +1944,8 @@ class Client extends node_events_1.default {
|
|
1941
1944
|
};
|
1942
1945
|
}
|
1943
1946
|
/** https://discord.com/developers/docs/resources/channel#list-thread-members */
|
1944
|
-
async getThreadMembers(
|
1945
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.threadMembers(
|
1947
|
+
async getThreadMembers(channelID, options) {
|
1948
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.threadMembers(channelID), {
|
1946
1949
|
query: {
|
1947
1950
|
with_member: options?.withMember,
|
1948
1951
|
after: options?.after,
|
@@ -1952,8 +1955,8 @@ class Client extends node_events_1.default {
|
|
1952
1955
|
return response.map((threadMember) => this.util.threadMemberFromRaw(threadMember));
|
1953
1956
|
}
|
1954
1957
|
/** https://discord.com/developers/docs/resources/user#get-user */
|
1955
|
-
async getUser(
|
1956
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.user(
|
1958
|
+
async getUser(userID) {
|
1959
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.user(userID));
|
1957
1960
|
return this.util.userFromRaw(response);
|
1958
1961
|
}
|
1959
1962
|
/** https://discord.com/developers/docs/resources/voice#list-voice-regions */
|
@@ -1968,90 +1971,85 @@ class Client extends node_events_1.default {
|
|
1968
1971
|
}));
|
1969
1972
|
}
|
1970
1973
|
/** https://discord.com/developers/docs/resources/webhook#get-webhook-message */
|
1971
|
-
async getWebhookMessage(
|
1972
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.webhookMessage(
|
1974
|
+
async getWebhookMessage(webhookID, webhookToken, messageID, options) {
|
1975
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.webhookMessage(webhookID, webhookToken, messageID), {
|
1973
1976
|
query: {
|
1974
|
-
thread_id: options?.
|
1977
|
+
thread_id: options?.threadID,
|
1975
1978
|
},
|
1976
1979
|
});
|
1977
1980
|
return this.util.messageFromRaw(response);
|
1978
1981
|
}
|
1979
1982
|
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
1980
|
-
async getWebhooks(
|
1981
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWebhooks(
|
1983
|
+
async getWebhooks(guildID) {
|
1984
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWebhooks(guildID));
|
1982
1985
|
return response.map((webhook) => this.util.webhookFromRaw(webhook));
|
1983
1986
|
}
|
1984
1987
|
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
1985
|
-
joinThread(
|
1986
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(
|
1988
|
+
joinThread(channelID) {
|
1989
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID, "@me"));
|
1987
1990
|
}
|
1988
1991
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
1989
|
-
joinVoiceChannel(
|
1990
|
-
this.shards.get(this.guildShardMap[
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
self_deaf: !!options?.selfDeaf,
|
1997
|
-
},
|
1998
|
-
}));
|
1992
|
+
joinVoiceChannel(guildID, channelID, options) {
|
1993
|
+
this.shards.get(this.guildShardMap[guildID])?.updateVoiceState({
|
1994
|
+
guildID: guildID,
|
1995
|
+
channelID: channelID,
|
1996
|
+
selfMute: !!options?.selfMute,
|
1997
|
+
selfDeaf: !!options?.selfDeaf,
|
1998
|
+
});
|
1999
1999
|
}
|
2000
2000
|
/** https://discord.com/developers/docs/resources/user#leave-guild */
|
2001
|
-
leaveGuild(
|
2002
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.userGuild(
|
2001
|
+
leaveGuild(guildID) {
|
2002
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.userGuild(guildID));
|
2003
2003
|
}
|
2004
2004
|
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
2005
|
-
leaveThread(
|
2006
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(
|
2005
|
+
leaveThread(channelID) {
|
2006
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID, "@me"));
|
2007
2007
|
}
|
2008
2008
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
2009
|
-
leaveVoiceChannel(
|
2010
|
-
this.
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
},
|
2018
|
-
}));
|
2009
|
+
leaveVoiceChannel(guildID) {
|
2010
|
+
this.voiceConnections.disconnect(guildID);
|
2011
|
+
this.shards.get(this.guildShardMap[guildID])?.updateVoiceState({
|
2012
|
+
guildID: guildID,
|
2013
|
+
channelID: null,
|
2014
|
+
selfMute: false,
|
2015
|
+
selfDeaf: false,
|
2016
|
+
});
|
2019
2017
|
}
|
2020
2018
|
/** https://discord.com/developers/docs/resources/channel#pin-message */
|
2021
|
-
pinMessage(
|
2022
|
-
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelPin(
|
2019
|
+
pinMessage(channelID, messageID, reason) {
|
2020
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelPin(channelID, messageID), {
|
2023
2021
|
reason,
|
2024
2022
|
});
|
2025
2023
|
}
|
2026
2024
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
2027
|
-
removeBan(
|
2028
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildBan(
|
2025
|
+
removeBan(guildID, userID, reason) {
|
2026
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildBan(guildID, userID), {
|
2029
2027
|
reason,
|
2030
2028
|
});
|
2031
2029
|
}
|
2032
2030
|
/** https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient */
|
2033
|
-
removeGroupRecipient(
|
2034
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelRecipient(
|
2031
|
+
removeGroupRecipient(channelID, userID) {
|
2032
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelRecipient(channelID, userID));
|
2035
2033
|
}
|
2036
2034
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-member */
|
2037
|
-
removeGuildMember(
|
2038
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildMember(
|
2035
|
+
removeGuildMember(guildID, userID, reason) {
|
2036
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildMember(guildID, userID), {
|
2039
2037
|
reason,
|
2040
2038
|
});
|
2041
2039
|
}
|
2042
2040
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
2043
|
-
removeGuildMemberRole(
|
2044
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildMemberRole(
|
2041
|
+
removeGuildMemberRole(guildID, userID, roleID, reason) {
|
2042
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildMemberRole(guildID, userID, roleID), {
|
2045
2043
|
reason,
|
2046
2044
|
});
|
2047
2045
|
}
|
2048
2046
|
/** https://discord.com/developers/docs/resources/channel#remove-thread-member */
|
2049
|
-
removeThreadMember(
|
2050
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(
|
2047
|
+
removeThreadMember(channelID, userID) {
|
2048
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID, userID));
|
2051
2049
|
}
|
2052
2050
|
/** https://discord.com/developers/docs/resources/guild#search-guild-members */
|
2053
|
-
async searchGuildMembers(
|
2054
|
-
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMembersSearch(
|
2051
|
+
async searchGuildMembers(guildID, options) {
|
2052
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMembersSearch(guildID), {
|
2055
2053
|
query: {
|
2056
2054
|
query: options.query,
|
2057
2055
|
limit: options.limit,
|
@@ -2061,21 +2059,20 @@ class Client extends node_events_1.default {
|
|
2061
2059
|
}
|
2062
2060
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
2063
2061
|
setPresence(options) {
|
2064
|
-
|
2065
|
-
shard.updatePresence(options);
|
2062
|
+
this.shards.updatePresence(options);
|
2066
2063
|
}
|
2067
2064
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
2068
|
-
async syncGuildTemplate(
|
2069
|
-
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildTemplate(
|
2065
|
+
async syncGuildTemplate(guildID, code) {
|
2066
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildTemplate(guildID, code));
|
2070
2067
|
return this.util.guildTemplateFromRaw(response);
|
2071
2068
|
}
|
2072
2069
|
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
2073
|
-
triggerTypingIndicator(
|
2074
|
-
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelTyping(
|
2070
|
+
triggerTypingIndicator(channelID) {
|
2071
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelTyping(channelID));
|
2075
2072
|
}
|
2076
2073
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
2077
|
-
async updateApplicationRoleConnectionMetadataRecords(
|
2078
|
-
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationRoleConnectionMetadata(
|
2074
|
+
async updateApplicationRoleConnectionMetadataRecords(applicationID) {
|
2075
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationID));
|
2079
2076
|
return response.map((applicationRoleConnectionMetadata) => ({
|
2080
2077
|
type: applicationRoleConnectionMetadata.type,
|
2081
2078
|
key: applicationRoleConnectionMetadata.key,
|
@@ -2108,8 +2105,8 @@ class Client extends node_events_1.default {
|
|
2108
2105
|
};
|
2109
2106
|
}
|
2110
2107
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
2111
|
-
unpinMessage(
|
2112
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(
|
2108
|
+
unpinMessage(channelID, messageID, reason) {
|
2109
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(channelID, messageID), {
|
2113
2110
|
reason,
|
2114
2111
|
});
|
2115
2112
|
}
|