@discordjs/core 0.4.0-dev.1677456628-ffdb197.0 → 0.4.0
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/CHANGELOG.md +28 -0
- package/README.md +2 -2
- package/dist/index.d.ts +18 -17
- package/dist/index.js +1354 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1365 -139
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -47,75 +47,186 @@ var ApplicationCommandsAPI = class {
|
|
|
47
47
|
constructor(rest) {
|
|
48
48
|
this.rest = rest;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Fetches all global commands for a application
|
|
52
|
+
*
|
|
53
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands}
|
|
54
|
+
* @param applicationId - The application id to fetch commands for
|
|
55
|
+
* @param options - The options to use when fetching commands
|
|
56
|
+
*/
|
|
50
57
|
async getGlobalCommands(applicationId, options = {}) {
|
|
51
58
|
return this.rest.get(import_v10.Routes.applicationCommands(applicationId), {
|
|
52
59
|
query: (0, import_rest.makeURLSearchParams)(options)
|
|
53
60
|
});
|
|
54
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new global command
|
|
64
|
+
*
|
|
65
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command}
|
|
66
|
+
* @param applicationId - The application id to create the command for
|
|
67
|
+
* @param data - The data to use when creating the command
|
|
68
|
+
*/
|
|
55
69
|
async createGlobalCommand(applicationId, data) {
|
|
56
70
|
return this.rest.post(import_v10.Routes.applicationCommands(applicationId), {
|
|
57
71
|
body: data
|
|
58
72
|
});
|
|
59
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Fetches a global command
|
|
76
|
+
*
|
|
77
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command}
|
|
78
|
+
* @param applicationId - The application id to fetch the command from
|
|
79
|
+
* @param commandId - The command id to fetch
|
|
80
|
+
*/
|
|
60
81
|
async getGlobalCommand(applicationId, commandId) {
|
|
61
|
-
return this.rest.get(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
return this.rest.get(import_v10.Routes.applicationCommand(applicationId, commandId));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Edits a global command
|
|
86
|
+
*
|
|
87
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command}
|
|
88
|
+
* @param applicationId - The application id of the command
|
|
89
|
+
* @param commandId - The id of the command to edit
|
|
90
|
+
* @param data - The data to use when editing the command
|
|
91
|
+
*/
|
|
65
92
|
async editGlobalCommand(applicationId, commandId, data) {
|
|
66
93
|
return this.rest.patch(import_v10.Routes.applicationCommand(applicationId, commandId), {
|
|
67
94
|
body: data
|
|
68
95
|
});
|
|
69
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Deletes a global command
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command}
|
|
101
|
+
* @param applicationId - The application id of the command
|
|
102
|
+
* @param commandId - The id of the command to delete
|
|
103
|
+
*/
|
|
70
104
|
async deleteGlobalCommand(applicationId, commandId) {
|
|
71
105
|
await this.rest.delete(import_v10.Routes.applicationCommand(applicationId, commandId));
|
|
72
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Overwrites global commands
|
|
109
|
+
*
|
|
110
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands}
|
|
111
|
+
* @param applicationId - The application id to overwrite commands for
|
|
112
|
+
* @param data - The data to use when overwriting commands
|
|
113
|
+
*/
|
|
73
114
|
async bulkOverwriteGlobalCommands(applicationId, data) {
|
|
74
115
|
return this.rest.put(import_v10.Routes.applicationCommands(applicationId), {
|
|
75
116
|
body: data
|
|
76
117
|
});
|
|
77
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Fetches all commands for a guild
|
|
121
|
+
*
|
|
122
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands}
|
|
123
|
+
* @param applicationId - The application id to fetch commands for
|
|
124
|
+
* @param guildId - The guild id to fetch commands for
|
|
125
|
+
* @param data - The data to use when fetching commands
|
|
126
|
+
*/
|
|
78
127
|
async getGuildCommands(applicationId, guildId, data = {}) {
|
|
79
128
|
return this.rest.get(import_v10.Routes.applicationGuildCommands(applicationId, guildId), {
|
|
80
129
|
query: (0, import_rest.makeURLSearchParams)(data)
|
|
81
130
|
});
|
|
82
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new command for a guild
|
|
134
|
+
*
|
|
135
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command}
|
|
136
|
+
* @param applicationId - The application id to create the command for
|
|
137
|
+
* @param guildId - The guild id to create the command for
|
|
138
|
+
* @param data - The data to use when creating the command
|
|
139
|
+
*/
|
|
83
140
|
async createGuildCommand(applicationId, guildId, data) {
|
|
84
141
|
return this.rest.post(import_v10.Routes.applicationGuildCommands(applicationId, guildId), {
|
|
85
142
|
body: data
|
|
86
143
|
});
|
|
87
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Fetches a guild command
|
|
147
|
+
*
|
|
148
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command}
|
|
149
|
+
* @param applicationId - The application id to fetch the command from
|
|
150
|
+
* @param guildId - The guild id to fetch the command from
|
|
151
|
+
* @param commandId - The command id to fetch
|
|
152
|
+
*/
|
|
88
153
|
async getGuildCommand(applicationId, guildId, commandId) {
|
|
89
|
-
return this.rest.get(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
154
|
+
return this.rest.get(import_v10.Routes.applicationGuildCommand(applicationId, guildId, commandId));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Edits a guild command
|
|
158
|
+
*
|
|
159
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
|
|
160
|
+
* @param applicationId - The application id of the command
|
|
161
|
+
* @param guildId - The guild id of the command
|
|
162
|
+
* @param commandId - The command id to edit
|
|
163
|
+
* @param data - The data to use when editing the command
|
|
164
|
+
*/
|
|
93
165
|
async editGuildCommand(applicationId, guildId, commandId, data) {
|
|
94
166
|
return this.rest.patch(import_v10.Routes.applicationGuildCommand(applicationId, guildId, commandId), {
|
|
95
167
|
body: data
|
|
96
168
|
});
|
|
97
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Deletes a guild command
|
|
172
|
+
*
|
|
173
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command}
|
|
174
|
+
* @param applicationId - The application id of the command
|
|
175
|
+
* @param guildId - The guild id of the command
|
|
176
|
+
* @param commandId - The id of the command to delete
|
|
177
|
+
*/
|
|
98
178
|
async deleteGuildCommand(applicationId, guildId, commandId) {
|
|
99
179
|
await this.rest.delete(import_v10.Routes.applicationGuildCommand(applicationId, guildId, commandId));
|
|
100
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Bulk overwrites guild commands
|
|
183
|
+
*
|
|
184
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands}
|
|
185
|
+
* @param applicationId - The application id to overwrite commands for
|
|
186
|
+
* @param guildId - The guild id to overwrite commands for
|
|
187
|
+
* @param data - The data to use when overwriting commands
|
|
188
|
+
*/
|
|
101
189
|
async bulkOverwriteGuildCommands(applicationId, guildId, data) {
|
|
102
190
|
return this.rest.put(import_v10.Routes.applicationGuildCommands(applicationId, guildId), {
|
|
103
191
|
body: data
|
|
104
192
|
});
|
|
105
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Fetches the permissions for a guild command
|
|
196
|
+
*
|
|
197
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions}
|
|
198
|
+
* @param applicationId - The application id to get the permissions for
|
|
199
|
+
* @param guildId - The guild id of the command
|
|
200
|
+
* @param commandId - The command id to get the permissions for
|
|
201
|
+
*/
|
|
106
202
|
async getGuildCommandPermissions(applicationId, guildId, commandId) {
|
|
107
|
-
return this.rest.get(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
203
|
+
return this.rest.get(import_v10.Routes.applicationCommandPermissions(applicationId, guildId, commandId));
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Fetches all permissions for all commands in a guild
|
|
207
|
+
*
|
|
208
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions}
|
|
209
|
+
* @param applicationId - The application id to get the permissions for
|
|
210
|
+
* @param guildId - The guild id to get the permissions for
|
|
211
|
+
*/
|
|
111
212
|
async getGuildCommandsPermissions(applicationId, guildId) {
|
|
112
|
-
return this.rest.get(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
213
|
+
return this.rest.get(import_v10.Routes.guildApplicationCommandsPermissions(applicationId, guildId));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Edits the permissions for a guild command
|
|
217
|
+
*
|
|
218
|
+
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions}
|
|
219
|
+
* @param userToken - The token of the user to edit permissions on behalf of
|
|
220
|
+
* @param applicationId - The application id to edit the permissions for
|
|
221
|
+
* @param guildId - The guild id to edit the permissions for
|
|
222
|
+
* @param commandId - The id of the command to edit the permissions for
|
|
223
|
+
* @param data - The data to use when editing the permissions
|
|
224
|
+
*/
|
|
116
225
|
async editGuildCommandPermissions(userToken, applicationId, guildId, commandId, data) {
|
|
117
226
|
return this.rest.put(import_v10.Routes.applicationCommandPermissions(applicationId, guildId, commandId), {
|
|
118
|
-
headers: {
|
|
227
|
+
headers: {
|
|
228
|
+
Authorization: `Bearer ${userToken.replace("Bearer ", "")}`
|
|
229
|
+
},
|
|
119
230
|
auth: false,
|
|
120
231
|
body: data
|
|
121
232
|
});
|
|
@@ -130,102 +241,304 @@ var ChannelsAPI = class {
|
|
|
130
241
|
constructor(rest) {
|
|
131
242
|
this.rest = rest;
|
|
132
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Sends a message in a channel
|
|
246
|
+
*
|
|
247
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#create-message}
|
|
248
|
+
* @param channelId - The id of the channel to send the message in
|
|
249
|
+
* @param data - The data to use when sending the message
|
|
250
|
+
*/
|
|
133
251
|
async createMessage(channelId, { files, ...body }) {
|
|
134
252
|
return this.rest.post(import_v102.Routes.channelMessages(channelId), {
|
|
135
253
|
files,
|
|
136
254
|
body
|
|
137
255
|
});
|
|
138
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Edits a message
|
|
259
|
+
*
|
|
260
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#edit-message}
|
|
261
|
+
* @param channelId - The id of the channel the message is in
|
|
262
|
+
* @param messageId - The id of the message to edit
|
|
263
|
+
* @param data - The data to use when editing the message
|
|
264
|
+
*/
|
|
139
265
|
async editMessage(channelId, messageId, { files, ...body }) {
|
|
140
266
|
return this.rest.patch(import_v102.Routes.channelMessage(channelId, messageId), {
|
|
141
267
|
files,
|
|
142
268
|
body
|
|
143
269
|
});
|
|
144
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Fetches the reactions for a message
|
|
273
|
+
*
|
|
274
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-reactions}
|
|
275
|
+
* @param channelId - The id of the channel the message is in
|
|
276
|
+
* @param messageId - The id of the message to get the reactions for
|
|
277
|
+
* @param emoji - The emoji to get the reactions for
|
|
278
|
+
* @param options - The options to use when fetching the reactions
|
|
279
|
+
*/
|
|
145
280
|
async getMessageReactions(channelId, messageId, emoji, options = {}) {
|
|
146
281
|
return this.rest.get(import_v102.Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), {
|
|
147
282
|
query: (0, import_rest2.makeURLSearchParams)(options)
|
|
148
283
|
});
|
|
149
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Deletes a reaction for the current user
|
|
287
|
+
*
|
|
288
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#delete-own-reaction}
|
|
289
|
+
* @param channelId - The id of the channel the message is in
|
|
290
|
+
* @param messageId - The id of the message to delete the reaction for
|
|
291
|
+
* @param emoji - The emoji to delete the reaction for
|
|
292
|
+
*/
|
|
150
293
|
async deleteOwnMessageReaction(channelId, messageId, emoji) {
|
|
151
294
|
await this.rest.delete(import_v102.Routes.channelMessageOwnReaction(channelId, messageId, encodeURIComponent(emoji)));
|
|
152
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Deletes a reaction for a user
|
|
298
|
+
*
|
|
299
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#delete-user-reaction}
|
|
300
|
+
* @param channelId - The id of the channel the message is in
|
|
301
|
+
* @param messageId - The id of the message to delete the reaction for
|
|
302
|
+
* @param emoji - The emoji to delete the reaction for
|
|
303
|
+
* @param userId - The id of the user to delete the reaction for
|
|
304
|
+
*/
|
|
153
305
|
async deleteUserMessageReaction(channelId, messageId, emoji, userId) {
|
|
154
306
|
await this.rest.delete(import_v102.Routes.channelMessageUserReaction(channelId, messageId, encodeURIComponent(emoji), userId));
|
|
155
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Deletes all reactions for a message
|
|
310
|
+
*
|
|
311
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#delete-all-reactions}
|
|
312
|
+
* @param channelId - The id of the channel the message is in
|
|
313
|
+
* @param messageId - The id of the message to delete the reactions for
|
|
314
|
+
*/
|
|
156
315
|
async deleteAllMessageReactions(channelId, messageId) {
|
|
157
316
|
await this.rest.delete(import_v102.Routes.channelMessageAllReactions(channelId, messageId));
|
|
158
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Deletes all reactions of an emoji for a message
|
|
320
|
+
*
|
|
321
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji}
|
|
322
|
+
* @param channelId - The id of the channel the message is in
|
|
323
|
+
* @param messageId - The id of the message to delete the reactions for
|
|
324
|
+
* @param emoji - The emoji to delete the reactions for
|
|
325
|
+
*/
|
|
159
326
|
async deleteAllMessageReactionsForEmoji(channelId, messageId, emoji) {
|
|
160
327
|
await this.rest.delete(import_v102.Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)));
|
|
161
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Adds a reaction to a message
|
|
331
|
+
*
|
|
332
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#create-reaction}
|
|
333
|
+
* @param channelId - The id of the channel the message is in
|
|
334
|
+
* @param messageId - The id of the message to add the reaction to
|
|
335
|
+
* @param emoji - The emoji to add the reaction with
|
|
336
|
+
*/
|
|
162
337
|
async addMessageReaction(channelId, messageId, emoji) {
|
|
163
338
|
await this.rest.put(import_v102.Routes.channelMessageOwnReaction(channelId, messageId, encodeURIComponent(emoji)));
|
|
164
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Fetches a channel
|
|
342
|
+
*
|
|
343
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel}
|
|
344
|
+
* @param channelId - The id of the channel
|
|
345
|
+
*/
|
|
165
346
|
async get(channelId) {
|
|
166
347
|
return this.rest.get(import_v102.Routes.channel(channelId));
|
|
167
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Edits a channel
|
|
351
|
+
*
|
|
352
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#modify-channel}
|
|
353
|
+
* @param channelId - The id of the channel to edit
|
|
354
|
+
* @param data - The new channel data
|
|
355
|
+
*/
|
|
168
356
|
async edit(channelId, data) {
|
|
169
|
-
return this.rest.patch(import_v102.Routes.channel(channelId), {
|
|
357
|
+
return this.rest.patch(import_v102.Routes.channel(channelId), {
|
|
358
|
+
body: data
|
|
359
|
+
});
|
|
170
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Deletes a channel
|
|
363
|
+
*
|
|
364
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#deleteclose-channel}
|
|
365
|
+
* @param channelId - The id of the channel to delete
|
|
366
|
+
*/
|
|
171
367
|
async delete(channelId) {
|
|
172
368
|
return this.rest.delete(import_v102.Routes.channel(channelId));
|
|
173
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Fetches the messages of a channel
|
|
372
|
+
*
|
|
373
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel-messages}
|
|
374
|
+
* @param channelId - The id of the channel to fetch messages from
|
|
375
|
+
* @param options - The options to use when fetching messages
|
|
376
|
+
*/
|
|
174
377
|
async getMessages(channelId, options = {}) {
|
|
175
378
|
return this.rest.get(import_v102.Routes.channelMessages(channelId), {
|
|
176
379
|
query: (0, import_rest2.makeURLSearchParams)(options)
|
|
177
380
|
});
|
|
178
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Shows a typing indicator in a channel
|
|
384
|
+
*
|
|
385
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#trigger-typing-indicator}
|
|
386
|
+
* @param channelId - The id of the channel to show the typing indicator in
|
|
387
|
+
*/
|
|
179
388
|
async showTyping(channelId) {
|
|
180
389
|
await this.rest.post(import_v102.Routes.channelTyping(channelId));
|
|
181
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Fetches the pinned messages of a channel
|
|
393
|
+
*
|
|
394
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-pinned-messages}
|
|
395
|
+
* @param channelId - The id of the channel to fetch pinned messages from
|
|
396
|
+
*/
|
|
182
397
|
async getPins(channelId) {
|
|
183
398
|
return this.rest.get(import_v102.Routes.channelPins(channelId));
|
|
184
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Pins a message in a channel
|
|
402
|
+
*
|
|
403
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#pin-message}
|
|
404
|
+
* @param channelId - The id of the channel to pin the message in
|
|
405
|
+
* @param messageId - The id of the message to pin
|
|
406
|
+
* @param reason - The reason for pinning the message
|
|
407
|
+
*/
|
|
185
408
|
async pinMessage(channelId, messageId, reason) {
|
|
186
|
-
await this.rest.put(import_v102.Routes.channelPin(channelId, messageId), {
|
|
409
|
+
await this.rest.put(import_v102.Routes.channelPin(channelId, messageId), {
|
|
410
|
+
reason
|
|
411
|
+
});
|
|
187
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Deletes a message
|
|
415
|
+
*
|
|
416
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#delete-message}
|
|
417
|
+
* @param channelId - The id of the channel the message is in
|
|
418
|
+
* @param messageId - The id of the message to delete
|
|
419
|
+
* @param reason - The reason for deleting the message
|
|
420
|
+
*/
|
|
188
421
|
async deleteMessage(channelId, messageId, reason) {
|
|
189
|
-
await this.rest.delete(import_v102.Routes.channelMessage(channelId, messageId), {
|
|
422
|
+
await this.rest.delete(import_v102.Routes.channelMessage(channelId, messageId), {
|
|
423
|
+
reason
|
|
424
|
+
});
|
|
190
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* Bulk deletes messages
|
|
428
|
+
*
|
|
429
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#bulk-delete-messages}
|
|
430
|
+
* @param channelId - The id of the channel the messages are in
|
|
431
|
+
* @param messageIds - The ids of the messages to delete
|
|
432
|
+
*/
|
|
191
433
|
async bulkDeleteMessages(channelId, messageIds, reason) {
|
|
192
|
-
await this.rest.post(import_v102.Routes.channelBulkDelete(channelId), {
|
|
434
|
+
await this.rest.post(import_v102.Routes.channelBulkDelete(channelId), {
|
|
435
|
+
reason,
|
|
436
|
+
body: {
|
|
437
|
+
messages: messageIds
|
|
438
|
+
}
|
|
439
|
+
});
|
|
193
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Fetches a message
|
|
443
|
+
*
|
|
444
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel-message}
|
|
445
|
+
* @param channelId - The id of the channel the message is in
|
|
446
|
+
* @param messageId - The id of the message to fetch
|
|
447
|
+
*/
|
|
194
448
|
async getMessage(channelId, messageId) {
|
|
195
449
|
return this.rest.get(import_v102.Routes.channelMessage(channelId, messageId));
|
|
196
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Crossposts a message
|
|
453
|
+
*
|
|
454
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#crosspost-message}
|
|
455
|
+
* @param channelId - The id of the channel the message is in
|
|
456
|
+
* @param messageId - The id of the message to crosspost
|
|
457
|
+
*/
|
|
197
458
|
async crosspostMessage(channelId, messageId) {
|
|
198
|
-
return this.rest.post(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
459
|
+
return this.rest.post(import_v102.Routes.channelMessageCrosspost(channelId, messageId));
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Unpins a message in a channel
|
|
463
|
+
*
|
|
464
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#unpin-message}
|
|
465
|
+
* @param channelId - The id of the channel to unpin the message in
|
|
466
|
+
* @param messageId - The id of the message to unpin
|
|
467
|
+
* @param reason - The reason for unpinning the message
|
|
468
|
+
*/
|
|
202
469
|
async unpinMessage(channelId, messageId, reason) {
|
|
203
|
-
await this.rest.delete(import_v102.Routes.channelPin(channelId, messageId), {
|
|
470
|
+
await this.rest.delete(import_v102.Routes.channelPin(channelId, messageId), {
|
|
471
|
+
reason
|
|
472
|
+
});
|
|
204
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Follows an announcement channel
|
|
476
|
+
*
|
|
477
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#follow-announcement-channel}
|
|
478
|
+
* @param channelId - The id of the announcement channel to follow
|
|
479
|
+
* @param webhookChannelId - The id of the webhook channel to follow the announcements in
|
|
480
|
+
*/
|
|
205
481
|
async followAnnouncements(channelId, webhookChannelId) {
|
|
206
482
|
return this.rest.post(import_v102.Routes.channelFollowers(channelId), {
|
|
207
|
-
body: {
|
|
483
|
+
body: {
|
|
484
|
+
webhook_channel_id: webhookChannelId
|
|
485
|
+
}
|
|
208
486
|
});
|
|
209
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Creates a new invite for a channel
|
|
490
|
+
*
|
|
491
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#create-channel-invite}
|
|
492
|
+
* @param channelId - The id of the channel to create an invite for
|
|
493
|
+
* @param data - The data to use when creating the invite
|
|
494
|
+
*/
|
|
210
495
|
async createInvite(channelId, data, reason) {
|
|
211
496
|
return this.rest.post(import_v102.Routes.channelInvites(channelId), {
|
|
212
497
|
reason,
|
|
213
498
|
body: data
|
|
214
499
|
});
|
|
215
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* Fetches the invites of a channel
|
|
503
|
+
*
|
|
504
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel-invites}
|
|
505
|
+
* @param channelId - The id of the channel to fetch invites from
|
|
506
|
+
*/
|
|
216
507
|
async getInvites(channelId) {
|
|
217
508
|
return this.rest.get(import_v102.Routes.channelInvites(channelId));
|
|
218
509
|
}
|
|
510
|
+
/**
|
|
511
|
+
* Fetches the archived threads of a channel
|
|
512
|
+
*
|
|
513
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#list-public-archived-threads}
|
|
514
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#list-private-archived-threads}
|
|
515
|
+
* @param channelId - The id of the channel to fetch archived threads from
|
|
516
|
+
* @param archivedStatus - The archived status of the threads to fetch
|
|
517
|
+
* @param options - The options to use when fetching archived threads
|
|
518
|
+
*/
|
|
219
519
|
async getArchivedThreads(channelId, archivedStatus, options = {}) {
|
|
220
520
|
return this.rest.get(import_v102.Routes.channelThreads(channelId, archivedStatus), {
|
|
221
521
|
query: (0, import_rest2.makeURLSearchParams)(options)
|
|
222
522
|
});
|
|
223
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* Fetches the private joined archived threads of a channel
|
|
526
|
+
*
|
|
527
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads}
|
|
528
|
+
* @param channelId - The id of the channel to fetch joined archived threads from
|
|
529
|
+
* @param options - The options to use when fetching joined archived threads
|
|
530
|
+
*/
|
|
224
531
|
async getJoinedPrivateArchivedThreads(channelId, options = {}) {
|
|
225
532
|
return this.rest.get(import_v102.Routes.channelJoinedArchivedThreads(channelId), {
|
|
226
533
|
query: (0, import_rest2.makeURLSearchParams)(options)
|
|
227
534
|
});
|
|
228
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* Fetches the webhooks of a channel
|
|
538
|
+
*
|
|
539
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#get-channel-webhooks}
|
|
540
|
+
* @param id - The id of the channel
|
|
541
|
+
*/
|
|
229
542
|
async getWebhooks(id) {
|
|
230
543
|
return this.rest.get(import_v102.Routes.channelWebhooks(id));
|
|
231
544
|
}
|
|
@@ -239,278 +552,828 @@ var GuildsAPI = class {
|
|
|
239
552
|
constructor(rest) {
|
|
240
553
|
this.rest = rest;
|
|
241
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Fetches a guild
|
|
557
|
+
*
|
|
558
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild}
|
|
559
|
+
* @param guildId - The id of the guild
|
|
560
|
+
*/
|
|
242
561
|
async get(guildId) {
|
|
243
562
|
return this.rest.get(import_v103.Routes.guild(guildId));
|
|
244
563
|
}
|
|
564
|
+
/**
|
|
565
|
+
* Fetches a guild preview
|
|
566
|
+
*
|
|
567
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-preview}
|
|
568
|
+
* @param guildId - The id of the guild to fetch the preview from
|
|
569
|
+
*/
|
|
245
570
|
async getPreview(guildId) {
|
|
246
571
|
return this.rest.get(import_v103.Routes.guildPreview(guildId));
|
|
247
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Creates a guild
|
|
575
|
+
*
|
|
576
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild}
|
|
577
|
+
* @param data - The guild to create
|
|
578
|
+
*/
|
|
248
579
|
async create(data) {
|
|
249
|
-
return this.rest.post(import_v103.Routes.guilds(), {
|
|
580
|
+
return this.rest.post(import_v103.Routes.guilds(), {
|
|
581
|
+
body: data
|
|
582
|
+
});
|
|
250
583
|
}
|
|
584
|
+
/**
|
|
585
|
+
* Edits a guild
|
|
586
|
+
*
|
|
587
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild}
|
|
588
|
+
* @param guildId - The id of the guild to edit
|
|
589
|
+
* @param data - The new guild data
|
|
590
|
+
* @param reason - The reason for editing this guild
|
|
591
|
+
*/
|
|
251
592
|
async edit(guildId, data, reason) {
|
|
252
|
-
return this.rest.patch(import_v103.Routes.guild(guildId), {
|
|
593
|
+
return this.rest.patch(import_v103.Routes.guild(guildId), {
|
|
594
|
+
reason,
|
|
595
|
+
body: data
|
|
596
|
+
});
|
|
253
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Deletes a guild
|
|
600
|
+
*
|
|
601
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#delete-guild}
|
|
602
|
+
* @param guildId - The id of the guild to delete
|
|
603
|
+
* @param reason - The reason for deleting this guild
|
|
604
|
+
*/
|
|
254
605
|
async delete(guildId, reason) {
|
|
255
|
-
await this.rest.delete(import_v103.Routes.guild(guildId), {
|
|
606
|
+
await this.rest.delete(import_v103.Routes.guild(guildId), {
|
|
607
|
+
reason
|
|
608
|
+
});
|
|
256
609
|
}
|
|
610
|
+
/**
|
|
611
|
+
* Fetches all the members of a guild
|
|
612
|
+
*
|
|
613
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#list-guild-members}
|
|
614
|
+
* @param guildId - The id of the guild
|
|
615
|
+
* @param options - The options to use when fetching the guild members
|
|
616
|
+
*/
|
|
257
617
|
async getMembers(guildId, options = {}) {
|
|
258
618
|
return this.rest.get(import_v103.Routes.guildMembers(guildId), {
|
|
259
619
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
260
620
|
});
|
|
261
621
|
}
|
|
622
|
+
/**
|
|
623
|
+
* Fetches a guild's channels
|
|
624
|
+
*
|
|
625
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels}
|
|
626
|
+
* @param guildId - The id of the guild to fetch the channels from
|
|
627
|
+
*/
|
|
262
628
|
async getChannels(guildId) {
|
|
263
629
|
return this.rest.get(import_v103.Routes.guildChannels(guildId));
|
|
264
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Creates a guild channel
|
|
633
|
+
*
|
|
634
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel}
|
|
635
|
+
* @param guildId - The id of the guild to create the channel in
|
|
636
|
+
* @param data - The data to create the new channel
|
|
637
|
+
* @param reason - The reason for creating this channel
|
|
638
|
+
*/
|
|
265
639
|
async createChannel(guildId, data, reason) {
|
|
266
640
|
return this.rest.post(import_v103.Routes.guildChannels(guildId), {
|
|
267
641
|
reason,
|
|
268
642
|
body: data
|
|
269
643
|
});
|
|
270
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Edits a guild channel's positions
|
|
647
|
+
*
|
|
648
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions}
|
|
649
|
+
* @param guildId - The id of the guild to edit the channel positions from
|
|
650
|
+
* @param data - The data to edit the channel positions with
|
|
651
|
+
* @param reason - The reason for editing the channel positions
|
|
652
|
+
*/
|
|
271
653
|
async setChannelPositions(guildId, data, reason) {
|
|
272
|
-
await this.rest.patch(import_v103.Routes.guildChannels(guildId), {
|
|
654
|
+
await this.rest.patch(import_v103.Routes.guildChannels(guildId), {
|
|
655
|
+
reason,
|
|
656
|
+
body: data
|
|
657
|
+
});
|
|
273
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* Fetches the active threads in a guild
|
|
661
|
+
*
|
|
662
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#list-active-guild-threads}
|
|
663
|
+
* @param guildId - The id of the guild to fetch the active threads from
|
|
664
|
+
*/
|
|
274
665
|
async getActiveThreads(guildId) {
|
|
275
666
|
return this.rest.get(import_v103.Routes.guildActiveThreads(guildId));
|
|
276
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* Fetches a guild member ban
|
|
670
|
+
*
|
|
671
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans}
|
|
672
|
+
* @param guildId - The id of the guild to fetch the ban from
|
|
673
|
+
*/
|
|
277
674
|
async getMemberBans(guildId) {
|
|
278
675
|
return this.rest.get(import_v103.Routes.guildBans(guildId));
|
|
279
676
|
}
|
|
677
|
+
/**
|
|
678
|
+
* Bans a user from a guild
|
|
679
|
+
*
|
|
680
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-ban}
|
|
681
|
+
* @param guildId - The id of the guild to ban the member in
|
|
682
|
+
* @param userId - The id of the user to ban
|
|
683
|
+
* @param options - Options for banning the user
|
|
684
|
+
* @param reason - The reason for banning the user
|
|
685
|
+
*/
|
|
280
686
|
async banUser(guildId, userId, options = {}, reason) {
|
|
281
|
-
await this.rest.put(import_v103.Routes.guildBan(guildId, userId), {
|
|
687
|
+
await this.rest.put(import_v103.Routes.guildBan(guildId, userId), {
|
|
688
|
+
reason,
|
|
689
|
+
body: options
|
|
690
|
+
});
|
|
282
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* Unbans a user from a guild
|
|
694
|
+
*
|
|
695
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-ban}
|
|
696
|
+
* @param guildId - The id of the guild to unban the member in
|
|
697
|
+
* @param userId - The id of the user to unban
|
|
698
|
+
* @param reason - The reason for unbanning the user
|
|
699
|
+
*/
|
|
283
700
|
async unbanUser(guildId, userId, reason) {
|
|
284
|
-
await this.rest.delete(import_v103.Routes.guildBan(guildId, userId), {
|
|
701
|
+
await this.rest.delete(import_v103.Routes.guildBan(guildId, userId), {
|
|
702
|
+
reason
|
|
703
|
+
});
|
|
285
704
|
}
|
|
705
|
+
/**
|
|
706
|
+
* Gets all the roles in a guild
|
|
707
|
+
*
|
|
708
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-roles}
|
|
709
|
+
* @param guildId - The id of the guild to fetch the roles from
|
|
710
|
+
*/
|
|
286
711
|
async getRoles(guildId) {
|
|
287
712
|
return this.rest.get(import_v103.Routes.guildRoles(guildId));
|
|
288
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* Creates a guild role
|
|
716
|
+
*
|
|
717
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-role}
|
|
718
|
+
* @param guildId - The id of the guild to create the role in
|
|
719
|
+
* @param data - The data to create the role with
|
|
720
|
+
* @param reason - The reason for creating the role
|
|
721
|
+
*/
|
|
289
722
|
async createRole(guildId, data, reason) {
|
|
290
|
-
return this.rest.post(import_v103.Routes.guildRoles(guildId), {
|
|
723
|
+
return this.rest.post(import_v103.Routes.guildRoles(guildId), {
|
|
724
|
+
reason,
|
|
725
|
+
body: data
|
|
726
|
+
});
|
|
291
727
|
}
|
|
728
|
+
/**
|
|
729
|
+
* Sets role positions in a guild
|
|
730
|
+
*
|
|
731
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role-positions}
|
|
732
|
+
* @param guildId - The id of the guild to set role positions for
|
|
733
|
+
* @param data - The data for setting a role position
|
|
734
|
+
* @param reason - The reason for setting the role position
|
|
735
|
+
*/
|
|
292
736
|
async setRolePositions(guildId, data, reason) {
|
|
293
737
|
return this.rest.patch(import_v103.Routes.guildRoles(guildId), {
|
|
294
738
|
reason,
|
|
295
739
|
body: data
|
|
296
740
|
});
|
|
297
741
|
}
|
|
742
|
+
/**
|
|
743
|
+
* Edits a guild role
|
|
744
|
+
*
|
|
745
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role}
|
|
746
|
+
* @param guildId - The id of the guild to edit the role in
|
|
747
|
+
* @param roleId - The id of the role to edit
|
|
748
|
+
* @param data - data for editing the role
|
|
749
|
+
* @param reason - The reason for editing the role
|
|
750
|
+
*/
|
|
298
751
|
async editRole(guildId, roleId, data, reason) {
|
|
299
752
|
return this.rest.patch(import_v103.Routes.guildRole(guildId, roleId), {
|
|
300
753
|
reason,
|
|
301
754
|
body: data
|
|
302
755
|
});
|
|
303
756
|
}
|
|
757
|
+
/**
|
|
758
|
+
* Deletes a guild role
|
|
759
|
+
*
|
|
760
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-role}
|
|
761
|
+
* @param guildId - The id of the guild to delete the role in
|
|
762
|
+
* @param roleId - The id of the role to delete
|
|
763
|
+
* @param reason - The reason for deleting the role
|
|
764
|
+
*/
|
|
304
765
|
async deleteRole(guildId, roleId, reason) {
|
|
305
|
-
await this.rest.delete(import_v103.Routes.guildRole(guildId, roleId), {
|
|
766
|
+
await this.rest.delete(import_v103.Routes.guildRole(guildId, roleId), {
|
|
767
|
+
reason
|
|
768
|
+
});
|
|
306
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* Edits the multi-factor-authentication (MFA) level of a guild
|
|
772
|
+
*
|
|
773
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level}
|
|
774
|
+
* @param guildId - The id of the guild to edit the MFA level for
|
|
775
|
+
* @param level - The new MFA level
|
|
776
|
+
* @param reason - The reason for editing the MFA level
|
|
777
|
+
*/
|
|
307
778
|
async editMFALevel(guildId, level, reason) {
|
|
308
779
|
return this.rest.post(import_v103.Routes.guildMFA(guildId), {
|
|
309
780
|
reason,
|
|
310
|
-
body: {
|
|
781
|
+
body: {
|
|
782
|
+
mfa_level: level
|
|
783
|
+
}
|
|
311
784
|
});
|
|
312
785
|
}
|
|
786
|
+
/**
|
|
787
|
+
* Fetch the number of members that can be pruned from a guild
|
|
788
|
+
*
|
|
789
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-prune-count}
|
|
790
|
+
* @param guildId - The id of the guild to fetch the number of pruned members from
|
|
791
|
+
* @param options - The options for fetching the number of pruned members
|
|
792
|
+
*/
|
|
313
793
|
async getPruneCount(guildId, options = {}) {
|
|
314
794
|
return this.rest.get(import_v103.Routes.guildPrune(guildId), {
|
|
315
795
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
316
796
|
});
|
|
317
797
|
}
|
|
798
|
+
/**
|
|
799
|
+
* Prunes members in a guild
|
|
800
|
+
*
|
|
801
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#begin-guild-prune}
|
|
802
|
+
* @param guildId - The id of the guild to prune members in
|
|
803
|
+
* @param options - The options for pruning members
|
|
804
|
+
* @param reason - The reason for pruning members
|
|
805
|
+
*/
|
|
318
806
|
async beginPrune(guildId, options = {}, reason) {
|
|
319
807
|
return this.rest.post(import_v103.Routes.guildPrune(guildId), {
|
|
320
808
|
body: options,
|
|
321
809
|
reason
|
|
322
810
|
});
|
|
323
811
|
}
|
|
812
|
+
/**
|
|
813
|
+
* Fetches voice regions for a guild
|
|
814
|
+
*
|
|
815
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions}
|
|
816
|
+
* @param guildId - The id of the guild to fetch the voice regions from
|
|
817
|
+
*/
|
|
324
818
|
async getVoiceRegions(guildId) {
|
|
325
819
|
return this.rest.get(import_v103.Routes.guildVoiceRegions(guildId));
|
|
326
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* Fetches the invites for a guild
|
|
823
|
+
*
|
|
824
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-invites}
|
|
825
|
+
* @param guildId - The id of the guild to fetch the invites from
|
|
826
|
+
*/
|
|
327
827
|
async getInvites(guildId) {
|
|
328
828
|
return this.rest.get(import_v103.Routes.guildInvites(guildId));
|
|
329
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* Fetches the integrations for a guild
|
|
832
|
+
*
|
|
833
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-integrations}
|
|
834
|
+
* @param guildId - The id of the guild to fetch the integrations from
|
|
835
|
+
*/
|
|
330
836
|
async getIntegrations(guildId) {
|
|
331
837
|
return this.rest.get(import_v103.Routes.guildIntegrations(guildId));
|
|
332
838
|
}
|
|
839
|
+
/**
|
|
840
|
+
* Deletes an integration from a guild
|
|
841
|
+
*
|
|
842
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-integration}
|
|
843
|
+
* @param guildId - The id of the guild to delete the integration from
|
|
844
|
+
* @param integrationId - The id of the integration to delete
|
|
845
|
+
* @param reason - The reason for deleting the integration
|
|
846
|
+
*/
|
|
333
847
|
async deleteIntegration(guildId, integrationId, reason) {
|
|
334
|
-
await this.rest.delete(import_v103.Routes.guildIntegration(guildId, integrationId), {
|
|
848
|
+
await this.rest.delete(import_v103.Routes.guildIntegration(guildId, integrationId), {
|
|
849
|
+
reason
|
|
850
|
+
});
|
|
335
851
|
}
|
|
852
|
+
/**
|
|
853
|
+
* Fetches the widget settings for a guild
|
|
854
|
+
*
|
|
855
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings}
|
|
856
|
+
* @param guildId - The id of the guild to fetch the widget settings from
|
|
857
|
+
*/
|
|
336
858
|
async getWidgetSettings(guildId) {
|
|
337
859
|
return this.rest.get(import_v103.Routes.guildWidgetSettings(guildId));
|
|
338
860
|
}
|
|
861
|
+
/**
|
|
862
|
+
* Edits the widget settings for a guild
|
|
863
|
+
*
|
|
864
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-widget}
|
|
865
|
+
* @param guildId - The id of the guild to edit the widget settings from
|
|
866
|
+
* @param data - The new widget settings data
|
|
867
|
+
* @param reason - The reason for editing the widget settings
|
|
868
|
+
*/
|
|
339
869
|
async editWidgetSettings(guildId, data, reason) {
|
|
340
870
|
return this.rest.patch(import_v103.Routes.guildWidgetSettings(guildId), {
|
|
341
871
|
reason,
|
|
342
872
|
body: data
|
|
343
873
|
});
|
|
344
874
|
}
|
|
875
|
+
/**
|
|
876
|
+
* Fetches the widget for a guild
|
|
877
|
+
*
|
|
878
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget}
|
|
879
|
+
* @param guildId - The id of the guild to fetch the widget from
|
|
880
|
+
*/
|
|
345
881
|
async getWidget(guildId) {
|
|
346
882
|
return this.rest.get(import_v103.Routes.guildWidgetJSON(guildId));
|
|
347
883
|
}
|
|
884
|
+
/**
|
|
885
|
+
* Fetches the vanity url for a guild
|
|
886
|
+
*
|
|
887
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-vanity-url}
|
|
888
|
+
* @param guildId - The id of the guild to fetch the vanity url from
|
|
889
|
+
*/
|
|
348
890
|
async getVanityURL(guildId) {
|
|
349
891
|
return this.rest.get(import_v103.Routes.guildVanityUrl(guildId));
|
|
350
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Fetches the widget image for a guild
|
|
895
|
+
*
|
|
896
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget-image}
|
|
897
|
+
* @param guildId - The id of the guild to fetch the widget image from
|
|
898
|
+
* @param style - The style of the widget image
|
|
899
|
+
*/
|
|
351
900
|
async getWidgetImage(guildId, style) {
|
|
352
901
|
return this.rest.get(import_v103.Routes.guildWidgetImage(guildId), {
|
|
353
|
-
query: (0, import_rest3.makeURLSearchParams)({
|
|
902
|
+
query: (0, import_rest3.makeURLSearchParams)({
|
|
903
|
+
style
|
|
904
|
+
})
|
|
354
905
|
});
|
|
355
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* Fetches the welcome screen for a guild
|
|
909
|
+
*
|
|
910
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen}
|
|
911
|
+
* @param guildId - The id of the guild to fetch the welcome screen from
|
|
912
|
+
*/
|
|
356
913
|
async getWelcomeScreen(guildId) {
|
|
357
914
|
return this.rest.get(import_v103.Routes.guildWelcomeScreen(guildId));
|
|
358
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Edits the welcome screen for a guild
|
|
918
|
+
*
|
|
919
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen}
|
|
920
|
+
* @param guildId - The id of the guild to edit the welcome screen for
|
|
921
|
+
* @param data - The new welcome screen data
|
|
922
|
+
* @param reason - The reason for editing the welcome screen
|
|
923
|
+
*/
|
|
359
924
|
async editWelcomeScreen(guildId, data, reason) {
|
|
360
925
|
return this.rest.patch(import_v103.Routes.guildWelcomeScreen(guildId), {
|
|
361
926
|
reason,
|
|
362
927
|
body: data
|
|
363
928
|
});
|
|
364
929
|
}
|
|
930
|
+
/**
|
|
931
|
+
* Edits a user's voice state in a guild
|
|
932
|
+
*
|
|
933
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-user-voice-state}
|
|
934
|
+
* @param guildId - The id of the guild to edit the current user's voice state in
|
|
935
|
+
* @param userId - The id of the user to edit the voice state for
|
|
936
|
+
* @param data - The data for editing the voice state
|
|
937
|
+
* @param reason - The reason for editing the voice state
|
|
938
|
+
*/
|
|
365
939
|
async editUserVoiceState(guildId, userId, data, reason) {
|
|
366
|
-
await this.rest.patch(import_v103.Routes.guildVoiceState(guildId, userId), {
|
|
940
|
+
await this.rest.patch(import_v103.Routes.guildVoiceState(guildId, userId), {
|
|
941
|
+
reason,
|
|
942
|
+
body: data
|
|
943
|
+
});
|
|
367
944
|
}
|
|
945
|
+
/**
|
|
946
|
+
* Fetches all emojis for a guild
|
|
947
|
+
*
|
|
948
|
+
* @see {@link https://discord.com/developers/docs/resources/emoji#list-guild-emojis}
|
|
949
|
+
* @param guildId - The id of the guild to fetch the emojis from
|
|
950
|
+
*/
|
|
368
951
|
async getEmojis(guildId) {
|
|
369
952
|
return this.rest.get(import_v103.Routes.guildEmojis(guildId));
|
|
370
953
|
}
|
|
954
|
+
/**
|
|
955
|
+
* Fetches an emoji for a guild
|
|
956
|
+
*
|
|
957
|
+
* @see {@link https://discord.com/developers/docs/resources/emoji#get-guild-emoji}
|
|
958
|
+
* @param guildId - The id of the guild to fetch the emoji from
|
|
959
|
+
* @param emojiId - The id of the emoji to fetch
|
|
960
|
+
*/
|
|
371
961
|
async getEmoji(guildId, emojiId) {
|
|
372
962
|
return this.rest.get(import_v103.Routes.guildEmoji(guildId, emojiId));
|
|
373
963
|
}
|
|
964
|
+
/**
|
|
965
|
+
* Creates a new emoji for a guild
|
|
966
|
+
*
|
|
967
|
+
* @see {@link https://discord.com/developers/docs/resources/emoji#create-guild-emoji}
|
|
968
|
+
* @param guildId - The id of the guild to create the emoji from
|
|
969
|
+
* @param data - The data for creating the emoji
|
|
970
|
+
* @param reason - The reason for creating the emoji
|
|
971
|
+
*/
|
|
374
972
|
async createEmoji(guildId, data, reason) {
|
|
375
973
|
return this.rest.post(import_v103.Routes.guildEmojis(guildId), {
|
|
376
974
|
reason,
|
|
377
975
|
body: data
|
|
378
976
|
});
|
|
379
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* Edits an emoji for a guild
|
|
980
|
+
*
|
|
981
|
+
* @see {@link https://discord.com/developers/docs/resources/emoji#modify-guild-emoji}
|
|
982
|
+
* @param guildId - The id of the guild to edit the emoji from
|
|
983
|
+
* @param emojiId - The id of the emoji to edit
|
|
984
|
+
* @param data - The data for editing the emoji
|
|
985
|
+
* @param reason - The reason for editing the emoji
|
|
986
|
+
*/
|
|
380
987
|
async editEmoji(guildId, emojiId, data, reason) {
|
|
381
988
|
return this.rest.patch(import_v103.Routes.guildEmoji(guildId, emojiId), {
|
|
382
989
|
reason,
|
|
383
990
|
body: data
|
|
384
991
|
});
|
|
385
992
|
}
|
|
993
|
+
/**
|
|
994
|
+
* Deletes an emoji for a guild
|
|
995
|
+
*
|
|
996
|
+
* @see {@link https://discord.com/developers/docs/resources/emoji#delete-guild-emoji}
|
|
997
|
+
* @param guildId - The id of the guild to delete the emoji from
|
|
998
|
+
* @param emojiId - The id of the emoji to delete
|
|
999
|
+
* @param reason - The reason for deleting the emoji
|
|
1000
|
+
*/
|
|
386
1001
|
async deleteEmoji(guildId, emojiId, reason) {
|
|
387
|
-
await this.rest.delete(import_v103.Routes.guildEmoji(guildId, emojiId), {
|
|
1002
|
+
await this.rest.delete(import_v103.Routes.guildEmoji(guildId, emojiId), {
|
|
1003
|
+
reason
|
|
1004
|
+
});
|
|
388
1005
|
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Fetches all scheduled events for a guild
|
|
1008
|
+
*
|
|
1009
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild}
|
|
1010
|
+
* @param guildId - The id of the guild to fetch the scheduled events from
|
|
1011
|
+
* @param options - The options for fetching the scheduled events
|
|
1012
|
+
*/
|
|
389
1013
|
async getScheduledEvents(guildId, options = {}) {
|
|
390
1014
|
return this.rest.get(import_v103.Routes.guildScheduledEvents(guildId), {
|
|
391
1015
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
392
1016
|
});
|
|
393
1017
|
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Creates a new scheduled event for a guild
|
|
1020
|
+
*
|
|
1021
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event}
|
|
1022
|
+
* @param guildId - The id of the guild to create the scheduled event from
|
|
1023
|
+
* @param data - The data to create the event with
|
|
1024
|
+
* @param reason - The reason for creating the scheduled event
|
|
1025
|
+
*/
|
|
394
1026
|
async createScheduledEvent(guildId, data, reason) {
|
|
395
1027
|
return this.rest.post(import_v103.Routes.guildScheduledEvents(guildId), {
|
|
396
1028
|
reason,
|
|
397
1029
|
body: data
|
|
398
1030
|
});
|
|
399
1031
|
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Fetches a scheduled event for a guild
|
|
1034
|
+
*
|
|
1035
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event}
|
|
1036
|
+
* @param guildId - The id of the guild to fetch the scheduled event from
|
|
1037
|
+
* @param eventId - The id of the scheduled event to fetch
|
|
1038
|
+
* @param options - The options for fetching the scheduled event
|
|
1039
|
+
*/
|
|
400
1040
|
async getScheduledEvent(guildId, eventId, options = {}) {
|
|
401
1041
|
return this.rest.get(import_v103.Routes.guildScheduledEvent(guildId, eventId), {
|
|
402
1042
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
403
1043
|
});
|
|
404
1044
|
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Edits a scheduled event for a guild
|
|
1047
|
+
*
|
|
1048
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event}
|
|
1049
|
+
* @param guildId - The id of the guild to edit the scheduled event from
|
|
1050
|
+
* @param eventId - The id of the scheduled event to edit
|
|
1051
|
+
* @param data - The new event data
|
|
1052
|
+
* @param reason - The reason for editing the scheduled event
|
|
1053
|
+
*/
|
|
405
1054
|
async editScheduledEvent(guildId, eventId, data, reason) {
|
|
406
1055
|
return this.rest.patch(import_v103.Routes.guildScheduledEvent(guildId, eventId), {
|
|
407
1056
|
reason,
|
|
408
1057
|
body: data
|
|
409
1058
|
});
|
|
410
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Deletes a scheduled event for a guild
|
|
1062
|
+
*
|
|
1063
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event}
|
|
1064
|
+
* @param guildId - The id of the guild to delete the scheduled event from
|
|
1065
|
+
* @param eventId - The id of the scheduled event to delete
|
|
1066
|
+
* @param reason - The reason for deleting the scheduled event
|
|
1067
|
+
*/
|
|
411
1068
|
async deleteScheduledEvent(guildId, eventId, reason) {
|
|
412
|
-
await this.rest.delete(import_v103.Routes.guildScheduledEvent(guildId, eventId), {
|
|
1069
|
+
await this.rest.delete(import_v103.Routes.guildScheduledEvent(guildId, eventId), {
|
|
1070
|
+
reason
|
|
1071
|
+
});
|
|
413
1072
|
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Gets all users that are interested in a scheduled event
|
|
1075
|
+
*
|
|
1076
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users}
|
|
1077
|
+
* @param guildId - The id of the guild to fetch the scheduled event users from
|
|
1078
|
+
* @param eventId - The id of the scheduled event to fetch the users for
|
|
1079
|
+
* @param options - The options for fetching the scheduled event users
|
|
1080
|
+
*/
|
|
414
1081
|
async getScheduledEventUsers(guildId, eventId, options = {}) {
|
|
415
1082
|
return this.rest.get(import_v103.Routes.guildScheduledEventUsers(guildId, eventId), {
|
|
416
1083
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
417
1084
|
});
|
|
418
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Fetches all the templates for a guild
|
|
1088
|
+
*
|
|
1089
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-templates}
|
|
1090
|
+
* @param guildId - The id of the guild to fetch the templates from
|
|
1091
|
+
*/
|
|
419
1092
|
async getTemplates(guildId) {
|
|
420
1093
|
return this.rest.get(import_v103.Routes.guildTemplates(guildId));
|
|
421
1094
|
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Syncs a template for a guild
|
|
1097
|
+
*
|
|
1098
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-template#sync-guild-template}
|
|
1099
|
+
* @param guildId - The id of the guild to sync the template from
|
|
1100
|
+
* @param templateCode - The code of the template to sync
|
|
1101
|
+
*/
|
|
422
1102
|
async syncTemplate(guildId, templateCode) {
|
|
423
1103
|
return this.rest.put(import_v103.Routes.guildTemplate(guildId, templateCode));
|
|
424
1104
|
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Edits a template for a guild
|
|
1107
|
+
*
|
|
1108
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-template#modify-guild-template}
|
|
1109
|
+
* @param guildId - The id of the guild to edit the template from
|
|
1110
|
+
* @param templateCode - The code of the template to edit
|
|
1111
|
+
* @param data - The data for editing the template
|
|
1112
|
+
*/
|
|
425
1113
|
async editTemplate(guildId, templateCode, data) {
|
|
426
1114
|
return this.rest.patch(import_v103.Routes.guildTemplate(guildId, templateCode), {
|
|
427
1115
|
body: data
|
|
428
1116
|
});
|
|
429
1117
|
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Deletes a template for a guild
|
|
1120
|
+
*
|
|
1121
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-template#delete-guild-template}
|
|
1122
|
+
* @param guildId - The id of the guild to delete the template from
|
|
1123
|
+
* @param templateCode - The code of the template to delete
|
|
1124
|
+
*/
|
|
430
1125
|
async deleteTemplate(guildId, templateCode) {
|
|
431
1126
|
await this.rest.delete(import_v103.Routes.guildTemplate(guildId, templateCode));
|
|
432
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Fetches all the stickers for a guild
|
|
1130
|
+
*
|
|
1131
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#list-guild-stickers}
|
|
1132
|
+
* @param guildId - The id of the guild to fetch the stickers from
|
|
1133
|
+
*/
|
|
433
1134
|
async getStickers(guildId) {
|
|
434
1135
|
return this.rest.get(import_v103.Routes.guildStickers(guildId));
|
|
435
1136
|
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Fetches a sticker for a guild
|
|
1139
|
+
*
|
|
1140
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#get-guild-sticker}
|
|
1141
|
+
* @param guildId - The id of the guild to fetch the sticker from
|
|
1142
|
+
* @param stickerId - The id of the sticker to fetch
|
|
1143
|
+
*/
|
|
436
1144
|
async getSticker(guildId, stickerId) {
|
|
437
1145
|
return this.rest.get(import_v103.Routes.guildSticker(guildId, stickerId));
|
|
438
1146
|
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Creates a sticker for a guild
|
|
1149
|
+
*
|
|
1150
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#create-guild-sticker}
|
|
1151
|
+
* @param guildId - The id of the guild to create the sticker for
|
|
1152
|
+
* @param data - The data for creating the sticker
|
|
1153
|
+
* @param reason - The reason for creating the sticker
|
|
1154
|
+
*/
|
|
439
1155
|
async createSticker(guildId, { file, ...body }, reason) {
|
|
440
|
-
const fileData = {
|
|
1156
|
+
const fileData = {
|
|
1157
|
+
...file,
|
|
1158
|
+
key: "file"
|
|
1159
|
+
};
|
|
441
1160
|
return this.rest.post(import_v103.Routes.guildStickers(guildId), {
|
|
442
1161
|
appendToFormData: true,
|
|
443
1162
|
body,
|
|
444
|
-
files: [
|
|
1163
|
+
files: [
|
|
1164
|
+
fileData
|
|
1165
|
+
],
|
|
445
1166
|
reason
|
|
446
1167
|
});
|
|
447
1168
|
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Edits a sticker for a guild
|
|
1171
|
+
*
|
|
1172
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker}
|
|
1173
|
+
* @param guildId - The id of the guild to edit the sticker from
|
|
1174
|
+
* @param stickerId - The id of the sticker to edit
|
|
1175
|
+
* @param data - The data for editing the sticker
|
|
1176
|
+
* @param reason - The reason for editing the sticker
|
|
1177
|
+
*/
|
|
448
1178
|
async editSticker(guildId, stickerId, data, reason) {
|
|
449
1179
|
return this.rest.patch(import_v103.Routes.guildSticker(guildId, stickerId), {
|
|
450
1180
|
reason,
|
|
451
1181
|
body: data
|
|
452
1182
|
});
|
|
453
1183
|
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Deletes a sticker for a guild
|
|
1186
|
+
*
|
|
1187
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#delete-guild-sticker}
|
|
1188
|
+
* @param guildId - The id of the guild to delete the sticker from
|
|
1189
|
+
* @param stickerId - The id of the sticker to delete
|
|
1190
|
+
* @param reason - The reason for deleting the sticker
|
|
1191
|
+
*/
|
|
454
1192
|
async deleteSticker(guildId, stickerId, reason) {
|
|
455
|
-
await this.rest.delete(import_v103.Routes.guildSticker(guildId, stickerId), {
|
|
1193
|
+
await this.rest.delete(import_v103.Routes.guildSticker(guildId, stickerId), {
|
|
1194
|
+
reason
|
|
1195
|
+
});
|
|
456
1196
|
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Fetches the audit logs for a guild
|
|
1199
|
+
*
|
|
1200
|
+
* @see {@link https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log}
|
|
1201
|
+
* @param guildId - The id of the guild to fetch the audit logs from
|
|
1202
|
+
* @param options - The options for fetching the audit logs
|
|
1203
|
+
*/
|
|
457
1204
|
async getAuditLogs(guildId, options = {}) {
|
|
458
1205
|
return this.rest.get(import_v103.Routes.guildAuditLog(guildId), {
|
|
459
1206
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
460
1207
|
});
|
|
461
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Fetches all auto moderation rules for a guild
|
|
1211
|
+
*
|
|
1212
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild}
|
|
1213
|
+
* @param guildId - The id of the guild to fetch the auto moderation rules from
|
|
1214
|
+
*/
|
|
462
1215
|
async getAutoModerationRules(guildId) {
|
|
463
1216
|
return this.rest.get(import_v103.Routes.guildAutoModerationRules(guildId));
|
|
464
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Fetches an auto moderation rule for a guild
|
|
1220
|
+
*
|
|
1221
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule}
|
|
1222
|
+
* @param guildId - The id of the guild to fetch the auto moderation rule from
|
|
1223
|
+
* @param ruleId - The id of the auto moderation rule to fetch
|
|
1224
|
+
*/
|
|
465
1225
|
async getAutoModerationRule(guildId, ruleId) {
|
|
466
|
-
return this.rest.get(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
1226
|
+
return this.rest.get(import_v103.Routes.guildAutoModerationRule(guildId, ruleId));
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Creates a new auto moderation rule for a guild
|
|
1230
|
+
*
|
|
1231
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule}
|
|
1232
|
+
* @param guildId - The id of the guild to create the auto moderation rule from
|
|
1233
|
+
* @param data - The data for creating the auto moderation rule
|
|
1234
|
+
*/
|
|
470
1235
|
async createAutoModerationRule(guildId, data, reason) {
|
|
471
1236
|
return this.rest.post(import_v103.Routes.guildAutoModerationRules(guildId), {
|
|
472
1237
|
reason,
|
|
473
1238
|
body: data
|
|
474
1239
|
});
|
|
475
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Edits an auto moderation rule for a guild
|
|
1243
|
+
*
|
|
1244
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule}
|
|
1245
|
+
* @param guildId - The id of the guild to edit the auto moderation rule from
|
|
1246
|
+
* @param ruleId - The id of the auto moderation rule to edit
|
|
1247
|
+
* @param data - The data for editing the auto moderation rule
|
|
1248
|
+
* @param reason - The reason for editing the auto moderation rule
|
|
1249
|
+
*/
|
|
476
1250
|
async editAutoModerationRule(guildId, ruleId, data, reason) {
|
|
477
1251
|
return this.rest.patch(import_v103.Routes.guildAutoModerationRule(guildId, ruleId), {
|
|
478
1252
|
reason,
|
|
479
1253
|
body: data
|
|
480
1254
|
});
|
|
481
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Deletes an auto moderation rule for a guild
|
|
1258
|
+
*
|
|
1259
|
+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule}
|
|
1260
|
+
* @param guildId - The id of the guild to delete the auto moderation rule from
|
|
1261
|
+
* @param ruleId - The id of the auto moderation rule to delete
|
|
1262
|
+
* @param reason - The reason for deleting the auto moderation rule
|
|
1263
|
+
*/
|
|
482
1264
|
async deleteAutoModerationRule(guildId, ruleId, reason) {
|
|
483
|
-
await this.rest.delete(import_v103.Routes.guildAutoModerationRule(guildId, ruleId), {
|
|
1265
|
+
await this.rest.delete(import_v103.Routes.guildAutoModerationRule(guildId, ruleId), {
|
|
1266
|
+
reason
|
|
1267
|
+
});
|
|
484
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Fetches a guild member
|
|
1271
|
+
*
|
|
1272
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-member}
|
|
1273
|
+
* @param guildId - The id of the guild
|
|
1274
|
+
* @param userId - The id of the user
|
|
1275
|
+
*/
|
|
485
1276
|
async getMember(guildId, userId) {
|
|
486
1277
|
return this.rest.get(import_v103.Routes.guildMember(guildId, userId));
|
|
487
1278
|
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Searches for guild members
|
|
1281
|
+
*
|
|
1282
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#search-guild-members}
|
|
1283
|
+
* @param guildId - The id of the guild to search in
|
|
1284
|
+
* @param query - The query to search for
|
|
1285
|
+
* @param limit - The maximum number of members to return
|
|
1286
|
+
*/
|
|
488
1287
|
async searchForMembers(guildId, options) {
|
|
489
1288
|
return this.rest.get(import_v103.Routes.guildMembersSearch(guildId), {
|
|
490
1289
|
query: (0, import_rest3.makeURLSearchParams)(options)
|
|
491
1290
|
});
|
|
492
1291
|
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Edits a guild member
|
|
1294
|
+
*
|
|
1295
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-member}
|
|
1296
|
+
* @param guildId - The id of the guild
|
|
1297
|
+
* @param userId - The id of the user
|
|
1298
|
+
* @param data - The data to use when editing the guild member
|
|
1299
|
+
* @param reason - The reason for editing this guild member
|
|
1300
|
+
*/
|
|
493
1301
|
async editMember(guildId, userId, data = {}, reason) {
|
|
494
1302
|
return this.rest.patch(import_v103.Routes.guildMember(guildId, userId), {
|
|
495
1303
|
reason,
|
|
496
1304
|
body: data
|
|
497
1305
|
});
|
|
498
1306
|
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Adds a role to a guild member
|
|
1309
|
+
*
|
|
1310
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member-role}
|
|
1311
|
+
* @param guildId - The id of the guild
|
|
1312
|
+
* @param userId - The id of the user
|
|
1313
|
+
* @param roleId - The id of the role
|
|
1314
|
+
* @param reason - The reason for adding this role to the guild member
|
|
1315
|
+
*/
|
|
499
1316
|
async addRoleToMember(guildId, userId, roleId, reason) {
|
|
500
|
-
await this.rest.put(import_v103.Routes.guildMemberRole(guildId, userId, roleId), {
|
|
1317
|
+
await this.rest.put(import_v103.Routes.guildMemberRole(guildId, userId, roleId), {
|
|
1318
|
+
reason
|
|
1319
|
+
});
|
|
501
1320
|
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Removes a role from a guild member
|
|
1323
|
+
*
|
|
1324
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-member-role}
|
|
1325
|
+
* @param guildId - The id of the guild
|
|
1326
|
+
* @param userId - The id of the user
|
|
1327
|
+
* @param roleId - The id of the role
|
|
1328
|
+
* @param reason - The reason for removing this role from the guild member
|
|
1329
|
+
*/
|
|
502
1330
|
async removeRoleFromMember(guildId, userId, roleId, reason) {
|
|
503
|
-
await this.rest.delete(import_v103.Routes.guildMemberRole(guildId, userId, roleId), {
|
|
1331
|
+
await this.rest.delete(import_v103.Routes.guildMemberRole(guildId, userId, roleId), {
|
|
1332
|
+
reason
|
|
1333
|
+
});
|
|
504
1334
|
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Fetches a guild template
|
|
1337
|
+
*
|
|
1338
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-template}
|
|
1339
|
+
* @param templateCode - The code of the template
|
|
1340
|
+
*/
|
|
505
1341
|
async getTemplate(templateCode) {
|
|
506
1342
|
return this.rest.get(import_v103.Routes.template(templateCode));
|
|
507
1343
|
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Creates a new template
|
|
1346
|
+
*
|
|
1347
|
+
* @see {@link https://discord.com/developers/docs/resources/guild-template#create-guild-template}
|
|
1348
|
+
* @param templateCode - The code of the template
|
|
1349
|
+
* @param data - The data to use when creating the template
|
|
1350
|
+
*/
|
|
508
1351
|
async createTemplate(templateCode, data) {
|
|
509
|
-
return this.rest.post(import_v103.Routes.template(templateCode), {
|
|
1352
|
+
return this.rest.post(import_v103.Routes.template(templateCode), {
|
|
1353
|
+
body: data
|
|
1354
|
+
});
|
|
510
1355
|
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Fetches webhooks for a guild
|
|
1358
|
+
*
|
|
1359
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#get-guild-webhooks}
|
|
1360
|
+
* @param id - The id of the guild
|
|
1361
|
+
*/
|
|
511
1362
|
async getWebhooks(id) {
|
|
512
1363
|
return this.rest.get(import_v103.Routes.guildWebhooks(id));
|
|
513
1364
|
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Sets the voice state for the current user
|
|
1367
|
+
*
|
|
1368
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state}
|
|
1369
|
+
* @param guildId - The id of the guild
|
|
1370
|
+
* @param options - The options to use when setting the voice state
|
|
1371
|
+
*/
|
|
1372
|
+
async setVoiceState(guildId, options = {}) {
|
|
1373
|
+
return this.rest.patch(import_v103.Routes.guildVoiceState(guildId, "@me"), {
|
|
1374
|
+
body: options
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
514
1377
|
};
|
|
515
1378
|
__name(GuildsAPI, "GuildsAPI");
|
|
516
1379
|
|
|
@@ -521,64 +1384,146 @@ var InteractionsAPI = class {
|
|
|
521
1384
|
this.rest = rest;
|
|
522
1385
|
this.webhooks = webhooks;
|
|
523
1386
|
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Replies to an interaction
|
|
1389
|
+
*
|
|
1390
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1391
|
+
* @param interactionId - The id of the interaction
|
|
1392
|
+
* @param interactionToken - The token of the interaction
|
|
1393
|
+
* @param data - The data to use when replying
|
|
1394
|
+
*/
|
|
524
1395
|
async reply(interactionId, interactionToken, { files, ...data }) {
|
|
525
1396
|
await this.rest.post(import_v104.Routes.interactionCallback(interactionId, interactionToken), {
|
|
526
1397
|
files,
|
|
1398
|
+
auth: false,
|
|
527
1399
|
body: {
|
|
528
1400
|
type: import_v104.InteractionResponseType.ChannelMessageWithSource,
|
|
529
1401
|
data
|
|
530
1402
|
}
|
|
531
1403
|
});
|
|
532
1404
|
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Defers the reply to an interaction
|
|
1407
|
+
*
|
|
1408
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1409
|
+
* @param interactionId - The id of the interaction
|
|
1410
|
+
* @param interactionToken - The token of the interaction
|
|
1411
|
+
*/
|
|
533
1412
|
async defer(interactionId, interactionToken) {
|
|
534
1413
|
await this.rest.post(import_v104.Routes.interactionCallback(interactionId, interactionToken), {
|
|
1414
|
+
auth: false,
|
|
535
1415
|
body: {
|
|
536
1416
|
type: import_v104.InteractionResponseType.DeferredChannelMessageWithSource
|
|
537
1417
|
}
|
|
538
1418
|
});
|
|
539
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Defers an update from a message component interaction
|
|
1422
|
+
*
|
|
1423
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1424
|
+
* @param interactionId - The id of the interaction
|
|
1425
|
+
* @param interactionToken - The token of the interaction
|
|
1426
|
+
*/
|
|
540
1427
|
async deferMessageUpdate(interactionId, interactionToken) {
|
|
541
1428
|
await this.rest.post(import_v104.Routes.interactionCallback(interactionId, interactionToken), {
|
|
1429
|
+
auth: false,
|
|
542
1430
|
body: {
|
|
543
1431
|
type: import_v104.InteractionResponseType.DeferredMessageUpdate
|
|
544
1432
|
}
|
|
545
1433
|
});
|
|
546
1434
|
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Reply to a deferred interaction
|
|
1437
|
+
*
|
|
1438
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message}
|
|
1439
|
+
* @param applicationId - The application id of the interaction
|
|
1440
|
+
* @param interactionToken - The token of the interaction
|
|
1441
|
+
* @param data - The data to use when replying
|
|
1442
|
+
*/
|
|
547
1443
|
async followUp(applicationId, interactionToken, data) {
|
|
548
1444
|
await this.webhooks.execute(applicationId, interactionToken, data);
|
|
549
1445
|
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Edits the initial reply to an interaction
|
|
1448
|
+
*
|
|
1449
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
|
|
1450
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message}
|
|
1451
|
+
* @param applicationId - The application id of the interaction
|
|
1452
|
+
* @param interactionToken - The token of the interaction
|
|
1453
|
+
* @param data - The data to use when editing the reply
|
|
1454
|
+
* @param messageId - The id of the message to edit. If omitted, the original reply will be edited
|
|
1455
|
+
*/
|
|
550
1456
|
async editReply(applicationId, interactionToken, data, messageId) {
|
|
551
1457
|
return this.webhooks.editMessage(applicationId, interactionToken, messageId ?? "@original", data);
|
|
552
1458
|
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Fetches the initial reply to an interaction
|
|
1461
|
+
*
|
|
1462
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response}
|
|
1463
|
+
* @param applicationId - The application id of the interaction
|
|
1464
|
+
* @param interactionToken - The token of the interaction
|
|
1465
|
+
*/
|
|
553
1466
|
async getOriginalReply(applicationId, interactionToken) {
|
|
554
|
-
return this.webhooks.getMessage(
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
1467
|
+
return this.webhooks.getMessage(applicationId, interactionToken, "@original");
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Deletes the initial reply to an interaction
|
|
1471
|
+
*
|
|
1472
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response}
|
|
1473
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message}
|
|
1474
|
+
* @param applicationId - The application id of the interaction
|
|
1475
|
+
* @param interactionToken - The token of the interaction
|
|
1476
|
+
* @param messageId - The id of the message to delete. If omitted, the original reply will be deleted
|
|
1477
|
+
*/
|
|
560
1478
|
async deleteReply(applicationId, interactionToken, messageId) {
|
|
561
1479
|
await this.webhooks.deleteMessage(applicationId, interactionToken, messageId ?? "@original");
|
|
562
1480
|
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Updates the the message the component interaction was triggered on
|
|
1483
|
+
*
|
|
1484
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1485
|
+
* @param interactionId - The id of the interaction
|
|
1486
|
+
* @param interactionToken - The token of the interaction
|
|
1487
|
+
* @param data - The data to use when updating the interaction
|
|
1488
|
+
*/
|
|
563
1489
|
async updateMessage(interactionId, interactionToken, { files, ...data }) {
|
|
564
1490
|
await this.rest.post(import_v104.Routes.interactionCallback(interactionId, interactionToken), {
|
|
565
1491
|
files,
|
|
1492
|
+
auth: false,
|
|
566
1493
|
body: {
|
|
567
1494
|
type: import_v104.InteractionResponseType.UpdateMessage,
|
|
568
1495
|
data
|
|
569
1496
|
}
|
|
570
1497
|
});
|
|
571
1498
|
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Sends an autocomplete response to an interaction
|
|
1501
|
+
*
|
|
1502
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1503
|
+
* @param interactionId - The id of the interaction
|
|
1504
|
+
* @param interactionToken - The token of the interaction
|
|
1505
|
+
* @param data - Data for the autocomplete response
|
|
1506
|
+
*/
|
|
572
1507
|
async createAutocompleteResponse(interactionId, interactionToken, data) {
|
|
573
1508
|
await this.rest.post(import_v104.Routes.interactionCallback(interactionId, interactionToken), {
|
|
1509
|
+
auth: false,
|
|
574
1510
|
body: {
|
|
575
1511
|
type: import_v104.InteractionResponseType.ApplicationCommandAutocompleteResult,
|
|
576
1512
|
data
|
|
577
1513
|
}
|
|
578
1514
|
});
|
|
579
1515
|
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Sends a modal response to an interaction
|
|
1518
|
+
*
|
|
1519
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1520
|
+
* @param interactionId - The id of the interaction
|
|
1521
|
+
* @param interactionToken - The token of the interaction
|
|
1522
|
+
* @param data - The modal to send
|
|
1523
|
+
*/
|
|
580
1524
|
async createModal(interactionId, interactionToken, data) {
|
|
581
1525
|
await this.rest.post(import_v104.Routes.interactionCallback(interactionId, interactionToken), {
|
|
1526
|
+
auth: false,
|
|
582
1527
|
body: {
|
|
583
1528
|
type: import_v104.InteractionResponseType.Modal,
|
|
584
1529
|
data
|
|
@@ -595,13 +1540,28 @@ var InvitesAPI = class {
|
|
|
595
1540
|
constructor(rest) {
|
|
596
1541
|
this.rest = rest;
|
|
597
1542
|
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Fetches an invite
|
|
1545
|
+
*
|
|
1546
|
+
* @see {@link https://discord.com/developers/docs/resources/invite#get-invite}
|
|
1547
|
+
* @param code - The invite code
|
|
1548
|
+
*/
|
|
598
1549
|
async get(code, options = {}) {
|
|
599
1550
|
return this.rest.get(import_v105.Routes.invite(code), {
|
|
600
1551
|
query: (0, import_rest4.makeURLSearchParams)(options)
|
|
601
1552
|
});
|
|
602
1553
|
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Deletes an invite
|
|
1556
|
+
*
|
|
1557
|
+
* @see {@link https://discord.com/developers/docs/resources/invite#delete-invite}
|
|
1558
|
+
* @param code - The invite code
|
|
1559
|
+
* @param reason - The reason for deleting the invite
|
|
1560
|
+
*/
|
|
603
1561
|
async delete(code, reason) {
|
|
604
|
-
await this.rest.delete(import_v105.Routes.invite(code), {
|
|
1562
|
+
await this.rest.delete(import_v105.Routes.invite(code), {
|
|
1563
|
+
reason
|
|
1564
|
+
});
|
|
605
1565
|
}
|
|
606
1566
|
};
|
|
607
1567
|
__name(InvitesAPI, "InvitesAPI");
|
|
@@ -614,11 +1574,23 @@ var OAuth2API = class {
|
|
|
614
1574
|
constructor(rest) {
|
|
615
1575
|
this.rest = rest;
|
|
616
1576
|
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Creates an OAuth2 authorization URL given the options
|
|
1579
|
+
*
|
|
1580
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-authorization-url-example}
|
|
1581
|
+
* @param options - The options for creating the authorization URL
|
|
1582
|
+
*/
|
|
617
1583
|
generateAuthorizationURL(options) {
|
|
618
1584
|
const url = new import_node_url.URL(`${import_v106.RouteBases.api}${import_v106.Routes.oauth2Authorization()}`);
|
|
619
1585
|
url.search = (0, import_rest5.makeURLSearchParams)(options).toString();
|
|
620
1586
|
return url.toString();
|
|
621
1587
|
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Performs an OAuth2 token exchange, giving you an access token
|
|
1590
|
+
*
|
|
1591
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example}
|
|
1592
|
+
* @param options - The options for the token exchange request
|
|
1593
|
+
*/
|
|
622
1594
|
async tokenExchange(options) {
|
|
623
1595
|
return this.rest.post(import_v106.Routes.oauth2TokenExchange(), {
|
|
624
1596
|
body: (0, import_rest5.makeURLSearchParams)(options),
|
|
@@ -628,6 +1600,12 @@ var OAuth2API = class {
|
|
|
628
1600
|
}
|
|
629
1601
|
});
|
|
630
1602
|
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Refreshes an OAuth2 access token, giving you a new one
|
|
1605
|
+
*
|
|
1606
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-refresh-token-exchange-example}
|
|
1607
|
+
* @param options - The options for the refresh token request
|
|
1608
|
+
*/
|
|
631
1609
|
async refreshToken(options) {
|
|
632
1610
|
return this.rest.post(import_v106.Routes.oauth2TokenExchange(), {
|
|
633
1611
|
body: (0, import_rest5.makeURLSearchParams)(options),
|
|
@@ -637,6 +1615,14 @@ var OAuth2API = class {
|
|
|
637
1615
|
}
|
|
638
1616
|
});
|
|
639
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Fetches the bearer token for the current application
|
|
1620
|
+
*
|
|
1621
|
+
* @remarks
|
|
1622
|
+
* This is primarily used for testing purposes
|
|
1623
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#client-credentials-grant}
|
|
1624
|
+
* @param options - The options for the client credentials grant request
|
|
1625
|
+
*/
|
|
640
1626
|
async getToken(options) {
|
|
641
1627
|
return this.rest.post(import_v106.Routes.oauth2TokenExchange(), {
|
|
642
1628
|
body: (0, import_rest5.makeURLSearchParams)(options),
|
|
@@ -646,9 +1632,19 @@ var OAuth2API = class {
|
|
|
646
1632
|
}
|
|
647
1633
|
});
|
|
648
1634
|
}
|
|
1635
|
+
/**
|
|
1636
|
+
* Fetches the current bot's application information
|
|
1637
|
+
*
|
|
1638
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information}
|
|
1639
|
+
*/
|
|
649
1640
|
async getCurrentBotApplicationInformation() {
|
|
650
1641
|
return this.rest.get(import_v106.Routes.oauth2CurrentApplication());
|
|
651
1642
|
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Fetches the current authorization information
|
|
1645
|
+
*
|
|
1646
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information}
|
|
1647
|
+
*/
|
|
652
1648
|
async getCurrentAuthorizationInformation() {
|
|
653
1649
|
return this.rest.get(import_v106.Routes.oauth2CurrentAuthorization());
|
|
654
1650
|
}
|
|
@@ -661,11 +1657,22 @@ var RoleConnectionsAPI = class {
|
|
|
661
1657
|
constructor(rest) {
|
|
662
1658
|
this.rest = rest;
|
|
663
1659
|
}
|
|
1660
|
+
/**
|
|
1661
|
+
* Gets the role connection metadata records for the application
|
|
1662
|
+
*
|
|
1663
|
+
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records}
|
|
1664
|
+
* @param applicationId - The id of the application to get role connection metadata records for
|
|
1665
|
+
*/
|
|
664
1666
|
async getMetadataRecords(applicationId) {
|
|
665
|
-
return this.rest.get(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
1667
|
+
return this.rest.get(import_v107.Routes.applicationRoleConnectionMetadata(applicationId));
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Updates the role connection metadata records for the application
|
|
1671
|
+
*
|
|
1672
|
+
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records}
|
|
1673
|
+
* @param applicationId - The id of the application to update role connection metadata records for
|
|
1674
|
+
* @param options - The new role connection metadata records
|
|
1675
|
+
*/
|
|
669
1676
|
async updateMetadataRecords(applicationId, options) {
|
|
670
1677
|
return this.rest.put(import_v107.Routes.applicationRoleConnectionMetadata(applicationId), {
|
|
671
1678
|
body: options
|
|
@@ -680,9 +1687,20 @@ var StickersAPI = class {
|
|
|
680
1687
|
constructor(rest) {
|
|
681
1688
|
this.rest = rest;
|
|
682
1689
|
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Fetches all of the nitro sticker packs
|
|
1692
|
+
*
|
|
1693
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs}
|
|
1694
|
+
*/
|
|
683
1695
|
async getNitroStickers() {
|
|
684
1696
|
return this.rest.get(import_v108.Routes.nitroStickerPacks());
|
|
685
1697
|
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Fetches a sticker
|
|
1700
|
+
*
|
|
1701
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker}
|
|
1702
|
+
* @param stickerId - The id of the sticker
|
|
1703
|
+
*/
|
|
686
1704
|
async get(stickerId) {
|
|
687
1705
|
return this.rest.get(import_v108.Routes.sticker(stickerId));
|
|
688
1706
|
}
|
|
@@ -695,35 +1713,100 @@ var ThreadsAPI = class {
|
|
|
695
1713
|
constructor(rest) {
|
|
696
1714
|
this.rest = rest;
|
|
697
1715
|
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Fetches a thread
|
|
1718
|
+
*
|
|
1719
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel}
|
|
1720
|
+
* @param threadId - The id of the thread
|
|
1721
|
+
*/
|
|
698
1722
|
async get(threadId) {
|
|
699
1723
|
return this.rest.get(import_v109.Routes.channel(threadId));
|
|
700
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Creates a new thread
|
|
1727
|
+
*
|
|
1728
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
|
|
1729
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
|
|
1730
|
+
* @param channelId - The id of the channel to start the thread in
|
|
1731
|
+
* @param data - The data to use when starting the thread
|
|
1732
|
+
*/
|
|
701
1733
|
async create(channelId, { message_id, ...body }) {
|
|
702
|
-
return this.rest.post(import_v109.Routes.threads(channelId, message_id), {
|
|
1734
|
+
return this.rest.post(import_v109.Routes.threads(channelId, message_id), {
|
|
1735
|
+
body
|
|
1736
|
+
});
|
|
703
1737
|
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Creates a new forum post
|
|
1740
|
+
*
|
|
1741
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel}
|
|
1742
|
+
* @param channelId - The id of the forum channel to start the thread in
|
|
1743
|
+
* @param data - The data to use when starting the thread
|
|
1744
|
+
*/
|
|
704
1745
|
async createForumThread(channelId, { message, ...optionsBody }) {
|
|
705
1746
|
const { files, ...messageBody } = message;
|
|
706
1747
|
const body = {
|
|
707
1748
|
...optionsBody,
|
|
708
1749
|
message: messageBody
|
|
709
1750
|
};
|
|
710
|
-
return this.rest.post(import_v109.Routes.threads(channelId), {
|
|
1751
|
+
return this.rest.post(import_v109.Routes.threads(channelId), {
|
|
1752
|
+
files,
|
|
1753
|
+
body
|
|
1754
|
+
});
|
|
711
1755
|
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Adds the current user to a thread
|
|
1758
|
+
*
|
|
1759
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#join-thread}
|
|
1760
|
+
* @param threadId - The id of the thread to join
|
|
1761
|
+
*/
|
|
712
1762
|
async join(threadId) {
|
|
713
1763
|
await this.rest.put(import_v109.Routes.threadMembers(threadId, "@me"));
|
|
714
1764
|
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Adds a member to a thread
|
|
1767
|
+
*
|
|
1768
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#add-thread-member}
|
|
1769
|
+
* @param threadId - The id of the thread to add the member to
|
|
1770
|
+
* @param userId - The id of the user to add to the thread
|
|
1771
|
+
*/
|
|
715
1772
|
async addMember(threadId, userId) {
|
|
716
1773
|
await this.rest.put(import_v109.Routes.threadMembers(threadId, userId));
|
|
717
1774
|
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Removes the current user from a thread
|
|
1777
|
+
*
|
|
1778
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#leave-thread}
|
|
1779
|
+
* @param threadId - The id of the thread to leave
|
|
1780
|
+
*/
|
|
718
1781
|
async leave(threadId) {
|
|
719
1782
|
await this.rest.delete(import_v109.Routes.threadMembers(threadId, "@me"));
|
|
720
1783
|
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Removes a member from a thread
|
|
1786
|
+
*
|
|
1787
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#remove-thread-member}
|
|
1788
|
+
* @param threadId - The id of the thread to remove the member from
|
|
1789
|
+
* @param userId - The id of the user to remove from the thread
|
|
1790
|
+
*/
|
|
721
1791
|
async removeMember(threadId, userId) {
|
|
722
1792
|
await this.rest.delete(import_v109.Routes.threadMembers(threadId, userId));
|
|
723
1793
|
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Fetches a member of a thread
|
|
1796
|
+
*
|
|
1797
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#get-thread-member}
|
|
1798
|
+
* @param threadId - The id of the thread to fetch the member from
|
|
1799
|
+
* @param userId - The id of the user
|
|
1800
|
+
*/
|
|
724
1801
|
async getMember(threadId, userId) {
|
|
725
1802
|
return this.rest.get(import_v109.Routes.threadMembers(threadId, userId));
|
|
726
1803
|
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Fetches all members of a thread
|
|
1806
|
+
*
|
|
1807
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#list-thread-members}
|
|
1808
|
+
* @param threadId - The id of the thread to fetch the members from
|
|
1809
|
+
*/
|
|
727
1810
|
async getAllMembers(threadId) {
|
|
728
1811
|
return this.rest.get(import_v109.Routes.threadMembers(threadId));
|
|
729
1812
|
}
|
|
@@ -737,50 +1820,114 @@ var UsersAPI = class {
|
|
|
737
1820
|
constructor(rest) {
|
|
738
1821
|
this.rest = rest;
|
|
739
1822
|
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Fetches a user by their id
|
|
1825
|
+
*
|
|
1826
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-user}
|
|
1827
|
+
* @param userId - The id of the user to fetch
|
|
1828
|
+
*/
|
|
740
1829
|
async get(userId) {
|
|
741
1830
|
return this.rest.get(import_v1010.Routes.user(userId));
|
|
742
1831
|
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Returns the user object of the requester's account
|
|
1834
|
+
*
|
|
1835
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user}
|
|
1836
|
+
*/
|
|
743
1837
|
async getCurrent() {
|
|
744
1838
|
return this.rest.get(import_v1010.Routes.user("@me"));
|
|
745
1839
|
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Returns a list of partial guild objects the current user is a member of
|
|
1842
|
+
*
|
|
1843
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guilds}
|
|
1844
|
+
* @param options - The options to use when fetching the current user's guilds
|
|
1845
|
+
*/
|
|
746
1846
|
async getGuilds(options = {}) {
|
|
747
1847
|
return this.rest.get(import_v1010.Routes.userGuilds(), {
|
|
748
1848
|
query: (0, import_rest6.makeURLSearchParams)(options)
|
|
749
1849
|
});
|
|
750
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Leaves the guild with the given id
|
|
1853
|
+
*
|
|
1854
|
+
* @see {@link https://discord.com/developers/docs/resources/user#leave-guild}
|
|
1855
|
+
* @param guildId - The id of the guild
|
|
1856
|
+
*/
|
|
751
1857
|
async leaveGuild(guildId) {
|
|
752
1858
|
await this.rest.delete(import_v1010.Routes.userGuild(guildId));
|
|
753
1859
|
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Edits the current user
|
|
1862
|
+
*
|
|
1863
|
+
* @see {@link https://discord.com/developers/docs/resources/user#modify-current-user}
|
|
1864
|
+
* @param user - The new data for the current user
|
|
1865
|
+
*/
|
|
754
1866
|
async edit(user) {
|
|
755
|
-
return this.rest.patch(import_v1010.Routes.user("@me"), {
|
|
1867
|
+
return this.rest.patch(import_v1010.Routes.user("@me"), {
|
|
1868
|
+
body: user
|
|
1869
|
+
});
|
|
756
1870
|
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Fetches the guild member for the current user
|
|
1873
|
+
*
|
|
1874
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guild-member}
|
|
1875
|
+
* @param guildId - The id of the guild
|
|
1876
|
+
*/
|
|
757
1877
|
async getGuildMember(guildId) {
|
|
758
1878
|
return this.rest.get(import_v1010.Routes.userGuildMember(guildId));
|
|
759
1879
|
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Edits the guild member for the current user
|
|
1882
|
+
*
|
|
1883
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-member}
|
|
1884
|
+
* @param guildId - The id of the guild
|
|
1885
|
+
* @param member - The new data for the guild member
|
|
1886
|
+
* @param reason - The reason for editing this guild member
|
|
1887
|
+
*/
|
|
760
1888
|
async editGuildMember(guildId, member = {}, reason) {
|
|
761
1889
|
return this.rest.patch(import_v1010.Routes.guildMember(guildId, "@me"), {
|
|
762
1890
|
reason,
|
|
763
1891
|
body: member
|
|
764
1892
|
});
|
|
765
1893
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1894
|
+
/**
|
|
1895
|
+
* Opens a new DM channel with a user
|
|
1896
|
+
*
|
|
1897
|
+
* @see {@link https://discord.com/developers/docs/resources/user#create-dm}
|
|
1898
|
+
* @param userId - The id of the user to open a DM channel with
|
|
1899
|
+
*/
|
|
771
1900
|
async createDM(userId) {
|
|
772
1901
|
return this.rest.post(import_v1010.Routes.userChannels(), {
|
|
773
|
-
body: {
|
|
1902
|
+
body: {
|
|
1903
|
+
recipient_id: userId
|
|
1904
|
+
}
|
|
774
1905
|
});
|
|
775
1906
|
}
|
|
1907
|
+
/**
|
|
1908
|
+
* Gets the current user's connections
|
|
1909
|
+
*
|
|
1910
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-user-connections}
|
|
1911
|
+
*/
|
|
776
1912
|
async getConnections() {
|
|
777
1913
|
return this.rest.get(import_v1010.Routes.userConnections());
|
|
778
1914
|
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Gets the current user's active application role connection
|
|
1917
|
+
*
|
|
1918
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-user-application-role-connection}
|
|
1919
|
+
* @param applicationId - The id of the application
|
|
1920
|
+
*/
|
|
779
1921
|
async getApplicationRoleConnection(applicationId) {
|
|
780
|
-
return this.rest.get(
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
1922
|
+
return this.rest.get(import_v1010.Routes.userApplicationRoleConnection(applicationId));
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* Updates the current user's application role connection
|
|
1926
|
+
*
|
|
1927
|
+
* @see {@link https://discord.com/developers/docs/resources/user#update-user-application-role-connection}
|
|
1928
|
+
* @param applicationId - The id of the application
|
|
1929
|
+
* @param options - The options to use when updating the application role connection
|
|
1930
|
+
*/
|
|
784
1931
|
async updateApplicationRoleConnection(applicationId, options) {
|
|
785
1932
|
return this.rest.put(import_v1010.Routes.userApplicationRoleConnection(applicationId), {
|
|
786
1933
|
body: options
|
|
@@ -795,6 +1942,11 @@ var VoiceAPI = class {
|
|
|
795
1942
|
constructor(rest) {
|
|
796
1943
|
this.rest = rest;
|
|
797
1944
|
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Fetches all voice regions
|
|
1947
|
+
*
|
|
1948
|
+
* @see {@link https://discord.com/developers/docs/resources/voice#list-voice-regions}
|
|
1949
|
+
*/
|
|
798
1950
|
async getVoiceRegions() {
|
|
799
1951
|
return this.rest.get(import_v1011.Routes.voiceRegions());
|
|
800
1952
|
}
|
|
@@ -808,34 +1960,86 @@ var WebhooksAPI = class {
|
|
|
808
1960
|
constructor(rest) {
|
|
809
1961
|
this.rest = rest;
|
|
810
1962
|
}
|
|
1963
|
+
/**
|
|
1964
|
+
* Fetches a webhook
|
|
1965
|
+
*
|
|
1966
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook}
|
|
1967
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-with-token}
|
|
1968
|
+
* @param id - The id of the webhook
|
|
1969
|
+
* @param token - The token of the webhook
|
|
1970
|
+
*/
|
|
811
1971
|
async get(id, token) {
|
|
812
1972
|
return this.rest.get(import_v1012.Routes.webhook(id, token));
|
|
813
1973
|
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Creates a new webhook
|
|
1976
|
+
*
|
|
1977
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook}
|
|
1978
|
+
* @param channelId - The id of the channel to create the webhook in
|
|
1979
|
+
* @param data - The data to use when creating the webhook
|
|
1980
|
+
* @param reason - The reason for creating the webhook
|
|
1981
|
+
*/
|
|
814
1982
|
async create(channelId, data, reason) {
|
|
815
1983
|
return this.rest.post(import_v1012.Routes.channelWebhooks(channelId), {
|
|
816
1984
|
reason,
|
|
817
1985
|
body: data
|
|
818
1986
|
});
|
|
819
1987
|
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Edits a webhook
|
|
1990
|
+
*
|
|
1991
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#modify-webhook}
|
|
1992
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token}
|
|
1993
|
+
* @param id - The id of the webhook to edit
|
|
1994
|
+
* @param webhook - The new webhook data
|
|
1995
|
+
* @param options - The options to use when editing the webhook
|
|
1996
|
+
*/
|
|
820
1997
|
async edit(id, webhook, { token, reason } = {}) {
|
|
821
|
-
return this.rest.patch(import_v1012.Routes.webhook(id, token), {
|
|
1998
|
+
return this.rest.patch(import_v1012.Routes.webhook(id, token), {
|
|
1999
|
+
reason,
|
|
2000
|
+
body: webhook
|
|
2001
|
+
});
|
|
822
2002
|
}
|
|
2003
|
+
/**
|
|
2004
|
+
* Deletes a webhook
|
|
2005
|
+
*
|
|
2006
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook}
|
|
2007
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token}
|
|
2008
|
+
* @param id - The id of the webhook to delete
|
|
2009
|
+
* @param options - The options to use when deleting the webhook
|
|
2010
|
+
*/
|
|
823
2011
|
async delete(id, { token, reason } = {}) {
|
|
824
|
-
await this.rest.delete(import_v1012.Routes.webhook(id, token), {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
2012
|
+
await this.rest.delete(import_v1012.Routes.webhook(id, token), {
|
|
2013
|
+
reason
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Executes a webhook
|
|
2018
|
+
*
|
|
2019
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook}
|
|
2020
|
+
* @param id - The id of the webhook
|
|
2021
|
+
* @param token - The token of the webhook
|
|
2022
|
+
* @param data - The data to use when executing the webhook
|
|
2023
|
+
*/
|
|
2024
|
+
async execute(id, token, { wait, thread_id, files, ...body }) {
|
|
832
2025
|
return this.rest.post(import_v1012.Routes.webhook(id, token), {
|
|
833
|
-
query: (0, import_rest7.makeURLSearchParams)({
|
|
2026
|
+
query: (0, import_rest7.makeURLSearchParams)({
|
|
2027
|
+
wait,
|
|
2028
|
+
thread_id
|
|
2029
|
+
}),
|
|
834
2030
|
files,
|
|
835
2031
|
body,
|
|
836
2032
|
auth: false
|
|
837
2033
|
});
|
|
838
2034
|
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Executes a slack webhook
|
|
2037
|
+
*
|
|
2038
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook}
|
|
2039
|
+
* @param id - The id of the webhook
|
|
2040
|
+
* @param token - The token of the webhook
|
|
2041
|
+
* @param options - The options to use when executing the webhook
|
|
2042
|
+
*/
|
|
839
2043
|
async executeSlack(id, token, body, options = {}) {
|
|
840
2044
|
await this.rest.post(import_v1012.Routes.webhookPlatform(id, token, "slack"), {
|
|
841
2045
|
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
@@ -843,6 +2047,14 @@ var WebhooksAPI = class {
|
|
|
843
2047
|
auth: false
|
|
844
2048
|
});
|
|
845
2049
|
}
|
|
2050
|
+
/**
|
|
2051
|
+
* Executes a github webhook
|
|
2052
|
+
*
|
|
2053
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook}
|
|
2054
|
+
* @param id - The id of the webhook
|
|
2055
|
+
* @param token - The token of the webhook
|
|
2056
|
+
* @param options - The options to use when executing the webhook
|
|
2057
|
+
*/
|
|
846
2058
|
async executeGitHub(id, token, body, options = {}) {
|
|
847
2059
|
await this.rest.post(import_v1012.Routes.webhookPlatform(id, token, "github"), {
|
|
848
2060
|
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
@@ -850,19 +2062,48 @@ var WebhooksAPI = class {
|
|
|
850
2062
|
auth: false
|
|
851
2063
|
});
|
|
852
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* Fetches an associated message from a webhook
|
|
2067
|
+
*
|
|
2068
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-message}
|
|
2069
|
+
* @param id - The id of the webhook
|
|
2070
|
+
* @param token - The token of the webhook
|
|
2071
|
+
* @param messageId - The id of the message to fetch
|
|
2072
|
+
* @param options - The options to use when fetching the message
|
|
2073
|
+
*/
|
|
853
2074
|
async getMessage(id, token, messageId, options = {}) {
|
|
854
2075
|
return this.rest.get(import_v1012.Routes.webhookMessage(id, token, messageId), {
|
|
855
2076
|
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
856
2077
|
auth: false
|
|
857
2078
|
});
|
|
858
2079
|
}
|
|
2080
|
+
/**
|
|
2081
|
+
* Edits an associated message from a webhook
|
|
2082
|
+
*
|
|
2083
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}
|
|
2084
|
+
* @param id - The id of the webhook
|
|
2085
|
+
* @param token - The token of the webhook
|
|
2086
|
+
* @param messageId - The id of the message to edit
|
|
2087
|
+
* @param data - The data to use when editing the message
|
|
2088
|
+
*/
|
|
859
2089
|
async editMessage(id, token, messageId, { thread_id, ...body }) {
|
|
860
2090
|
return this.rest.patch(import_v1012.Routes.webhookMessage(id, token, messageId), {
|
|
861
|
-
query: (0, import_rest7.makeURLSearchParams)({
|
|
2091
|
+
query: (0, import_rest7.makeURLSearchParams)({
|
|
2092
|
+
thread_id
|
|
2093
|
+
}),
|
|
862
2094
|
auth: false,
|
|
863
2095
|
body
|
|
864
2096
|
});
|
|
865
2097
|
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Deletes an associated message from a webhook
|
|
2100
|
+
*
|
|
2101
|
+
* @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook-message}
|
|
2102
|
+
* @param id - The id of the webhook
|
|
2103
|
+
* @param token - The token of the webhook
|
|
2104
|
+
* @param messageId - The id of the message to delete
|
|
2105
|
+
* @param options - The options to use when deleting the message
|
|
2106
|
+
*/
|
|
866
2107
|
async deleteMessage(id, token, messageId, options = {}) {
|
|
867
2108
|
await this.rest.delete(import_v1012.Routes.webhookMessage(id, token, messageId), {
|
|
868
2109
|
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
@@ -889,18 +2130,6 @@ var API = class {
|
|
|
889
2130
|
this.webhooks = new WebhooksAPI(rest);
|
|
890
2131
|
this.interactions = new InteractionsAPI(rest, this.webhooks);
|
|
891
2132
|
}
|
|
892
|
-
applicationCommands;
|
|
893
|
-
channels;
|
|
894
|
-
guilds;
|
|
895
|
-
interactions;
|
|
896
|
-
invites;
|
|
897
|
-
oauth2;
|
|
898
|
-
roleConnections;
|
|
899
|
-
stickers;
|
|
900
|
-
threads;
|
|
901
|
-
users;
|
|
902
|
-
voice;
|
|
903
|
-
webhooks;
|
|
904
2133
|
};
|
|
905
2134
|
__name(API, "API");
|
|
906
2135
|
|
|
@@ -912,9 +2141,6 @@ var import_snowflake = require("@sapphire/snowflake");
|
|
|
912
2141
|
var import_async_event_emitter = require("@vladfrangu/async_event_emitter");
|
|
913
2142
|
var import_v1013 = require("discord-api-types/v10");
|
|
914
2143
|
var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
915
|
-
rest;
|
|
916
|
-
ws;
|
|
917
|
-
api;
|
|
918
2144
|
constructor({ rest, ws }) {
|
|
919
2145
|
super();
|
|
920
2146
|
this.rest = rest;
|
|
@@ -924,6 +2150,13 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
924
2150
|
this.emit(dispatch.t, this.wrapIntrinsicProps(dispatch.d, shardId));
|
|
925
2151
|
});
|
|
926
2152
|
}
|
|
2153
|
+
/**
|
|
2154
|
+
* Requests guild members from the gateway.
|
|
2155
|
+
*
|
|
2156
|
+
* @see {@link https://discord.com/developers/docs/topics/gateway-events#request-guild-members}
|
|
2157
|
+
* @param options - The options for the request
|
|
2158
|
+
* @param timeout - The timeout for waiting for each guild members chunk event
|
|
2159
|
+
*/
|
|
927
2160
|
async requestGuildMembers(options, timeout = 1e4) {
|
|
928
2161
|
const shardId = (0, import_util.calculateShardId)(options.guild_id, await this.ws.getShardCount());
|
|
929
2162
|
const nonce = options.nonce ?? import_snowflake.DiscordSnowflake.generate().toString();
|
|
@@ -946,6 +2179,7 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
946
2179
|
});
|
|
947
2180
|
await this.ws.send(shardId, {
|
|
948
2181
|
op: import_v1013.GatewayOpcodes.RequestGuildMembers,
|
|
2182
|
+
// eslint-disable-next-line id-length
|
|
949
2183
|
d: {
|
|
950
2184
|
...options,
|
|
951
2185
|
nonce
|
|
@@ -953,16 +2187,30 @@ var Client = class extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
953
2187
|
});
|
|
954
2188
|
return promise;
|
|
955
2189
|
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Updates the voice state of the bot user
|
|
2192
|
+
*
|
|
2193
|
+
* @see {@link https://discord.com/developers/docs/topics/gateway-events#update-voice-state}
|
|
2194
|
+
* @param options - The options for updating the voice state
|
|
2195
|
+
*/
|
|
956
2196
|
async updateVoiceState(options) {
|
|
957
2197
|
const shardId = (0, import_util.calculateShardId)(options.guild_id, await this.ws.getShardCount());
|
|
958
2198
|
await this.ws.send(shardId, {
|
|
959
2199
|
op: import_v1013.GatewayOpcodes.VoiceStateUpdate,
|
|
2200
|
+
// eslint-disable-next-line id-length
|
|
960
2201
|
d: options
|
|
961
2202
|
});
|
|
962
2203
|
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Updates the presence of the bot user
|
|
2206
|
+
*
|
|
2207
|
+
* @param shardId - The id of the shard to update the presence in
|
|
2208
|
+
* @param options - The options for updating the presence
|
|
2209
|
+
*/
|
|
963
2210
|
async updatePresence(shardId, options) {
|
|
964
2211
|
await this.ws.send(shardId, {
|
|
965
2212
|
op: import_v1013.GatewayOpcodes.PresenceUpdate,
|
|
2213
|
+
// eslint-disable-next-line id-length
|
|
966
2214
|
d: options
|
|
967
2215
|
});
|
|
968
2216
|
}
|
|
@@ -989,7 +2237,10 @@ function withFiles(files, options) {
|
|
|
989
2237
|
name: file.name ?? index.toString(),
|
|
990
2238
|
data: file.data
|
|
991
2239
|
}));
|
|
992
|
-
return {
|
|
2240
|
+
return {
|
|
2241
|
+
body,
|
|
2242
|
+
files: outputFiles
|
|
2243
|
+
};
|
|
993
2244
|
}
|
|
994
2245
|
__name(withFiles, "withFiles");
|
|
995
2246
|
|