oceanic.js 0.0.7 → 0.0.11-dev.40bf3a4

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 (129) hide show
  1. package/.github/workflows/build.yml +12 -0
  2. package/.github/workflows/dev-publish.yml +32 -0
  3. package/.github/workflows/lint.yml +13 -0
  4. package/.npm-deprecaterc.json +9 -0
  5. package/README.md +1 -1
  6. package/build.js +6 -0
  7. package/dist/lib/Client.d.ts +7 -4
  8. package/dist/lib/Client.js +45 -25
  9. package/dist/lib/Constants.d.ts +5 -2
  10. package/dist/lib/Constants.js +4 -1
  11. package/dist/lib/gateway/Shard.d.ts +4 -10
  12. package/dist/lib/gateway/Shard.js +402 -332
  13. package/dist/lib/gateway/ShardManager.d.ts +1 -4
  14. package/dist/lib/gateway/ShardManager.js +41 -38
  15. package/dist/lib/index.d.ts +1 -0
  16. package/dist/lib/index.js +5 -3
  17. package/dist/lib/rest/Bucket.d.ts +1 -1
  18. package/dist/lib/rest/Bucket.js +9 -8
  19. package/dist/lib/rest/DiscordHTTPError.d.ts +1 -1
  20. package/dist/lib/rest/DiscordHTTPError.js +4 -6
  21. package/dist/lib/rest/DiscordRESTError.d.ts +1 -1
  22. package/dist/lib/rest/DiscordRESTError.js +8 -10
  23. package/dist/lib/rest/RESTManager.d.ts +1 -2
  24. package/dist/lib/rest/RESTManager.js +16 -18
  25. package/dist/lib/rest/RequestHandler.d.ts +1 -1
  26. package/dist/lib/rest/RequestHandler.js +18 -20
  27. package/dist/lib/rest/SequentialBucket.d.ts +1 -1
  28. package/dist/lib/rest/SequentialBucket.js +9 -8
  29. package/dist/lib/routes/ApplicationCommands.d.ts +4 -2
  30. package/dist/lib/routes/ApplicationCommands.js +37 -34
  31. package/dist/lib/routes/Channels.d.ts +7 -4
  32. package/dist/lib/routes/Channels.js +83 -77
  33. package/dist/lib/routes/Guilds.d.ts +4 -2
  34. package/dist/lib/routes/Guilds.js +137 -134
  35. package/dist/lib/routes/Interactions.d.ts +4 -2
  36. package/dist/lib/routes/Interactions.js +19 -18
  37. package/dist/lib/routes/OAuth.d.ts +4 -2
  38. package/dist/lib/routes/OAuth.js +24 -21
  39. package/dist/lib/routes/Users.d.ts +4 -2
  40. package/dist/lib/routes/Users.js +14 -11
  41. package/dist/lib/routes/Webhooks.d.ts +4 -2
  42. package/dist/lib/routes/Webhooks.js +38 -35
  43. package/dist/lib/structures/AnnouncementChannel.d.ts +6 -2
  44. package/dist/lib/structures/AnnouncementChannel.js +9 -3
  45. package/dist/lib/structures/AnnouncementThreadChannel.js +2 -2
  46. package/dist/lib/structures/Application.js +15 -5
  47. package/dist/lib/structures/ApplicationCommand.js +8 -8
  48. package/dist/lib/structures/AutoModerationRule.d.ts +4 -3
  49. package/dist/lib/structures/AutoModerationRule.js +29 -11
  50. package/dist/lib/structures/AutocompleteInteraction.d.ts +0 -5
  51. package/dist/lib/structures/AutocompleteInteraction.js +6 -16
  52. package/dist/lib/structures/Base.d.ts +1 -1
  53. package/dist/lib/structures/Base.js +3 -3
  54. package/dist/lib/structures/CategoryChannel.d.ts +7 -0
  55. package/dist/lib/structures/CategoryChannel.js +44 -6
  56. package/dist/lib/structures/Channel.js +4 -2
  57. package/dist/lib/structures/ClientApplication.js +18 -17
  58. package/dist/lib/structures/CommandInteraction.js +25 -25
  59. package/dist/lib/structures/ComponentInteraction.js +18 -18
  60. package/dist/lib/structures/ExtendedUser.js +4 -2
  61. package/dist/lib/structures/ForumChannel.d.ts +86 -0
  62. package/dist/lib/structures/ForumChannel.js +194 -0
  63. package/dist/lib/structures/GroupChannel.d.ts +1 -1
  64. package/dist/lib/structures/GroupChannel.js +29 -23
  65. package/dist/lib/structures/Guild.d.ts +3 -2
  66. package/dist/lib/structures/Guild.js +131 -82
  67. package/dist/lib/structures/GuildChannel.d.ts +3 -2
  68. package/dist/lib/structures/GuildChannel.js +9 -5
  69. package/dist/lib/structures/GuildPreview.js +12 -2
  70. package/dist/lib/structures/GuildScheduledEvent.d.ts +2 -2
  71. package/dist/lib/structures/GuildScheduledEvent.js +18 -8
  72. package/dist/lib/structures/GuildTemplate.d.ts +4 -3
  73. package/dist/lib/structures/GuildTemplate.js +22 -10
  74. package/dist/lib/structures/Integration.d.ts +5 -5
  75. package/dist/lib/structures/Integration.js +12 -3
  76. package/dist/lib/structures/Interaction.d.ts +2 -1
  77. package/dist/lib/structures/Interaction.js +4 -4
  78. package/dist/lib/structures/Invite.d.ts +1 -1
  79. package/dist/lib/structures/Invite.js +11 -11
  80. package/dist/lib/structures/Member.d.ts +1 -1
  81. package/dist/lib/structures/Member.js +28 -16
  82. package/dist/lib/structures/Message.d.ts +6 -6
  83. package/dist/lib/structures/Message.js +43 -29
  84. package/dist/lib/structures/ModalSubmitInteraction.js +17 -17
  85. package/dist/lib/structures/PartialApplication.js +5 -2
  86. package/dist/lib/structures/PingInteraction.js +2 -2
  87. package/dist/lib/structures/PrivateChannel.js +15 -15
  88. package/dist/lib/structures/PrivateThreadChannel.js +2 -2
  89. package/dist/lib/structures/PublicThreadChannel.js +2 -2
  90. package/dist/lib/structures/Role.js +13 -4
  91. package/dist/lib/structures/StageChannel.js +11 -7
  92. package/dist/lib/structures/StageInstance.js +6 -3
  93. package/dist/lib/structures/Team.js +6 -3
  94. package/dist/lib/structures/TextChannel.d.ts +6 -1
  95. package/dist/lib/structures/TextChannel.js +9 -3
  96. package/dist/lib/structures/TextableChannel.d.ts +1 -3
  97. package/dist/lib/structures/TextableChannel.js +33 -32
  98. package/dist/lib/structures/ThreadChannel.d.ts +6 -0
  99. package/dist/lib/structures/ThreadChannel.js +49 -26
  100. package/dist/lib/structures/User.js +8 -4
  101. package/dist/lib/structures/VoiceChannel.js +32 -24
  102. package/dist/lib/structures/VoiceState.d.ts +7 -3
  103. package/dist/lib/structures/VoiceState.js +24 -11
  104. package/dist/lib/structures/Webhook.js +17 -18
  105. package/dist/lib/types/channels.d.ts +151 -53
  106. package/dist/lib/types/client.d.ts +25 -3
  107. package/dist/lib/types/guilds.d.ts +15 -5
  108. package/dist/lib/types/interactions.d.ts +27 -3
  109. package/dist/lib/types/json.d.ts +26 -9
  110. package/dist/lib/util/Collection.d.ts +3 -3
  111. package/dist/lib/util/Collection.js +18 -10
  112. package/dist/lib/util/InteractionOptionsWrapper.d.ts +2 -1
  113. package/dist/lib/util/InteractionOptionsWrapper.js +15 -9
  114. package/dist/lib/util/Properties.d.ts +1 -1
  115. package/dist/lib/util/Properties.js +5 -5
  116. package/dist/lib/util/Routes.d.ts +1 -1
  117. package/dist/lib/util/Util.d.ts +5 -2
  118. package/dist/lib/util/Util.js +126 -8
  119. package/dist/lib/voice/VoiceConnectionManager.d.ts +1 -1
  120. package/dist/lib/voice/VoiceConnectionManager.js +3 -7
  121. package/dist/package.json +15 -15
  122. package/esm.mjs +5 -3
  123. package/package.json +15 -15
  124. package/dist/lib/routes/BaseRoute.d.ts +0 -6
  125. package/dist/lib/routes/BaseRoute.js +0 -16
  126. package/dist/lib/util/Debug.d.ts +0 -1
  127. package/dist/lib/util/Debug.js +0 -13
  128. package/favicon.ico +0 -0
  129. package/typedoc.json +0 -26
