disgroove 1.3.1-dev.8cd17af → 1.3.1-dev.99aa77b

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