disgroove 1.2.4 → 1.2.5-dev.c349b3c

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.
@@ -1,926 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnavailableGuild = void 0;
4
- const _1 = require(".");
5
- const rest_1 = require("../rest");
6
- class UnavailableGuild extends _1.Base {
7
- raw;
8
- id;
9
- unavailable;
10
- constructor(data, client) {
11
- super(data.id, client);
12
- this.raw = data;
13
- this.id = data.id;
14
- this.unavailable = data.unavailable;
15
- }
16
- /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
17
- async getApplicationCommands(applicationId, options) {
18
- return this.client.rest
19
- .get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
20
- query: {
21
- with_localizations: options?.withLocalizations,
22
- },
23
- })
24
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
25
- }
26
- /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
27
- async createApplicationCommand(applicationId, options) {
28
- return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
29
- json: this.client.util.applicationCommandToRaw(options),
30
- }), this.client);
31
- }
32
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
33
- async getApplicationCommand(applicationId, commandId) {
34
- return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
35
- }
36
- /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
37
- async editApplicationCommand(applicationId, commandId, options) {
38
- return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
39
- json: this.client.util.applicationCommandToRaw(options),
40
- }), this.client);
41
- }
42
- /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
43
- deleteApplicationCommand(applicationId, commandId) {
44
- this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
45
- }
46
- /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
47
- async bulkOverwriteGuildApplicationCommands(applicationId, options) {
48
- return this.client.rest
49
- .put(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
50
- json: this.client.util.applicationCommandToRaw(options),
51
- })
52
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
53
- }
54
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
55
- async getApplicationCommandPermissions(applicationId) {
56
- return this.client.rest
57
- .get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
58
- .then((response) => response.map((permissions) => ({
59
- id: permissions.id,
60
- applicationId: permissions.application_id,
61
- guildId: permissions.guild_id,
62
- permissions: permissions.permissions.map((permission) => ({
63
- id: permission.id,
64
- type: permission.type,
65
- permission: permission.permission,
66
- })),
67
- })));
68
- }
69
- /** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
70
- async getAuditLog(options) {
71
- return this.client.rest
72
- .get(rest_1.Endpoints.guildAuditLog(this.id), {
73
- query: {
74
- user_id: options?.userId,
75
- action_type: options?.actionType,
76
- before: options?.before,
77
- after: options?.after,
78
- limit: options?.limit,
79
- },
80
- })
81
- .then((response) => ({
82
- applicationCommands: response.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
83
- auditLogEntries: response.audit_log_entries.map((auditLogEntry) => ({
84
- targetId: auditLogEntry.target_id,
85
- changes: auditLogEntry.changes?.map((change) => ({
86
- newValue: change.new_value,
87
- oldValue: change.old_value,
88
- key: change.key,
89
- })),
90
- userId: auditLogEntry.user_id,
91
- id: auditLogEntry.id,
92
- actionType: auditLogEntry.action_type,
93
- options: auditLogEntry.options !== undefined
94
- ? {
95
- applicationId: auditLogEntry.options.application_id,
96
- autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
97
- autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
98
- channelId: auditLogEntry.options.channel_id,
99
- count: auditLogEntry.options.count,
100
- deleteMemberDays: auditLogEntry.options.delete_member_days,
101
- id: auditLogEntry.options.id,
102
- membersRemoved: auditLogEntry.options.members_removed,
103
- messageId: auditLogEntry.options.message_id,
104
- roleName: auditLogEntry.options.role_name,
105
- type: auditLogEntry.options.type,
106
- }
107
- : undefined,
108
- reason: auditLogEntry.reason,
109
- })),
110
- autoModerationRules: response.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client)),
111
- guildScheduledEvents: response.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client)),
112
- integrations: response.integrations.map((integration) => new _1.Integration(integration, this.client)),
113
- threads: response.threads.map((thread) => new _1.Channel(thread, this.client)),
114
- users: response.users.map((user) => new _1.User(user, this.client)),
115
- webhooks: response.webhooks.map((webhook) => new _1.Webhook(webhook, this.client)),
116
- }));
117
- }
118
- /** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
119
- async getAutoModerationRules() {
120
- return this.client.rest
121
- .get(rest_1.Endpoints.guildAutoModerationRules(this.id))
122
- .then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
123
- }
124
- /** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
125
- async getAutoModerationRule(ruleId) {
126
- return new _1.AutoModerationRule(await this.client.rest.get(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
127
- }
128
- /** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
129
- async createAutoModerationRule(options, reason) {
130
- return new _1.AutoModerationRule(await this.client.rest.post(rest_1.Endpoints.guildAutoModerationRules(this.id), {
131
- json: {
132
- name: options.name,
133
- event_type: options.eventType,
134
- trigger_type: options.triggerType,
135
- trigger_metadata: options.triggerMetadata,
136
- actions: options.actions.map((action) => ({
137
- type: action.type,
138
- metadata: {
139
- channel_id: action.metadata.channelId,
140
- duration_seconds: action.metadata.durationSeconds,
141
- custom_message: action.metadata.customMessage,
142
- },
143
- })),
144
- enabled: options.enabled,
145
- exempt_roles: options.exemptRoles,
146
- exempt_channels: options.exemptChannels,
147
- },
148
- reason,
149
- }), this.client);
150
- }
151
- /** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
152
- async editAutoModerationRule(ruleId, options, reason) {
153
- return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
154
- json: {
155
- name: options.name,
156
- event_type: options.eventType,
157
- trigger_type: options.triggerType,
158
- trigger_metadata: options.triggerMetadata,
159
- actions: options.actions?.map((action) => ({
160
- type: action.type,
161
- metadata: {
162
- channel_id: action.metadata.channelId,
163
- duration_seconds: action.metadata.durationSeconds,
164
- custom_message: action.metadata.customMessage,
165
- },
166
- })),
167
- enabled: options.enabled,
168
- exempt_roles: options.exemptRoles,
169
- exempt_channels: options.exemptChannels,
170
- },
171
- reason,
172
- }), this.client);
173
- }
174
- /** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
175
- deleteAutoModerationRule(ruleId, reason) {
176
- this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
177
- reason,
178
- });
179
- }
180
- /** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
181
- async getEmojis() {
182
- return this.client.rest
183
- .get(rest_1.Endpoints.guildEmojis(this.id))
184
- .then((response) => response.map((data) => new _1.Emoji(data, this.client)));
185
- }
186
- /** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
187
- async getEmoji(emojiId) {
188
- return new _1.Emoji(await this.client.rest.get(rest_1.Endpoints.guildEmoji(this.id, emojiId)), this.client);
189
- }
190
- /** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
191
- async createEmoji(options, reason) {
192
- return new _1.Emoji(await this.client.rest.post(rest_1.Endpoints.guildEmojis(this.id), {
193
- json: {
194
- name: options.name,
195
- image: options.image,
196
- roles: options.roles,
197
- },
198
- reason,
199
- }), this.client);
200
- }
201
- /** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
202
- async editEmoji(emojiId, options, reason) {
203
- return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
204
- json: {
205
- name: options.name,
206
- roles: options.roles,
207
- },
208
- reason,
209
- }), this.client);
210
- }
211
- /** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
212
- deleteEmoji(emojiId, reason) {
213
- this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
214
- reason,
215
- });
216
- }
217
- /** https://discord.com/developers/docs/resources/guild#get-guild-preview */
218
- async getPreview() {
219
- return this.client.rest
220
- .get(rest_1.Endpoints.guildPreview(this.id))
221
- .then((response) => ({
222
- id: response.id,
223
- name: response.name,
224
- icon: response.icon,
225
- splash: response.splash,
226
- discoverySplash: response.discovery_splash,
227
- emojis: response.emojis.map((emoji) => new _1.Emoji(emoji, this.client)),
228
- features: response.features,
229
- approximateMemberCount: response.approximate_member_count,
230
- approximatePresenceCount: response.approximate_presence_count,
231
- description: response.description,
232
- stickers: response.stickers?.map((sticker) => ({
233
- id: sticker.id,
234
- packId: sticker.pack_id,
235
- name: sticker.name,
236
- description: sticker.description,
237
- tags: sticker.tags,
238
- asset: sticker.asset,
239
- type: sticker.type,
240
- formatType: sticker.format_type,
241
- available: sticker.available,
242
- guildId: sticker.guild_id,
243
- user: sticker.user !== undefined
244
- ? new _1.User(sticker.user, this.client)
245
- : undefined,
246
- sortValue: sticker.sort_value,
247
- })),
248
- }));
249
- }
250
- /** https://discord.com/developers/docs/resources/guild#modify-guild */
251
- async edit(options, reason) {
252
- return new _1.Guild(await this.client.rest.patch(rest_1.Endpoints.guild(this.id), {
253
- json: {
254
- name: options.name,
255
- region: options.region,
256
- verification_level: options.verificationLevel,
257
- default_message_notifications: options.defaultMessageNotifications,
258
- explicit_content_filter: options.explicitContentFilter,
259
- afk_channel_id: options.afkChannelId,
260
- afk_timeout: options.afkTimeout,
261
- icon: options.icon,
262
- owner_id: options.ownerId,
263
- splash: options.splash,
264
- discovery_splash: options.discoverySplash,
265
- banner: options.banner,
266
- system_channel_id: options.systemChannelId,
267
- system_channel_flags: options.systemChannelFlags,
268
- rules_channel_id: options.rulesChannelId,
269
- public_updates_channel_id: options.publicUpdatesChannelId,
270
- preferred_locale: options.preferredLocale,
271
- features: options.features,
272
- description: options.description,
273
- premium_progress_bar_enabled: options.premiumProgressBarEnabled,
274
- safety_alerts_channel_id: options.safetyAlertsChannelId,
275
- },
276
- reason,
277
- }), this.client);
278
- }
279
- /** https://discord.com/developers/docs/resources/guild#delete-guild */
280
- delete() {
281
- this.client.rest.delete(rest_1.Endpoints.guild(this.id));
282
- }
283
- /** https://discord.com/developers/docs/resources/guild#get-guild-channels */
284
- async getChannels() {
285
- return this.client.rest
286
- .get(rest_1.Endpoints.guildChannels(this.id))
287
- .then((response) => response.map((data) => new _1.Channel(data, this.client)));
288
- }
289
- /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
290
- async createChannel(options, reason) {
291
- return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
292
- json: {
293
- name: options.name,
294
- type: options.type,
295
- topic: options.topic,
296
- bitrate: options.bitrate,
297
- user_limit: options.userLimit,
298
- rate_limit_per_user: options.rateLimitPerUser,
299
- position: options.position,
300
- permission_overwrites: options.permissionOverwrites,
301
- parent_id: options.parentId,
302
- nsfw: options.nsfw,
303
- rtc_region: options.rtcRegion,
304
- video_quality_mode: options.videoQualityMode,
305
- default_auto_archive_duration: options.defaultAutoArchiveDuration,
306
- default_reaction_emoji: {
307
- emojiId: options.defaultReactionEmoji?.emojiId,
308
- emojiName: options.defaultReactionEmoji?.emojiName,
309
- },
310
- available_tags: options.availableTags,
311
- default_sort_order: options.defaultSortOrder,
312
- default_forum_layout: options.defaultForumLayout,
313
- },
314
- reason,
315
- }), this.client);
316
- }
317
- /** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
318
- editChannelPositions(options) {
319
- this.client.rest.patch(rest_1.Endpoints.guildChannels(this.id), {
320
- json: options.map((data) => ({
321
- id: data.id,
322
- position: data.position,
323
- lock_permissions: data.lockPermissions,
324
- parent_id: data.parentId,
325
- })),
326
- });
327
- }
328
- /** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
329
- async getActiveThreads() {
330
- return this.client.rest
331
- .get(rest_1.Endpoints.guildActiveThreads(this.id))
332
- .then((response) => response.map((data) => ({
333
- threads: data.threads.map((data) => new _1.Channel(data, this.client)),
334
- members: data.members.map((data) => ({
335
- id: data.id,
336
- userId: data.user_id,
337
- joinTimestamp: data.join_timestamp,
338
- flags: data.flags,
339
- member: data.member !== undefined
340
- ? new _1.GuildMember(data.member, this.client)
341
- : undefined,
342
- })),
343
- })));
344
- }
345
- /** https://discord.com/developers/docs/resources/guild#get-guild-member */
346
- async getMember(userId) {
347
- return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
348
- }
349
- /** https://discord.com/developers/docs/resources/guild#list-guild-members */
350
- async getMembers() {
351
- return this.client.rest
352
- .get(rest_1.Endpoints.guildMembers(this.id))
353
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
354
- }
355
- /** https://discord.com/developers/docs/resources/guild#search-guild-members */
356
- async searchMembers(options) {
357
- return this.client.rest
358
- .get(rest_1.Endpoints.guildMembersSearch(this.id), {
359
- query: {
360
- query: options.query,
361
- limit: options.limit,
362
- },
363
- })
364
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
365
- }
366
- /** https://discord.com/developers/docs/resources/guild#add-guild-member */
367
- async addMember(userId, options) {
368
- return this.client.rest
369
- .put(rest_1.Endpoints.guildMember(this.id, userId), {
370
- json: {
371
- access_token: options.accessToken,
372
- nick: options.nick,
373
- roles: options.roles,
374
- mute: options.mute,
375
- deaf: options.deaf,
376
- },
377
- })
378
- .then((response) => {
379
- if (response !== null) {
380
- return new _1.GuildMember(response, this.client);
381
- }
382
- else {
383
- return null;
384
- }
385
- });
386
- }
387
- /** https://discord.com/developers/docs/resources/guild#modify-guild-member */
388
- async editMember(userId, options, reason) {
389
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id, userId), {
390
- json: {
391
- nick: options.nick,
392
- roles: options.roles,
393
- mute: options.mute,
394
- deaf: options.deaf,
395
- channel_id: options.channelId,
396
- communication_disabled_until: options.communicationDisabledUntil,
397
- flags: options.flags,
398
- },
399
- reason,
400
- }), this.client);
401
- }
402
- /** https://discord.com/developers/docs/resources/guild#modify-current-member */
403
- async editCurrentMember(options, reason) {
404
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
405
- json: {
406
- nick: options.nick,
407
- },
408
- reason,
409
- }), this.client);
410
- }
411
- /** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
412
- addMemberRole(userId, roleId, reason) {
413
- this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
414
- reason,
415
- });
416
- }
417
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
418
- removeMemberRole(userId, roleId, reason) {
419
- this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
420
- reason,
421
- });
422
- }
423
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
424
- removeMember(userId, reason) {
425
- this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
426
- reason,
427
- });
428
- }
429
- /** https://discord.com/developers/docs/resources/guild#get-guild-bans */
430
- async getBans(options) {
431
- return this.client.rest
432
- .get(rest_1.Endpoints.guildBans(this.id), {
433
- query: {
434
- limit: options?.limit,
435
- before: options?.before,
436
- after: options?.after,
437
- },
438
- })
439
- .then((response) => response.map((data) => ({
440
- reason: data.reason,
441
- user: new _1.User(data.user, this.client),
442
- })));
443
- }
444
- /** https://discord.com/developers/docs/resources/guild#get-guild-ban */
445
- async getBan(userId) {
446
- return this.client.rest
447
- .get(rest_1.Endpoints.guildBan(this.id, userId))
448
- .then((response) => ({
449
- reason: response.reason,
450
- user: new _1.User(response.user, this.client),
451
- }));
452
- }
453
- /** https://discord.com/developers/docs/resources/guild#create-guild-ban */
454
- createBan(userId, options, reason) {
455
- this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
456
- json: {
457
- delete_message_days: options?.deleteMessageDays,
458
- delete_message_seconds: options?.deleteMessageSeconds,
459
- },
460
- reason,
461
- });
462
- }
463
- /** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
464
- removeBan(userId, reason) {
465
- this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
466
- reason,
467
- });
468
- }
469
- /** https://discord.com/developers/docs/resources/guild#get-guild-roles */
470
- async getRoles() {
471
- return this.client.rest
472
- .get(rest_1.Endpoints.guildRoles(this.id))
473
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
474
- }
475
- /** https://discord.com/developers/docs/resources/guild#create-guild-role */
476
- async createRole(options, reason) {
477
- return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
478
- json: {
479
- name: options.name,
480
- permissions: options.permissions,
481
- color: options.color,
482
- hoist: options.hoist,
483
- icon: options.icon,
484
- unicode_emoji: options.unicodeEmoji,
485
- mentionable: options.mentionable,
486
- },
487
- reason,
488
- }), this.client);
489
- }
490
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
491
- async editRolePositions(options) {
492
- return this.client.rest
493
- .patch(rest_1.Endpoints.guildRoles(this.id), {
494
- json: options.map((data) => ({
495
- id: data.id,
496
- position: data.position,
497
- })),
498
- })
499
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
500
- }
501
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role */
502
- async editRole(roleId, options, reason) {
503
- return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
504
- json: {
505
- name: options?.name,
506
- permissions: options?.permissions,
507
- color: options?.color,
508
- hoist: options?.hoist,
509
- icon: options?.icon,
510
- unicode_emoji: options?.unicodeEmoji,
511
- mentionable: options?.mentionable,
512
- },
513
- reason,
514
- }), this.client);
515
- }
516
- /** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
517
- async editMFALevel(options, reason) {
518
- return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), {
519
- json: {
520
- level: options.level,
521
- },
522
- reason,
523
- });
524
- }
525
- /** https://discord.com/developers/docs/resources/guild#delete-guild-role */
526
- deleteRole(roleId, reason) {
527
- this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
528
- reason,
529
- });
530
- }
531
- /** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
532
- async getPruneCount(options) {
533
- return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
534
- query: {
535
- days: options.days,
536
- include_roles: options.includeRoles,
537
- },
538
- });
539
- }
540
- /** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
541
- async beginGuildPrune(options, reason) {
542
- return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
543
- json: {
544
- days: options.days,
545
- compute_prune_count: options.computePruneCount,
546
- include_roles: options.includeRoles,
547
- reason: options.reason,
548
- },
549
- reason,
550
- });
551
- }
552
- /** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
553
- async getVoiceRegions() {
554
- return this.client.rest
555
- .get(rest_1.Endpoints.guildVoiceRegions(this.id))
556
- .then((response) => response.map((data) => ({
557
- id: data.id,
558
- name: data.name,
559
- optimal: data.optimal,
560
- deprecated: data.deprecated,
561
- custom: data.custom,
562
- })));
563
- }
564
- /** https://discord.com/developers/docs/resources/guild#get-guild-invites */
565
- async getInvites() {
566
- return this.client.rest
567
- .get(rest_1.Endpoints.guildInvites(this.id))
568
- .then((response) => response.map((data) => new _1.Invite(data, this.client)));
569
- }
570
- /** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
571
- async getIntegrations() {
572
- return this.client.rest
573
- .get(rest_1.Endpoints.guildIntegrations(this.id))
574
- .then((response) => response.map((data) => new _1.Integration(data, this.client)));
575
- }
576
- /** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
577
- deleteIntegration(integrationId, reason) {
578
- this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
579
- reason,
580
- });
581
- }
582
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
583
- async getWidgetSettings() {
584
- return this.client.rest
585
- .get(rest_1.Endpoints.guildWidgetSettings(this.id))
586
- .then((response) => ({
587
- enabled: response.enabled,
588
- channelId: response.channel_id,
589
- }));
590
- }
591
- /** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
592
- async editWidget(options, reason) {
593
- return this.client.rest
594
- .patch(rest_1.Endpoints.guildWidgetSettings(this.id), {
595
- json: {
596
- enabled: options.enabled,
597
- channel_id: options.channelId,
598
- },
599
- reason,
600
- })
601
- .then((response) => ({
602
- enabled: response.enabled,
603
- channelId: response.channel_id,
604
- }));
605
- }
606
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget */
607
- async getWidget() {
608
- return this.client.rest
609
- .get(rest_1.Endpoints.guildWidgetJSON(this.id))
610
- .then((response) => ({
611
- id: response.id,
612
- name: response.name,
613
- instantInvite: response.instant_invite,
614
- channels: response.channels.map((data) => new _1.Channel(data, this.client)),
615
- members: response.members.map((data) => new _1.User(data, this.client)),
616
- presenceCount: response.presence_count,
617
- }));
618
- }
619
- /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
620
- async getVanityURL() {
621
- return new _1.Invite(await this.client.rest.get(rest_1.Endpoints.guildVanityUrl(this.id)), this.client);
622
- }
623
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
624
- async getWidgetImage(options) {
625
- return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
626
- query: {
627
- style: options?.style,
628
- },
629
- });
630
- }
631
- /** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
632
- async getWelcomeScreen() {
633
- return this.client.rest
634
- .get(rest_1.Endpoints.guildWelcomeScreen(this.id))
635
- .then((response) => ({
636
- description: response.description,
637
- welcomeChannels: response.welcome_channels.map((data) => ({
638
- channelId: data.channel_id,
639
- description: data.description,
640
- emojiId: data.emoji_id,
641
- emojiName: data.emoji_name,
642
- })),
643
- }));
644
- }
645
- /** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
646
- async editWelcomeScreen(options, reason) {
647
- return this.client.rest
648
- .patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
649
- json: {
650
- enabled: options.enabled,
651
- welcome_channels: options.welcomeChannels,
652
- description: options.description,
653
- },
654
- reason,
655
- })
656
- .then((response) => ({
657
- description: response.description,
658
- welcomeChannels: response.welcome_channels.map((data) => ({
659
- channelId: data.channel_id,
660
- description: data.description,
661
- emojiId: data.emoji_id,
662
- emojiName: data.emoji_name,
663
- })),
664
- }));
665
- }
666
- /** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
667
- async getOnboarding() {
668
- return this.client.rest
669
- .get(rest_1.Endpoints.guildOnboarding(this.id))
670
- .then((response) => ({
671
- guildId: response.guild_id,
672
- prompts: response.prompts.map((prompt) => ({
673
- id: prompt.id,
674
- type: prompt.type,
675
- options: prompt.options.map((option) => ({
676
- id: option.id,
677
- channelIds: option.channel_ids,
678
- roleIds: option.role_ids,
679
- emoji: new _1.Emoji(option.emoji, this.client),
680
- title: option.title,
681
- description: option.description,
682
- })),
683
- title: prompt.title,
684
- singleSelect: prompt.single_select,
685
- required: prompt.required,
686
- inOnboarding: prompt.in_onboarding,
687
- })),
688
- defaultChannelIds: response.default_channel_ids,
689
- enabled: response.enabled,
690
- mode: response.mode,
691
- }));
692
- }
693
- /** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
694
- editOnboarding(options, reason) {
695
- this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
696
- json: {
697
- prompts: options.prompts.map((prompt) => ({
698
- id: prompt.id,
699
- type: prompt.type,
700
- options: prompt.options.map((option) => ({
701
- id: option.id,
702
- channel_ids: option.channelIds,
703
- role_ids: option.roleIds,
704
- emoji: {
705
- id: option.emoji.id,
706
- name: option.emoji.name,
707
- roles: option.emoji.roles,
708
- user: option.emoji.user,
709
- require_colons: option.emoji.requireColons,
710
- managed: option.emoji.managed,
711
- animated: option.emoji.animated,
712
- available: option.emoji.available,
713
- },
714
- title: option.title,
715
- description: option.description,
716
- })),
717
- title: prompt.title,
718
- single_select: prompt.singleSelect,
719
- required: prompt.required,
720
- in_onboarding: prompt.inOnboarding,
721
- })),
722
- },
723
- reason,
724
- });
725
- }
726
- /** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
727
- editCurrentUserVoiceState(options) {
728
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
729
- json: {
730
- channel_id: options.channelId,
731
- suppress: options.suppress,
732
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
733
- },
734
- });
735
- }
736
- /** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
737
- editUserVoiceState(userId, options) {
738
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
739
- json: {
740
- channel_id: options.channelId,
741
- suppress: options.suppress,
742
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
743
- },
744
- });
745
- }
746
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
747
- async getScheduledEvents(options) {
748
- return this.client.rest
749
- .get(rest_1.Endpoints.guildScheduledEvents(this.id), {
750
- query: {
751
- with_user_count: options?.withUserCount,
752
- },
753
- })
754
- .then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
755
- }
756
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
757
- async createScheduledEvent(options, reason) {
758
- return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
759
- json: {
760
- channel_id: options.channelId,
761
- entity_metadata: options.entityMetadata,
762
- name: options.name,
763
- privacy_level: options.privacyLevel,
764
- scheduled_start_time: options.scheduledEndTime,
765
- scheduled_end_time: options.scheduledEndTime,
766
- description: options.description,
767
- entity_type: options.entityType,
768
- image: options.image,
769
- },
770
- reason,
771
- }), this.client);
772
- }
773
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
774
- async editScheduledEvent(scheduledEventId, options, reason) {
775
- return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
776
- json: {
777
- channel_id: options.channelId,
778
- entity_metadata: options.entityMetadata,
779
- name: options.name,
780
- privacy_level: options.privacyLevel,
781
- scheduled_start_time: options.scheduledStartTime,
782
- scheduled_end_time: options.scheduledEndTime,
783
- description: options.description,
784
- entityType: options.entityType,
785
- status: options.status,
786
- image: options.image,
787
- },
788
- reason,
789
- }), this.client);
790
- }
791
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
792
- deleteScheduledEvent(scheduledEventId) {
793
- this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
794
- }
795
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
796
- async getScheduledEventUsers(scheduledEventId, options) {
797
- return this.client.rest
798
- .get(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
799
- query: {
800
- limit: options?.limit,
801
- with_member: options?.withMember,
802
- before: options?.before,
803
- after: options?.after,
804
- },
805
- })
806
- .then((response) => response.map((data) => ({
807
- guildScheduledEventId: data.guild_scheduled_event_id,
808
- user: new _1.User(data.user, this.client),
809
- member: data.member !== undefined
810
- ? new _1.GuildMember(data.member, this.client)
811
- : undefined,
812
- })));
813
- }
814
- /** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
815
- async getTemplate(code) {
816
- return new _1.GuildTemplate(await this.client.rest.get(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
817
- }
818
- /** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
819
- async getTemplates() {
820
- return this.client.rest
821
- .get(rest_1.Endpoints.guildTemplates(this.id))
822
- .then((response) => response.map((data) => new _1.GuildTemplate(data, this.client)));
823
- }
824
- /** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
825
- async createTemplate(options) {
826
- return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
827
- json: {
828
- name: options.name,
829
- description: options.description,
830
- },
831
- }), this.client);
832
- }
833
- /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
834
- async syncTemplate(code) {
835
- return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
836
- }
837
- /** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
838
- async editTemplate(code, options) {
839
- return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
840
- json: {
841
- name: options.name,
842
- description: options.description,
843
- },
844
- }), this.client);
845
- }
846
- /** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
847
- async deleteTemplate(code) {
848
- return this.client.rest
849
- .delete(rest_1.Endpoints.guildTemplate(this.id, code))
850
- .then((response) => ({
851
- code: response.code,
852
- name: response.name,
853
- description: response.description,
854
- usageCount: response.usage_count,
855
- creatorId: response.creator_id,
856
- creator: new _1.User(response.creator, this.client),
857
- createdAt: response.created_at,
858
- updatedAt: response.updated_at,
859
- sourceGuildId: response.source_guild_id,
860
- serializedSourceGuild: new _1.Guild(response.serialized_source_guild, this.client),
861
- isDirty: response.is_dirty,
862
- }));
863
- }
864
- /** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
865
- async getStickers() {
866
- return this.client.rest
867
- .get(rest_1.Endpoints.guildStickers(this.id))
868
- .then((response) => response.map((data) => new _1.Sticker(data, this.client)));
869
- }
870
- /** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
871
- async getSticker(stickerId) {
872
- return this.client.rest
873
- .get(rest_1.Endpoints.guildSticker(this.id, stickerId))
874
- .then((response) => new _1.Sticker(response, this.client));
875
- }
876
- /** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
877
- async createSticker(options, reason) {
878
- return this.client.rest
879
- .post(rest_1.Endpoints.guildStickers(this.id), {
880
- json: {
881
- name: options.name,
882
- description: options.description,
883
- tags: options.tags,
884
- },
885
- files: [options.file],
886
- reason,
887
- })
888
- .then((response) => new _1.Sticker(response, this.client));
889
- }
890
- /** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
891
- async editSticker(stickerId, options, reason) {
892
- return this.client.rest
893
- .patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
894
- json: {
895
- name: options.name,
896
- description: options.description,
897
- tags: options.tags,
898
- },
899
- reason,
900
- })
901
- .then((response) => new _1.Sticker(response, this.client));
902
- }
903
- /** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
904
- deleteSticker(stickerId, reason) {
905
- this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
906
- reason,
907
- });
908
- }
909
- /** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
910
- async getWebhooks() {
911
- return this.client.rest
912
- .get(rest_1.Endpoints.guildWebhooks(this.id))
913
- .then((response) => response.map((data) => new _1.Webhook(data, this.client)));
914
- }
915
- toRaw() {
916
- return this.raw;
917
- }
918
- toJSON() {
919
- return {
920
- id: this.id,
921
- unavailable: this.unavailable,
922
- };
923
- }
924
- }
925
- exports.UnavailableGuild = UnavailableGuild;
926
- //# sourceMappingURL=UnavailableGuild.js.map