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