disgroove 0.0.1

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.
Files changed (151) hide show
  1. package/dist/class/Client.d.ts +306 -0
  2. package/dist/class/Client.js +771 -0
  3. package/dist/class/Client.js.map +1 -0
  4. package/dist/class/index.d.ts +1 -0
  5. package/dist/class/index.js +18 -0
  6. package/dist/class/index.js.map +1 -0
  7. package/dist/index.d.ts +5 -0
  8. package/dist/index.js +22 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/rest/Endpoints.d.ts +97 -0
  11. package/dist/rest/Endpoints.js +205 -0
  12. package/dist/rest/Endpoints.js.map +1 -0
  13. package/dist/rest/REST.d.ts +16 -0
  14. package/dist/rest/REST.js +55 -0
  15. package/dist/rest/REST.js.map +1 -0
  16. package/dist/rest/index.d.ts +2 -0
  17. package/dist/rest/index.js +32 -0
  18. package/dist/rest/index.js.map +1 -0
  19. package/dist/structures/Application.d.ts +250 -0
  20. package/dist/structures/Application.js +258 -0
  21. package/dist/structures/Application.js.map +1 -0
  22. package/dist/structures/ApplicationCommand.d.ts +68 -0
  23. package/dist/structures/ApplicationCommand.js +133 -0
  24. package/dist/structures/ApplicationCommand.js.map +1 -0
  25. package/dist/structures/AuditLogEntry.d.ts +16 -0
  26. package/dist/structures/AuditLogEntry.js +54 -0
  27. package/dist/structures/AuditLogEntry.js.map +1 -0
  28. package/dist/structures/AutoModerationRule.d.ts +29 -0
  29. package/dist/structures/AutoModerationRule.js +85 -0
  30. package/dist/structures/AutoModerationRule.js.map +1 -0
  31. package/dist/structures/Channel.d.ts +296 -0
  32. package/dist/structures/Channel.js +579 -0
  33. package/dist/structures/Channel.js.map +1 -0
  34. package/dist/structures/Guild.d.ts +452 -0
  35. package/dist/structures/Guild.js +1161 -0
  36. package/dist/structures/Guild.js.map +1 -0
  37. package/dist/structures/GuildMember.d.ts +46 -0
  38. package/dist/structures/GuildMember.js +126 -0
  39. package/dist/structures/GuildMember.js.map +1 -0
  40. package/dist/structures/GuildScheduledEvent.d.ts +45 -0
  41. package/dist/structures/GuildScheduledEvent.js +115 -0
  42. package/dist/structures/GuildScheduledEvent.js.map +1 -0
  43. package/dist/structures/GuildTemplate.d.ts +25 -0
  44. package/dist/structures/GuildTemplate.js +80 -0
  45. package/dist/structures/GuildTemplate.js.map +1 -0
  46. package/dist/structures/Integration.d.ts +28 -0
  47. package/dist/structures/Integration.js +96 -0
  48. package/dist/structures/Integration.js.map +1 -0
  49. package/dist/structures/Interaction.d.ts +204 -0
  50. package/dist/structures/Interaction.js +368 -0
  51. package/dist/structures/Interaction.js.map +1 -0
  52. package/dist/structures/Invite.d.ts +22 -0
  53. package/dist/structures/Invite.js +108 -0
  54. package/dist/structures/Invite.js.map +1 -0
  55. package/dist/structures/Message.d.ts +97 -0
  56. package/dist/structures/Message.js +327 -0
  57. package/dist/structures/Message.js.map +1 -0
  58. package/dist/structures/Role.d.ts +35 -0
  59. package/dist/structures/Role.js +81 -0
  60. package/dist/structures/Role.js.map +1 -0
  61. package/dist/structures/StageInstance.d.ts +20 -0
  62. package/dist/structures/StageInstance.js +53 -0
  63. package/dist/structures/StageInstance.js.map +1 -0
  64. package/dist/structures/User.d.ts +53 -0
  65. package/dist/structures/User.js +168 -0
  66. package/dist/structures/User.js.map +1 -0
  67. package/dist/structures/Webhook.d.ts +133 -0
  68. package/dist/structures/Webhook.js +189 -0
  69. package/dist/structures/Webhook.js.map +1 -0
  70. package/dist/structures/index.d.ts +17 -0
  71. package/dist/structures/index.js +34 -0
  72. package/dist/structures/index.js.map +1 -0
  73. package/dist/types/application-command.d.ts +97 -0
  74. package/dist/types/application-command.js +3 -0
  75. package/dist/types/application-command.js.map +1 -0
  76. package/dist/types/application-role-connection-metadata.d.ts +17 -0
  77. package/dist/types/application-role-connection-metadata.js +3 -0
  78. package/dist/types/application-role-connection-metadata.js.map +1 -0
  79. package/dist/types/application.d.ts +55 -0
  80. package/dist/types/application.js +3 -0
  81. package/dist/types/application.js.map +1 -0
  82. package/dist/types/audit-log.d.ts +77 -0
  83. package/dist/types/audit-log.js +3 -0
  84. package/dist/types/audit-log.js.map +1 -0
  85. package/dist/types/auto-moderation.d.ts +61 -0
  86. package/dist/types/auto-moderation.js +3 -0
  87. package/dist/types/auto-moderation.js.map +1 -0
  88. package/dist/types/channel.d.ts +411 -0
  89. package/dist/types/channel.js +3 -0
  90. package/dist/types/channel.js.map +1 -0
  91. package/dist/types/emoji.d.ts +22 -0
  92. package/dist/types/emoji.js +3 -0
  93. package/dist/types/emoji.js.map +1 -0
  94. package/dist/types/gateway-events.d.ts +53 -0
  95. package/dist/types/gateway-events.js +3 -0
  96. package/dist/types/gateway-events.js.map +1 -0
  97. package/dist/types/guild-scheduled-event.d.ts +55 -0
  98. package/dist/types/guild-scheduled-event.js +3 -0
  99. package/dist/types/guild-scheduled-event.js.map +1 -0
  100. package/dist/types/guild-template.d.ts +28 -0
  101. package/dist/types/guild-template.js +3 -0
  102. package/dist/types/guild-template.js.map +1 -0
  103. package/dist/types/guild.d.ts +305 -0
  104. package/dist/types/guild.js +3 -0
  105. package/dist/types/guild.js.map +1 -0
  106. package/dist/types/index.d.ts +22 -0
  107. package/dist/types/index.js +39 -0
  108. package/dist/types/index.js.map +1 -0
  109. package/dist/types/interaction.d.ts +141 -0
  110. package/dist/types/interaction.js +3 -0
  111. package/dist/types/interaction.js.map +1 -0
  112. package/dist/types/invite.d.ts +56 -0
  113. package/dist/types/invite.js +3 -0
  114. package/dist/types/invite.js.map +1 -0
  115. package/dist/types/message-components.d.ts +76 -0
  116. package/dist/types/message-components.js +3 -0
  117. package/dist/types/message-components.js.map +1 -0
  118. package/dist/types/oauth2.d.ts +14 -0
  119. package/dist/types/oauth2.js +3 -0
  120. package/dist/types/oauth2.js.map +1 -0
  121. package/dist/types/role.d.ts +42 -0
  122. package/dist/types/role.js +3 -0
  123. package/dist/types/role.js.map +1 -0
  124. package/dist/types/stage-instance.d.ts +18 -0
  125. package/dist/types/stage-instance.js +3 -0
  126. package/dist/types/stage-instance.js.map +1 -0
  127. package/dist/types/sticker.d.ts +59 -0
  128. package/dist/types/sticker.js +3 -0
  129. package/dist/types/sticker.js.map +1 -0
  130. package/dist/types/team.d.ts +28 -0
  131. package/dist/types/team.js +3 -0
  132. package/dist/types/team.js.map +1 -0
  133. package/dist/types/user.d.ts +73 -0
  134. package/dist/types/user.js +3 -0
  135. package/dist/types/user.js.map +1 -0
  136. package/dist/types/voice.d.ts +46 -0
  137. package/dist/types/voice.js +3 -0
  138. package/dist/types/voice.js.map +1 -0
  139. package/dist/types/webhook.d.ts +31 -0
  140. package/dist/types/webhook.js +3 -0
  141. package/dist/types/webhook.js.map +1 -0
  142. package/dist/utils/constants.d.ts +963 -0
  143. package/dist/utils/constants.js +1147 -0
  144. package/dist/utils/constants.js.map +1 -0
  145. package/dist/utils/index.d.ts +2 -0
  146. package/dist/utils/index.js +19 -0
  147. package/dist/utils/index.js.map +1 -0
  148. package/dist/utils/rawers.d.ts +467 -0
  149. package/dist/utils/rawers.js +295 -0
  150. package/dist/utils/rawers.js.map +1 -0
  151. package/package.json +27 -0
