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