disgroove 1.3.1-dev.6068992 → 1.3.1-dev.84d0e5a

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