@@ -31,11 +31,18 @@ import type StageChannel from "../structures/StageChannel";
31
31
  import type TextChannel from "../structures/TextChannel";
32
32
  import type User from "../structures/User";
33
33
  import type VoiceChannel from "../structures/VoiceChannel";
34
+ import type ForumChannel from "../structures/ForumChannel";
34
35
 
35
36
  export interface RawChannel {
36
37
  application_id?: string;
38
+ available_tags?: Array<RawForumTag>;
37
39
  bitrate?: number;
38
40
  default_auto_archive_duration?: ThreadAutoArchiveDuration;
41
+ default_reaction_emoji?: {
42
+ emoji_id: string | null;
43
+ emoji_name: string;
44
+ } | null;
45
+ default_thread_rate_limit_per_user?: number;
39
46
  flags?: number;
40
47
  guild_id?: string;
41
48
  icon?: string | null;
@@ -56,6 +63,7 @@ export interface RawChannel {
56
63
  rate_limit_per_user?: number;
57
64
  recipients?: Array<RawUser>;
58
65
  rtc_region?: string | null;
66
+ template?: string;
59
67
  thread_metadata?: RawThreadMetadata;
60
68
  topic?: string | null;
61
69
  total_message_sent?: number;
@@ -66,16 +74,17 @@ export interface RawChannel {
66
74
  export type RawGuildChannel = Required<Pick<RawChannel, "id" | "guild_id" | "parent_id">> & { name: string; type: GuildChannelTypes; };
67
75
  export type RawPrivateChannel = Required<Pick<RawChannel, "id" | "last_message_id" | "recipients">> & { type: ChannelTypes.DM; };
68
76
  // managed and nicks are undocumented, creating a group dm DOES work, and they show in the client, so we're supporting them
69
- export type RawGroupChannel = Required<Pick<RawChannel, "id" | "recipients" | "application_id" | "icon" | "owner_id" | "nsfw" | "last_message_id">> & { managed: boolean; name: string; nicks?: Record<"id" | "nick", string>; type: ChannelTypes.GROUP_DM; };
77
+ export type RawGroupChannel = Required<Pick<RawChannel, "id" | "recipients" | "application_id" | "icon" | "owner_id" | "nsfw" | "last_message_id">> & { managed: boolean; name: string; nicks?: Array<Record<"id" | "nick", string>>; type: ChannelTypes.GROUP_DM; };
70
78
  export type RawTextChannel = Omit<RawGuildChannel, "type"> & Required<Pick<RawChannel, "default_auto_archive_duration" | "last_message_id" | "last_pin_timestamp" | "rate_limit_per_user" | "topic" | "nsfw" | "permission_overwrites" | "position">> & { type: ChannelTypes.GUILD_TEXT; };
71
79
  export type RawCategoryChannel = Omit<RawGuildChannel, "type"> & Required<Pick<RawChannel, "permission_overwrites" | "position">> & { type: ChannelTypes.GUILD_CATEGORY; };
72
80
  export type RawAnnouncementChannel = Omit<RawTextChannel, "type"> & { type: ChannelTypes.GUILD_ANNOUNCEMENT; };
73
- export type RawVoiceChannel = Omit<RawGuildChannel, "type"> & Required<Pick<RawChannel, "bitrate" | "user_limit" | "video_quality_mode" | "rtc_region" | "nsfw" | "topic" | "permission_overwrites" | "position">> & { type: ChannelTypes.GUILD_VOICE; };
81
+ export type RawVoiceChannel = Omit<RawGuildChannel, "type"> & Required<Pick<RawChannel, "bitrate" | "user_limit" | "video_quality_mode" | "rtc_region" | "nsfw" | "topic" | "permission_overwrites" | "position" | "last_message_id">> & { type: ChannelTypes.GUILD_VOICE; };
74
82
  export type RawStageChannel = Omit<RawGuildChannel, "type"> & Required<Pick<RawChannel, "bitrate" | "rtc_region" | "topic" | "permission_overwrites" | "position">> & { type: ChannelTypes.GUILD_STAGE_VOICE; };
75
83
  export type RawThreadChannel = RawAnnouncementThreadChannel | RawPublicThreadChannel | RawPrivateThreadChannel;
76
84
  export type RawAnnouncementThreadChannel = Required<Pick<RawChannel, "id" | "guild_id" | "parent_id" | "owner_id" | "last_message_id" | "thread_metadata" | "message_count" | "member_count" | "rate_limit_per_user" | "flags" | "total_message_sent" | "newly_created" | "member">> & { name: string; type: ChannelTypes.ANNOUNCEMENT_THREAD; };
77
85
  export type RawPublicThreadChannel = Omit<RawAnnouncementThreadChannel, "type"> & { type: ChannelTypes.PUBLIC_THREAD; };
78
86
  export type RawPrivateThreadChannel = Omit<RawAnnouncementThreadChannel, "type"> & { member: RawChannel["member"]; type: ChannelTypes.PRIVATE_THREAD; };
87
+ export type RawForumChannel = Omit<RawGuildChannel, "type"> & Required<Pick<RawChannel, "position" | "topic" | "flags" | "permission_overwrites" | "rate_limit_per_user" | "nsfw" | "available_tags" | "template" | "default_reaction_emoji" | "last_message_id" | "default_thread_rate_limit_per_user" | "default_auto_archive_duration">> & { type: ChannelTypes.GUILD_FORUM; };
79
88
 
80
89
  export type PartialChannel = Pick<RawChannel, "id" | "name" | "type">;
81
90
 
@@ -143,11 +152,17 @@ export interface EditGuildChannelOptions {
143
152
  archived?: boolean;
144
153
  /** [Thread] The duration after which the thread will be archived. */
145
154
  autoArchiveDuration?: ThreadAutoArchiveDuration;
146
- /** [Voice, Stage] The bitrate of the channel. Minimum 8000. */
155
+ /** [Forum] The {@link types/channels.ForumTag | tags} available in the channel. */
156
+ availableTags?: Array<ForumTag>;
157
+ /** [Stage, Voice] The bitrate of the channel. Minimum 8000. */
147
158
  bitrate?: number | null;
148
- /** [Text, Announcement] The default auto archive duration for threads made in this channel. */
159
+ /** [Announcement, Text] The default auto archive duration for threads made in this channel. */
149
160
  defaultAutoArchiveDuration?: ThreadAutoArchiveDuration | null;
150
- /** [Thread] The [channel flags](https://discord.com/developers/docs/resources/channel#channel-object-channel-flags) to set on the channel. */
161
+ /** [Forum] The default auto archive duration for threads. */
162
+ defaultReactionEmoji?: ForumEmoji | null;
163
+ /** [Forum] The default reaction emoji for threads. */
164
+ defaultThreadRateLimitPerUser?: number;
165
+ /** [Forum, Thread] The {@link Constants.ChannelFlags | Channel Flags} to set on the channel. */
151
166
  flags?: number;
152
167
  /** [Private Thread] If non-moderators can add other non-moderators to the thread. */
153
168
  invitable?: boolean;
@@ -155,23 +170,25 @@ export interface EditGuildChannelOptions {
155
170
  locked?: boolean;
156
171
  /** The name of the channel. */
157
172
  name?: string;
158
- /** [Text, Voice, Announcement] If the channel is age gated. */
173
+ /** [Announcement, Text, Voice] If the channel is age gated. */
159
174
  nsfw?: string | null;
160
- /** [Text, Voice, Announcement] The id of the parent category channel. */
175
+ /** [Announcement, Forum, Text, Voice] The id of the parent category channel. */
161
176
  parentID?: string | null;
162
177
  /** Channel or category specific permissions. */
163
178
  permissionOverwrites?: Array<RawOverwrite> | null;
164
179
  /** The position of the channel in the channel list. */
165
180
  position?: number | null;
166
- /** [Thread, Text] The seconds between sending messages for users. Between 0 and 21600. */
181
+ /** [Forum, Text, Thread] The seconds between sending messages for users. Between 0 and 21600. */
167
182
  rateLimitPerUser?: number | null;
168
183
  /** The reason to be displayed in the audit log. */
169
184
  reason?: string;
170
- /** [Voice, Stage] The voice region id of the channel, null for automatic. */
185
+ /** [Stage, Voice] The voice region id of the channel, null for automatic. */
171
186
  rtcRegion?: string | null;
172
- /** [Text, Announcement] The topic of the channel. */
187
+ /** [Forum] Undocumented property. */
188
+ template?: string;
189
+ /** [Announcement, Forum, Text, Voice] The topic of the channel. In forum channels, this is the `Guidelines` section. */
173
190
  topic?: string | null;
174
- /** [Text, Announcement] Provide the opposite type to convert the channel. */
191
+ /** [Announcement, Text] Provide the opposite type to convert the channel. */
175
192
  type?: ChannelTypes.GUILD_TEXT | ChannelTypes.GUILD_ANNOUNCEMENT;
176
193
  /** [Voice] The maximum amount of users in the channel. `0` is unlimited, values range 1-99. */
177
194
  userLimit?: number | null;
@@ -188,6 +205,7 @@ export type EditStageChannelOptions = EditAnyGuildChannelOptions & Pick<EditGuil
188
205
  export type EditThreadChannelOptions = EditPublicThreadChannelOptions | EditPrivateThreadChannelOptions;
189
206
  export type EditPublicThreadChannelOptions = Pick<EditGuildChannelOptions, "name" | "archived" | "autoArchiveDuration" | "locked" | "rateLimitPerUser" | "flags">;
190
207
  export type EditPrivateThreadChannelOptions = EditPublicThreadChannelOptions & Pick<EditGuildChannelOptions, "invitable">;
208
+ export type EditForumChannelOptions = EditAnyGuildChannelOptions & Pick<EditGuildChannelOptions, "availableTags" | "defaultReactionEmoji" | "defaultThreadRateLimitPerUser" | "flags" | "nsfw" | "rateLimitPerUser" | "template" | "topic">;
191
209
 
192
210
  export interface AddGroupRecipientOptions {
193
211
  /** The access token of the user to add. */
@@ -207,7 +225,7 @@ export interface CreateMessageOptions {
207
225
  components?: Array<MessageActionRow>;
208
226
  /** The content of the message. */
209
227
  content?: string;
210
- /** An array of [embeds](https://discord.com/developers/docs/resources/channel#embed-object) to send. */
228
+ /** An array of [embeds](https://discord.com/developers/docs/resources/channel#embed-object) to send. Convert `snake_case` keys to `camelCase`. */
211
229
  embeds?: Array<EmbedOptions>;
212
230
  /** The files to send. */
213
231
  files?: Array<File>;
@@ -221,87 +239,141 @@ export interface CreateMessageOptions {
221
239
  tts?: boolean;
222
240
  }
223
241
 
224
- export interface EmbedOptions {
225
- author?: EmbedAuthorOptions;
242
+ export interface EmbedOptionsBase {
226
243
  color?: number;
227
244
  description?: string;
228
- fields?: Array<EmbedField>;
229
- footer?: EmbedFooterOptions;
230
- image?: EmbedImageOptions;
231
- thumbnail?: EmbedThumbnailOptions;
232
245
  timestamp?: string;
233
246
  title?: string;
234
247
  url?: string;
235
248
  }
236
- export interface Embed {
249
+
250
+ export interface RawEmbedOptions extends EmbedOptionsBase {
251
+ author?: RawEmbedAuthorOptions;
252
+ fields?: Array<EmbedField>;
253
+ footer?: RawEmbedFooterOptions;
254
+ image?: EmbedImageOptions;
255
+ thumbnail?: EmbedImageOptions;
256
+ }
257
+
258
+ export interface EmbedOptions extends EmbedOptionsBase {
259
+ author?: EmbedAuthorOptions;
260
+ fields?: Array<EmbedField>;
261
+ footer?: EmbedFooterOptions;
262
+ image?: EmbedImageOptions;
263
+ thumbnail?: EmbedImageOptions;
264
+ }
265
+
266
+ export interface EmbedBase extends EmbedOptionsBase {
267
+ type?: EmbedType;
268
+ }
269
+
270
+ export interface RawEmbed extends EmbedBase {
271
+ author?: RawEmbedAuthor;
272
+ fields?: Array<EmbedField>;
273
+ footer?: RawEmbedFooter;
274
+ image?: RawEmbedImage;
275
+ provider?: EmbedProvider;
276
+ thumbnail?: RawEmbedImage;
277
+ video?: RawEmbedVideo;
278
+ }
279
+
280
+ export interface Embed extends EmbedBase {
237
281
  author?: EmbedAuthor;
238
- color?: number;
239
- description?: string;
240
282
  fields?: Array<EmbedField>;
241
283
  footer?: EmbedFooter;
242
284
  image?: EmbedImage;
243
285
  provider?: EmbedProvider;
244
- thumbnail?: EmbedThumbnail;
245
- timestamp?: string;
246
- title?: string;
247
- type?: EmbedType;
248
- url?: string;
286
+ thumbnail?: EmbedImage;
249
287
  video?: EmbedVideo;
250
288
  }
289
+
251
290
  export type EmbedType = "rich" | "image" | "video" | "gifv" | "article" | "link";
252
291
 
253
- export interface EmbedFooterOptions {
292
+ export interface EmbedAuthorBase {
293
+ name: string;
294
+ url?: string;
295
+ }
296
+
297
+ export interface RawEmbedAuthor extends EmbedAuthorBase {
254
298
  icon_url?: string;
255
- text: string;
299
+ proxy_icon_url?: string;
256
300
  }
257
- export interface EmbedImageOptions {
258
- url: string;
301
+
302
+ export interface EmbedAuthorOptions extends EmbedAuthorBase {
303
+ iconURL?: string;
259
304
  }
260
305
 
261
- export interface EmbedThumbnailOptions {
262
- url: string;
306
+ export interface RawEmbedAuthorOptions extends EmbedAuthorBase {
307
+ icon_url?: string;
308
+ }
309
+
310
+ export interface EmbedAuthor extends EmbedAuthorOptions {
311
+ iconURL?: string;
312
+ proxyIconURL?: string;
313
+ }
314
+ export interface EmbedFooterBase {
315
+ text: string;
316
+ }
317
+
318
+ export interface EmbedFooterOptions extends EmbedFooterBase {
319
+ iconURL?: string;
263
320
  }
264
321
 
265
- export interface EmbedAuthorOptions {
322
+ export interface RawEmbedFooterOptions extends EmbedFooterBase {
266
323
  icon_url?: string;
267
- name: string;
268
- url?: string;
269
324
  }
270
325
 
271
- export interface EmbedField {
272
- inline?: boolean;
273
- name: string;
274
- value: string;
326
+ export interface RawEmbedFooter extends EmbedFooterBase {
327
+ icon_url?: string;
328
+ proxy_icon_url?: string;
275
329
  }
330
+
276
331
  export interface EmbedFooter extends EmbedFooterOptions {
277
- proxy_icon_url?: string;
332
+ iconURL?: string;
333
+ proxyIconURL?: string;
278
334
  }
279
- export interface EmbedImage extends EmbedImageOptions {
335
+
336
+ export interface EmbedImageBase {
280
337
  height?: number;
281
- proxy_url?: string;
282
338
  width?: number;
283
339
  }
284
340
 
285
- export interface EmbedThumbnail extends EmbedThumbnailOptions {
286
- height?: number;
341
+ export interface RawEmbedImage extends EmbedImageBase, EmbedImageOptions {
287
342
  proxy_url?: string;
288
- width?: number;
289
343
  }
290
344
 
291
- export interface EmbedVideo {
345
+ export interface EmbedImageOptions {
346
+ url: string;
347
+ }
348
+
349
+ export interface EmbedImage extends EmbedImageBase, EmbedImageOptions {
350
+ proxyURL?: string;
351
+ }
352
+
353
+ export interface EmbedField {
354
+ inline?: boolean;
355
+ name: string;
356
+ value: string;
357
+ }
358
+
359
+ export interface EmbedVideoBase {
292
360
  height?: number;
293
- proxy_url?: string;
294
361
  url?: string;
295
362
  width?: number;
296
363
  }
297
364
 
365
+ export interface RawEmbedVideo extends EmbedVideoBase {
366
+ proxy_url?: string;
367
+ }
368
+
369
+ export interface EmbedVideo extends EmbedVideoBase {
370
+ proxyURL?: string;
371
+ }
372
+
298
373
  export interface EmbedProvider {
299
374
  name?: string;
300
375
  url?: string;
301
376
  }
302
- export interface EmbedAuthor extends EmbedAuthorOptions {
303
- proxy_icon_url?: string;
304
- }
305
377
 
306
378
  export interface AllowedMentions {
307
379
  /** If `@everyone`/`@here` mentions should be allowed. */
@@ -466,7 +538,7 @@ export interface RawMessage {
466
538
  components?: Array<RawMessageActionRow>;
467
539
  content: string;
468
540
  edited_timestamp: string | null;
469
- embeds: Array<Embed>;
541
+ embeds: Array<RawEmbed>;
470
542
  flags?: number;
471
543
  guild_id?: string;
472
544
  id: string;
@@ -484,7 +556,7 @@ export interface RawMessage {
484
556
  referenced_message?: RawMessage | null;
485
557
  // stickers exists, but is deprecated
486
558
  sticker_items?: Array<StickerItem>;
487
- thread?: RawChannel;
559
+ thread?: RawAnnouncementThreadChannel | RawPublicThreadChannel | RawPrivateThreadChannel;
488
560
  timestamp: string;
489
561
  tts: boolean;
490
562
  type: MessageTypes;
@@ -547,7 +619,7 @@ export interface StickerItem {
547
619
 
548
620
 
549
621
  // @TODO directory & forum
550
- export type AnyChannel = TextChannel | PrivateChannel | VoiceChannel | GroupChannel | CategoryChannel | AnnouncementChannel | AnnouncementThreadChannel | PublicThreadChannel | PrivateThreadChannel | StageChannel;
622
+ export type AnyChannel = TextChannel | PrivateChannel | VoiceChannel | GroupChannel | CategoryChannel | AnnouncementChannel | AnnouncementThreadChannel | PublicThreadChannel | PrivateThreadChannel | StageChannel | ForumChannel;
551
623
  export type AnyPrivateChannel = PrivateChannel | GroupChannel;
552
624
  export type AnyGuildChannel = Exclude<AnyChannel, AnyPrivateChannel>;
553
625
  export type AnyGuildChannelWithoutThreads = Exclude<AnyGuildChannel, AnyThreadChannel>;
@@ -757,3 +829,29 @@ export interface ThreadMetadata {
757
829
  export interface PrivateThreadmetadata extends ThreadMetadata {
758
830
  invitable: boolean;
759
831
  }
832
+
833
+ export interface RawForumTag {
834
+ emoji_id: string | null;
835
+ emoji_name: string | null;
836
+ id: string;
837
+ moderated: boolean;
838
+ name: string;
839
+ }
840
+
841
+ export interface ForumTag {
842
+ /** The emoji for this tag. */
843
+ emoji: ForumEmoji | null;
844
+ /** The ID of this tag. */
845
+ id: string;
846
+ /** If this tag can only be used by moderators. */
847
+ moderated: boolean;
848
+ /** The name of this tag. */
849
+ name: string;
850
+ }
851
+
852
+ export interface ForumEmoji {
853
+ /** The ID of this emoji if custom, null otherwise. */
854
+ id: string | null;
855
+ /** The unicode codepoint of this emoji if default, null otherwise. */
856
+ name: string | null;
857
+ }
@@ -33,7 +33,7 @@ import type {
33
33
  } from "./json";
34
34
  import type { GuildApplicationCommandPermissions } from "./application-commands";
35
35
  import type { GuildEmoji, PartialEmoji, Sticker } from "./guilds";
36
- import type { AnyGatewayInteraction } from "./interactions";
36
+ import type { AnyInteractionGateway } from "./interactions";
37
37
  import type { ImageFormat } from "../Constants";
38
38
  import type Guild from "../structures/Guild";
39
39
  import type UnavailableGuild from "../structures/UnavailableGuild";
@@ -65,6 +65,8 @@ export interface ClientOptions {
65
65
  allowedMentions?: AllowedMentions;
66
66
  /** Fully qualified authorization string (e.x. Bot [TOKEN]) - you MUST prefix it yourself */
67
67
  auth?: string | null;
68
+ /** The maximum number of items that can be present in various collections. */
69
+ collectionLimits?: CollectionLimitsOptions;
68
70
  /**
69
71
  * The default image format to use.
70
72
  * @defaultValue png
@@ -80,7 +82,7 @@ export interface ClientOptions {
80
82
  /** The options for the request handler. */
81
83
  rest?: RESTOptions;
82
84
  }
83
- type ClientInstanceOptions = Required<Omit<ClientOptions, "rest" | "gateway">>;
85
+ type ClientInstanceOptions = Required<Omit<ClientOptions, "rest" | "gateway" | "collectionLimits">> & { collectionLimits: Required<CollectionLimitsOptions>; };
84
86
 
85
87
  export interface RESTOptions {
86
88
  /**
@@ -125,6 +127,26 @@ export interface RESTOptions {
125
127
  userAgent?: string;
126
128
  }
127
129
 
130
+ export interface CollectionLimitsOptions {
131
+ /**
132
+ * The maximum number of members to cache. A number to apply to all guilds individually, or a dictionary of guild IDs to member limits. Any not present will be `Infinity`.
133
+ *
134
+ * Note: If you request members from the gateway, this will be increased (on the specific guild) as meeded to accomidate those members.
135
+ * @defaultValue 1000
136
+ */
137
+ members?: number | Record<string, number>;
138
+ /**
139
+ * The maximum number of messages to cache.
140
+ * @defaultValue 100
141
+ */
142
+ messages?: number;
143
+ /**
144
+ * The maximum number of users to cache globally.
145
+ * @defaultValue Infinity
146
+ */
147
+ users?: number;
148
+ }
149
+
128
150
  // @TODO document events
129
151
  export interface ClientEvents {
130
152
  /** @event Emitted when an application command's permissions are updated. */
@@ -206,7 +228,7 @@ export interface ClientEvents {
206
228
  /** @event Emitted when an integration is updated. Requires the `GUILD_INTEGRATIONS` intent. */
207
229
  integrationUpdate: [guild: Guild, integration: Integration, oldIntegration: JSONIntegration | null];
208
230
  /** @event Emitted when an interaction is created. */
209
- interactionCreate: [interaction: AnyGatewayInteraction];
231
+ interactionCreate: [interaction: AnyInteractionGateway];
210
232
  /** @event Emitted when an invite is created. Requires the `GUILD_INVITES` intent. */
211
233
  inviteCreate: [guild: Guild | null, channel: InviteChannel, invite: Invite];
212
234
  /** @event Emitted when an invite is deleted. Requires the `GUILD_INVITES` intent. */
@@ -1,6 +1,8 @@
1
1
  import type { RawUser } from "./users";
2
2
  import type {
3
3
  AnyThreadChannel,
4
+ ForumEmoji,
5
+ ForumTag,
4
6
  OverwriteOptions,
5
7
  RawChannel,
6
8
  RawGuildChannel,
@@ -325,11 +327,19 @@ export interface EditGuildOptions {
325
327
  }
326
328
 
327
329
  export interface CreateChannelOptions<T extends GuildChannelTypesWithoutThreads = GuildChannelTypesWithoutThreads> {
328
- /** [Text, Announcement] The default auto archive duration for the channel. */
330
+ /** [Forum] The {@link types/channels.ForumTag | tags} available in the channel. */
331
+ availableTags?: Array<ForumTag>;
332
+ /** [Stage, Voice] The bitrate of the channel. Minimum 8000. */
333
+ bitrate?: number | null;
334
+ /** [Announcement, Text] The default auto archive duration for the channel. */
329
335
  defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
336
+ /** [Forum] The default auto archive duration for threads. */
337
+ defaultReactionEmoji?: ForumEmoji | null;
338
+ /** [Forum] The default reaction emoji for threads. */
339
+ defaultThreadRateLimitPerUser?: number;
330
340
  /** The name of the channel. */
331
341
  name: string;
332
- /** [Text, Voice, Announcement] If the channel is age restricted. */
342
+ /** [Announcement, Text, Voice] If the channel is age restricted. */
333
343
  nsfw?: boolean;
334
344
  /** The ID of the category to put this channel in. */
335
345
  parentID?: string;
@@ -337,13 +347,13 @@ export interface CreateChannelOptions<T extends GuildChannelTypesWithoutThreads
337
347
  permissionOverwrites?: Array<OverwriteOptions>;
338
348
  /** The position of the channel. */
339
349
  position?: number;
340
- /** [Text] The seconds between sending messages for users. Between 0 and 21600. */
350
+ /** [Forum, Text] The seconds between sending messages for users. Between 0 and 21600. */
341
351
  rateLimitPerUser?: number;
342
352
  /** The reason for creating the channel. */
343
353
  reason?: string;
344
- /** [Voice] The voice region for the channel. */
354
+ /** [Stage, Voice] The voice region for the channel. */
345
355
  rtcRegion?: string;
346
- /** [Text, Voice, Announcement] The topic of the channel. */
356
+ /** [Announcement, Forum, Text, Voice] The topic of the channel. In forum channels, this is the `Guidelines` section. */
347
357
  topic?: string;
348
358
  /** The [type](https://discord.com/developers/docs/resources/channel#channel-object-channel-types) of channel to create. */
349
359
  type: T;
@@ -5,7 +5,8 @@ import type {
5
5
  RawAttachment,
6
6
  RawChannel,
7
7
  RawMessage,
8
- ModalActionRow
8
+ ModalActionRow,
9
+ AnyGuildTextChannel
9
10
  } from "./channels";
10
11
  import type { InteractionMember, RawMember, RawRole } from "./guilds";
11
12
  import type { RawUser } from "./users";
@@ -29,6 +30,8 @@ import type ComponentInteraction from "../structures/ComponentInteraction";
29
30
  import type AutocompleteInteraction from "../structures/AutocompleteInteraction";
30
31
  import type ModalSubmitInteraction from "../structures/ModalSubmitInteraction";
31
32
  import type InteractionOptionsWrapper from "../util/InteractionOptionsWrapper";
33
+ import type PrivateChannel from "../structures/PrivateChannel";
34
+ import type Guild from "../structures/Guild";
32
35
 
33
36
  export type InteractionContent = Pick<ExecuteWebhookOptions, "tts" | "content" | "embeds" | "allowedMentions" | "flags" | "components" | "attachments" | "files">;
34
37
 
@@ -213,8 +216,8 @@ export type InteractionOptionsMentionable = InteractionOptionsStringValue<Applic
213
216
  export type InteractionOptionsNumber = InteractionOptionsNumberValue<ApplicationCommandOptionTypes.NUMBER>;
214
217
  export type InteractionOptionsAttachment = InteractionOptionsStringValue<ApplicationCommandOptionTypes.ATTACHMENT>;
215
218
 
216
- export type AnyInteraction = PingInteraction | AnyGatewayInteraction;
217
- export type AnyGatewayInteraction = CommandInteraction | ComponentInteraction | AutocompleteInteraction | ModalSubmitInteraction;
219
+ export type AnyInteraction = PingInteraction | AnyInteractionGateway;
220
+ export type AnyInteractionGateway = AutocompleteInteraction | CommandInteraction | ComponentInteraction | ModalSubmitInteraction;
218
221
 
219
222
 
220
223
  export interface AutocompleteChoice {
@@ -225,3 +228,24 @@ export interface AutocompleteChoice {
225
228
  /** The value of the choice. */
226
229
  value: string;
227
230
  }
231
+
232
+
233
+ export type GuildAutocompleteInteraction = Omit<AutocompleteInteraction, "guild" | "guildID" | "channel" | "member"> & { channel: AnyGuildTextChannel; guild: Guild; guildID: string; member: Member; };
234
+ export type PrivateAutocompleteInteraction = Omit<AutocompleteInteraction, "guild" | "guildID" | "channel" | "member"> & { channel: PrivateChannel | undefined; };
235
+ export type AnyAutocompleteInteraction = GuildAutocompleteInteraction | PrivateAutocompleteInteraction;
236
+
237
+ export type GuildCommandInteraction = Omit<CommandInteraction, "guild" | "guildID" | "channel" | "member"> & { channel: AnyGuildTextChannel; guild: Guild; guildID: string; member: Member; };
238
+ export type PrivateCommandInteraction = Omit<CommandInteraction, "guild" | "guildID" | "channel" | "member"> & { channel: PrivateChannel | undefined; };
239
+ export type AnyCommandInteraction = GuildCommandInteraction | PrivateCommandInteraction;
240
+
241
+ export type GuildComponentButtonInteraction = Omit<ComponentInteraction, "guild" | "guildID" | "channel" | "member" | "data"> & { channel: AnyGuildTextChannel; data: MessageComponentButtonInteractionData; guild: Guild; guildID: string; member: Member; };
242
+ export type GuildComponentSelectMenuInteraction = Omit<ComponentInteraction, "guild" | "guildID" | "channel" | "member" | "data"> & { channel: AnyGuildTextChannel; data: MessageComponentSelectMenuInteractionData; guild: Guild; guildID: string; member: Member; };
243
+ export type GuildComponentInteraction = GuildComponentButtonInteraction | GuildComponentSelectMenuInteraction;
244
+ export type PrivateComponentButtonInteraction = Omit<ComponentInteraction, "guild" | "guildID" | "channel" | "member" | "data"> & { channel: PrivateChannel | undefined; data: MessageComponentButtonInteractionData; };
245
+ export type PrivateComponentSelectMenuInteraction = Omit<ComponentInteraction, "guild" | "guildID" | "channel" | "member" | "data"> & { channel: PrivateChannel | undefined; data: MessageComponentSelectMenuInteractionData; };
246
+ export type PrivateComponentInteraction = PrivateComponentButtonInteraction | PrivateComponentSelectMenuInteraction;
247
+ export type AnyComponentInteraction = GuildComponentInteraction | PrivateComponentInteraction;
248
+
249
+ export type GuildModalSubmitInteraction = Omit<ModalSubmitInteraction, "guild" | "guildID" | "channel" | "member"> & { channel: AnyGuildTextChannel; guild: Guild; guildID: string; member: Member; };
250
+ export type PrivateModalSubmitInteraction = Omit<ModalSubmitInteraction, "guild" | "guildID" | "channel" | "member"> & { channel: PrivateChannel | undefined; };
251
+ export type AnyModalSubmitInteraction = GuildModalSubmitInteraction | PrivateModalSubmitInteraction;
@@ -19,7 +19,6 @@ import type {
19
19
  } from "./guilds";
20
20
  import type {
21
21
  ChannelMention,
22
- Embed,
23
22
  MessageActivity,
24
23
  MessageReference,
25
24
  RawChannel,
@@ -27,7 +26,10 @@ import type {
27
26
  MessageReaction,
28
27
  ThreadMetadata,
29
28
  PrivateThreadmetadata,
30
- MessageActionRow
29
+ ForumTag,
30
+ ForumEmoji,
31
+ MessageActionRow,
32
+ Embed
31
33
  } from "./channels";
32
34
  import type { ScheduledEventEntityMetadata } from "./scheduled-events";
33
35
  import type { Presence } from "./gateway";
@@ -64,6 +66,7 @@ import type {
64
66
 
65
67
  export interface JSONAnnouncementChannel extends JSONTextableChannel {
66
68
  rateLimitPerUser: 0;
69
+ threads: Array<string>;
67
70
  type: ChannelTypes.GUILD_ANNOUNCEMENT;
68
71
  }
69
72
  export interface JSONAnnouncementThreadChannel extends JSONThreadChannel {
@@ -127,7 +130,7 @@ export interface JSONAutocompleteInteraction extends JSONInteraction {
127
130
  }
128
131
  export interface JSONAutoModerationRule extends JSONBase {
129
132
  actions: Array<AutoModerationAction>;
130
- creator: JSONUser | string;
133
+ creator: string;
131
134
  enabled: boolean;
132
135
  eventType: AutoModerationEventTypes;
133
136
  exemptChannels: Array<string>;
@@ -203,12 +206,26 @@ export interface JSONExtendedUser extends JSONUser {
203
206
  mfaEnabled: boolean;
204
207
  verified: boolean;
205
208
  }
209
+ export interface JSONForumChannel extends JSONGuildChannel {
210
+ availableTags: Array<ForumTag>;
211
+ defaultAutoArchiveDuration: ThreadAutoArchiveDuration;
212
+ defaultReactionEmoji: ForumEmoji | null;
213
+ defaultThreadRateLimitPerUser: number;
214
+ flags: number;
215
+ lastThread: string | null;
216
+ permissionOverwrites: Array<JSONPermissionOverwrite>;
217
+ position: number;
218
+ rateLimitPerUser: number;
219
+ template: string;
220
+ threads: Array<string>;
221
+ topic: string | null;
222
+ }
206
223
  export interface JSONGroupChannel extends JSONChannel {
207
224
  application: string;
208
225
  icon: string | null;
209
226
  managed: boolean;
210
227
  name: string | null;
211
- nicks?: Record<"id" | "nick", string>;
228
+ nicks: Array<Record<"id" | "nick", string>>;
212
229
  owner: string | JSONUser;
213
230
  recipients: Array<JSONUser>;
214
231
  type: ChannelTypes.GROUP_DM;
@@ -229,7 +246,7 @@ export interface JSONGuild extends JSONBase {
229
246
  explicitContentFilter: ExplicitContentFilterLevels;
230
247
  features: Array<GuildFeature>;
231
248
  icon: string | null;
232
- joinedAt: number;
249
+ joinedAt: number | null;
233
250
  large: boolean;
234
251
  maxMembers?: number;
235
252
  maxPresences?: number;
@@ -390,7 +407,7 @@ export interface JSONMessage extends JSONBase {
390
407
  reactions: Record<string, MessageReaction>;
391
408
  referencedMessage?: JSONMessage | null;
392
409
  stickerItems?: Array<StickerItem>;
393
- thread?: JSONAnnouncementThreadChannel | JSONPublicThreadChannel;
410
+ thread?: JSONAnnouncementThreadChannel | JSONPublicThreadChannel | JSONPrivateThreadChannel;
394
411
  timestamp: number;
395
412
  tts: boolean;
396
413
  type: MessageTypes;
@@ -498,11 +515,11 @@ export interface JSONTextableChannel extends JSONGuildChannel {
498
515
  permissionOverwrites: Array<JSONPermissionOverwrite>;
499
516
  position: number;
500
517
  rateLimitPerUser: number;
501
- threads: Array<string>;
502
518
  topic: string | null;
503
519
  type: Exclude<TextChannelTypes, PrivateChannelTypes>;
504
520
  }
505
521
  export interface JSONTextChannel extends JSONTextableChannel {
522
+ threads: Array<string>;
506
523
  type: ChannelTypes.GUILD_TEXT;
507
524
  }
508
525
  export interface JSONThreadChannel extends JSONGuildChannel {
@@ -545,8 +562,8 @@ export interface JSONVoiceChannel extends JSONGuildChannel {
545
562
  export interface JSONVoiceState extends JSONBase {
546
563
  channel: string | null;
547
564
  deaf: boolean;
548
- guild: string;
549
- member: JSONMember;
565
+ guild?: string;
566
+ member?: JSONMember;
550
567
  mute: boolean;
551
568
  requestToSpeakTimestamp: number | null;
552
569
  selfDeaf: boolean;
@@ -3,9 +3,9 @@ import Base from "../structures/Base";
3
3
  import { Collection as PolarCollection } from "@augu/collections";
4
4
  export declare type AnyClass<T, I, E extends Array<unknown>> = new (data: T, client: Client, ...extra: E) => I;
5
5
  export default class Collection<K extends string | number, M extends Record<string, any>, C extends Base, E extends Array<unknown> = []> extends PolarCollection<K, C> {
6
- protected _baseObject: AnyClass<M, C, E>;
7
- protected _client: Client;
8
- constructor(baseObject: AnyClass<M, C, E>, client: Client);
6
+ #private;
7
+ limit: number;
8
+ constructor(baseObject: AnyClass<M, C, E>, client: Client, limit?: number);
9
9
  add<T extends C>(value: T): T;
10
10
  update(value: C | Partial<M> & {
11
11
  id?: K;