@zygout/eris 0.19.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +71 -80
  3. package/esm.mjs +72 -72
  4. package/index.d.ts +4407 -4397
  5. package/index.js +75 -75
  6. package/lib/Client.js +4708 -4683
  7. package/lib/Constants.d.ts +990 -988
  8. package/lib/Constants.js +1163 -1161
  9. package/lib/command/Command.js +552 -552
  10. package/lib/command/CommandClient.js +460 -460
  11. package/lib/errors/DiscordHTTPError.js +63 -63
  12. package/lib/errors/DiscordRESTError.js +77 -77
  13. package/lib/gateway/Shard.js +3029 -3029
  14. package/lib/gateway/ShardManager.js +164 -164
  15. package/lib/rest/Endpoints.js +172 -172
  16. package/lib/rest/RequestHandler.js +459 -459
  17. package/lib/structures/ApplicationCommand.js +125 -125
  18. package/lib/structures/AutoModerationRule.js +143 -143
  19. package/lib/structures/AutocompleteInteraction.js +80 -80
  20. package/lib/structures/Base.js +81 -81
  21. package/lib/structures/CategoryChannel.js +77 -77
  22. package/lib/structures/Channel.js +98 -98
  23. package/lib/structures/CommandInteraction.js +473 -473
  24. package/lib/structures/ComponentInteraction.js +538 -538
  25. package/lib/structures/DMChannel.js +278 -278
  26. package/lib/structures/Entitlement.js +77 -77
  27. package/lib/structures/ExtendedUser.js +46 -46
  28. package/lib/structures/ForumChannel.js +24 -24
  29. package/lib/structures/GroupChannel.js +106 -106
  30. package/lib/structures/Guild.js +1677 -1677
  31. package/lib/structures/GuildAuditLogEntry.js +190 -190
  32. package/lib/structures/GuildChannel.js +128 -128
  33. package/lib/structures/GuildIntegration.js +99 -99
  34. package/lib/structures/GuildPreview.js +97 -97
  35. package/lib/structures/GuildScheduledEvent.js +176 -176
  36. package/lib/structures/GuildTemplate.js +76 -76
  37. package/lib/structures/GuildTextableChannel.js +260 -260
  38. package/lib/structures/Interaction.js +133 -133
  39. package/lib/structures/Invite.js +143 -143
  40. package/lib/structures/Lobby.js +108 -108
  41. package/lib/structures/LobbyMember.js +59 -59
  42. package/lib/structures/MediaChannel.js +216 -216
  43. package/lib/structures/Member.js +371 -371
  44. package/lib/structures/Message.js +708 -708
  45. package/lib/structures/ModalSubmitInteraction.js +478 -478
  46. package/lib/structures/NewsChannel.js +34 -34
  47. package/lib/structures/NewsThreadChannel.js +12 -12
  48. package/lib/structures/Permission.js +80 -80
  49. package/lib/structures/PermissionOverwrite.js +32 -32
  50. package/lib/structures/PingInteraction.js +39 -39
  51. package/lib/structures/PrivateThreadChannel.js +25 -25
  52. package/lib/structures/PublicThreadChannel.js +26 -26
  53. package/lib/structures/Role.js +163 -163
  54. package/lib/structures/SKU.js +80 -80
  55. package/lib/structures/SoundboardSound.js +79 -79
  56. package/lib/structures/StageChannel.js +59 -59
  57. package/lib/structures/StageInstance.js +55 -55
  58. package/lib/structures/Subscription.js +69 -69
  59. package/lib/structures/TextChannel.js +202 -202
  60. package/lib/structures/ThreadChannel.js +143 -143
  61. package/lib/structures/ThreadMember.js +59 -59
  62. package/lib/structures/UnavailableGuild.js +26 -26
  63. package/lib/structures/UnknownInteraction.js +502 -502
  64. package/lib/structures/User.js +296 -296
  65. package/lib/structures/VoiceChannel.js +166 -166
  66. package/lib/structures/VoiceState.js +84 -84
  67. package/lib/util/BrowserWebSocket.js +76 -76
  68. package/lib/util/Bucket.js +89 -89
  69. package/lib/util/Collection.js +202 -202
  70. package/lib/util/MultipartData.js +70 -70
  71. package/lib/util/Opus.js +33 -33
  72. package/lib/util/SequentialBucket.js +83 -83
  73. package/lib/util/emitDeprecation.js +26 -26
  74. package/lib/voice/Piper.js +300 -300
  75. package/lib/voice/SharedStream.js +238 -238
  76. package/lib/voice/VoiceConnection.js +1440 -1440
  77. package/lib/voice/VoiceConnectionManager.js +151 -151
  78. package/lib/voice/VoiceDataStream.js +22 -22
  79. package/lib/voice/streams/BaseTransformer.js +40 -40
  80. package/lib/voice/streams/DCAOpusTransformer.js +78 -78
  81. package/lib/voice/streams/FFmpegDuplex.js +192 -192
  82. package/lib/voice/streams/FFmpegOggTransformer.js +35 -35
  83. package/lib/voice/streams/FFmpegPCMTransformer.js +26 -26
  84. package/lib/voice/streams/OggOpusTransformer.js +108 -108
  85. package/lib/voice/streams/PCMOpusTransformer.js +61 -61
  86. package/lib/voice/streams/VolumeTransformer.js +50 -50
  87. package/lib/voice/streams/WebmOpusTransformer.js +258 -258
  88. package/package.json +83 -82
