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