@@ -0,0 +1,1161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Guild = void 0;
4
+ const _1 = require(".");
5
+ const rest_1 = require("../rest");
6
+ const utils_1 = require("../utils");
7
+ class Guild {
8
+ client;
9
+ id;
10
+ name;
11
+ icon;
12
+ iconHash;
13
+ splash;
14
+ discoverySplash;
15
+ owner;
16
+ ownerId;
17
+ permissions;
18
+ region;
19
+ afkChannelId;
20
+ afkTimeout;
21
+ widgetEnabled;
22
+ widgetChannelId;
23
+ verificationLevel;
24
+ defaultMessageNotifications;
25
+ explicitContentFilter;
26
+ roles;
27
+ emojis;
28
+ features;
29
+ mfaLevel;
30
+ applicationId;
31
+ systemChannelId;
32
+ systemChannelFlags;
33
+ rulesChannelId;
34
+ maxPresences;
35
+ maxMembers;
36
+ vanityURLCode;
37
+ description;
38
+ banner;
39
+ premiumTier;
40
+ premiumSubscriptionCount;
41
+ preferredLocale;
42
+ publicUpdatesChannelId;
43
+ maxVideoChannelUsers;
44
+ approximateMemberCount;
45
+ approximatePresenceCount;
46
+ welcomeScreen;
47
+ nsfwLevel;
48
+ stickers;
49
+ premiumProgressBarEnabled;
50
+ safetyAlertsChannelId;
51
+ constructor(data, client) {
52
+ this.client = client;
53
+ this.id = data.id;
54
+ this.name = data.name;
55
+ this.icon = data.icon;
56
+ this.splash = data.splash;
57
+ this.discoverySplash = data.discovery_splash;
58
+ this.ownerId = data.owner_id;
59
+ this.afkChannelId = data.afk_channel_id;
60
+ this.afkTimeout = data.afk_timeout;
61
+ this.verificationLevel = data.verification_level;
62
+ this.defaultMessageNotifications = data.default_message_notifications;
63
+ this.explicitContentFilter = data.explicit_content_filter;
64
+ this.roles = data.roles.map((role) => new _1.Role(role, client));
65
+ this.emojis = data.emojis.map((data) => ({
66
+ id: data.id,
67
+ name: data.name,
68
+ roles: data?.roles,
69
+ user: data.user !== undefined ? new _1.User(data.user, client) : undefined,
70
+ requireColons: data?.require_colons,
71
+ managed: data?.managed,
72
+ animated: data?.animated,
73
+ available: data?.available,
74
+ }));
75
+ this.features = data.features;
76
+ this.mfaLevel = data.mfa_level;
77
+ this.applicationId = data.application_id;
78
+ this.systemChannelId = data.system_channel_id;
79
+ this.systemChannelFlags = data.system_channel_flags;
80
+ this.rulesChannelId = data.rules_channel_id;
81
+ this.vanityURLCode = data.vanity_url_code;
82
+ this.description = data.description;
83
+ this.banner = data.banner;
84
+ this.premiumTier = data.premium_tier;
85
+ this.preferredLocale = data.preferred_locale;
86
+ this.publicUpdatesChannelId = data.public_updates_channel_id;
87
+ this.nsfwLevel = data.nsfw_level;
88
+ this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
89
+ this.safetyAlertsChannelId = data.safety_alerts_channel_id;
90
+ this.update(data);
91
+ }
92
+ update(data) {
93
+ if (data.icon_hash !== undefined)
94
+ this.iconHash = data.icon_hash;
95
+ if (data.owner !== undefined)
96
+ this.owner = data.owner;
97
+ if (data.permissions !== undefined)
98
+ this.permissions = data.permissions;
99
+ if (data.region !== undefined)
100
+ this.region = data.region;
101
+ if (data.widget_enabled !== undefined)
102
+ this.widgetEnabled = data.widget_enabled;
103
+ if (data.widget_channel_id !== undefined)
104
+ this.widgetChannelId = data.widget_channel_id;
105
+ if (data.max_presences !== undefined)
106
+ this.maxPresences = data.max_presences;
107
+ if (data.max_members !== undefined)
108
+ this.maxMembers = data.max_members;
109
+ if (data.premium_subscription_count !== undefined)
110
+ this.premiumSubscriptionCount = data.premium_subscription_count;
111
+ if (data.max_video_channel_users !== undefined)
112
+ this.maxVideoChannelUsers = data.max_video_channel_users;
113
+ if (data.approximate_member_count !== undefined)
114
+ this.approximateMemberCount = data.approximate_member_count;
115
+ if (data.approximate_presence_count !== undefined)
116
+ this.approximatePresenceCount = data.approximate_presence_count;
117
+ if (data.welcome_screen !== undefined)
118
+ this.welcomeScreen = {
119
+ description: data.welcome_screen.description,
120
+ welcomeChannels: data.welcome_screen.welcome_channels.map((data) => ({
121
+ channelId: data.channel_id,
122
+ description: data.description,
123
+ emojiId: data.emoji_id,
124
+ emojiName: data.emoji_name,
125
+ })),
126
+ };
127
+ if (data.stickers !== undefined)
128
+ this.stickers = data.stickers.map((data) => ({
129
+ id: data.id,
130
+ packId: data?.pack_id,
131
+ name: data.name,
132
+ description: data.description,
133
+ tags: data.tags,
134
+ asset: data?.asset,
135
+ type: data.type,
136
+ formatType: data.format_type,
137
+ available: data?.available,
138
+ guildId: data?.guild_id,
139
+ user: data.user !== undefined
140
+ ? new _1.User(data.user, this.client)
141
+ : undefined,
142
+ sortValue: data?.sort_value,
143
+ }));
144
+ }
145
+ /* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
146
+ async getApplicationCommands(applicationId, options) {
147
+ return this.client.rest
148
+ .request("GET", rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
149
+ query: {
150
+ with_localizations: options?.withLocalizations,
151
+ },
152
+ })
153
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
154
+ }
155
+ /* https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
156
+ async createApplicationCommand(applicationId, options) {
157
+ return new _1.ApplicationCommand(await this.client.rest.request("POST", rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
158
+ json: (0, utils_1.rawApplicationCommand)(options),
159
+ }), this.client);
160
+ }
161
+ /* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
162
+ async getApplicationCommand(applicationId, commandId) {
163
+ return new _1.ApplicationCommand(await this.client.rest.request("GET", rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
164
+ }
165
+ /* https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
166
+ async editApplicationCommand(applicationId, commandId, options) {
167
+ return new _1.ApplicationCommand(await this.client.rest.request("PATCH", rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
168
+ json: (0, utils_1.rawApplicationCommand)(options),
169
+ }), this.client);
170
+ }
171
+ /* https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
172
+ async deleteApplicationCommand(applicationId, commandId) {
173
+ this.client.rest.request("PUT", rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
174
+ }
175
+ /* https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
176
+ async bulkOverwriteGuildApplicationCommands(applicationId, options) {
177
+ return this.client.rest
178
+ .request("PUT", rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
179
+ json: (0, utils_1.rawApplicationCommand)(options),
180
+ })
181
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
182
+ }
183
+ /* https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
184
+ async getApplicationCommandPermissions(guildId) {
185
+ return this.client.rest
186
+ .request("GET", rest_1.Endpoints.guildApplicationCommandsPermissions(this.id, guildId))
187
+ .then((response) => response.map((permissions) => ({
188
+ id: permissions.id,
189
+ applicationId: permissions.application_id,
190
+ guildId: permissions.guild_id,
191
+ permissions: permissions.permissions.map((permission) => ({
192
+ id: permission.id,
193
+ type: permission.type,
194
+ permission: permission.permission,
195
+ })),
196
+ })));
197
+ }
198
+ /* https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
199
+ async getAuditLog(options) {
200
+ return this.client.rest
201
+ .request("GET", rest_1.Endpoints.guildAuditLog(this.id), {
202
+ query: {
203
+ user_id: options?.userId,
204
+ action_type: options?.actionType,
205
+ before: options?.before,
206
+ after: options?.after,
207
+ limit: options?.limit,
208
+ },
209
+ })
210
+ .then((response) => response.map((data) => ({
211
+ applicationCommands: data.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
212
+ auditLogEntries: data.audit_log_entries.map((auditLogEntry) => new _1.AuditLogEntry(auditLogEntry, this.client)),
213
+ autoModerationRules: data.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client)),
214
+ guildScheduledEvents: data.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client)),
215
+ integrations: data.integrations.map((integration) => new _1.Integration(integration, this.client)),
216
+ threads: data.threads.map((thread) => new _1.Channel(thread, this.client)),
217
+ users: data.users.map((user) => new _1.User(user, this.client)),
218
+ webhooks: data.webhooks.map((webhook) => new _1.Webhook(webhook, this.client)),
219
+ })));
220
+ }
221
+ /* https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
222
+ async listAutoModerationRules() {
223
+ return this.client.rest
224
+ .request("GET", rest_1.Endpoints.guildAutoModerationRules(this.id))
225
+ .then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
226
+ }
227
+ /* https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
228
+ async getAutoModerationRule(ruleId) {
229
+ return new _1.AutoModerationRule(await this.client.rest.request("GET", rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
230
+ }
231
+ /* https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
232
+ async createAutoModerationRule(options, reason) {
233
+ return new _1.AutoModerationRule(await this.client.rest.request("POST", rest_1.Endpoints.guildAutoModerationRules(this.id), {
234
+ json: {
235
+ name: options.name,
236
+ event_type: options.eventType,
237
+ trigger_type: options.triggerType,
238
+ trigger_metadata: options?.triggerMetadata,
239
+ actions: options.actions?.map((action) => ({
240
+ type: action.type,
241
+ metadata: {
242
+ channel_id: action.metadata?.channelId,
243
+ duration_seconds: action.metadata?.durationSeconds,
244
+ custom_message: action.metadata?.customMessage,
245
+ },
246
+ })),
247
+ enabled: options.enabled,
248
+ exempt_roles: options?.exemptRoles,
249
+ exempt_channels: options?.exemptChannels,
250
+ },
251
+ reason,
252
+ }), this.client);
253
+ }
254
+ /* https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
255
+ async modifyAutoModerationRule(ruleId, options, reason) {
256
+ return new _1.AutoModerationRule(await this.client.rest.request("PATCH", rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
257
+ json: {
258
+ name: options?.name,
259
+ event_type: options?.eventType,
260
+ trigger_type: options?.triggerType,
261
+ trigger_metadata: options?.triggerMetadata,
262
+ actions: options?.actions?.map((action) => ({
263
+ type: action.type,
264
+ metadata: {
265
+ channel_id: action.metadata?.channelId,
266
+ duration_seconds: action.metadata?.durationSeconds,
267
+ custom_message: action.metadata?.customMessage,
268
+ },
269
+ })),
270
+ enabled: options?.enabled,
271
+ exempt_roles: options?.exemptRoles,
272
+ exempt_channels: options?.exemptChannels,
273
+ },
274
+ reason,
275
+ }), this.client);
276
+ }
277
+ /* https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
278
+ async deleteAutoModerationRule(ruleId, reason) {
279
+ this.client.rest.request("PUT", rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
280
+ reason,
281
+ });
282
+ }
283
+ /* https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
284
+ async listGuildEmojis() {
285
+ return this.client.rest
286
+ .request("GET", rest_1.Endpoints.guildEmojis(this.id))
287
+ .then((response) => response.map((data) => ({
288
+ id: data.id,
289
+ name: data.name,
290
+ roles: data.roles,
291
+ user: data.user !== undefined
292
+ ? new _1.User(data.user, this.client)
293
+ : undefined,
294
+ requireColons: data.require_colons,
295
+ managed: data.managed,
296
+ animated: data.animated,
297
+ available: data.available,
298
+ })));
299
+ }
300
+ /* https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
301
+ async getEmoji(emojiId) {
302
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildEmoji(this.id, emojiId));
303
+ return {
304
+ id: data.id,
305
+ name: data.name,
306
+ roles: data.roles,
307
+ user: data.user !== undefined ? new _1.User(data.user, this.client) : undefined,
308
+ requireColons: data.require_colons,
309
+ managed: data.managed,
310
+ animated: data.animated,
311
+ available: data.available,
312
+ };
313
+ }
314
+ /* https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
315
+ async createEmoji(options, reason) {
316
+ const data = await this.client.rest.request("POST", rest_1.Endpoints.guildEmojis(this.id), {
317
+ json: {
318
+ name: options.name,
319
+ image: options.image,
320
+ roles: options.roles,
321
+ },
322
+ reason,
323
+ });
324
+ return {
325
+ id: data.id,
326
+ name: data.name,
327
+ roles: data.roles,
328
+ user: data.user !== undefined ? new _1.User(data.user, this.client) : undefined,
329
+ requireColons: data.require_colons,
330
+ managed: data.managed,
331
+ animated: data.animated,
332
+ available: data.available,
333
+ };
334
+ }
335
+ /* https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
336
+ async modifyEmoji(emojiId, options, reason) {
337
+ const data = await this.client.rest.request("PATCH", rest_1.Endpoints.guildEmoji(this.id, emojiId), {
338
+ json: {
339
+ name: options.name,
340
+ roles: options.roles,
341
+ },
342
+ reason,
343
+ });
344
+ return {
345
+ id: data.id,
346
+ name: data.name,
347
+ roles: data.roles,
348
+ user: data.user !== undefined ? new _1.User(data.user, this.client) : undefined,
349
+ requireColons: data.require_colons,
350
+ managed: data.managed,
351
+ animated: data.animated,
352
+ available: data.available,
353
+ };
354
+ }
355
+ /* https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
356
+ async deleteEmoji(emojiId, reason) {
357
+ this.client.rest.request("PUT", rest_1.Endpoints.guildEmoji(this.id, emojiId), {
358
+ reason,
359
+ });
360
+ }
361
+ /* https://discord.com/developers/docs/resources/guild#get-guild-preview */
362
+ async getPreview() {
363
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildPreview(this.id));
364
+ return {
365
+ id: data.id,
366
+ name: data.name,
367
+ icon: data.icon,
368
+ splash: data.splash,
369
+ discoverySplash: data.discovery_splash,
370
+ emojis: data.emojis.map((emoji) => ({
371
+ id: emoji.id,
372
+ name: emoji.name,
373
+ roles: emoji?.roles,
374
+ user: emoji.user !== undefined
375
+ ? new _1.User(emoji.user, this.client)
376
+ : undefined,
377
+ requireColons: emoji?.require_colons,
378
+ managed: emoji?.managed,
379
+ animated: emoji?.animated,
380
+ available: emoji?.available,
381
+ })),
382
+ features: data.features,
383
+ approximateMemberCount: data?.approximate_member_count,
384
+ approximatePresenceCount: data?.approximate_presence_count,
385
+ description: data.description,
386
+ stickers: data?.stickers?.map((sticker) => ({
387
+ id: sticker.id,
388
+ packId: sticker?.pack_id,
389
+ name: sticker.name,
390
+ description: sticker.description,
391
+ tags: sticker.tags,
392
+ asset: sticker?.asset,
393
+ type: sticker.type,
394
+ formatType: sticker.format_type,
395
+ available: sticker?.available,
396
+ guildId: sticker?.guild_id,
397
+ user: sticker?.user !== undefined
398
+ ? new _1.User(sticker.user, this.client)
399
+ : undefined,
400
+ sortValue: sticker?.sort_value,
401
+ })),
402
+ };
403
+ }
404
+ /* https://discord.com/developers/docs/resources/guild#modify-guild */
405
+ async modify(options, reason) {
406
+ return new Guild(await this.client.rest.request("PATCH", rest_1.Endpoints.guild(this.id), {
407
+ json: {
408
+ name: options?.name,
409
+ region: options?.region,
410
+ verification_level: options?.verificationLevel,
411
+ default_message_notifications: options?.defaultMessageNotifications,
412
+ explicit_content_filter: options?.explicitContentFilter,
413
+ afk_channel_id: options?.afkChannelId,
414
+ afk_timeout: options?.afkTimeout,
415
+ icon: options?.icon,
416
+ owner_id: options?.ownerId,
417
+ splash: options?.splash,
418
+ discovery_splash: options?.discoverySplash,
419
+ banner: options?.banner,
420
+ system_channel_id: options?.systemChannelId,
421
+ system_channel_flags: options?.systemChannelFlags,
422
+ rules_channel_id: options?.rulesChannelId,
423
+ public_updates_channel_id: options?.publicUpdatesChannelId,
424
+ preferred_locale: options?.preferredLocale,
425
+ features: options?.features,
426
+ description: options?.description,
427
+ premium_progress_bar_enabled: options?.premiumProgressBarEnabled,
428
+ safety_alerts_channel_id: options?.safetyAlertsChannelId,
429
+ },
430
+ reason,
431
+ }), this.client);
432
+ }
433
+ /* https://discord.com/developers/docs/resources/guild#delete-guild */
434
+ async delete() {
435
+ this.client.rest.request("PUT", rest_1.Endpoints.guild(this.id));
436
+ }
437
+ /* https://discord.com/developers/docs/resources/guild#get-guild-channels */
438
+ async getChannels() {
439
+ return this.client.rest
440
+ .request("GET", rest_1.Endpoints.guildChannels(this.id))
441
+ .then((response) => response.map((data) => new _1.Channel(data, this.client)));
442
+ }
443
+ /* https://discord.com/developers/docs/resources/guild#create-guild-channel */
444
+ async createChannel(options, reason) {
445
+ return new _1.Channel(await this.client.rest.request("POST", rest_1.Endpoints.guildChannels(this.id), {
446
+ json: {
447
+ name: options?.name,
448
+ type: options?.type,
449
+ topic: options?.topic,
450
+ bitrate: options?.bitrate,
451
+ user_limit: options?.userLimit,
452
+ rate_limit_per_user: options?.rateLimitPerUser,
453
+ position: options?.position,
454
+ permission_overwrites: options?.permissionOverwrites,
455
+ parent_id: options?.parentId,
456
+ nsfw: options?.nsfw,
457
+ rtc_region: options?.rtcRegion,
458
+ video_quality_mode: options?.videoQualityMode,
459
+ default_auto_archive_duration: options?.defaultAutoArchiveDuration,
460
+ default_reaction_emoji: {
461
+ emojiId: options?.defaultReactionEmoji?.emojiId,
462
+ emojiName: options?.defaultReactionEmoji?.emojiName,
463
+ },
464
+ available_tags: options?.availableTags,
465
+ default_sort_order: options?.defaultSortOrder,
466
+ default_forum_layout: options?.defaultForumLayout,
467
+ },
468
+ reason,
469
+ }), this.client);
470
+ }
471
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
472
+ async modifyChannelPositions(options) {
473
+ this.client.rest.request("PATCH", rest_1.Endpoints.guildChannels(this.id), {
474
+ json: options.map((data) => ({
475
+ id: data.id,
476
+ position: data.position,
477
+ lock_permissions: data.lockPermissions,
478
+ parent_id: data.parentId,
479
+ })),
480
+ });
481
+ }
482
+ /* https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
483
+ async listActiveGuildThreads() {
484
+ return this.client.rest
485
+ .request("GET", rest_1.Endpoints.guildActiveThreads(this.id))
486
+ .then((response) => response.map((data) => ({
487
+ threads: data.threads.map((data) => new _1.Channel(data, this.client)),
488
+ members: data.members.map((data) => ({
489
+ id: data?.id,
490
+ userId: data?.user_id,
491
+ joinTimestamp: data?.join_timestamp,
492
+ flags: data?.flags,
493
+ member: data?.member !== undefined
494
+ ? new _1.GuildMember(data?.member, this.client)
495
+ : undefined,
496
+ })),
497
+ })));
498
+ }
499
+ /* https://discord.com/developers/docs/resources/guild#get-guild-member */
500
+ async getMember(userId) {
501
+ return new _1.GuildMember(await this.client.rest.request("GET", rest_1.Endpoints.guildMember(this.id, userId)), this.client);
502
+ }
503
+ /* https://discord.com/developers/docs/resources/guild#list-guild-members */
504
+ async listGuildMembers() {
505
+ return this.client.rest
506
+ .request("GET", rest_1.Endpoints.guildMembers(this.id))
507
+ .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
508
+ }
509
+ /* https://discord.com/developers/docs/resources/guild#search-guild-members */
510
+ async searchGuildMembers(options) {
511
+ return this.client.rest
512
+ .request("GET", rest_1.Endpoints.guildMembersSearch(this.id), {
513
+ query: {
514
+ query: options.query,
515
+ limit: options.limit,
516
+ },
517
+ })
518
+ .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
519
+ }
520
+ /* https://discord.com/developers/docs/resources/guild#add-guild-member */
521
+ async addGuildMember(userId, options) {
522
+ this.client.rest.request("PUT", rest_1.Endpoints.guildMember(this.id, userId), {
523
+ json: {
524
+ access_token: options.accessToken,
525
+ nick: options?.nick,
526
+ roles: options?.roles,
527
+ mute: options?.mute,
528
+ deaf: options?.deaf,
529
+ },
530
+ });
531
+ }
532
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-member */
533
+ async modifyMember(userId, options, reason) {
534
+ this.client.rest.request("PATCH", rest_1.Endpoints.guildMember(this.id, userId), {
535
+ json: {
536
+ nick: options?.nick,
537
+ roles: options?.roles,
538
+ mute: options?.mute,
539
+ deaf: options?.deaf,
540
+ channel_id: options?.channelId,
541
+ communication_disabled_until: options?.communicationDisabledUntil,
542
+ flags: options?.flags,
543
+ },
544
+ reason,
545
+ });
546
+ }
547
+ /* https://discord.com/developers/docs/resources/guild#modify-current-member */
548
+ async modifyCurrentMember(options, reason) {
549
+ this.client.rest.request("PATCH", rest_1.Endpoints.guildMember(this.id), {
550
+ json: {
551
+ nick: options.nick,
552
+ },
553
+ reason,
554
+ });
555
+ }
556
+ /* https://discord.com/developers/docs/resources/guild#add-guild-member-role */
557
+ async addGuildMemberRole(userId, roleId, reason) {
558
+ this.client.rest.request("PUT", rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
559
+ reason,
560
+ });
561
+ }
562
+ /* https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
563
+ async removeMemberRole(userId, roleId, reason) {
564
+ this.client.rest.request("PUT", rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
565
+ reason,
566
+ });
567
+ }
568
+ /* https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
569
+ async removeMember(userId, reason) {
570
+ this.client.rest.request("PUT", rest_1.Endpoints.guildMember(this.id, userId), {
571
+ reason,
572
+ });
573
+ }
574
+ /* https://discord.com/developers/docs/resources/guild#get-guild-bans */
575
+ async getBans(options) {
576
+ return this.client.rest
577
+ .request("GET", rest_1.Endpoints.guildBans(this.id), {
578
+ query: {
579
+ limit: options?.limit,
580
+ before: options?.before,
581
+ after: options?.after,
582
+ },
583
+ })
584
+ .then((response) => response.map((data) => ({
585
+ reason: data.reason,
586
+ user: new _1.User(data.user, this.client),
587
+ })));
588
+ }
589
+ /* https://discord.com/developers/docs/resources/guild#get-guild-ban */
590
+ async getBan(userId) {
591
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildBan(this.id, userId));
592
+ return {
593
+ reason: data.reason,
594
+ user: new _1.User(data.user, this.client),
595
+ };
596
+ }
597
+ /* https://discord.com/developers/docs/resources/guild#create-guild-ban */
598
+ async createBan(userId, options, reason) {
599
+ this.client.rest.request("PUT", rest_1.Endpoints.guildBan(this.id, userId), {
600
+ json: {
601
+ delete_message_days: options?.deleteMessageDays,
602
+ delete_message_seconds: options?.deleteMessageSeconds,
603
+ },
604
+ reason,
605
+ });
606
+ }
607
+ /* https://discord.com/developers/docs/resources/guild#remove-guild-ban */
608
+ async removeBan(userId, reason) {
609
+ this.client.rest.request("PUT", rest_1.Endpoints.guildBan(this.id, userId), {
610
+ reason,
611
+ });
612
+ }
613
+ /* https://discord.com/developers/docs/resources/guild#get-guild-roles */
614
+ async getRoles() {
615
+ return this.client.rest
616
+ .request("GET", rest_1.Endpoints.guildRoles(this.id))
617
+ .then((response) => response.map((data) => new _1.Role(data, this.client)));
618
+ }
619
+ /* https://discord.com/developers/docs/resources/guild#create-guild-role */
620
+ async createRole(options, reason) {
621
+ return new _1.Role(await this.client.rest.request("POST", rest_1.Endpoints.guildRoles(this.id), {
622
+ json: {
623
+ name: options.name,
624
+ permissions: options.permissions,
625
+ color: options.color,
626
+ hoist: options.hoist,
627
+ icon: options.icon,
628
+ unicode_emoji: options.unicodeEmoji,
629
+ mentionable: options.mentionable,
630
+ },
631
+ reason,
632
+ }), this.client);
633
+ }
634
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
635
+ async modifyRolePositions(options) {
636
+ return this.client.rest
637
+ .request("PATCH", rest_1.Endpoints.guildRoles(this.id), {
638
+ json: options.map((data) => ({
639
+ id: data.id,
640
+ position: data?.position,
641
+ })),
642
+ })
643
+ .then((response) => response.map((data) => new _1.Role(data, this.client)));
644
+ }
645
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-role */
646
+ async modifyRole(roleId, options, reason) {
647
+ return new _1.Role(await this.client.rest.request("PATCH", rest_1.Endpoints.guildRole(this.id, roleId), {
648
+ json: {
649
+ name: options?.name,
650
+ permissions: options?.permissions,
651
+ color: options?.color,
652
+ hoist: options?.hoist,
653
+ icon: options?.icon,
654
+ unicode_emoji: options?.unicodeEmoji,
655
+ mentionable: options?.mentionable,
656
+ },
657
+ reason,
658
+ }), this.client);
659
+ }
660
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
661
+ async modifyMFALevel(options, reason) {
662
+ return await this.client.rest.request("POST", rest_1.Endpoints.guildMFA(this.id), {
663
+ json: {
664
+ level: options.level,
665
+ },
666
+ reason,
667
+ });
668
+ }
669
+ /* https://discord.com/developers/docs/resources/guild#delete-guild-role */
670
+ async deleteRole(roleId, reason) {
671
+ this.client.rest.request("PUT", rest_1.Endpoints.guildRole(this.id, roleId), {
672
+ reason,
673
+ });
674
+ }
675
+ /* https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
676
+ async getPruneCount(options) {
677
+ return await this.client.rest.request("GET", rest_1.Endpoints.guildPrune(this.id), {
678
+ query: {
679
+ days: options.days,
680
+ include_roles: options.includeRoles,
681
+ },
682
+ });
683
+ }
684
+ /* https://discord.com/developers/docs/resources/guild#begin-guild-prune */
685
+ async beginGuildPrune(options, reason) {
686
+ return await this.client.rest.request("POST", rest_1.Endpoints.guildPrune(this.id), {
687
+ json: {
688
+ days: options.days,
689
+ compute_prune_count: options.computePruneCount,
690
+ include_roles: options.includeRoles,
691
+ reason: options?.reason,
692
+ },
693
+ reason,
694
+ });
695
+ }
696
+ /* https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
697
+ async getVoiceRegions() {
698
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildVoiceRegions(this.id));
699
+ return data.map((data) => ({
700
+ id: data.id,
701
+ name: data.name,
702
+ optimal: data.optimal,
703
+ deprecated: data.deprecated,
704
+ custom: data.custom,
705
+ }));
706
+ }
707
+ /* https://discord.com/developers/docs/resources/guild#get-guild-invites */
708
+ async getInvites() {
709
+ return this.client.rest
710
+ .request("GET", rest_1.Endpoints.guildInvites(this.id))
711
+ .then((response) => response.map((data) => new _1.Invite(data, this.client)));
712
+ }
713
+ /* https://discord.com/developers/docs/resources/guild#get-guild-integrations */
714
+ async getIntegrations() {
715
+ return this.client.rest
716
+ .request("GET", rest_1.Endpoints.guildIntegrations(this.id))
717
+ .then((response) => response.map((data) => new _1.Integration(data, this.client)));
718
+ }
719
+ /* https://discord.com/developers/docs/resources/guild#delete-guild-integration */
720
+ async deleteIntegration(integrationId, reason) {
721
+ this.client.rest.request("PUT", rest_1.Endpoints.guildIntegration(this.id, integrationId), {
722
+ reason,
723
+ });
724
+ }
725
+ /* https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
726
+ async getWidgetSettings() {
727
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildWidgetSettings(this.id));
728
+ return {
729
+ enabled: data.enabled,
730
+ channelId: data.channel_id,
731
+ };
732
+ }
733
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-widget */
734
+ async modifyWidget(options, reason) {
735
+ const data = await this.client.rest.request("PATCH", rest_1.Endpoints.guildWidgetSettings(this.id), {
736
+ json: {
737
+ enabled: options?.enabled,
738
+ channel_id: options?.channelId,
739
+ },
740
+ reason,
741
+ });
742
+ return {
743
+ enabled: data.enabled,
744
+ channelId: data.channel_id,
745
+ };
746
+ }
747
+ /* https://discord.com/developers/docs/resources/guild#get-guild-widget */
748
+ async getWidget() {
749
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildWidgetJSON(this.id));
750
+ return {
751
+ id: data.id,
752
+ name: data.name,
753
+ instantInvite: data.instant_invite,
754
+ channels: data.channels.map((data) => new _1.Channel(data, this.client)),
755
+ members: data.members.map((data) => new _1.User(data, this.client)),
756
+ presenceCount: data.presence_count,
757
+ };
758
+ }
759
+ /* https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
760
+ async getVanityURL() {
761
+ return new _1.Invite(await this.client.rest.request("GET", rest_1.Endpoints.guildVanityUrl(this.id)), this.client);
762
+ }
763
+ /* https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
764
+ async getWidgetImage(options) {
765
+ return await this.client.rest.request("GET", rest_1.Endpoints.guildWidgetImage(this.id), {
766
+ query: {
767
+ style: options?.style,
768
+ },
769
+ });
770
+ }
771
+ /* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
772
+ async getWelcomeScreen() {
773
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildWelcomeScreen(this.id));
774
+ return {
775
+ description: data.description,
776
+ welcomeChannels: data.welcome_channels.map((data) => ({
777
+ channelId: data.channel_id,
778
+ description: data.description,
779
+ emojiId: data.emoji_id,
780
+ emojiName: data.emoji_name,
781
+ })),
782
+ };
783
+ }
784
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
785
+ async modifyWelcomeScreen(options, reason) {
786
+ const data = await this.client.rest.request("PATCH", rest_1.Endpoints.guildWelcomeScreen(this.id), {
787
+ json: {
788
+ enabled: options?.enabled,
789
+ welcome_channels: options?.welcomeChannels,
790
+ description: options?.description,
791
+ },
792
+ reason,
793
+ });
794
+ return {
795
+ description: data.description,
796
+ welcomeChannels: data.welcome_channels.map((data) => ({
797
+ channelId: data.channel_id,
798
+ description: data.description,
799
+ emojiId: data.emoji_id,
800
+ emojiName: data.emoji_name,
801
+ })),
802
+ };
803
+ }
804
+ /* https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
805
+ async getOnboarding() {
806
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildOnboarding(this.id));
807
+ return {
808
+ guildId: data.guild_id,
809
+ prompts: data.prompts.map((prompt) => ({
810
+ id: prompt.id,
811
+ type: prompt.type,
812
+ options: prompt.options.map((option) => ({
813
+ id: option.id,
814
+ channelIds: option.channel_ids,
815
+ roleIds: option.role_ids,
816
+ emoji: {
817
+ id: option.emoji.id,
818
+ name: option.emoji.name,
819
+ roles: option.emoji?.roles,
820
+ user: option.emoji.user !== undefined
821
+ ? new _1.User(option.emoji.user, this.client)
822
+ : undefined,
823
+ requireColons: option.emoji?.require_colons,
824
+ managed: option.emoji?.managed,
825
+ animated: option.emoji?.animated,
826
+ available: option.emoji?.available,
827
+ },
828
+ title: option.title,
829
+ description: option.description,
830
+ })),
831
+ title: prompt.title,
832
+ singleSelect: prompt.single_select,
833
+ required: prompt.required,
834
+ inOnboarding: prompt.in_onboarding,
835
+ })),
836
+ defaultChannelIds: data.default_channel_ids,
837
+ enabled: data.enabled,
838
+ mode: data.mode,
839
+ };
840
+ }
841
+ /* https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
842
+ async modifyOnboarding(options, reason) {
843
+ this.client.rest.request("PATCH", rest_1.Endpoints.guildOnboarding(this.id), {
844
+ json: {
845
+ prompts: options.prompts.map((prompt) => ({
846
+ id: prompt.id,
847
+ type: prompt.type,
848
+ options: prompt.options.map((option) => ({
849
+ id: option.id,
850
+ channel_ids: option.channelIds,
851
+ role_ids: option.roleIds,
852
+ emoji: {
853
+ id: option.emoji.id,
854
+ name: option.emoji.name,
855
+ roles: option.emoji?.roles,
856
+ user: option.emoji.user,
857
+ require_colons: option.emoji?.requireColons,
858
+ managed: option.emoji?.managed,
859
+ animated: option.emoji?.animated,
860
+ available: option.emoji?.available,
861
+ },
862
+ title: option.title,
863
+ description: option.description,
864
+ })),
865
+ title: prompt.title,
866
+ single_select: prompt.singleSelect,
867
+ required: prompt.required,
868
+ in_onboarding: prompt.inOnboarding,
869
+ })),
870
+ },
871
+ reason,
872
+ });
873
+ }
874
+ /* https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
875
+ async modifyCurrentUserVoiceState(options) {
876
+ this.client.rest.request("PATCH", rest_1.Endpoints.guildVoiceState(this.id), {
877
+ json: {
878
+ channel_id: options?.channelId,
879
+ suppress: options?.suppress,
880
+ requestToSpeakTimestamp: options?.requestToSpeakTimestamp,
881
+ },
882
+ });
883
+ }
884
+ /* https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
885
+ async modifyUserVoiceState(userId, options) {
886
+ this.client.rest.request("PATCH", rest_1.Endpoints.guildVoiceState(this.id, userId), {
887
+ json: {
888
+ channel_id: options?.channelId,
889
+ suppress: options?.suppress,
890
+ requestToSpeakTimestamp: options?.requestToSpeakTimestamp,
891
+ },
892
+ });
893
+ }
894
+ /* https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
895
+ async listScheduledEvents(options) {
896
+ return this.client.rest
897
+ .request("GET", rest_1.Endpoints.guildScheduledEvents(this.id), {
898
+ query: {
899
+ with_user_count: options?.withUserCount,
900
+ },
901
+ })
902
+ .then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
903
+ }
904
+ /* https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
905
+ async createScheduledEvent(options, reason) {
906
+ return new _1.GuildScheduledEvent(await this.client.rest.request("POST", rest_1.Endpoints.guildScheduledEvents(this.id), {
907
+ json: {
908
+ channel_id: options?.channelId,
909
+ entity_metadata: options?.entityMetadata,
910
+ name: options.name,
911
+ privacy_level: options.privacyLevel,
912
+ scheduled_start_time: options.scheduledEndTime,
913
+ scheduled_end_time: options?.scheduledEndTime,
914
+ description: options?.description,
915
+ entity_type: options.entityType,
916
+ image: options?.image,
917
+ },
918
+ reason,
919
+ }), this.client);
920
+ }
921
+ /* https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
922
+ async modifyScheduledEvent(scheduledEventId, options, reason) {
923
+ return new _1.GuildScheduledEvent(await this.client.rest.request("PATCH", rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
924
+ json: {
925
+ channel_id: options?.channelId,
926
+ entity_metadata: options?.entityMetadata,
927
+ name: options?.name,
928
+ privacy_level: options?.privacyLevel,
929
+ scheduled_start_time: options?.scheduledStartTime,
930
+ scheduled_end_time: options?.scheduledEndTime,
931
+ description: options?.description,
932
+ entityType: options?.entityType,
933
+ status: options?.status,
934
+ image: options?.image,
935
+ },
936
+ reason,
937
+ }), this.client);
938
+ }
939
+ /* https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
940
+ async deleteScheduledEvent(scheduledEventId) {
941
+ this.client.rest.request("PUT", rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
942
+ }
943
+ /* https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
944
+ async getScheduledEventUsers(scheduledEventId, options) {
945
+ return this.client.rest
946
+ .request("GET", rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
947
+ query: {
948
+ limit: options?.limit,
949
+ with_member: options?.withMember,
950
+ before: options?.before,
951
+ after: options?.after,
952
+ },
953
+ })
954
+ .then((response) => response.map((data) => ({
955
+ guildScheduledEventId: data.guild_scheduled_event_id,
956
+ user: new _1.User(data.user, this.client),
957
+ member: data.member !== undefined
958
+ ? new _1.GuildMember(data.member, this.client)
959
+ : undefined,
960
+ })));
961
+ }
962
+ /* https://discord.com/developers/docs/resources/guild-template#get-guild-template */
963
+ async getTemplate(code) {
964
+ return new _1.GuildTemplate(await this.client.rest.request("GET", rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
965
+ }
966
+ /* https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
967
+ async getTemplates() {
968
+ return this.client.rest
969
+ .request("GET", rest_1.Endpoints.guildTemplates(this.id))
970
+ .then((response) => response.map((data) => new _1.GuildTemplate(data, this.client)));
971
+ }
972
+ /* https://discord.com/developers/docs/resources/guild-template#create-guild-template */
973
+ async createTemplate(options) {
974
+ return new _1.GuildTemplate(await this.client.rest.request("POST", rest_1.Endpoints.guildTemplates(this.id), {
975
+ json: {
976
+ name: options.name,
977
+ description: options?.description,
978
+ },
979
+ }), this.client);
980
+ }
981
+ /* https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
982
+ async syncTemplate(code) {
983
+ return new _1.GuildTemplate(await this.client.rest.request("PUT", rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
984
+ }
985
+ /* https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
986
+ async modifyTemplate(code, options) {
987
+ return new _1.GuildTemplate(await this.client.rest.request("PATCH", rest_1.Endpoints.guildTemplate(this.id, code), {
988
+ json: {
989
+ name: options?.name,
990
+ description: options?.description,
991
+ },
992
+ }), this.client);
993
+ }
994
+ /* https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
995
+ async deleteTemplate(code) {
996
+ const data = await this.client.rest.request("PUT", rest_1.Endpoints.guildTemplate(this.id, code));
997
+ return {
998
+ code: data.code,
999
+ name: data.name,
1000
+ description: data.description,
1001
+ usageCount: data.usage_count,
1002
+ creatorId: data.creator_id,
1003
+ creator: new _1.User(data.creator, this.client),
1004
+ createdAt: data.created_at,
1005
+ updatedAt: data.updated_at,
1006
+ sourceGuildId: data.source_guild_id,
1007
+ serializedSourceGuild: new Guild(data.serialized_source_guild, this.client),
1008
+ isDirty: data.is_dirty,
1009
+ };
1010
+ }
1011
+ /* https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
1012
+ async listStickers() {
1013
+ return this.client.rest
1014
+ .request("GET", rest_1.Endpoints.guildStickers(this.id))
1015
+ .then((response) => response.map((data) => ({
1016
+ id: data.id,
1017
+ packId: data.pack_id,
1018
+ name: data.name,
1019
+ description: data.description,
1020
+ tags: data.tags,
1021
+ asset: data.asset,
1022
+ type: data.type,
1023
+ formatType: data.format_type,
1024
+ available: data.available,
1025
+ guildId: data.guild_id,
1026
+ user: data.user !== undefined
1027
+ ? new _1.User(data.user, this.client)
1028
+ : undefined,
1029
+ sortValue: data.sort_value,
1030
+ })));
1031
+ }
1032
+ /* https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
1033
+ async getSticker(stickerId) {
1034
+ const data = await this.client.rest.request("GET", rest_1.Endpoints.guildSticker(this.id, stickerId));
1035
+ return {
1036
+ id: data.id,
1037
+ packId: data.pack_id,
1038
+ name: data.name,
1039
+ description: data.description,
1040
+ tags: data.tags,
1041
+ asset: data.asset,
1042
+ type: data.type,
1043
+ formatType: data.format_type,
1044
+ available: data.available,
1045
+ guildId: data.guild_id,
1046
+ user: data.user !== undefined ? new _1.User(data.user, this.client) : undefined,
1047
+ sortValue: data.sort_value,
1048
+ };
1049
+ }
1050
+ /* https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
1051
+ async createSticker(options, reason) {
1052
+ const data = await this.client.rest.request("POST", rest_1.Endpoints.guildStickers(this.id), {
1053
+ json: {
1054
+ name: options.name,
1055
+ description: options.description,
1056
+ tags: options.tags,
1057
+ },
1058
+ files: [options.file],
1059
+ reason,
1060
+ });
1061
+ return {
1062
+ id: data.id,
1063
+ packId: data.pack_id,
1064
+ name: data.name,
1065
+ description: data.description,
1066
+ tags: data.tags,
1067
+ asset: data.asset,
1068
+ type: data.type,
1069
+ formatType: data.format_type,
1070
+ available: data.available,
1071
+ guildId: data.guild_id,
1072
+ user: data.user !== undefined ? new _1.User(data.user, this.client) : undefined,
1073
+ sortValue: data.sort_value,
1074
+ };
1075
+ }
1076
+ /* https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
1077
+ async modifySticker(stickerId, options, reason) {
1078
+ const data = await this.client.rest.request("PATCH", rest_1.Endpoints.guildSticker(this.id, stickerId), {
1079
+ json: {
1080
+ name: options.name,
1081
+ description: options.description,
1082
+ tags: options.tags,
1083
+ },
1084
+ reason,
1085
+ });
1086
+ return {
1087
+ id: data.id,
1088
+ packId: data.pack_id,
1089
+ name: data.name,
1090
+ description: data.description,
1091
+ tags: data.tags,
1092
+ asset: data.asset,
1093
+ type: data.type,
1094
+ formatType: data.format_type,
1095
+ available: data.available,
1096
+ guildId: data.guild_id,
1097
+ user: data.user !== undefined ? new _1.User(data.user, this.client) : undefined,
1098
+ sortValue: data.sort_value,
1099
+ };
1100
+ }
1101
+ /* https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
1102
+ async deleteSticker(stickerId, reason) {
1103
+ this.client.rest.request("PUT", rest_1.Endpoints.guildSticker(this.id, stickerId), {
1104
+ reason,
1105
+ });
1106
+ }
1107
+ /* https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
1108
+ async getWebhooks() {
1109
+ return this.client.rest
1110
+ .request("GET", rest_1.Endpoints.guildWebhooks(this.id))
1111
+ .then((response) => response.map((data) => new _1.Webhook(data, this.client)));
1112
+ }
1113
+ toJSON() {
1114
+ return {
1115
+ id: this.id,
1116
+ name: this.name,
1117
+ icon: this.icon,
1118
+ iconHash: this.iconHash,
1119
+ splash: this.splash,
1120
+ discoverySplash: this.discoverySplash,
1121
+ owner: this.owner,
1122
+ ownerId: this.ownerId,
1123
+ permissions: this.permissions,
1124
+ region: this.region,
1125
+ afkChannelId: this.afkChannelId,
1126
+ afkTimeout: this.afkTimeout,
1127
+ widgetEnabled: this.widgetEnabled,
1128
+ widgetChannelId: this.widgetChannelId,
1129
+ verificationLevel: this.verificationLevel,
1130
+ defaultMessageNotifications: this.defaultMessageNotifications,
1131
+ explicitContentFilter: this.explicitContentFilter,
1132
+ roles: this.roles,
1133
+ emojis: this.emojis,
1134
+ features: this.features,
1135
+ mfaLevel: this.mfaLevel,
1136
+ applicationId: this.applicationId,
1137
+ systemChannelId: this.systemChannelId,
1138
+ systemChannelFlags: this.systemChannelFlags,
1139
+ rulesChannelId: this.rulesChannelId,
1140
+ maxPresences: this.maxPresences,
1141
+ maxMembers: this.maxMembers,
1142
+ vanityURLCode: this.vanityURLCode,
1143
+ description: this.description,
1144
+ banner: this.banner,
1145
+ premiumTier: this.premiumTier,
1146
+ premiumSubscriptionCount: this.premiumSubscriptionCount,
1147
+ preferredLocale: this.preferredLocale,
1148
+ publicUpdatesChannelId: this.publicUpdatesChannelId,
1149
+ maxVideoChannelUsers: this.maxVideoChannelUsers,
1150
+ approximateMemberCount: this.approximateMemberCount,
1151
+ approximatePresenceCount: this.approximatePresenceCount,
1152
+ welcomeScreen: this.welcomeScreen,
1153
+ nsfwLevel: this.nsfwLevel,
1154
+ stickers: this.stickers,
1155
+ premiumProgressBarEnabled: this.premiumProgressBarEnabled,
1156
+ safetyAlertsChannelId: this.safetyAlertsChannelId,
1157
+ };
1158
+ }
1159
+ }
1160
+ exports.Guild = Guild;
1161
+ //# sourceMappingURL=Guild.js.map