disgroove 1.3.3-test.1 → 1.3.4-dev.7ed5475

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