@@ -1,216 +1,216 @@
1
- "use strict";
2
-
3
- const Collection = require("../util/Collection");
4
- const GuildChannel = require("./GuildChannel");
5
- const PermissionOverwrite = require("./PermissionOverwrite");
6
-
7
- /**
8
- * Represents a guild media channel. See GuildChannel for more properties and methods.
9
- * @extends GuildChannel
10
- * @prop {Array<Object>} availableTags The available tags that can be applied to threads in the channel. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#forum-tag-object) for object structure (max 20)
11
- * @prop {Number} defaultAutoArchiveDuration The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080)
12
- * @prop {Object} defaultReactionEmoji The emoji to show in the add reaction button on a thread in the channel
13
- * @prop {Number} defaultSortOrder The default sort order type used to order posts in the channel
14
- * @prop {Number} defaultThreadRateLimitPerUser The initial rateLimitPerUser to set on newly created threads in the channel
15
- * @prop {String?} lastMessageID The ID of the most recently created thread in the channel. This can be null if there has never been a thread in this channel
16
- * @prop {Boolean} nsfw Whether the channel is an NSFW channel or not
17
- * @prop {Collection<PermissionOverwrite>} permissionOverwrites Collection of PermissionOverwrites in the channel
18
- * @prop {Number} position The position of the channel
19
- * @prop {Number?} rateLimitPerUser The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)
20
- * @prop {Array<PublicThreadChannel>} threads An array of threads in the channel
21
- * @prop {String?} topic The topic of the channel
22
- */
23
- class MediaChannel extends GuildChannel {
24
- constructor(data, client) {
25
- super(data, client);
26
- this.lastMessageID = data.last_message_id || null;
27
- this.update(data);
28
- }
29
-
30
- update(data) {
31
- super.update(data);
32
- if (data.topic !== undefined) {
33
- this.topic = data.topic;
34
- }
35
- if (data.available_tags !== undefined) {
36
- this.availableTags = data.available_tags;
37
- }
38
- if (data.default_auto_archive_duration !== undefined) {
39
- this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
40
- }
41
- if (data.default_reaction_emoji !== undefined) {
42
- this.defaultReactionEmoji = data.default_reaction_emoji;
43
- }
44
- if (data.default_sort_order !== undefined) {
45
- this.defaultSortOrder = data.default_sort_order;
46
- }
47
- if (data.default_thread_rate_limit_per_user !== undefined) {
48
- this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
49
- }
50
- if (data.nsfw !== undefined) {
51
- this.nsfw = data.nsfw;
52
- }
53
- if (data.permission_overwrites !== undefined) {
54
- this.permissionOverwrites = new Collection(PermissionOverwrite);
55
- data.permission_overwrites.forEach((overwrite) => {
56
- this.permissionOverwrites.add(overwrite);
57
- });
58
- }
59
- if (data.position !== undefined) {
60
- this.position = data.position;
61
- }
62
- if (data.rate_limit_per_user !== undefined) {
63
- this.rateLimitPerUser = data.rate_limit_per_user;
64
- }
65
- }
66
-
67
- get threads() {
68
- return this.guild.threads.filter((thread) => thread.parentID === this.id);
69
- }
70
-
71
- /**
72
- * Create an invite for the channel
73
- * @arg {Object} [options] Invite generation options
74
- * @arg {Number} [options.maxAge] How long the invite should last in seconds
75
- * @arg {Number} [options.maxUses] How many uses the invite should last for
76
- * @arg {Boolean} [options.temporary] Whether the invite grants temporary membership or not
77
- * @arg {Boolean} [options.unique] Whether the invite is unique or not
78
- * @arg {String} [reason] The reason to be displayed in audit logs
79
- * @returns {Promise<Invite>}
80
- */
81
- createInvite(options, reason) {
82
- return this._client.createChannelInvite.call(this.client, this.id, options, reason);
83
- }
84
-
85
- /**
86
- * Create a thread inside the channel
87
- * @arg {Object} options The thread options
88
- * @arg {Array<String>} [options.appliedTags] The IDs of the set of tags that have been applied to a thread in a forum/media channel (threads created in forum/media channels only, max 5)
89
- * @arg {Number} [options.autoArchiveDuration] The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080 (thread channels only)
90
- * @arg {Object} [options.message] The message to create with the thread. Note: When creating a forum/media channel thread, you must provide at least one of `content`, `embeds`, `stickerIDs`, `components`, or `files`
91
- * @arg {Object} [options.message.allowedMentions] A list of mentions to allow (overrides default)
92
- * @arg {Boolean} [options.message.allowedMentions.everyone] Whether or not to allow @everyone/@here
93
- * @arg {Boolean} [options.message.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
94
- * @arg {Boolean | Array<String>} [options.message.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
95
- * @arg {Boolean | Array<String>} [options.message.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
96
- * @arg {Array<Object>} [options.message.attachments] An array of attachment objects with the filename and description
97
- * @arg {String} [options.message.attachments[].description] The description of the file
98
- * @arg {String} [options.message.attachments[].filename] The name of the file
99
- * @arg {Number} options.message.attachments[].id The index of the file
100
- * @arg {Array<Object>} [options.message.components] An array of component objects
101
- * @arg {String} [options.message.components[].custom_id] The ID of the component (type 2 style 1-4 and type 3,5,6,7,8 only)
102
- * @arg {Boolean} [options.message.components[].disabled] Whether the component is disabled (type 2 and 3,5,6,7,8 only)
103
- * @arg {Object} [options.message.components[].emoji] The emoji to be displayed in the component (type 2)
104
- * @arg {String} [options.message.components[].label] The label to be displayed in the component (type 2)
105
- * @arg {Array<Object>} [options.message.components[].default_values] default values for the component (type 5,6,7,8 only)
106
- * @arg {String} [options.message.components[].default_values[].id] id of a user, role, or channel
107
- * @arg {String} [options.message.components[].default_values[].type] type of value that id represents (user, role, or channel)
108
- * @arg {Number} [options.message.components[].max_values] The maximum number of items that can be chosen (1-25, default 1)
109
- * @arg {Number} [options.message.components[].min_values] The minimum number of items that must be chosen (0-25, default 1)
110
- * @arg {Array<Object>} [options.message.components[].options] The options for this component (type 3 only)
111
- * @arg {Boolean} [options.message.components[].options[].default] Whether this option should be the default value selected
112
- * @arg {String} [options.message.components[].options[].description] The description for this option
113
- * @arg {Object} [options.message.components[].options[].emoji] The emoji to be displayed in this option
114
- * @arg {String} options.message.components[].options[].label The label for this option
115
- * @arg {Number | String} options.message.components[].options[].value The value for this option
116
- * @arg {String} [options.message.components[].placeholder] The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)
117
- * @arg {String} [options.message.components[].sku_id] The ID of the SKU to purchase (type 2 style 6 only)
118
- * @arg {Number} [options.message.components[].style] The style of the component (type 2 only) - If 1-4, `custom_id` is required; if 5, `url` is required; if 6, `sku_id` is required
119
- * @arg {Number} options.message.components[].type The type of component - If 1, it is a collection and a `components` array (nested) is required; if 2, it is a button; if 3, it is a string select; if 4, it is a text input; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select; if 9, it is a section; if 10, it is a text display; if 11, it is a thumbnail; if 12, it is a media gallery; if 13, it is a file; if 14, it is a separator; if 17, it is a container; if 18, it is a label (modals only); if 19, it is a file upload (modals only); if 21, it is a radio group (modals only); if 22, it is a checkbox group (modals only); if 23, it is a checkbox (modals only)
120
- * @arg {String} [options.message.components[].url] The URL that the component should open for users (type 2 style 5 only)
121
- * @arg {String} [options.message.content] A string containing the message content
122
- * @arg {Array<Object>} [options.message.embeds] An array of embed objects. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#embed-object) for object structure
123
- * @arg {Array<String>} [options.message.stickerIDs] An array of IDs corresponding to stickers to send
124
- * @arg {String} options.name The thread channel name
125
- * @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)
126
- * @arg {String} [options.reason] The reason to be displayed in audit logs
127
- * @arg {Object | Array<Object>} [file] A file object (or an Array of them)
128
- * @arg {Buffer} file.file A buffer containing file data
129
- * @arg {String} file.name What to name the file
130
- * @returns {Promise<ThreadChannel>}
131
- */
132
- createThread(options, file) {
133
- return this._client.createThread.call(this.client, this.id, options, file);
134
- }
135
-
136
- /**
137
- * Create a channel webhook
138
- * @arg {Object} options Webhook options
139
- * @arg {String} [options.avatar] The default avatar as a base64 data URI. Note: base64 strings alone are not base64 data URI strings
140
- * @arg {String} options.name The default name
141
- * @arg {String} [reason] The reason to be displayed in audit logs
142
- * @returns {Promise<Object>} Resolves with a webhook object
143
- */
144
- createWebhook(options, reason) {
145
- return this._client.createChannelWebhook.call(this.client, this.id, options, reason);
146
- }
147
-
148
- /**
149
- * Delete a channel permission overwrite
150
- * @arg {String} overwriteID The ID of the overwritten user or role
151
- * @arg {String} [reason] The reason to be displayed in audit logs
152
- * @returns {Promise}
153
- */
154
- deletePermission(overwriteID, reason) {
155
- return this._client.deleteChannelPermission.call(this._client, this.id, overwriteID, reason);
156
- }
157
-
158
- /**
159
- * Create a channel permission overwrite
160
- * @arg {String} overwriteID The ID of the overwritten user or role
161
- * @arg {BigInt | Number | String} allow The permissions number for allowed permissions
162
- * @arg {BigInt | Number | String} deny The permissions number for denied permissions
163
- * @arg {Number} type The object type of the overwrite, either 1 for "member" or 0 for "role"
164
- * @arg {String} [reason] The reason to be displayed in audit logs
165
- * @returns {Promise<PermissionOverwrite>}
166
- */
167
- editPermission(overwriteID, allow, deny, type, reason) {
168
- return this._client.editChannelPermission.call(this._client, this.id, overwriteID, allow, deny, type, reason);
169
- }
170
-
171
- /**
172
- * Get all archived threads in the channel
173
- * @arg {Object} [options] Additional options when requesting archived threads
174
- * @arg {Date} [options.before] List of threads to return before the timestamp
175
- * @arg {Number} [options.limit] Maximum number of threads to return
176
- * @returns {Promise<Object>} An object containing an array of `threads`, an array of `members` and whether the response `hasMore` threads that could be returned in a subsequent call
177
- */
178
- getArchivedThreads(options) {
179
- return this._client.getArchivedThreads.call(this.client, this.id, "public", options);
180
- }
181
-
182
- /**
183
- * Get all invites in the channel
184
- * @returns {Promise<Array<Invite>>}
185
- */
186
- getInvites() {
187
- return this._client.getChannelInvites.call(this.client, this.id);
188
- }
189
-
190
- /**
191
- * Get all the webhooks in the channel
192
- * @returns {Promise<Array<Object>>} Resolves with an array of webhook objects
193
- */
194
- getWebhooks() {
195
- return this._client.getChannelWebhooks.call(this.client, this.id);
196
- }
197
-
198
- toJSON(props = []) {
199
- return super.toJSON([
200
- "availableTags",
201
- "defaultAutoArchiveDuration",
202
- "defaultReactionEmoji",
203
- "defaultSortOrder",
204
- "defaultThreadRateLimitPerUser",
205
- "lastMessageID",
206
- "nsfw",
207
- "permissionOverwrites",
208
- "position",
209
- "rateLimitPerUser",
210
- "topic",
211
- ...props,
212
- ]);
213
- }
214
- }
215
-
216
- module.exports = MediaChannel;
1
+ "use strict";
2
+
3
+ const Collection = require("../util/Collection");
4
+ const GuildChannel = require("./GuildChannel");
5
+ const PermissionOverwrite = require("./PermissionOverwrite");
6
+
7
+ /**
8
+ * Represents a guild media channel. See GuildChannel for more properties and methods.
9
+ * @extends GuildChannel
10
+ * @prop {Array<Object>} availableTags The available tags that can be applied to threads in the channel. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#forum-tag-object) for object structure (max 20)
11
+ * @prop {Number} defaultAutoArchiveDuration The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080)
12
+ * @prop {Object} defaultReactionEmoji The emoji to show in the add reaction button on a thread in the channel
13
+ * @prop {Number} defaultSortOrder The default sort order type used to order posts in the channel
14
+ * @prop {Number} defaultThreadRateLimitPerUser The initial rateLimitPerUser to set on newly created threads in the channel
15
+ * @prop {String?} lastMessageID The ID of the most recently created thread in the channel. This can be null if there has never been a thread in this channel
16
+ * @prop {Boolean} nsfw Whether the channel is an NSFW channel or not
17
+ * @prop {Collection<PermissionOverwrite>} permissionOverwrites Collection of PermissionOverwrites in the channel
18
+ * @prop {Number} position The position of the channel
19
+ * @prop {Number?} rateLimitPerUser The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)
20
+ * @prop {Array<PublicThreadChannel>} threads An array of threads in the channel
21
+ * @prop {String?} topic The topic of the channel
22
+ */
23
+ class MediaChannel extends GuildChannel {
24
+ constructor(data, client) {
25
+ super(data, client);
26
+ this.lastMessageID = data.last_message_id || null;
27
+ this.update(data);
28
+ }
29
+
30
+ update(data) {
31
+ super.update(data);
32
+ if (data.topic !== undefined) {
33
+ this.topic = data.topic;
34
+ }
35
+ if (data.available_tags !== undefined) {
36
+ this.availableTags = data.available_tags;
37
+ }
38
+ if (data.default_auto_archive_duration !== undefined) {
39
+ this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
40
+ }
41
+ if (data.default_reaction_emoji !== undefined) {
42
+ this.defaultReactionEmoji = data.default_reaction_emoji;
43
+ }
44
+ if (data.default_sort_order !== undefined) {
45
+ this.defaultSortOrder = data.default_sort_order;
46
+ }
47
+ if (data.default_thread_rate_limit_per_user !== undefined) {
48
+ this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
49
+ }
50
+ if (data.nsfw !== undefined) {
51
+ this.nsfw = data.nsfw;
52
+ }
53
+ if (data.permission_overwrites !== undefined) {
54
+ this.permissionOverwrites = new Collection(PermissionOverwrite);
55
+ data.permission_overwrites.forEach((overwrite) => {
56
+ this.permissionOverwrites.add(overwrite);
57
+ });
58
+ }
59
+ if (data.position !== undefined) {
60
+ this.position = data.position;
61
+ }
62
+ if (data.rate_limit_per_user !== undefined) {
63
+ this.rateLimitPerUser = data.rate_limit_per_user;
64
+ }
65
+ }
66
+
67
+ get threads() {
68
+ return this.guild.threads.filter((thread) => thread.parentID === this.id);
69
+ }
70
+
71
+ /**
72
+ * Create an invite for the channel
73
+ * @arg {Object} [options] Invite generation options
74
+ * @arg {Number} [options.maxAge] How long the invite should last in seconds
75
+ * @arg {Number} [options.maxUses] How many uses the invite should last for
76
+ * @arg {Boolean} [options.temporary] Whether the invite grants temporary membership or not
77
+ * @arg {Boolean} [options.unique] Whether the invite is unique or not
78
+ * @arg {String} [reason] The reason to be displayed in audit logs
79
+ * @returns {Promise<Invite>}
80
+ */
81
+ createInvite(options, reason) {
82
+ return this._client.createChannelInvite.call(this.client, this.id, options, reason);
83
+ }
84
+
85
+ /**
86
+ * Create a thread inside the channel
87
+ * @arg {Object} options The thread options
88
+ * @arg {Array<String>} [options.appliedTags] The IDs of the set of tags that have been applied to a thread in a forum/media channel (threads created in forum/media channels only, max 5)
89
+ * @arg {Number} [options.autoArchiveDuration] The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080 (thread channels only)
90
+ * @arg {Object} [options.message] The message to create with the thread. Note: When creating a forum/media channel thread, you must provide at least one of `content`, `embeds`, `stickerIDs`, `components`, or `files`
91
+ * @arg {Object} [options.message.allowedMentions] A list of mentions to allow (overrides default)
92
+ * @arg {Boolean} [options.message.allowedMentions.everyone] Whether or not to allow @everyone/@here
93
+ * @arg {Boolean} [options.message.allowedMentions.repliedUser] Whether or not to mention the author of the message being replied to
94
+ * @arg {Boolean | Array<String>} [options.message.allowedMentions.roles] Whether or not to allow all role mentions, or an array of specific role mentions to allow
95
+ * @arg {Boolean | Array<String>} [options.message.allowedMentions.users] Whether or not to allow all user mentions, or an array of specific user mentions to allow
96
+ * @arg {Array<Object>} [options.message.attachments] An array of attachment objects with the filename and description
97
+ * @arg {String} [options.message.attachments[].description] The description of the file
98
+ * @arg {String} [options.message.attachments[].filename] The name of the file
99
+ * @arg {Number} options.message.attachments[].id The index of the file
100
+ * @arg {Array<Object>} [options.message.components] An array of component objects
101
+ * @arg {String} [options.message.components[].custom_id] The ID of the component (type 2 style 1-4 and type 3,5,6,7,8 only)
102
+ * @arg {Boolean} [options.message.components[].disabled] Whether the component is disabled (type 2 and 3,5,6,7,8 only)
103
+ * @arg {Object} [options.message.components[].emoji] The emoji to be displayed in the component (type 2)
104
+ * @arg {String} [options.message.components[].label] The label to be displayed in the component (type 2)
105
+ * @arg {Array<Object>} [options.message.components[].default_values] default values for the component (type 5,6,7,8 only)
106
+ * @arg {String} [options.message.components[].default_values[].id] id of a user, role, or channel
107
+ * @arg {String} [options.message.components[].default_values[].type] type of value that id represents (user, role, or channel)
108
+ * @arg {Number} [options.message.components[].max_values] The maximum number of items that can be chosen (1-25, default 1)
109
+ * @arg {Number} [options.message.components[].min_values] The minimum number of items that must be chosen (0-25, default 1)
110
+ * @arg {Array<Object>} [options.message.components[].options] The options for this component (type 3 only)
111
+ * @arg {Boolean} [options.message.components[].options[].default] Whether this option should be the default value selected
112
+ * @arg {String} [options.message.components[].options[].description] The description for this option
113
+ * @arg {Object} [options.message.components[].options[].emoji] The emoji to be displayed in this option
114
+ * @arg {String} options.message.components[].options[].label The label for this option
115
+ * @arg {Number | String} options.message.components[].options[].value The value for this option
116
+ * @arg {String} [options.message.components[].placeholder] The placeholder text for the component when no option is selected (type 3,5,6,7,8 only)
117
+ * @arg {String} [options.message.components[].sku_id] The ID of the SKU to purchase (type 2 style 6 only)
118
+ * @arg {Number} [options.message.components[].style] The style of the component (type 2 only) - If 1-4, `custom_id` is required; if 5, `url` is required; if 6, `sku_id` is required
119
+ * @arg {Number} options.message.components[].type The type of component - If 1, it is a collection and a `components` array (nested) is required; if 2, it is a button; if 3, it is a string select; if 4, it is a text input; if 5, it is a user select; if 6, it is a role select; if 7, it is a mentionable select; if 8, it is a channel select; if 9, it is a section; if 10, it is a text display; if 11, it is a thumbnail; if 12, it is a media gallery; if 13, it is a file; if 14, it is a separator; if 17, it is a container; if 18, it is a label (modals only); if 19, it is a file upload (modals only); if 21, it is a radio group (modals only); if 22, it is a checkbox group (modals only); if 23, it is a checkbox (modals only)
120
+ * @arg {String} [options.message.components[].url] The URL that the component should open for users (type 2 style 5 only)
121
+ * @arg {String} [options.message.content] A string containing the message content
122
+ * @arg {Array<Object>} [options.message.embeds] An array of embed objects. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/channel#embed-object) for object structure
123
+ * @arg {Array<String>} [options.message.stickerIDs] An array of IDs corresponding to stickers to send
124
+ * @arg {String} options.name The thread channel name
125
+ * @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)
126
+ * @arg {String} [options.reason] The reason to be displayed in audit logs
127
+ * @arg {Object | Array<Object>} [file] A file object (or an Array of them)
128
+ * @arg {Buffer} file.file A buffer containing file data
129
+ * @arg {String} file.name What to name the file
130
+ * @returns {Promise<ThreadChannel>}
131
+ */
132
+ createThread(options, file) {
133
+ return this._client.createThread.call(this.client, this.id, options, file);
134
+ }
135
+
136
+ /**
137
+ * Create a channel webhook
138
+ * @arg {Object} options Webhook options
139
+ * @arg {String} [options.avatar] The default avatar as a base64 data URI. Note: base64 strings alone are not base64 data URI strings
140
+ * @arg {String} options.name The default name
141
+ * @arg {String} [reason] The reason to be displayed in audit logs
142
+ * @returns {Promise<Object>} Resolves with a webhook object
143
+ */
144
+ createWebhook(options, reason) {
145
+ return this._client.createChannelWebhook.call(this.client, this.id, options, reason);
146
+ }
147
+
148
+ /**
149
+ * Delete a channel permission overwrite
150
+ * @arg {String} overwriteID The ID of the overwritten user or role
151
+ * @arg {String} [reason] The reason to be displayed in audit logs
152
+ * @returns {Promise}
153
+ */
154
+ deletePermission(overwriteID, reason) {
155
+ return this._client.deleteChannelPermission.call(this._client, this.id, overwriteID, reason);
156
+ }
157
+
158
+ /**
159
+ * Create a channel permission overwrite
160
+ * @arg {String} overwriteID The ID of the overwritten user or role
161
+ * @arg {BigInt | Number | String} allow The permissions number for allowed permissions
162
+ * @arg {BigInt | Number | String} deny The permissions number for denied permissions
163
+ * @arg {Number} type The object type of the overwrite, either 1 for "member" or 0 for "role"
164
+ * @arg {String} [reason] The reason to be displayed in audit logs
165
+ * @returns {Promise<PermissionOverwrite>}
166
+ */
167
+ editPermission(overwriteID, allow, deny, type, reason) {
168
+ return this._client.editChannelPermission.call(this._client, this.id, overwriteID, allow, deny, type, reason);
169
+ }
170
+
171
+ /**
172
+ * Get all archived threads in the channel
173
+ * @arg {Object} [options] Additional options when requesting archived threads
174
+ * @arg {Date} [options.before] List of threads to return before the timestamp
175
+ * @arg {Number} [options.limit] Maximum number of threads to return
176
+ * @returns {Promise<Object>} An object containing an array of `threads`, an array of `members` and whether the response `hasMore` threads that could be returned in a subsequent call
177
+ */
178
+ getArchivedThreads(options) {
179
+ return this._client.getArchivedThreads.call(this.client, this.id, "public", options);
180
+ }
181
+
182
+ /**
183
+ * Get all invites in the channel
184
+ * @returns {Promise<Array<Invite>>}
185
+ */
186
+ getInvites() {
187
+ return this._client.getChannelInvites.call(this.client, this.id);
188
+ }
189
+
190
+ /**
191
+ * Get all the webhooks in the channel
192
+ * @returns {Promise<Array<Object>>} Resolves with an array of webhook objects
193
+ */
194
+ getWebhooks() {
195
+ return this._client.getChannelWebhooks.call(this.client, this.id);
196
+ }
197
+
198
+ toJSON(props = []) {
199
+ return super.toJSON([
200
+ "availableTags",
201
+ "defaultAutoArchiveDuration",
202
+ "defaultReactionEmoji",
203
+ "defaultSortOrder",
204
+ "defaultThreadRateLimitPerUser",
205
+ "lastMessageID",
206
+ "nsfw",
207
+ "permissionOverwrites",
208
+ "position",
209
+ "rateLimitPerUser",
210
+ "topic",
211
+ ...props,
212
+ ]);
213
+ }
214
+ }
215
+
216
+ module.exports = MediaChannel;