disgroove 1.3.1-dev.f29c081 → 1.3.2

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