disgroove 1.3.4 → 2.0.0-dev.0f17bf6
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/README.md +9 -9
- package/dist/lib/Client.d.ts +562 -144
- package/dist/lib/Client.js +1795 -125
- package/dist/lib/Client.js.map +1 -1
- package/dist/lib/constants.d.ts +7 -7
- package/dist/lib/constants.js +218 -218
- package/dist/lib/gateway/Shard.d.ts +0 -1
- package/dist/lib/gateway/Shard.js +65 -261
- package/dist/lib/gateway/Shard.js.map +1 -1
- package/dist/lib/gateway/ShardManager.d.ts +5 -0
- package/dist/lib/gateway/ShardManager.js +13 -0
- package/dist/lib/gateway/ShardManager.js.map +1 -0
- package/dist/lib/gateway/index.d.ts +1 -1
- package/dist/lib/gateway/index.js +1 -1
- package/dist/lib/gateway/index.js.map +1 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/rest/CDN.d.ts +21 -21
- package/dist/lib/rest/CDN.js +21 -21
- package/dist/lib/rest/CDN.js.map +1 -1
- package/dist/lib/rest/Endpoints.d.ts +3 -3
- package/dist/lib/rest/Endpoints.js +8 -8
- package/dist/lib/rest/Endpoints.js.map +1 -1
- package/dist/lib/rest/REST.d.ts +2 -2
- package/dist/lib/rest/REST.js +1 -1
- package/dist/lib/rest/REST.js.map +1 -1
- package/dist/lib/rest/RequestManager.d.ts +28 -0
- package/dist/lib/rest/RequestManager.js +130 -0
- package/dist/lib/rest/RequestManager.js.map +1 -0
- package/dist/lib/rest/index.d.ts +1 -2
- package/dist/lib/rest/index.js +1 -2
- package/dist/lib/rest/index.js.map +1 -1
- package/dist/lib/types/application-command.d.ts +94 -20
- package/dist/lib/types/application-role-connection-metadata.d.ts +7 -6
- package/dist/lib/types/application.d.ts +24 -13
- package/dist/lib/types/audit-log.d.ts +15 -16
- package/dist/lib/types/auto-moderation.d.ts +27 -7
- package/dist/lib/types/channel.d.ts +170 -68
- package/dist/lib/types/emoji.d.ts +12 -3
- package/dist/lib/types/entitlements.d.ts +6 -1
- package/dist/lib/types/gateway-events.d.ts +11 -336
- package/dist/lib/types/guild-scheduled-event.d.ts +31 -8
- package/dist/lib/types/guild-template.d.ts +16 -4
- package/dist/lib/types/guild.d.ts +190 -37
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/index.js.map +1 -1
- package/dist/lib/types/interaction.d.ts +37 -36
- package/dist/lib/types/invite.d.ts +12 -12
- package/dist/lib/types/message-components.d.ts +12 -12
- package/dist/lib/types/role.d.ts +3 -3
- package/dist/lib/types/sku.d.ts +8 -8
- package/dist/lib/types/stage-instance.d.ts +12 -1
- package/dist/lib/types/sticker.d.ts +18 -6
- package/dist/lib/types/team.d.ts +5 -5
- package/dist/lib/types/user.d.ts +30 -7
- package/dist/lib/types/voice.d.ts +4 -4
- package/dist/lib/types/webhook.d.ts +38 -6
- package/dist/lib/utils/Util.d.ts +2 -13
- package/dist/lib/utils/Util.js +39 -535
- package/dist/lib/utils/Util.js.map +1 -1
- package/dist/lib/utils/errors.d.ts +1 -1
- package/dist/lib/utils/errors.js +4 -4
- package/dist/lib/utils/index.d.ts +0 -1
- package/dist/lib/utils/index.js +0 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/lib/Client.js
CHANGED
@@ -7,7 +7,6 @@ exports.Client = void 0;
|
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const utils_1 = require("./utils");
|
9
9
|
const rest_1 = require("./rest");
|
10
|
-
const structures_1 = require("./structures");
|
11
10
|
const node_events_1 = __importDefault(require("node:events"));
|
12
11
|
const gateway_1 = require("./gateway");
|
13
12
|
class Client extends node_events_1.default {
|
@@ -18,9 +17,10 @@ class Client extends node_events_1.default {
|
|
18
17
|
shards;
|
19
18
|
rest;
|
20
19
|
util;
|
20
|
+
guildShardMap;
|
21
21
|
user;
|
22
|
+
guilds;
|
22
23
|
application;
|
23
|
-
guildShardMap;
|
24
24
|
constructor(token, options) {
|
25
25
|
super();
|
26
26
|
this.token = token;
|
@@ -32,14 +32,216 @@ class Client extends node_events_1.default {
|
|
32
32
|
: constants_1.GatewayIntents.AllNonPrivileged;
|
33
33
|
this.shardsCount = options?.shardsCount ?? "auto";
|
34
34
|
this.auth = options?.auth ?? "Bot";
|
35
|
-
this.shards = new gateway_1.
|
36
|
-
this.rest = new rest_1.
|
35
|
+
this.shards = new gateway_1.ShardManager();
|
36
|
+
this.rest = new rest_1.RequestManager(token, this.auth);
|
37
37
|
this.util = new utils_1.Util();
|
38
38
|
this.guildShardMap = {};
|
39
39
|
}
|
40
|
+
/** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient */
|
41
|
+
addGroupRecipient(channelId, userId, options) {
|
42
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.channelRecipient(channelId, userId), {
|
43
|
+
json: {
|
44
|
+
access_token: options.accessToken,
|
45
|
+
nick: options.nick,
|
46
|
+
},
|
47
|
+
});
|
48
|
+
}
|
49
|
+
/** https://discord.com/developers/docs/resources/guild#add-guild-member */
|
50
|
+
addGuildMember(guildId, userId, options) {
|
51
|
+
return this.rest
|
52
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.guildMember(guildId, userId), {
|
53
|
+
json: {
|
54
|
+
access_token: options.accessToken,
|
55
|
+
nick: options.nick,
|
56
|
+
roles: options.roles,
|
57
|
+
mute: options.mute,
|
58
|
+
deaf: options.deaf,
|
59
|
+
},
|
60
|
+
})
|
61
|
+
.then((response) => response !== null ? this.util.toCamelCase(response) : null);
|
62
|
+
}
|
63
|
+
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
64
|
+
addGuildMemberRole(guildId, userId, roleId, reason) {
|
65
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.guildMemberRole(guildId, userId, roleId), {
|
66
|
+
reason,
|
67
|
+
});
|
68
|
+
}
|
69
|
+
/** https://discord.com/developers/docs/resources/channel#add-thread-member */
|
70
|
+
addThreadMember(channelId, userId) {
|
71
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.threadMembers(channelId, userId));
|
72
|
+
}
|
73
|
+
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
74
|
+
beginGuildPrune(guildId, options, reason) {
|
75
|
+
return this.rest
|
76
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildPrune(guildId), {
|
77
|
+
json: {
|
78
|
+
days: options.days,
|
79
|
+
compute_prune_count: options.computePruneCount,
|
80
|
+
include_roles: options.includeRoles,
|
81
|
+
reason: options.reason,
|
82
|
+
},
|
83
|
+
reason,
|
84
|
+
})
|
85
|
+
.then((response) => this.util.toCamelCase(response));
|
86
|
+
}
|
87
|
+
/** https://discord.com/developers/docs/resources/channel#bulk-delete-messages */
|
88
|
+
bulkDeleteMessages(channelId, options, reason) {
|
89
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelBulkDelete(channelId), {
|
90
|
+
json: {
|
91
|
+
messages: options?.messagesIds,
|
92
|
+
},
|
93
|
+
reason,
|
94
|
+
});
|
95
|
+
}
|
96
|
+
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
97
|
+
bulkEditGlobalApplicationCommands(applicationId, commands) {
|
98
|
+
return this.rest
|
99
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.applicationCommands(applicationId), {
|
100
|
+
json: commands.map((command) => this.util.toSnakeCase(command)),
|
101
|
+
})
|
102
|
+
.then((response) => response.map((applicationCommand) => this.util.toCamelCase(applicationCommand)));
|
103
|
+
}
|
104
|
+
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
105
|
+
bulkEditGuildApplicationCommands(applicationId, guildId, commands) {
|
106
|
+
return this.rest
|
107
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.applicationGuildCommands(applicationId, guildId), {
|
108
|
+
json: commands.map((command) => this.util.toSnakeCase(command)),
|
109
|
+
})
|
110
|
+
.then((response) => response.map((applicationCommand) => this.util.toCamelCase(applicationCommand)));
|
111
|
+
}
|
112
|
+
/** https://discord.com/developers/docs/topics/gateway#connections */
|
113
|
+
async connect() {
|
114
|
+
this.shardsCount =
|
115
|
+
this.shardsCount === "auto"
|
116
|
+
? (await this.getGatewayBot()).shards
|
117
|
+
: this.shardsCount;
|
118
|
+
for (let i = 0; i < this.shardsCount; i++)
|
119
|
+
this.shards.set(i, new gateway_1.Shard(i, this));
|
120
|
+
this.shards.connect();
|
121
|
+
}
|
122
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
|
123
|
+
createAutoModerationRule(guildId, options, reason) {
|
124
|
+
return this.rest
|
125
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildAutoModerationRules(guildId), {
|
126
|
+
json: {
|
127
|
+
name: options.name,
|
128
|
+
event_type: options.eventType,
|
129
|
+
trigger_type: options.triggerType,
|
130
|
+
trigger_metadata: options.triggerMetadata,
|
131
|
+
actions: options.actions.map((action) => this.util.toSnakeCase(action)),
|
132
|
+
enabled: options.enabled,
|
133
|
+
exempt_roles: options.exemptRoles,
|
134
|
+
exempt_channels: options.exemptChannels,
|
135
|
+
},
|
136
|
+
reason,
|
137
|
+
})
|
138
|
+
.then((response) => this.util.toCamelCase(response));
|
139
|
+
}
|
140
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
141
|
+
createChannel(guildId, options, reason) {
|
142
|
+
return this.rest
|
143
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildChannels(guildId), {
|
144
|
+
json: {
|
145
|
+
name: options.name,
|
146
|
+
type: options.type,
|
147
|
+
topic: options.topic,
|
148
|
+
bitrate: options.bitrate,
|
149
|
+
user_limit: options.userLimit,
|
150
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
151
|
+
position: options.position,
|
152
|
+
permission_overwrites: options.permissionOverwrites,
|
153
|
+
parent_id: options.parentId,
|
154
|
+
nsfw: options.nsfw,
|
155
|
+
rtc_region: options.rtcRegion,
|
156
|
+
video_quality_mode: options.videoQualityMode,
|
157
|
+
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
158
|
+
default_reaction_emoji: options.defaultReactionEmoji !== undefined
|
159
|
+
? options.defaultReactionEmoji !== null
|
160
|
+
? this.util.toSnakeCase(options.defaultReactionEmoji)
|
161
|
+
: null
|
162
|
+
: undefined,
|
163
|
+
available_tags: options.availableTags,
|
164
|
+
default_sort_order: options.defaultSortOrder,
|
165
|
+
default_forum_layout: options.defaultForumLayout,
|
166
|
+
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
167
|
+
},
|
168
|
+
reason,
|
169
|
+
})
|
170
|
+
.then((response) => this.util.toCamelCase(response));
|
171
|
+
}
|
172
|
+
/** https://discord.com/developers/docs/resources/channel#create-channel-invite */
|
173
|
+
createChannelInvite(channelId, options, reason) {
|
174
|
+
return this.rest
|
175
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelInvites(channelId), {
|
176
|
+
json: {
|
177
|
+
max_age: options.maxAge,
|
178
|
+
max_uses: options.maxUses,
|
179
|
+
temporary: options.temporary,
|
180
|
+
unique: options.unique,
|
181
|
+
target_type: options.targetType,
|
182
|
+
target_user_id: options.targetUserId,
|
183
|
+
target_application_id: options.targetApplicationId,
|
184
|
+
},
|
185
|
+
reason,
|
186
|
+
})
|
187
|
+
.then((response) => this.util.toCamelCase(response));
|
188
|
+
}
|
189
|
+
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
190
|
+
createChannelWebhook(channelId, options, reason) {
|
191
|
+
return this.rest
|
192
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelWebhooks(channelId), {
|
193
|
+
json: {
|
194
|
+
name: options.name,
|
195
|
+
avatar: options.avatar,
|
196
|
+
},
|
197
|
+
reason,
|
198
|
+
})
|
199
|
+
.then((response) => this.util.toCamelCase(response));
|
200
|
+
}
|
201
|
+
/** https://discord.com/developers/docs/resources/user#create-dm */
|
202
|
+
createDM(options) {
|
203
|
+
return this.rest
|
204
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.userChannels(), {
|
205
|
+
json: {
|
206
|
+
recipient_id: options.recipientId,
|
207
|
+
},
|
208
|
+
})
|
209
|
+
.then((response) => this.util.toCamelCase(response));
|
210
|
+
}
|
211
|
+
/** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
|
212
|
+
createGlobalApplicationCommand(applicationId, options) {
|
213
|
+
return this.rest
|
214
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.applicationCommands(applicationId), {
|
215
|
+
json: {
|
216
|
+
type: options.type,
|
217
|
+
name: options.name,
|
218
|
+
name_localizations: options.nameLocalizations,
|
219
|
+
description: options.description,
|
220
|
+
description_localizations: options.descriptionLocalizations,
|
221
|
+
options: options.options?.map((option) => this.util.toSnakeCase(option)),
|
222
|
+
default_member_permissions: options.defaultMemberPermissions,
|
223
|
+
dm_permission: options.dmPermission,
|
224
|
+
default_permission: options.defaultPermission,
|
225
|
+
nsfw: options.nsfw,
|
226
|
+
},
|
227
|
+
})
|
228
|
+
.then((response) => this.util.toCamelCase(response));
|
229
|
+
}
|
230
|
+
/** https://discord.com/developers/docs/resources/user#create-group-dm */
|
231
|
+
createGroupDM(options) {
|
232
|
+
return this.rest
|
233
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.userChannels(), {
|
234
|
+
json: {
|
235
|
+
access_tokens: options.accessTokens,
|
236
|
+
nicks: options.nicks,
|
237
|
+
},
|
238
|
+
})
|
239
|
+
.then((response) => this.util.toCamelCase(response));
|
240
|
+
}
|
40
241
|
/** https://discord.com/developers/docs/resources/guild#create-guild */
|
41
|
-
|
42
|
-
return
|
242
|
+
createGuild(options) {
|
243
|
+
return this.rest
|
244
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guilds(), {
|
43
245
|
json: {
|
44
246
|
name: options.name,
|
45
247
|
region: options.region,
|
@@ -47,81 +249,1204 @@ class Client extends node_events_1.default {
|
|
47
249
|
verification_level: options.verificationLevel,
|
48
250
|
default_message_notifications: options.defaultMessageNotifications,
|
49
251
|
explicit_content_filter: options.explicitContentFilter,
|
50
|
-
roles: options.roles?.map((role) => this.util.
|
51
|
-
channels: options.channels?.map((channel) => (
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
252
|
+
roles: options.roles?.map((role) => this.util.toSnakeCase(role)),
|
253
|
+
channels: options.channels?.map((channel) => this.util.toSnakeCase(channel)),
|
254
|
+
afk_channel_id: options.afkChannelId,
|
255
|
+
afk_timeout: options.afkTimeout,
|
256
|
+
system_channel_id: options.systemChannelId,
|
257
|
+
system_channel_flags: options.systemChannelFlags,
|
258
|
+
},
|
259
|
+
})
|
260
|
+
.then((response) => this.util.toCamelCase(response));
|
261
|
+
}
|
262
|
+
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
263
|
+
createGuildApplicationCommand(applicationId, guildId, options) {
|
264
|
+
return this.rest
|
265
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.applicationGuildCommands(applicationId, guildId), {
|
266
|
+
json: {
|
267
|
+
type: options.type,
|
268
|
+
name: options.name,
|
269
|
+
name_localizations: options.nameLocalizations,
|
270
|
+
description: options.description,
|
271
|
+
description_localizations: options.descriptionLocalizations,
|
272
|
+
options: options.options?.map((option) => this.util.toSnakeCase(option)),
|
273
|
+
default_member_permissions: options.defaultMemberPermissions,
|
274
|
+
default_permission: options.defaultPermission,
|
275
|
+
nsfw: options.nsfw,
|
276
|
+
},
|
277
|
+
})
|
278
|
+
.then((response) => this.util.toCamelCase(response));
|
279
|
+
}
|
280
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
281
|
+
createGuildBan(guildId, userId, options, reason) {
|
282
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.guildBan(guildId, userId), {
|
283
|
+
json: {
|
284
|
+
delete_message_days: options?.deleteMessageDays,
|
285
|
+
delete_message_seconds: options?.deleteMessageSeconds,
|
286
|
+
},
|
287
|
+
reason,
|
288
|
+
});
|
289
|
+
}
|
290
|
+
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
291
|
+
createGuildEmoji(guildId, options, reason) {
|
292
|
+
return this.rest
|
293
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildEmojis(guildId), {
|
294
|
+
json: {
|
295
|
+
name: options.name,
|
296
|
+
image: options.image,
|
297
|
+
roles: options.roles,
|
298
|
+
},
|
299
|
+
reason,
|
300
|
+
})
|
301
|
+
.then((response) => this.util.toCamelCase(response));
|
302
|
+
}
|
303
|
+
/** https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template */
|
304
|
+
createGuildFromTemplate(code, options) {
|
305
|
+
return this.rest
|
306
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.template(code), {
|
307
|
+
json: {
|
308
|
+
name: options.name,
|
309
|
+
icon: options.icon,
|
310
|
+
},
|
311
|
+
})
|
312
|
+
.then((response) => this.util.toCamelCase(response));
|
313
|
+
}
|
314
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
315
|
+
createGuildRole(guildId, options, reason) {
|
316
|
+
return this.rest
|
317
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildRoles(guildId), {
|
318
|
+
json: {
|
319
|
+
name: options.name,
|
320
|
+
permissions: options.permissions,
|
321
|
+
color: options.color,
|
322
|
+
hoist: options.hoist,
|
323
|
+
icon: options.icon,
|
324
|
+
unicode_emoji: options.unicodeEmoji,
|
325
|
+
mentionable: options.mentionable,
|
326
|
+
},
|
327
|
+
reason,
|
328
|
+
})
|
329
|
+
.then((response) => this.util.toCamelCase(response));
|
330
|
+
}
|
331
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
332
|
+
createGuildScheduledEvent(guildId, options, reason) {
|
333
|
+
return this.rest
|
334
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildScheduledEvents(guildId), {
|
335
|
+
json: {
|
336
|
+
channel_id: options.channelId,
|
337
|
+
entity_metadata: options.entityMetadata,
|
338
|
+
name: options.name,
|
339
|
+
privacy_level: options.privacyLevel,
|
340
|
+
scheduled_start_time: options.scheduledEndTime,
|
341
|
+
scheduled_end_time: options.scheduledEndTime,
|
342
|
+
description: options.description,
|
343
|
+
entity_type: options.entityType,
|
344
|
+
image: options.image,
|
345
|
+
},
|
346
|
+
reason,
|
347
|
+
})
|
348
|
+
.then((response) => this.util.toCamelCase(response));
|
349
|
+
}
|
350
|
+
/** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
|
351
|
+
createGuildSticker(guildId, options, reason) {
|
352
|
+
const formData = new FormData();
|
353
|
+
formData.set("name", options.name);
|
354
|
+
formData.set("description", options.description);
|
355
|
+
formData.set("tags", options.tags);
|
356
|
+
formData.set("file", new Blob([options.file.contents]), options.file.name);
|
357
|
+
return this.rest
|
358
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildStickers(guildId), {
|
359
|
+
form: formData,
|
360
|
+
reason,
|
361
|
+
})
|
362
|
+
.then((response) => this.util.toCamelCase(response));
|
363
|
+
}
|
364
|
+
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
365
|
+
createGuildTemplate(guildId, options) {
|
366
|
+
return this.rest
|
367
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildTemplates(guildId), {
|
368
|
+
json: {
|
369
|
+
name: options.name,
|
370
|
+
description: options.description,
|
371
|
+
},
|
372
|
+
})
|
373
|
+
.then((response) => this.util.toCamelCase(response));
|
374
|
+
}
|
375
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message */
|
376
|
+
createInteractionFollowupMessage(applicationId, interactionToken, options) {
|
377
|
+
return this.rest
|
378
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.webhook(applicationId, interactionToken), {
|
379
|
+
json: {
|
380
|
+
content: options.content,
|
381
|
+
tts: options.tts,
|
382
|
+
embeds: options.embeds !== undefined
|
383
|
+
? options.embeds !== null
|
384
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
385
|
+
: null
|
386
|
+
: undefined,
|
387
|
+
allowed_mentions: options.allowedMentions !== undefined
|
388
|
+
? options.allowedMentions !== null
|
389
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
390
|
+
: null
|
391
|
+
: undefined,
|
392
|
+
components: options.components !== undefined
|
393
|
+
? options.components !== null
|
394
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
395
|
+
: null
|
396
|
+
: undefined,
|
397
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
398
|
+
flags: options.flags,
|
399
|
+
thread_name: options.threadName,
|
400
|
+
},
|
401
|
+
files: options.files,
|
402
|
+
})
|
403
|
+
.then((response) => this.util.toCamelCase(response));
|
404
|
+
}
|
405
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
|
406
|
+
createInteractionResponse(interactionId, interactionToken, options) {
|
407
|
+
switch (options.type) {
|
408
|
+
case constants_1.InteractionCallbackType.ChannelMessageWithSource:
|
409
|
+
case constants_1.InteractionCallbackType.UpdateMessage:
|
410
|
+
{
|
411
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.interactionCallback(interactionId, interactionToken), {
|
412
|
+
json: {
|
413
|
+
type: options.type,
|
414
|
+
data: {
|
415
|
+
content: options.data?.content,
|
416
|
+
embeds: options.data?.embeds !== undefined
|
417
|
+
? this.util.toSnakeCase(options.data.embeds)
|
418
|
+
: undefined,
|
419
|
+
allowed_mentions: options.data?.allowedMentions !== undefined
|
420
|
+
? this.util.toSnakeCase(options.data.allowedMentions)
|
421
|
+
: undefined,
|
422
|
+
flags: options.data?.flags,
|
423
|
+
components: options.data?.components !== undefined
|
424
|
+
? this.util.toSnakeCase(options.data.components)
|
425
|
+
: undefined,
|
426
|
+
attachments: options.data?.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
427
|
+
},
|
428
|
+
},
|
429
|
+
files: options.data?.files,
|
430
|
+
});
|
431
|
+
}
|
432
|
+
break;
|
433
|
+
case constants_1.InteractionCallbackType.DeferredChannelMessageWithSource:
|
434
|
+
case constants_1.InteractionCallbackType.DeferredUpdateMessage:
|
435
|
+
{
|
436
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.interactionCallback(interactionId, interactionToken), {
|
437
|
+
json: {
|
438
|
+
type: options.type,
|
439
|
+
data: {
|
440
|
+
flags: options.data?.flags,
|
441
|
+
},
|
442
|
+
},
|
443
|
+
});
|
444
|
+
}
|
445
|
+
break;
|
446
|
+
case constants_1.InteractionCallbackType.ApplicationCommandAutocompleteResult:
|
447
|
+
{
|
448
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.interactionCallback(interactionId, interactionToken), {
|
449
|
+
json: {
|
450
|
+
type: options.type,
|
451
|
+
data: {
|
452
|
+
choices: options.data?.choices?.map((choice) => this.util.toSnakeCase(choice)),
|
453
|
+
},
|
454
|
+
},
|
455
|
+
});
|
456
|
+
}
|
457
|
+
break;
|
458
|
+
case constants_1.InteractionCallbackType.Modal:
|
459
|
+
{
|
460
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.interactionCallback(interactionId, interactionToken), {
|
461
|
+
json: {
|
462
|
+
type: options.type,
|
463
|
+
data: {
|
464
|
+
custom_id: options.data?.customId,
|
465
|
+
components: options.data?.components !== undefined
|
466
|
+
? this.util.toSnakeCase(options.data.components)
|
467
|
+
: undefined,
|
468
|
+
title: options.data?.title,
|
469
|
+
},
|
470
|
+
},
|
471
|
+
});
|
472
|
+
}
|
473
|
+
break;
|
474
|
+
case constants_1.InteractionCallbackType.PremiumRequired:
|
475
|
+
{
|
476
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.interactionCallback(interactionId, interactionToken), {
|
477
|
+
json: {
|
478
|
+
type: options.type,
|
479
|
+
data: {},
|
480
|
+
},
|
481
|
+
});
|
482
|
+
}
|
483
|
+
break;
|
484
|
+
}
|
485
|
+
}
|
486
|
+
/** https://discord.com/developers/docs/resources/channel#create-message */
|
487
|
+
createMessage(channelId, options) {
|
488
|
+
return this.rest
|
489
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelMessages(channelId), {
|
490
|
+
json: {
|
491
|
+
content: options.content,
|
492
|
+
nonce: options.nonce,
|
493
|
+
tts: options.tts,
|
494
|
+
embeds: options.embeds !== undefined
|
495
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
496
|
+
: undefined,
|
497
|
+
allowed_mentions: options.allowedMentions !== undefined
|
498
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
499
|
+
: undefined,
|
500
|
+
message_reference: options.messageReference,
|
501
|
+
components: options.components !== undefined
|
502
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
503
|
+
: undefined,
|
504
|
+
stickers_ids: options.stickersIds,
|
505
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
506
|
+
flags: options.flags,
|
507
|
+
enforce_nonce: options.enforceNonce,
|
508
|
+
},
|
509
|
+
files: options.files,
|
510
|
+
})
|
511
|
+
.then((response) => this.util.toCamelCase(response));
|
512
|
+
}
|
513
|
+
/** https://discord.com/developers/docs/resources/channel#create-reaction */
|
514
|
+
createMessageReaction(channelId, messageId, emoji) {
|
515
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.channelMessageReaction(channelId, messageId, emoji));
|
516
|
+
}
|
517
|
+
/** https://discord.com/developers/docs/resources/stage-instance#create-stage-instance */
|
518
|
+
createStageInstance(options, reason) {
|
519
|
+
return this.rest
|
520
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.stageInstances(), {
|
521
|
+
json: {
|
522
|
+
channel_id: options.channelId,
|
523
|
+
topic: options.topic,
|
524
|
+
privacy_level: options.privacyLevel,
|
525
|
+
send_start_notifications: options.sendStartNotifications,
|
526
|
+
guild_scheduled_event_id: options.guildScheduledEventId,
|
527
|
+
},
|
528
|
+
reason,
|
529
|
+
})
|
530
|
+
.then((response) => this.util.toCamelCase(response));
|
531
|
+
}
|
532
|
+
/** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
|
533
|
+
createTestEntitlement(applicationId, options) {
|
534
|
+
return this.rest
|
535
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.applicationEntitlements(applicationId), {
|
536
|
+
json: {
|
537
|
+
sku_id: options.skuId,
|
538
|
+
owner_id: options.ownerId,
|
539
|
+
owner_type: options.ownerType,
|
540
|
+
},
|
541
|
+
})
|
542
|
+
.then((response) => this.util.toCamelCase(response));
|
543
|
+
}
|
544
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel */
|
545
|
+
createThread(channelId, options, reason) {
|
546
|
+
return this.rest
|
547
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.threads(channelId), {
|
548
|
+
json: {
|
549
|
+
name: options.name,
|
550
|
+
auto_archive_duration: options.autoArchiveDuration,
|
551
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
552
|
+
message: this.util.toSnakeCase(options.message),
|
553
|
+
applied_tags: options.appliedTags,
|
554
|
+
},
|
555
|
+
files: options.files,
|
556
|
+
reason,
|
557
|
+
})
|
558
|
+
.then((response) => this.util.toCamelCase(response));
|
559
|
+
}
|
560
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
|
561
|
+
createThreadFromMessage(channelId, messageId, options, reason) {
|
562
|
+
return this.rest
|
563
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.threads(channelId, messageId), {
|
564
|
+
json: {
|
565
|
+
name: options.name,
|
566
|
+
auto_archive_duration: options.autoArchiveDuration,
|
567
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
568
|
+
},
|
569
|
+
reason,
|
570
|
+
})
|
571
|
+
.then((response) => this.util.toCamelCase(response));
|
572
|
+
}
|
573
|
+
/** https://discord.com/developers/docs/resources/channel#start-thread-without-message */
|
574
|
+
createThreadWithoutMessage(channelId, options, reason) {
|
575
|
+
return this.rest
|
576
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.threads(channelId), {
|
577
|
+
json: {
|
578
|
+
name: options.name,
|
579
|
+
auto_archive_duration: options.autoArchiveDuration,
|
580
|
+
type: options.type,
|
581
|
+
invitable: options.invitable,
|
582
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
583
|
+
},
|
584
|
+
reason,
|
585
|
+
})
|
586
|
+
.then((response) => this.util.toCamelCase(response));
|
587
|
+
}
|
588
|
+
/** https://discord.com/developers/docs/resources/channel#crosspost-message */
|
589
|
+
crosspostMessage(channelId, messageId) {
|
590
|
+
return this.rest
|
591
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelMessage(channelId, messageId))
|
592
|
+
.then((response) => this.util.toCamelCase(response));
|
593
|
+
}
|
594
|
+
/** https://discord.com/developers/docs/resources/channel#delete-all-reactions */
|
595
|
+
deleteAllMessageReactions(channelId, messageId, emoji) {
|
596
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channelMessageAllReactions(channelId, messageId, emoji));
|
597
|
+
}
|
598
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
599
|
+
deleteAutoModerationRule(guildId, autoModerationRuleId, reason) {
|
600
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildAutoModerationRule(guildId, autoModerationRuleId), {
|
601
|
+
reason,
|
602
|
+
});
|
603
|
+
}
|
604
|
+
/** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
|
605
|
+
deleteChannel(channelId, reason) {
|
606
|
+
return this.rest
|
607
|
+
.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channel(channelId), {
|
608
|
+
reason,
|
609
|
+
})
|
610
|
+
.then((response) => this.util.toCamelCase(response));
|
611
|
+
}
|
612
|
+
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
613
|
+
deleteChannelPermission(channelId, overwriteId, reason) {
|
614
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channelPermission(channelId, overwriteId), {
|
615
|
+
reason,
|
616
|
+
});
|
617
|
+
}
|
618
|
+
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
619
|
+
deleteGlobalApplicationCommand(applicationId, commandId) {
|
620
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.applicationCommand(applicationId, commandId));
|
621
|
+
}
|
622
|
+
/** https://discord.com/developers/docs/resources/guild#delete-guild */
|
623
|
+
deleteGuild(guildId) {
|
624
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guild(guildId));
|
625
|
+
}
|
626
|
+
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
627
|
+
deleteGuildApplicationCommand(applicationId, guildId, commandId) {
|
628
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.applicationGuildCommand(applicationId, guildId, commandId));
|
629
|
+
}
|
630
|
+
/** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
|
631
|
+
deleteGuildEmoji(guildId, emojiId, reason) {
|
632
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildEmoji(guildId, emojiId), {
|
633
|
+
reason,
|
634
|
+
});
|
635
|
+
}
|
636
|
+
/** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
|
637
|
+
deleteGuildIntegration(guildId, integrationId, reason) {
|
638
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildIntegration(guildId, integrationId), {
|
639
|
+
reason,
|
640
|
+
});
|
641
|
+
}
|
642
|
+
/** https://discord.com/developers/docs/resources/guild#delete-guild-role */
|
643
|
+
deleteGuildRole(guildId, roleId, reason) {
|
644
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildRole(guildId, roleId), {
|
645
|
+
reason,
|
646
|
+
});
|
647
|
+
}
|
648
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
|
649
|
+
deleteGuildScheduledEvent(guildId, guildScheduledEventId) {
|
650
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildScheduledEvent(guildId, guildScheduledEventId));
|
651
|
+
}
|
652
|
+
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
653
|
+
deleteGuildSticker(guildId, stickerId, reason) {
|
654
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildSticker(guildId, stickerId), {
|
655
|
+
reason,
|
656
|
+
});
|
657
|
+
}
|
658
|
+
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
659
|
+
deleteGuildTemplate(guildId, code) {
|
660
|
+
return this.rest
|
661
|
+
.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildTemplate(guildId, code))
|
662
|
+
.then((response) => this.util.toCamelCase(response));
|
663
|
+
}
|
664
|
+
/** https://discord.com/developers/docs/resources/invite#delete-invite */
|
665
|
+
deleteInvite(code, reason) {
|
666
|
+
return this.rest
|
667
|
+
.request(rest_1.RestMethods.Delete, rest_1.Endpoints.invite(code), {
|
668
|
+
reason,
|
669
|
+
})
|
670
|
+
.then((response) => this.util.toCamelCase(response));
|
671
|
+
}
|
672
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message */
|
673
|
+
deleteInteractionFollowupMessage(applicationId, interactionToken, messageId) {
|
674
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.webhookMessage(applicationId, interactionToken, messageId));
|
675
|
+
}
|
676
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response */
|
677
|
+
deleteInteractionResponse(applicationId, interactionToken) {
|
678
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.webhookMessage(applicationId, interactionToken));
|
679
|
+
}
|
680
|
+
/** https://discord.com/developers/docs/resources/channel#delete-message */
|
681
|
+
deleteMessage(channelId, messageId, reason) {
|
682
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channelMessage(channelId, messageId), {
|
683
|
+
reason,
|
684
|
+
});
|
685
|
+
}
|
686
|
+
/** https://discord.com/developers/docs/resources/channel#delete-user-reaction */
|
687
|
+
deleteMessageReaction(channelId, messageId, emoji, userId) {
|
688
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channelMessageReaction(channelId, messageId, emoji, userId));
|
689
|
+
}
|
690
|
+
/** https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance */
|
691
|
+
deleteStageInstance(channelId, reason) {
|
692
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.stageInstance(channelId), {
|
693
|
+
reason,
|
694
|
+
});
|
695
|
+
}
|
696
|
+
/** https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement */
|
697
|
+
deleteTestEntitlement(applicationId, entitlementId) {
|
698
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.applicationEntitlement(applicationId, entitlementId));
|
699
|
+
}
|
700
|
+
/** https://discord.com/developers/docs/resources/webhook#delete-webhook */
|
701
|
+
deleteWebhook(webhookId, reason) {
|
702
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.webhook(webhookId), {
|
703
|
+
reason,
|
704
|
+
});
|
705
|
+
}
|
706
|
+
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-message */
|
707
|
+
deleteWebhookMessage(webhookId, webhookToken, messageId, options) {
|
708
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.webhookMessage(webhookId, webhookToken, messageId), {
|
709
|
+
query: {
|
710
|
+
thread_id: options?.threadId,
|
711
|
+
},
|
712
|
+
});
|
713
|
+
}
|
714
|
+
/** https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token */
|
715
|
+
deleteWebhookWithToken(webhookId, webhookToken, reason) {
|
716
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.webhook(webhookId, webhookToken), {
|
717
|
+
reason,
|
718
|
+
authorization: false,
|
719
|
+
});
|
720
|
+
}
|
721
|
+
disconnect() {
|
722
|
+
this.shards.disconnect();
|
723
|
+
}
|
724
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
|
725
|
+
editAutoModerationRule(guildId, autoModerationRuleId, options, reason) {
|
726
|
+
return this.rest
|
727
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildAutoModerationRule(guildId, autoModerationRuleId), {
|
728
|
+
json: {
|
729
|
+
name: options.name,
|
730
|
+
event_type: options.eventType,
|
731
|
+
trigger_type: options.triggerType,
|
732
|
+
trigger_metadata: options.triggerMetadata,
|
733
|
+
actions: options.actions?.map((action) => this.util.toSnakeCase(action)),
|
734
|
+
enabled: options.enabled,
|
735
|
+
exempt_roles: options.exemptRoles,
|
736
|
+
exempt_channels: options.exemptChannels,
|
737
|
+
},
|
738
|
+
reason,
|
739
|
+
})
|
740
|
+
.then((response) => this.util.toCamelCase(response));
|
741
|
+
}
|
742
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
|
743
|
+
editApplicationCommandPermissions(applicationId, guildId, commandId, options) {
|
744
|
+
return this.rest
|
745
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.applicationCommandPermissions(applicationId, guildId, commandId), {
|
746
|
+
json: {
|
747
|
+
permissions: options.permissions.map((permission) => this.util.toSnakeCase(permission)),
|
748
|
+
},
|
749
|
+
})
|
750
|
+
.then((response) => this.util.toCamelCase(response));
|
751
|
+
}
|
752
|
+
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
753
|
+
editChannel(channelId, options, reason) {
|
754
|
+
return this.rest
|
755
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.channel(channelId), {
|
756
|
+
json: {
|
757
|
+
name: options.name,
|
758
|
+
type: options.type,
|
759
|
+
position: options.position,
|
760
|
+
topic: options.topic,
|
761
|
+
nsfw: options.nsfw,
|
762
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
763
|
+
bitrate: options.bitrate,
|
764
|
+
permission_overwrites: options.permissionOverwrites,
|
765
|
+
parent_id: options.parentId,
|
766
|
+
rtc_region: options.rtcRegion,
|
767
|
+
video_quality_mode: options.videoQualityMode,
|
768
|
+
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
769
|
+
flags: options.flags,
|
770
|
+
available_tags: options.availableTags,
|
771
|
+
default_reaction_emoji: options.defaultReactionEmoji,
|
772
|
+
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
773
|
+
default_sort_order: options.defaultSortOrder,
|
774
|
+
default_forum_layout: options.defaultForumLayout,
|
775
|
+
archived: options.archived,
|
776
|
+
auto_archive_duration: options.autoArchiveDuration,
|
777
|
+
locked: options.locked,
|
778
|
+
invitable: options.invitable,
|
779
|
+
applied_tags: options.appliedTags,
|
780
|
+
},
|
781
|
+
reason,
|
782
|
+
})
|
783
|
+
.then((response) => this.util.toCamelCase(response));
|
784
|
+
}
|
785
|
+
/** https://discord.com/developers/docs/resources/channel#edit-channel-permissions */
|
786
|
+
editChannelPermissions(channelId, overwriteId, options, reason) {
|
787
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.channelPermission(channelId, overwriteId), {
|
788
|
+
json: options,
|
789
|
+
reason,
|
790
|
+
});
|
791
|
+
}
|
792
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
793
|
+
editChannelPositions(guildId, options) {
|
794
|
+
this.rest.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildChannels(guildId), {
|
795
|
+
json: options.map((data) => ({
|
796
|
+
id: data.id,
|
797
|
+
position: data.position,
|
798
|
+
lock_permissions: data.lockPermissions,
|
799
|
+
parent_id: data.parentId,
|
800
|
+
})),
|
801
|
+
});
|
802
|
+
}
|
803
|
+
/** https://discord.com/developers/docs/resources/user#modify-current-user */
|
804
|
+
editCurrentUser(options) {
|
805
|
+
return this.rest
|
806
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.user(), {
|
807
|
+
json: {
|
808
|
+
username: options.username,
|
809
|
+
avatar: options.avatar,
|
810
|
+
},
|
811
|
+
})
|
812
|
+
.then((response) => this.util.toCamelCase(response));
|
813
|
+
}
|
814
|
+
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
815
|
+
editCurrentGuildMember(guildId, options, reason) {
|
816
|
+
return this.rest
|
817
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildMember(guildId), {
|
818
|
+
json: {
|
819
|
+
nick: options.nick,
|
820
|
+
},
|
821
|
+
reason,
|
822
|
+
})
|
823
|
+
.then((response) => this.util.toCamelCase(response));
|
824
|
+
}
|
825
|
+
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
826
|
+
editCurrentUserVoiceState(guildId, options) {
|
827
|
+
this.rest.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildVoiceState(guildId), {
|
828
|
+
json: {
|
829
|
+
channel_id: options.channelId,
|
830
|
+
suppress: options.suppress,
|
831
|
+
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
832
|
+
},
|
833
|
+
});
|
834
|
+
}
|
835
|
+
/** https://discord.com/developers/docs/resources/application#edit-current-application */
|
836
|
+
editCurrentApplication(options) {
|
837
|
+
return this.rest
|
838
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.applicationCurrentUser(), {
|
839
|
+
json: {
|
840
|
+
custom_install_url: options.customInstallUrl,
|
841
|
+
description: options.description,
|
842
|
+
role_connections_verification_url: options.roleConnectionsVerificationUrl,
|
843
|
+
install_params: options.installParams,
|
844
|
+
flags: options.flags,
|
845
|
+
icon: options.icon,
|
846
|
+
cover_image: options.coverImage,
|
847
|
+
interactions_endpoint_url: options.interactionsEndpointUrl,
|
848
|
+
tags: options.tags,
|
849
|
+
},
|
850
|
+
})
|
851
|
+
.then((response) => this.util.toCamelCase(response));
|
852
|
+
}
|
853
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
|
854
|
+
editGlobalApplicationCommand(applicationId, commandId, options) {
|
855
|
+
return this.rest
|
856
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.applicationCommand(applicationId, commandId), {
|
857
|
+
json: {
|
858
|
+
name: options.name,
|
859
|
+
name_localizations: options.nameLocalizations,
|
860
|
+
description: options.description,
|
861
|
+
description_localizations: options.descriptionLocalizations,
|
862
|
+
options: options.options?.map((option) => this.util.toSnakeCase(option)),
|
863
|
+
default_member_permissions: options.defaultMemberPermissions,
|
864
|
+
dm_permission: options.dmPermission,
|
865
|
+
default_permission: options.defaultPermission,
|
866
|
+
nsfw: options.nsfw,
|
867
|
+
},
|
868
|
+
})
|
869
|
+
.then((response) => this.util.toCamelCase(response));
|
870
|
+
}
|
871
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
872
|
+
editGuild(guildId, options, reason) {
|
873
|
+
return this.rest
|
874
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guild(guildId), {
|
875
|
+
json: {
|
876
|
+
name: options.name,
|
877
|
+
region: options.region,
|
878
|
+
verification_level: options.verificationLevel,
|
879
|
+
default_message_notifications: options.defaultMessageNotifications,
|
880
|
+
explicit_content_filter: options.explicitContentFilter,
|
57
881
|
afk_channel_id: options.afkChannelId,
|
58
882
|
afk_timeout: options.afkTimeout,
|
883
|
+
icon: options.icon,
|
884
|
+
owner_id: options.ownerId,
|
885
|
+
splash: options.splash,
|
886
|
+
discovery_splash: options.discoverySplash,
|
887
|
+
banner: options.banner,
|
59
888
|
system_channel_id: options.systemChannelId,
|
60
889
|
system_channel_flags: options.systemChannelFlags,
|
890
|
+
rules_channel_id: options.rulesChannelId,
|
891
|
+
public_updates_channel_id: options.publicUpdatesChannelId,
|
892
|
+
preferred_locale: options.preferredLocale,
|
893
|
+
features: options.features,
|
894
|
+
description: options.description,
|
895
|
+
premium_progress_bar_enabled: options.premiumProgressBarEnabled,
|
896
|
+
safety_alerts_channel_id: options.safetyAlertsChannelId,
|
897
|
+
},
|
898
|
+
reason,
|
899
|
+
})
|
900
|
+
.then((response) => this.util.toCamelCase(response));
|
901
|
+
}
|
902
|
+
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
903
|
+
editGuildApplicationCommand(applicationId, guildId, commandId, options) {
|
904
|
+
return this.rest
|
905
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.applicationGuildCommand(applicationId, guildId, commandId), {
|
906
|
+
json: {
|
907
|
+
name: options.name,
|
908
|
+
name_localizations: options.nameLocalizations,
|
909
|
+
description: options.description,
|
910
|
+
description_localizations: options.descriptionLocalizations,
|
911
|
+
options: options.options?.map((option) => this.util.toSnakeCase(option)),
|
912
|
+
default_member_permissions: options.defaultMemberPermissions,
|
913
|
+
default_permission: options.defaultPermission,
|
914
|
+
nsfw: options.nsfw,
|
915
|
+
},
|
916
|
+
})
|
917
|
+
.then((response) => this.util.toCamelCase(response));
|
918
|
+
}
|
919
|
+
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
920
|
+
editGuildEmoji(guildId, emojiId, options, reason) {
|
921
|
+
return this.rest
|
922
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildEmoji(guildId, emojiId), {
|
923
|
+
json: {
|
924
|
+
name: options.name,
|
925
|
+
roles: options.roles,
|
926
|
+
},
|
927
|
+
reason,
|
928
|
+
})
|
929
|
+
.then((response) => this.util.toCamelCase(response));
|
930
|
+
}
|
931
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
932
|
+
editGuildMember(guildId, userId, options, reason) {
|
933
|
+
return this.rest
|
934
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildMember(guildId, userId), {
|
935
|
+
json: {
|
936
|
+
nick: options.nick,
|
937
|
+
roles: options.roles,
|
938
|
+
mute: options.mute,
|
939
|
+
deaf: options.deaf,
|
940
|
+
channel_id: options.channelId,
|
941
|
+
communication_disabled_until: options.communicationDisabledUntil,
|
942
|
+
flags: options.flags,
|
943
|
+
},
|
944
|
+
reason,
|
945
|
+
})
|
946
|
+
.then((response) => this.util.toCamelCase(response));
|
947
|
+
}
|
948
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
949
|
+
editGuildMFALevel(guildId, options, reason) {
|
950
|
+
return this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.guildMFA(guildId), {
|
951
|
+
json: {
|
952
|
+
level: options.level,
|
953
|
+
},
|
954
|
+
reason,
|
955
|
+
});
|
956
|
+
}
|
957
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
|
958
|
+
editGuildOnboarding(guildId, options, reason) {
|
959
|
+
this.rest.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildOnboarding(guildId), {
|
960
|
+
json: {
|
961
|
+
prompts: options.prompts.map((prompt) => this.util.toSnakeCase(prompt)),
|
962
|
+
},
|
963
|
+
reason,
|
964
|
+
});
|
965
|
+
}
|
966
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-role */
|
967
|
+
editGuildRole(guildId, roleId, options, reason) {
|
968
|
+
return this.rest
|
969
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildRole(guildId, roleId), {
|
970
|
+
json: {
|
971
|
+
name: options?.name,
|
972
|
+
permissions: options?.permissions,
|
973
|
+
color: options?.color,
|
974
|
+
hoist: options?.hoist,
|
975
|
+
icon: options?.icon,
|
976
|
+
unicode_emoji: options?.unicodeEmoji,
|
977
|
+
mentionable: options?.mentionable,
|
978
|
+
},
|
979
|
+
reason,
|
980
|
+
})
|
981
|
+
.then((response) => this.util.toCamelCase(response));
|
982
|
+
}
|
983
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
984
|
+
editGuildRolePositions(guildId, options) {
|
985
|
+
return this.rest
|
986
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildRoles(guildId), {
|
987
|
+
json: options.map((role) => this.util.toSnakeCase(role)),
|
988
|
+
})
|
989
|
+
.then((response) => response.map((role) => this.util.toCamelCase(role)));
|
990
|
+
}
|
991
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
992
|
+
editGuildScheduledEvent(guildId, guildScheduledEventId, options, reason) {
|
993
|
+
return this.rest
|
994
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildScheduledEvent(guildId, guildScheduledEventId), {
|
995
|
+
json: {
|
996
|
+
channel_id: options.channelId,
|
997
|
+
entity_metadata: options.entityMetadata,
|
998
|
+
name: options.name,
|
999
|
+
privacy_level: options.privacyLevel,
|
1000
|
+
scheduled_start_time: options.scheduledStartTime,
|
1001
|
+
scheduled_end_time: options.scheduledEndTime,
|
1002
|
+
description: options.description,
|
1003
|
+
entityType: options.entityType,
|
1004
|
+
status: options.status,
|
1005
|
+
image: options.image,
|
1006
|
+
},
|
1007
|
+
reason,
|
1008
|
+
})
|
1009
|
+
.then((response) => this.util.toCamelCase(response));
|
1010
|
+
}
|
1011
|
+
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
1012
|
+
editGuildSticker(guildId, stickerId, options, reason) {
|
1013
|
+
return this.rest
|
1014
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildSticker(guildId, stickerId), {
|
1015
|
+
json: {
|
1016
|
+
name: options.name,
|
1017
|
+
description: options.description,
|
1018
|
+
tags: options.tags,
|
1019
|
+
},
|
1020
|
+
reason,
|
1021
|
+
})
|
1022
|
+
.then((response) => this.util.toCamelCase(response));
|
1023
|
+
}
|
1024
|
+
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
1025
|
+
editGuildTemplate(guildId, code, options) {
|
1026
|
+
return this.rest
|
1027
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildTemplate(guildId, code), {
|
1028
|
+
json: {
|
1029
|
+
name: options.name,
|
1030
|
+
description: options.description,
|
1031
|
+
},
|
1032
|
+
})
|
1033
|
+
.then((response) => this.util.toCamelCase(response));
|
1034
|
+
}
|
1035
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
1036
|
+
editGuildWelcomeScreen(guildId, options, reason) {
|
1037
|
+
return this.rest
|
1038
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildWelcomeScreen(guildId), {
|
1039
|
+
json: {
|
1040
|
+
enabled: options.enabled,
|
1041
|
+
welcome_channels: options.welcomeChannels,
|
1042
|
+
description: options.description,
|
1043
|
+
},
|
1044
|
+
reason,
|
1045
|
+
})
|
1046
|
+
.then((response) => this.util.toCamelCase(response));
|
1047
|
+
}
|
1048
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
|
1049
|
+
editGuildWidget(guildId, options, reason) {
|
1050
|
+
return this.rest
|
1051
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildWidgetSettings(guildId), {
|
1052
|
+
json: {
|
1053
|
+
enabled: options.enabled,
|
1054
|
+
channel_id: options.channelId,
|
1055
|
+
},
|
1056
|
+
reason,
|
1057
|
+
})
|
1058
|
+
.then((response) => this.util.toCamelCase(response));
|
1059
|
+
}
|
1060
|
+
/** https://discord.com/developers/docs/resources/channel#edit-message */
|
1061
|
+
editMessage(channelId, messageId, options) {
|
1062
|
+
return this.rest
|
1063
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.channelMessage(channelId, messageId), {
|
1064
|
+
json: {
|
1065
|
+
content: options.content,
|
1066
|
+
embeds: options.embeds !== undefined
|
1067
|
+
? options.embeds !== null
|
1068
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
1069
|
+
: null
|
1070
|
+
: undefined,
|
1071
|
+
allowed_mentions: options.allowedMentions !== undefined
|
1072
|
+
? options.allowedMentions !== null
|
1073
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
1074
|
+
: null
|
1075
|
+
: undefined,
|
1076
|
+
components: options.components !== undefined
|
1077
|
+
? options.components !== null
|
1078
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
1079
|
+
: null
|
1080
|
+
: undefined,
|
1081
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
1082
|
+
flags: options.flags,
|
1083
|
+
},
|
1084
|
+
files: options.files,
|
1085
|
+
})
|
1086
|
+
.then((response) => this.util.toCamelCase(response));
|
1087
|
+
}
|
1088
|
+
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance */
|
1089
|
+
editStageInstance(channelId, options, reason) {
|
1090
|
+
return this.rest
|
1091
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.stageInstance(channelId), {
|
1092
|
+
json: {
|
1093
|
+
topic: options.topic,
|
1094
|
+
privacy_level: options.privacyLevel,
|
1095
|
+
},
|
1096
|
+
reason,
|
1097
|
+
})
|
1098
|
+
.then((response) => this.util.toCamelCase(response));
|
1099
|
+
}
|
1100
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message */
|
1101
|
+
editInteractionFollowupMessage(applicationId, interactionToken, messageId, options) {
|
1102
|
+
return this.rest
|
1103
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.webhookMessage(applicationId, interactionToken, messageId), {
|
1104
|
+
json: {
|
1105
|
+
content: options.content,
|
1106
|
+
embeds: options.embeds !== undefined
|
1107
|
+
? options.embeds !== null
|
1108
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
1109
|
+
: null
|
1110
|
+
: undefined,
|
1111
|
+
allowed_mentions: options.allowedMentions !== undefined
|
1112
|
+
? options.allowedMentions !== null
|
1113
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
1114
|
+
: null
|
1115
|
+
: undefined,
|
1116
|
+
components: options.components !== undefined
|
1117
|
+
? options.components !== null
|
1118
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
1119
|
+
: null
|
1120
|
+
: undefined,
|
1121
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
1122
|
+
flags: options.flags,
|
1123
|
+
},
|
1124
|
+
files: options.files,
|
1125
|
+
query: {
|
1126
|
+
thread_id: options.threadId,
|
1127
|
+
},
|
1128
|
+
})
|
1129
|
+
.then((response) => this.util.toCamelCase(response));
|
1130
|
+
}
|
1131
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response */
|
1132
|
+
editInteractionResponse(applicationId, interactionToken, options) {
|
1133
|
+
return this.rest
|
1134
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.webhookMessage(applicationId, interactionToken), {
|
1135
|
+
json: {
|
1136
|
+
content: options.content,
|
1137
|
+
embeds: options.embeds !== undefined
|
1138
|
+
? options.embeds !== null
|
1139
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
1140
|
+
: null
|
1141
|
+
: undefined,
|
1142
|
+
allowed_mentions: options.allowedMentions !== undefined
|
1143
|
+
? options.allowedMentions !== null
|
1144
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
1145
|
+
: null
|
1146
|
+
: undefined,
|
1147
|
+
components: options.components !== undefined
|
1148
|
+
? options.components !== null
|
1149
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
1150
|
+
: null
|
1151
|
+
: undefined,
|
1152
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
1153
|
+
flags: options.flags,
|
1154
|
+
},
|
1155
|
+
files: options.files,
|
1156
|
+
query: {
|
1157
|
+
thread_id: options.threadId,
|
1158
|
+
},
|
1159
|
+
})
|
1160
|
+
.then((response) => this.util.toCamelCase(response));
|
1161
|
+
}
|
1162
|
+
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
1163
|
+
editUserVoiceState(guildId, userId, options) {
|
1164
|
+
this.rest.request(rest_1.RestMethods.Patch, rest_1.Endpoints.guildVoiceState(guildId, userId), {
|
1165
|
+
json: {
|
1166
|
+
channel_id: options.channelId,
|
1167
|
+
suppress: options.suppress,
|
1168
|
+
requestToSpeakTimestamp: options.requestToSpeakTimestamp,
|
1169
|
+
},
|
1170
|
+
});
|
1171
|
+
}
|
1172
|
+
/** https://discord.com/developers/docs/resources/webhook#modify-webhook */
|
1173
|
+
editWebhook(webhookId, options, reason) {
|
1174
|
+
return this.rest
|
1175
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.webhook(webhookId), {
|
1176
|
+
json: {
|
1177
|
+
name: options.name,
|
1178
|
+
avatar: options.avatar,
|
1179
|
+
channel_id: options.channelId,
|
1180
|
+
},
|
1181
|
+
reason,
|
1182
|
+
})
|
1183
|
+
.then((response) => this.util.toCamelCase(response));
|
1184
|
+
}
|
1185
|
+
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
|
1186
|
+
editWebhookMessage(webhookId, webhookToken, messageId, options) {
|
1187
|
+
return this.rest
|
1188
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.webhookMessage(webhookId, webhookToken, messageId), {
|
1189
|
+
json: {
|
1190
|
+
content: options.content,
|
1191
|
+
embeds: options.embeds !== undefined
|
1192
|
+
? options.embeds !== null
|
1193
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
1194
|
+
: null
|
1195
|
+
: undefined,
|
1196
|
+
allowed_mentions: options.allowedMentions !== undefined
|
1197
|
+
? options.allowedMentions !== null
|
1198
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
1199
|
+
: null
|
1200
|
+
: undefined,
|
1201
|
+
components: options.components !== undefined
|
1202
|
+
? options.components !== null
|
1203
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
1204
|
+
: null
|
1205
|
+
: undefined,
|
1206
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
1207
|
+
flags: options.flags,
|
1208
|
+
},
|
1209
|
+
files: options.files,
|
1210
|
+
query: {
|
1211
|
+
thread_id: options.threadId,
|
1212
|
+
},
|
1213
|
+
})
|
1214
|
+
.then((response) => this.util.toCamelCase(response));
|
1215
|
+
}
|
1216
|
+
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
|
1217
|
+
editWebhookWithToken(webhookId, webhookToken, options, reason) {
|
1218
|
+
return this.rest
|
1219
|
+
.request(rest_1.RestMethods.Patch, rest_1.Endpoints.webhook(webhookId, webhookToken), {
|
1220
|
+
json: {
|
1221
|
+
name: options.name,
|
1222
|
+
avatar: options.avatar,
|
1223
|
+
},
|
1224
|
+
reason,
|
1225
|
+
authorization: false,
|
1226
|
+
})
|
1227
|
+
.then((response) => this.util.toCamelCase(response));
|
1228
|
+
}
|
1229
|
+
/** https://discord.com/developers/docs/resources/webhook#execute-webhook */
|
1230
|
+
executeWebhook(webhookId, webhookToken, options) {
|
1231
|
+
return this.rest
|
1232
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.webhook(webhookId, webhookToken), {
|
1233
|
+
json: {
|
1234
|
+
content: options.content,
|
1235
|
+
username: options.username,
|
1236
|
+
avatarUrl: options.avatarUrl,
|
1237
|
+
tts: options.tts,
|
1238
|
+
embeds: options.embeds !== undefined
|
1239
|
+
? options.embeds !== null
|
1240
|
+
? options.embeds.map((e) => this.util.toSnakeCase(e))
|
1241
|
+
: null
|
1242
|
+
: undefined,
|
1243
|
+
allowed_mentions: options.allowedMentions !== undefined
|
1244
|
+
? options.allowedMentions !== null
|
1245
|
+
? this.util.toSnakeCase(options.allowedMentions)
|
1246
|
+
: null
|
1247
|
+
: undefined,
|
1248
|
+
components: options.components !== undefined
|
1249
|
+
? options.components !== null
|
1250
|
+
? options.components.map((c) => this.util.toSnakeCase(c))
|
1251
|
+
: null
|
1252
|
+
: undefined,
|
1253
|
+
attachments: options.attachments?.map((attachment) => this.util.toSnakeCase(attachment)),
|
1254
|
+
flags: options.flags,
|
1255
|
+
thread_name: options.threadName,
|
61
1256
|
},
|
62
|
-
|
1257
|
+
files: options.files,
|
1258
|
+
query: {
|
1259
|
+
wait: options.wait,
|
1260
|
+
thread_id: options.threadId,
|
1261
|
+
},
|
1262
|
+
})
|
1263
|
+
.then((response) => response !== null ? this.util.toCamelCase(response) : null);
|
63
1264
|
}
|
64
|
-
/**
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
1265
|
+
/**
|
1266
|
+
* https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook
|
1267
|
+
*
|
1268
|
+
* https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook
|
1269
|
+
*/
|
1270
|
+
executeWebhookPlatform(webhookId, webhookToken, platform, options) {
|
1271
|
+
return this.rest
|
1272
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.webhookPlatform(webhookId, webhookToken, platform), {
|
1273
|
+
query: {
|
1274
|
+
thread_id: options.threadId,
|
1275
|
+
wait: options.wait,
|
70
1276
|
},
|
71
|
-
|
1277
|
+
json: options,
|
1278
|
+
})
|
1279
|
+
.then((response) => response !== null ? this.util.toCamelCase(response) : null);
|
72
1280
|
}
|
73
|
-
/** https://discord.com/developers/docs/resources/
|
74
|
-
|
75
|
-
return
|
1281
|
+
/** https://discord.com/developers/docs/resources/channel#follow-announcement-channel */
|
1282
|
+
followChannel(channelId, options) {
|
1283
|
+
return this.rest
|
1284
|
+
.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelFollowers(channelId), {
|
76
1285
|
json: {
|
77
|
-
|
78
|
-
topic: options.topic,
|
79
|
-
privacy_level: options.privacyLevel,
|
80
|
-
send_start_notifications: options.sendStartNotifications,
|
81
|
-
guild_scheduled_event_id: options.guildScheduledEventId,
|
1286
|
+
webhook_channel_id: options.webhookChannelId,
|
82
1287
|
},
|
83
|
-
|
84
|
-
|
1288
|
+
})
|
1289
|
+
.then((response) => this.util.toCamelCase(response));
|
85
1290
|
}
|
86
|
-
/** https://discord.com/developers/docs/resources/
|
87
|
-
|
88
|
-
return
|
1291
|
+
/** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
|
1292
|
+
getActiveGuildThreads(guildId) {
|
1293
|
+
return this.rest
|
1294
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildActiveThreads(guildId))
|
1295
|
+
.then((response) => this.util.toCamelCase(response));
|
1296
|
+
}
|
1297
|
+
/** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
|
1298
|
+
getArchivedThreads(channelId, archivedStatus, options) {
|
1299
|
+
return this.rest
|
1300
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelThreads(channelId, archivedStatus, false), {
|
1301
|
+
query: {
|
1302
|
+
before: options?.before,
|
1303
|
+
limit: options?.limit,
|
1304
|
+
},
|
1305
|
+
})
|
1306
|
+
.then((response) => this.util.toCamelCase(response));
|
1307
|
+
}
|
1308
|
+
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
|
1309
|
+
getAuditLog(guildId, options) {
|
1310
|
+
return this.rest
|
1311
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildAuditLog(guildId), {
|
1312
|
+
query: {
|
1313
|
+
user_id: options?.userId,
|
1314
|
+
action_type: options?.actionType,
|
1315
|
+
before: options?.before,
|
1316
|
+
after: options?.after,
|
1317
|
+
limit: options?.limit,
|
1318
|
+
},
|
1319
|
+
})
|
1320
|
+
.then((response) => this.util.toCamelCase(response));
|
1321
|
+
}
|
1322
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
|
1323
|
+
getAutoModerationRule(guildId, ruleId) {
|
1324
|
+
return this.rest
|
1325
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildAutoModerationRule(guildId, ruleId))
|
1326
|
+
.then((response) => this.util.toCamelCase(response));
|
1327
|
+
}
|
1328
|
+
/** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
|
1329
|
+
getAutoModerationRules(guildId) {
|
1330
|
+
return this.rest
|
1331
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildAutoModerationRules(guildId))
|
1332
|
+
.then((response) => response.map((autoModerationRule) => this.util.toCamelCase(autoModerationRule)));
|
1333
|
+
}
|
1334
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
1335
|
+
getApplicationCommandPermissions(applicationId, guildId, commandId) {
|
1336
|
+
return this.rest
|
1337
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationCommandPermissions(applicationId, guildId, commandId))
|
1338
|
+
.then((response) => this.util.toCamelCase(response));
|
1339
|
+
}
|
1340
|
+
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
1341
|
+
getApplicationRoleConnectionMetadataRecords(applicationId) {
|
1342
|
+
return this.rest
|
1343
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationId))
|
1344
|
+
.then((response) => response.map((applicationRoleConnectionMetadata) => this.util.toCamelCase(applicationRoleConnectionMetadata)));
|
89
1345
|
}
|
90
1346
|
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
91
|
-
|
92
|
-
return
|
1347
|
+
getChannel(channelId) {
|
1348
|
+
return this.rest
|
1349
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channel(channelId))
|
1350
|
+
.then((response) => this.util.toCamelCase(response));
|
1351
|
+
}
|
1352
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-channels */
|
1353
|
+
getChannels(guildId) {
|
1354
|
+
return this.rest
|
1355
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildChannels(guildId))
|
1356
|
+
.then((response) => response.map((channel) => this.util.toCamelCase(channel)));
|
1357
|
+
}
|
1358
|
+
/** https://discord.com/developers/docs/resources/channel#get-channel-invites */
|
1359
|
+
getChannelInvites(channelId) {
|
1360
|
+
return this.rest
|
1361
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelInvites(channelId))
|
1362
|
+
.then((response) => response.map((invite) => this.util.toCamelCase(invite)));
|
1363
|
+
}
|
1364
|
+
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
1365
|
+
getChannelWebhooks(channelId) {
|
1366
|
+
return this.rest
|
1367
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelWebhooks(channelId))
|
1368
|
+
.then((response) => response.map((webhook) => this.util.toCamelCase(webhook)));
|
1369
|
+
}
|
1370
|
+
/** https://discord.com/developers/docs/resources/application#get-current-application */
|
1371
|
+
getCurrentApplication() {
|
1372
|
+
return this.rest
|
1373
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationCurrentUser())
|
1374
|
+
.then((response) => this.util.toCamelCase(response));
|
1375
|
+
}
|
1376
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-application-role-connection */
|
1377
|
+
getCurrentApplicationRoleConnection(applicationId) {
|
1378
|
+
return this.rest
|
1379
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.userApplicationRoleConnection(applicationId))
|
1380
|
+
.then((response) => this.util.toCamelCase(response));
|
1381
|
+
}
|
1382
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-guild-member */
|
1383
|
+
getCurrentGuildMember(guildId) {
|
1384
|
+
return this.rest
|
1385
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildMember(guildId))
|
1386
|
+
.then((response) => this.util.toCamelCase(response));
|
1387
|
+
}
|
1388
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-connections */
|
1389
|
+
getCurrentUserConnections() {
|
1390
|
+
return this.rest
|
1391
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.userConnections())
|
1392
|
+
.then((response) => response.map((connection) => this.util.toCamelCase(connection)));
|
1393
|
+
}
|
1394
|
+
/** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
|
1395
|
+
getEntitlements(applicationId, options) {
|
1396
|
+
return this.rest
|
1397
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationEntitlements(applicationId), {
|
1398
|
+
query: {
|
1399
|
+
user_id: options?.userId,
|
1400
|
+
sku_ids: options?.skuIds,
|
1401
|
+
before: options?.before,
|
1402
|
+
after: options?.after,
|
1403
|
+
limit: options?.limit,
|
1404
|
+
guild_id: options?.guildId,
|
1405
|
+
exclude_ended: options?.excludeEnded,
|
1406
|
+
},
|
1407
|
+
})
|
1408
|
+
.then((response) => response.map((entitlement) => this.util.toCamelCase(entitlement)));
|
93
1409
|
}
|
94
1410
|
/** https://discord.com/developers/docs/topics/gateway#get-gateway */
|
95
|
-
|
96
|
-
return this.rest.
|
1411
|
+
getGateway() {
|
1412
|
+
return this.rest.request(rest_1.RestMethods.Get, rest_1.Endpoints.gateway());
|
97
1413
|
}
|
98
1414
|
/** https://discord.com/developers/docs/topics/gateway#get-gateway-bot */
|
99
|
-
|
100
|
-
return this.rest
|
101
|
-
.
|
102
|
-
.then((response) => (
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
1415
|
+
getGatewayBot() {
|
1416
|
+
return this.rest
|
1417
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.gatewayBot())
|
1418
|
+
.then((response) => this.util.toCamelCase(response));
|
1419
|
+
}
|
1420
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
|
1421
|
+
getGlobalApplicationCommand(applicationId, commandId) {
|
1422
|
+
return this.rest
|
1423
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationCommand(applicationId, commandId))
|
1424
|
+
.then((response) => this.util.toCamelCase(response));
|
1425
|
+
}
|
1426
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
|
1427
|
+
getGlobalApplicationCommands(applicationId, options) {
|
1428
|
+
return this.rest
|
1429
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationCommands(applicationId), {
|
1430
|
+
query: {
|
1431
|
+
with_localizations: options.withLocalizations,
|
110
1432
|
},
|
111
|
-
})
|
1433
|
+
})
|
1434
|
+
.then((response) => response.map((applicationCommand) => this.util.toCamelCase(applicationCommand)));
|
112
1435
|
}
|
113
1436
|
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
114
|
-
|
115
|
-
return
|
1437
|
+
getGuild(guildId, options) {
|
1438
|
+
return this.rest
|
1439
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guild(guildId), {
|
116
1440
|
query: {
|
117
1441
|
with_counts: options?.withCounts,
|
118
1442
|
},
|
119
|
-
})
|
1443
|
+
})
|
1444
|
+
.then((response) => this.util.toCamelCase(response));
|
120
1445
|
}
|
121
1446
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guilds */
|
122
|
-
|
1447
|
+
getGuilds(options) {
|
123
1448
|
return this.rest
|
124
|
-
.
|
1449
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.userGuilds(), {
|
125
1450
|
query: {
|
126
1451
|
before: options?.before,
|
127
1452
|
after: options?.after,
|
@@ -129,85 +1454,358 @@ class Client extends node_events_1.default {
|
|
129
1454
|
with_counts: options?.withCounts,
|
130
1455
|
},
|
131
1456
|
})
|
132
|
-
.then((response) => response.map((
|
1457
|
+
.then((response) => response.map((guild) => this.util.toCamelCase(guild)));
|
1458
|
+
}
|
1459
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
1460
|
+
getGuildApplicationCommand(applicationId, guildId, commandId) {
|
1461
|
+
return this.rest
|
1462
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationGuildCommand(applicationId, guildId, commandId))
|
1463
|
+
.then((response) => this.util.toCamelCase(response));
|
1464
|
+
}
|
1465
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
1466
|
+
getGuildApplicationCommands(applicationId, guildId, options) {
|
1467
|
+
return this.rest
|
1468
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationGuildCommands(applicationId, guildId), {
|
1469
|
+
query: {
|
1470
|
+
with_localizations: options?.withLocalizations,
|
1471
|
+
},
|
1472
|
+
})
|
1473
|
+
.then((response) => response.map((applicationCommand) => this.util.toCamelCase(applicationCommand)));
|
1474
|
+
}
|
1475
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
1476
|
+
getGuildApplicationCommandPermissions(applicationId, guildId) {
|
1477
|
+
return this.rest
|
1478
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, guildId))
|
1479
|
+
.then((response) => this.util.toCamelCase(response));
|
1480
|
+
}
|
1481
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-ban */
|
1482
|
+
getGuildBan(guildId, userId) {
|
1483
|
+
return this.rest
|
1484
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildBan(guildId, userId))
|
1485
|
+
.then((response) => this.util.toCamelCase(response));
|
1486
|
+
}
|
1487
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-bans */
|
1488
|
+
getGuildBans(guildId, options) {
|
1489
|
+
return this.rest
|
1490
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildBans(guildId), {
|
1491
|
+
query: {
|
1492
|
+
limit: options?.limit,
|
1493
|
+
before: options?.before,
|
1494
|
+
after: options?.after,
|
1495
|
+
},
|
1496
|
+
})
|
1497
|
+
.then((response) => response.map((ban) => this.util.toCamelCase(ban)));
|
1498
|
+
}
|
1499
|
+
/** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
|
1500
|
+
getGuildEmoji(guildId, emojiId) {
|
1501
|
+
return this.rest
|
1502
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildEmoji(guildId, emojiId))
|
1503
|
+
.then((response) => this.util.toCamelCase(response));
|
1504
|
+
}
|
1505
|
+
/** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
|
1506
|
+
getGuildEmojis(guildId) {
|
1507
|
+
return this.rest
|
1508
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildEmojis(guildId))
|
1509
|
+
.then((response) => response.map((emoji) => this.util.toCamelCase(emoji)));
|
1510
|
+
}
|
1511
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
|
1512
|
+
getGuildIntegrations(guildId) {
|
1513
|
+
return this.rest
|
1514
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildIntegrations(guildId))
|
1515
|
+
.then((response) => response.map((integration) => this.util.toCamelCase(integration)));
|
1516
|
+
}
|
1517
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-invites */
|
1518
|
+
getGuildInvites(guildId) {
|
1519
|
+
return this.rest
|
1520
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildInvites(guildId))
|
1521
|
+
.then((response) => response.map((invite) => this.util.toCamelCase(invite)));
|
1522
|
+
}
|
1523
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-member */
|
1524
|
+
getGuildMember(guildId, userId) {
|
1525
|
+
return this.rest
|
1526
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildMember(guildId, userId))
|
1527
|
+
.then((response) => this.util.toCamelCase(response));
|
1528
|
+
}
|
1529
|
+
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
1530
|
+
getGuildMembers(guildId) {
|
1531
|
+
return this.rest
|
1532
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildMembers(guildId))
|
1533
|
+
.then((response) => response.map((guildMember) => this.util.toCamelCase(guildMember)));
|
1534
|
+
}
|
1535
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
|
1536
|
+
getGuildOnboarding(guildId) {
|
1537
|
+
return this.rest
|
1538
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildOnboarding(guildId))
|
1539
|
+
.then((response) => this.util.toCamelCase(response));
|
1540
|
+
}
|
1541
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-preview */
|
1542
|
+
getGuildPreview(guildId) {
|
1543
|
+
return this.rest
|
1544
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildPreview(guildId))
|
1545
|
+
.then((response) => this.util.toCamelCase(response));
|
1546
|
+
}
|
1547
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
1548
|
+
getGuildPruneCount(guildId, options) {
|
1549
|
+
return this.rest
|
1550
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildPrune(guildId), {
|
1551
|
+
query: {
|
1552
|
+
days: options.days,
|
1553
|
+
include_roles: options.includeRoles,
|
1554
|
+
},
|
1555
|
+
})
|
1556
|
+
.then((response) => this.util.toCamelCase(response));
|
1557
|
+
}
|
1558
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-roles */
|
1559
|
+
getGuildRoles(guildId) {
|
1560
|
+
return this.rest
|
1561
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildRoles(guildId))
|
1562
|
+
.then((response) => response.map((role) => this.util.toCamelCase(role)));
|
1563
|
+
}
|
1564
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
|
1565
|
+
getGuildScheduledEvents(guildId, options) {
|
1566
|
+
return this.rest
|
1567
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildScheduledEvents(guildId), {
|
1568
|
+
query: {
|
1569
|
+
with_user_count: options?.withUserCount,
|
1570
|
+
},
|
1571
|
+
})
|
1572
|
+
.then((response) => response.map((guildScheduledEvent) => this.util.toCamelCase(guildScheduledEvent)));
|
1573
|
+
}
|
1574
|
+
/** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
|
1575
|
+
getGuildScheduledEventUsers(guildId, guildScheduledEventId, options) {
|
1576
|
+
return this.rest
|
1577
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildScheduledEvent(guildId, guildScheduledEventId), {
|
1578
|
+
query: {
|
1579
|
+
limit: options?.limit,
|
1580
|
+
with_member: options?.withMember,
|
1581
|
+
before: options?.before,
|
1582
|
+
after: options?.after,
|
1583
|
+
},
|
1584
|
+
})
|
1585
|
+
.then((response) => response.map((guildScheduledEventUser) => this.util.toCamelCase(guildScheduledEventUser)));
|
1586
|
+
}
|
1587
|
+
/** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
|
1588
|
+
getGuildSticker(guildId, stickerId) {
|
1589
|
+
return this.rest
|
1590
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildSticker(guildId, stickerId))
|
1591
|
+
.then((response) => this.util.toCamelCase(response));
|
1592
|
+
}
|
1593
|
+
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
1594
|
+
getGuildStickers(guildId) {
|
1595
|
+
return this.rest
|
1596
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildStickers(guildId))
|
1597
|
+
.then((response) => response.map((sticker) => this.util.toCamelCase(sticker)));
|
1598
|
+
}
|
1599
|
+
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
1600
|
+
getGuildTemplate(guildId, code) {
|
1601
|
+
return this.rest
|
1602
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildTemplate(guildId, code))
|
1603
|
+
.then((response) => this.util.toCamelCase(response));
|
1604
|
+
}
|
1605
|
+
/** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
|
1606
|
+
getGuildTemplates(guildId) {
|
1607
|
+
return this.rest
|
1608
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildTemplates(guildId))
|
1609
|
+
.then((response) => response.map((guildTemplate) => this.util.toCamelCase(guildTemplate)));
|
1610
|
+
}
|
1611
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
1612
|
+
getGuildVanityUrl(guildId) {
|
1613
|
+
return this.rest.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildVanityUrl(guildId));
|
1614
|
+
}
|
1615
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
|
1616
|
+
getGuildVoiceRegions(guildId) {
|
1617
|
+
return this.rest
|
1618
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildVoiceRegions(guildId))
|
1619
|
+
.then((response) => response.map((VoiceRegion) => this.util.toCamelCase(VoiceRegion)));
|
1620
|
+
}
|
1621
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
|
1622
|
+
getGuildWelcomeScreen(guildId) {
|
1623
|
+
return this.rest
|
1624
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildWelcomeScreen(guildId))
|
1625
|
+
.then((response) => this.util.toCamelCase(response));
|
1626
|
+
}
|
1627
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget */
|
1628
|
+
getGuildWidget(guildId) {
|
1629
|
+
return this.rest
|
1630
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildWidgetJson(guildId))
|
1631
|
+
.then((response) => this.util.toCamelCase(response));
|
1632
|
+
}
|
1633
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
|
1634
|
+
getGuildWidgetImage(guildId, options) {
|
1635
|
+
return this.rest.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildWidgetImage(guildId), {
|
1636
|
+
query: {
|
1637
|
+
style: options?.style,
|
1638
|
+
},
|
1639
|
+
});
|
1640
|
+
}
|
1641
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
|
1642
|
+
getGuildWidgetSettings(guildId) {
|
1643
|
+
return this.rest
|
1644
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildWidgetSettings(guildId))
|
1645
|
+
.then((response) => this.util.toCamelCase(response));
|
1646
|
+
}
|
1647
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message */
|
1648
|
+
getInteractionFollowupMessage(applicationId, interactionToken, messageId, options) {
|
1649
|
+
return this.rest
|
1650
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.webhookMessage(applicationId, interactionToken, messageId), {
|
1651
|
+
query: {
|
1652
|
+
thread_id: options?.threadId,
|
1653
|
+
},
|
1654
|
+
})
|
1655
|
+
.then((response) => this.util.toCamelCase(response));
|
1656
|
+
}
|
1657
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response */
|
1658
|
+
getInteractionResponse(applicationId, interactionToken, options) {
|
1659
|
+
return this.rest
|
1660
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.webhookMessage(applicationId, interactionToken), {
|
1661
|
+
query: {
|
1662
|
+
thread_id: options?.threadId,
|
1663
|
+
},
|
1664
|
+
})
|
1665
|
+
.then((response) => this.util.toCamelCase(response));
|
133
1666
|
}
|
134
1667
|
/** https://discord.com/developers/docs/resources/invite#get-invite */
|
135
|
-
|
136
|
-
return
|
1668
|
+
getInvite(code, options) {
|
1669
|
+
return this.rest
|
1670
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.invite(code), {
|
137
1671
|
query: {
|
138
1672
|
with_counts: options?.withCounts,
|
139
1673
|
with_expiration: options?.withExpiration,
|
140
1674
|
guild_scheduled_event_id: options?.guildScheduledEventId,
|
141
1675
|
},
|
142
|
-
})
|
1676
|
+
})
|
1677
|
+
.then((response) => this.util.toCamelCase(response));
|
1678
|
+
}
|
1679
|
+
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
1680
|
+
getJoinedPrivateArchivedThreads(channelId, options) {
|
1681
|
+
return this.rest
|
1682
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelThreads(channelId, "private", true), {
|
1683
|
+
query: {
|
1684
|
+
before: options?.before,
|
1685
|
+
limit: options?.limit,
|
1686
|
+
},
|
1687
|
+
})
|
1688
|
+
.then((response) => this.util.toCamelCase(response));
|
1689
|
+
}
|
1690
|
+
/** https://discord.com/developers/docs/resources/channel#get-channel-message */
|
1691
|
+
getMessage(channelId, messageId) {
|
1692
|
+
return this.rest
|
1693
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelMessage(channelId, messageId))
|
1694
|
+
.then((response) => this.util.toCamelCase(response));
|
1695
|
+
}
|
1696
|
+
/** https://discord.com/developers/docs/resources/channel#get-reactions */
|
1697
|
+
getMessageReactions(channelId, messageId, emoji, options) {
|
1698
|
+
return this.rest
|
1699
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelMessageAllReactions(channelId, messageId, emoji), {
|
1700
|
+
query: {
|
1701
|
+
after: options?.after,
|
1702
|
+
limit: options?.limit,
|
1703
|
+
},
|
1704
|
+
})
|
1705
|
+
.then((response) => response.map((user) => this.util.toCamelCase(user)));
|
1706
|
+
}
|
1707
|
+
/** https://discord.com/developers/docs/resources/channel#get-channel-messages */
|
1708
|
+
getMessages(channelId, options) {
|
1709
|
+
return this.rest
|
1710
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelMessages(channelId), {
|
1711
|
+
query: {
|
1712
|
+
around: options.around,
|
1713
|
+
before: options.before,
|
1714
|
+
after: options.after,
|
1715
|
+
limit: options.limit,
|
1716
|
+
},
|
1717
|
+
})
|
1718
|
+
.then((response) => response.map((message) => this.util.toCamelCase(message)));
|
143
1719
|
}
|
144
1720
|
/** https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information */
|
145
|
-
|
146
|
-
return
|
1721
|
+
getOAuth2Application() {
|
1722
|
+
return this.rest
|
1723
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.oauth2CurrentApplication())
|
1724
|
+
.then((response) => this.util.toCamelCase(response));
|
147
1725
|
}
|
148
1726
|
/** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information */
|
149
|
-
|
150
|
-
return this.rest
|
151
|
-
.
|
152
|
-
.then((response) => (
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
1727
|
+
getOAuth2Authorization() {
|
1728
|
+
return this.rest
|
1729
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.oauth2Authorization())
|
1730
|
+
.then((response) => this.util.toCamelCase(response));
|
1731
|
+
}
|
1732
|
+
/** https://discord.com/developers/docs/resources/channel#get-pinned-messages */
|
1733
|
+
getPinnedMessages(channelId) {
|
1734
|
+
return this.rest
|
1735
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.channelPins(channelId))
|
1736
|
+
.then((response) => response.map((message) => this.util.toCamelCase(message)));
|
1737
|
+
}
|
1738
|
+
/** https://discord.com/developers/docs/monetization/skus#list-skus */
|
1739
|
+
getSkus(applicationId) {
|
1740
|
+
return this.rest
|
1741
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.applicationSkus(applicationId))
|
1742
|
+
.then((response) => response.map((sku) => this.util.toCamelCase(sku)));
|
160
1743
|
}
|
161
1744
|
/** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
|
162
|
-
|
163
|
-
return
|
1745
|
+
getStageInstance(channelId) {
|
1746
|
+
return this.rest
|
1747
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.stageInstance(channelId))
|
1748
|
+
.then((response) => this.util.toCamelCase(response));
|
164
1749
|
}
|
165
1750
|
/** https://discord.com/developers/docs/resources/sticker#list-sticker-packs */
|
166
|
-
|
167
|
-
return this.rest
|
168
|
-
.
|
169
|
-
.then((response) => (
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
bannerAssetId: stickerPack.banner_asset_id,
|
193
|
-
})),
|
194
|
-
}));
|
1751
|
+
getStickerPacks() {
|
1752
|
+
return this.rest
|
1753
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.stickerPacks())
|
1754
|
+
.then((response) => this.util.toCamelCase(response));
|
1755
|
+
}
|
1756
|
+
/** https://discord.com/developers/docs/resources/channel#get-thread-member */
|
1757
|
+
getThreadMember(channelId, userId, options) {
|
1758
|
+
return this.rest
|
1759
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.threadMembers(channelId, userId), {
|
1760
|
+
query: {
|
1761
|
+
with_member: options?.withMember,
|
1762
|
+
},
|
1763
|
+
})
|
1764
|
+
.then((response) => this.util.toCamelCase(response));
|
1765
|
+
}
|
1766
|
+
/** https://discord.com/developers/docs/resources/channel#list-thread-members */
|
1767
|
+
getThreadMembers(channelId, options) {
|
1768
|
+
return this.rest
|
1769
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.threadMembers(channelId), {
|
1770
|
+
query: {
|
1771
|
+
with_member: options?.withMember,
|
1772
|
+
after: options?.after,
|
1773
|
+
limit: options?.limit,
|
1774
|
+
},
|
1775
|
+
})
|
1776
|
+
.then((response) => response.map((threadMember) => this.util.toCamelCase(threadMember)));
|
195
1777
|
}
|
196
1778
|
/** https://discord.com/developers/docs/resources/user#get-user */
|
197
|
-
|
198
|
-
return
|
1779
|
+
getUser(userId) {
|
1780
|
+
return this.rest
|
1781
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.user(userId))
|
1782
|
+
.then((response) => this.util.toCamelCase(response));
|
199
1783
|
}
|
200
1784
|
/** https://discord.com/developers/docs/resources/voice#list-voice-regions */
|
201
|
-
|
1785
|
+
getVoiceRegions() {
|
1786
|
+
return this.rest
|
1787
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.voiceRegions())
|
1788
|
+
.then((response) => response.map((voiceRegion) => this.util.toCamelCase(voiceRegion)));
|
1789
|
+
}
|
1790
|
+
/** https://discord.com/developers/docs/resources/webhook#get-webhook-message */
|
1791
|
+
getWebhookMessage(webhookId, webhookToken, messageId, options) {
|
1792
|
+
return this.rest
|
1793
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.webhookMessage(webhookId, webhookToken, messageId), {
|
1794
|
+
query: {
|
1795
|
+
thread_id: options?.threadId,
|
1796
|
+
},
|
1797
|
+
})
|
1798
|
+
.then((response) => this.util.toCamelCase(response));
|
1799
|
+
}
|
1800
|
+
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
1801
|
+
getWebhooks(guildId) {
|
202
1802
|
return this.rest
|
203
|
-
.
|
204
|
-
.then((response) => response.map((
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
custom: data.custom,
|
210
|
-
})));
|
1803
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildWebhooks(guildId))
|
1804
|
+
.then((response) => response.map((webhook) => this.util.toCamelCase(webhook)));
|
1805
|
+
}
|
1806
|
+
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
1807
|
+
joinThread(channelId) {
|
1808
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.threadMembers(channelId, "@me"));
|
211
1809
|
}
|
212
1810
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
213
1811
|
joinVoiceChannel(guildId, channelId, options) {
|
@@ -221,6 +1819,14 @@ class Client extends node_events_1.default {
|
|
221
1819
|
},
|
222
1820
|
}));
|
223
1821
|
}
|
1822
|
+
/** https://discord.com/developers/docs/resources/user#leave-guild */
|
1823
|
+
leaveGuild(guildId) {
|
1824
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.userGuild(guildId));
|
1825
|
+
}
|
1826
|
+
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
1827
|
+
leaveThread(channelId) {
|
1828
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.threadMembers(channelId, "@me"));
|
1829
|
+
}
|
224
1830
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
225
1831
|
leaveVoiceChannel(guildId) {
|
226
1832
|
this.shards.get(this.guildShardMap[guildId])?.ws.send(JSON.stringify({
|
@@ -233,23 +1839,87 @@ class Client extends node_events_1.default {
|
|
233
1839
|
},
|
234
1840
|
}));
|
235
1841
|
}
|
1842
|
+
/** https://discord.com/developers/docs/resources/channel#pin-message */
|
1843
|
+
pinMessage(channelId, messageId, reason) {
|
1844
|
+
this.rest.request(rest_1.RestMethods.Put, rest_1.Endpoints.channelPin(channelId, messageId), {
|
1845
|
+
reason,
|
1846
|
+
});
|
1847
|
+
}
|
1848
|
+
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
1849
|
+
removeBan(guildId, userId, reason) {
|
1850
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildBan(guildId, userId), {
|
1851
|
+
reason,
|
1852
|
+
});
|
1853
|
+
}
|
1854
|
+
/** https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient */
|
1855
|
+
removeGroupRecipient(channelId, userId) {
|
1856
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channelRecipient(channelId, userId));
|
1857
|
+
}
|
1858
|
+
/** https://discord.com/developers/docs/resources/guild#remove-guild-member */
|
1859
|
+
removeGuildMember(guildId, userId, reason) {
|
1860
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildMember(guildId, userId), {
|
1861
|
+
reason,
|
1862
|
+
});
|
1863
|
+
}
|
1864
|
+
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
1865
|
+
removeGuildMemberRole(guildId, userId, roleId, reason) {
|
1866
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.guildMemberRole(guildId, userId, roleId), {
|
1867
|
+
reason,
|
1868
|
+
});
|
1869
|
+
}
|
1870
|
+
/** https://discord.com/developers/docs/resources/channel#remove-thread-member */
|
1871
|
+
removeThreadMember(channelId, userId) {
|
1872
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.threadMembers(channelId, userId));
|
1873
|
+
}
|
1874
|
+
/** https://discord.com/developers/docs/resources/guild#search-guild-members */
|
1875
|
+
searchGuildMembers(guildId, options) {
|
1876
|
+
return this.rest
|
1877
|
+
.request(rest_1.RestMethods.Get, rest_1.Endpoints.guildMembersSearch(guildId), {
|
1878
|
+
query: {
|
1879
|
+
query: options.query,
|
1880
|
+
limit: options.limit,
|
1881
|
+
},
|
1882
|
+
})
|
1883
|
+
.then((response) => response.map((guildMember) => this.util.toCamelCase(guildMember)));
|
1884
|
+
}
|
236
1885
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
237
1886
|
setPresence(options) {
|
238
1887
|
for (const [id, shard] of this.shards)
|
239
1888
|
shard.setPresence(options);
|
240
1889
|
}
|
241
|
-
/** https://discord.com/developers/docs/
|
242
|
-
|
243
|
-
this.
|
244
|
-
|
245
|
-
|
246
|
-
: this.shardsCount;
|
247
|
-
for (let i = 0; i < this.shardsCount; i++)
|
248
|
-
this.shards.set(i, new gateway_1.Shard(i, this));
|
249
|
-
this.shards.connect();
|
1890
|
+
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
1891
|
+
syncGuildTemplate(guildId, code) {
|
1892
|
+
return this.rest
|
1893
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.guildTemplate(guildId, code))
|
1894
|
+
.then((response) => this.util.toCamelCase(response));
|
250
1895
|
}
|
251
|
-
|
252
|
-
|
1896
|
+
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
1897
|
+
triggerTypingIndicator(channelId) {
|
1898
|
+
this.rest.request(rest_1.RestMethods.Post, rest_1.Endpoints.channelTyping(channelId));
|
1899
|
+
}
|
1900
|
+
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
1901
|
+
updateApplicationRoleConnectionMetadataRecords(applicationId) {
|
1902
|
+
return this.rest
|
1903
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationId))
|
1904
|
+
.then((response) => response.map((applicationRoleConnectionMetadata) => this.util.toCamelCase(applicationRoleConnectionMetadata)));
|
1905
|
+
}
|
1906
|
+
/** https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection */
|
1907
|
+
updateCurrentApplicationRoleConnection(options) {
|
1908
|
+
return this.rest
|
1909
|
+
.request(rest_1.RestMethods.Put, rest_1.Endpoints.userApplicationRoleConnection(this.application.id), {
|
1910
|
+
json: {
|
1911
|
+
platform_name: options.platformName,
|
1912
|
+
platform_username: options.platformUsername,
|
1913
|
+
metadata: options.metadata,
|
1914
|
+
},
|
1915
|
+
})
|
1916
|
+
.then((response) => this.util.toCamelCase(response));
|
1917
|
+
}
|
1918
|
+
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
1919
|
+
unpinMessage(channelId, messageId, reason) {
|
1920
|
+
this.rest.request(rest_1.RestMethods.Delete, rest_1.Endpoints.channelPin(channelId, messageId), {
|
1921
|
+
reason,
|
1922
|
+
});
|
253
1923
|
}
|
254
1924
|
}
|
255
1925
|
exports.Client = Client;
|