disgroove 2.0.0 → 2.1.0-dev.c430b6f

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