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