@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.
- package/LICENSE +20 -20
- package/README.md +71 -80
- package/esm.mjs +72 -72
- package/index.d.ts +4407 -4397
- package/index.js +75 -75
- package/lib/Client.js +4708 -4683
- package/lib/Constants.d.ts +990 -988
- package/lib/Constants.js +1163 -1161
- package/lib/command/Command.js +552 -552
- package/lib/command/CommandClient.js +460 -460
- package/lib/errors/DiscordHTTPError.js +63 -63
- package/lib/errors/DiscordRESTError.js +77 -77
- package/lib/gateway/Shard.js +3029 -3029
- package/lib/gateway/ShardManager.js +164 -164
- package/lib/rest/Endpoints.js +172 -172
- package/lib/rest/RequestHandler.js +459 -459
- package/lib/structures/ApplicationCommand.js +125 -125
- package/lib/structures/AutoModerationRule.js +143 -143
- package/lib/structures/AutocompleteInteraction.js +80 -80
- package/lib/structures/Base.js +81 -81
- package/lib/structures/CategoryChannel.js +77 -77
- package/lib/structures/Channel.js +98 -98
- package/lib/structures/CommandInteraction.js +473 -473
- package/lib/structures/ComponentInteraction.js +538 -538
- package/lib/structures/DMChannel.js +278 -278
- package/lib/structures/Entitlement.js +77 -77
- package/lib/structures/ExtendedUser.js +46 -46
- package/lib/structures/ForumChannel.js +24 -24
- package/lib/structures/GroupChannel.js +106 -106
- package/lib/structures/Guild.js +1677 -1677
- package/lib/structures/GuildAuditLogEntry.js +190 -190
- package/lib/structures/GuildChannel.js +128 -128
- package/lib/structures/GuildIntegration.js +99 -99
- package/lib/structures/GuildPreview.js +97 -97
- package/lib/structures/GuildScheduledEvent.js +176 -176
- package/lib/structures/GuildTemplate.js +76 -76
- package/lib/structures/GuildTextableChannel.js +260 -260
- package/lib/structures/Interaction.js +133 -133
- package/lib/structures/Invite.js +143 -143
- package/lib/structures/Lobby.js +108 -108
- package/lib/structures/LobbyMember.js +59 -59
- package/lib/structures/MediaChannel.js +216 -216
- package/lib/structures/Member.js +371 -371
- package/lib/structures/Message.js +708 -708
- package/lib/structures/ModalSubmitInteraction.js +478 -478
- package/lib/structures/NewsChannel.js +34 -34
- package/lib/structures/NewsThreadChannel.js +12 -12
- package/lib/structures/Permission.js +80 -80
- package/lib/structures/PermissionOverwrite.js +32 -32
- package/lib/structures/PingInteraction.js +39 -39
- package/lib/structures/PrivateThreadChannel.js +25 -25
- package/lib/structures/PublicThreadChannel.js +26 -26
- package/lib/structures/Role.js +163 -163
- package/lib/structures/SKU.js +80 -80
- package/lib/structures/SoundboardSound.js +79 -79
- package/lib/structures/StageChannel.js +59 -59
- package/lib/structures/StageInstance.js +55 -55
- package/lib/structures/Subscription.js +69 -69
- package/lib/structures/TextChannel.js +202 -202
- package/lib/structures/ThreadChannel.js +143 -143
- package/lib/structures/ThreadMember.js +59 -59
- package/lib/structures/UnavailableGuild.js +26 -26
- package/lib/structures/UnknownInteraction.js +502 -502
- package/lib/structures/User.js +296 -296
- package/lib/structures/VoiceChannel.js +166 -166
- package/lib/structures/VoiceState.js +84 -84
- package/lib/util/BrowserWebSocket.js +76 -76
- package/lib/util/Bucket.js +89 -89
- package/lib/util/Collection.js +202 -202
- package/lib/util/MultipartData.js +70 -70
- package/lib/util/Opus.js +33 -33
- package/lib/util/SequentialBucket.js +83 -83
- package/lib/util/emitDeprecation.js +26 -26
- package/lib/voice/Piper.js +300 -300
- package/lib/voice/SharedStream.js +238 -238
- package/lib/voice/VoiceConnection.js +1440 -1440
- package/lib/voice/VoiceConnectionManager.js +151 -151
- package/lib/voice/VoiceDataStream.js +22 -22
- package/lib/voice/streams/BaseTransformer.js +40 -40
- package/lib/voice/streams/DCAOpusTransformer.js +78 -78
- package/lib/voice/streams/FFmpegDuplex.js +192 -192
- package/lib/voice/streams/FFmpegOggTransformer.js +35 -35
- package/lib/voice/streams/FFmpegPCMTransformer.js +26 -26
- package/lib/voice/streams/OggOpusTransformer.js +108 -108
- package/lib/voice/streams/PCMOpusTransformer.js +61 -61
- package/lib/voice/streams/VolumeTransformer.js +50 -50
- package/lib/voice/streams/WebmOpusTransformer.js +258 -258
- package/package.json +83 -82
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Collection = require("../util/Collection");
|
|
4
|
-
const GuildTextableChannel = require("./GuildTextableChannel");
|
|
5
|
-
const PermissionOverwrite = require("./PermissionOverwrite");
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Represents a guild text channel. See GuildTextableChannel for more properties and methods
|
|
9
|
-
* @extends GuildTextableChannel
|
|
10
|
-
* @prop {Number} defaultAutoArchiveDuration The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080)
|
|
11
|
-
* @prop {Number?} lastPinTimestamp The timestamp of the last pinned message
|
|
12
|
-
* @prop {Boolean} nsfw Whether the channel is an NSFW channel or not
|
|
13
|
-
* @prop {Collection<PermissionOverwrite>} permissionOverwrites Collection of PermissionOverwrites in the channel
|
|
14
|
-
* @prop {Number} position The position of the channel
|
|
15
|
-
* @prop {String?} topic The topic of the channel
|
|
16
|
-
*/
|
|
17
|
-
class TextChannel extends GuildTextableChannel {
|
|
18
|
-
constructor(data, client) {
|
|
19
|
-
super(data, client);
|
|
20
|
-
this.update(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
update(data) {
|
|
24
|
-
super.update(data);
|
|
25
|
-
if (data.position !== undefined) {
|
|
26
|
-
this.position = data.position;
|
|
27
|
-
}
|
|
28
|
-
if (data.permission_overwrites !== undefined) {
|
|
29
|
-
this.permissionOverwrites = new Collection(PermissionOverwrite);
|
|
30
|
-
data.permission_overwrites.forEach((overwrite) => {
|
|
31
|
-
this.permissionOverwrites.add(overwrite);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
if (data.nsfw !== undefined) {
|
|
35
|
-
this.nsfw = data.nsfw;
|
|
36
|
-
}
|
|
37
|
-
if (data.topic !== undefined) {
|
|
38
|
-
this.topic = data.topic;
|
|
39
|
-
}
|
|
40
|
-
if (data.default_auto_archive_duration !== undefined) {
|
|
41
|
-
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
42
|
-
}
|
|
43
|
-
this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Create an invite for the channel
|
|
48
|
-
* @arg {Object} [options] Invite generation options
|
|
49
|
-
* @arg {Number} [options.maxAge] How long the invite should last in seconds
|
|
50
|
-
* @arg {Number} [options.maxUses] How many uses the invite should last for
|
|
51
|
-
* @arg {String} [options.targetApplicationID] The target application id
|
|
52
|
-
* @arg {Number} [options.targetType] The type of the target application
|
|
53
|
-
* @arg {String} [options.targetUserID] The ID of the user whose stream should be displayed for the invite (`options.targetType` must be `1`)
|
|
54
|
-
* @arg {Boolean} [options.temporary] Whether the invite grants temporary membership or not
|
|
55
|
-
* @arg {Boolean} [options.unique] Whether the invite is unique or not
|
|
56
|
-
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
57
|
-
* @returns {Promise<Invite>}
|
|
58
|
-
*/
|
|
59
|
-
createInvite(options, reason) {
|
|
60
|
-
return this._client.createChannelInvite.call(this._client, this.id, options, reason);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Create a thread without an existing message
|
|
65
|
-
* @arg {Object} options The thread options
|
|
66
|
-
* @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)
|
|
67
|
-
* @arg {Boolean} [options.invitable] Whether non-moderators can add other non-moderators to the thread (private threads only)
|
|
68
|
-
* @arg {String} options.name The thread channel name
|
|
69
|
-
* @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)
|
|
70
|
-
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
71
|
-
* @arg {Number} [options.type] The channel type of the thread to create. Either `10` (announcement thread, announcement channels only), `11` (public thread) or `12` (private thread)
|
|
72
|
-
* @returns {Promise<NewsThreadChannel | PublicThreadChannel | PrivateThreadChannel>}
|
|
73
|
-
*/
|
|
74
|
-
createThread(options) {
|
|
75
|
-
return this._client.createThread.call(this.client, this.id, options);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Create a thread with an existing message
|
|
80
|
-
* @arg {String} messageID The ID of the message to create the thread from
|
|
81
|
-
* @arg {Object} options The thread options
|
|
82
|
-
* @arg {Number} [options.autoArchiveDuration] Duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080
|
|
83
|
-
* @arg {String} options.name The thread channel name
|
|
84
|
-
* @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)
|
|
85
|
-
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
86
|
-
* @returns {Promise<NewsThreadChannel | PublicThreadChannel>}
|
|
87
|
-
*/
|
|
88
|
-
createThreadWithMessage(messageID, options) {
|
|
89
|
-
return this._client.createThreadWithMessage.call(this._client, this.id, messageID, options);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* [DEPRECATED] Create a thread without an existing message. Use `createThread` instead
|
|
94
|
-
* @arg {Object} options The thread options
|
|
95
|
-
* @arg {Number} [options.autoArchiveDuration] Duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080
|
|
96
|
-
* @arg {Boolean} [options.invitable] Whether non-moderators can add other non-moderators to the thread (private threads only)
|
|
97
|
-
* @arg {String} options.name The thread channel name
|
|
98
|
-
* @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)
|
|
99
|
-
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
100
|
-
* @arg {Number} [options.type] The channel type of the thread to create. Either `10` (announcement thread, announcement channels only), `11` (public thread) or `12` (private thread)
|
|
101
|
-
* @returns {Promise<NewsThreadChannel | PublicThreadChannel | PrivateThreadChannel>}
|
|
102
|
-
*/
|
|
103
|
-
createThreadWithoutMessage(options) {
|
|
104
|
-
return this._client.createThreadWithoutMessage.call(this._client, this.id, options);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Delete a channel permission overwrite
|
|
109
|
-
* @arg {String} overwriteID The ID of the overwritten user or role
|
|
110
|
-
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
111
|
-
* @returns {Promise}
|
|
112
|
-
*/
|
|
113
|
-
deletePermission(overwriteID, reason) {
|
|
114
|
-
return this._client.deleteChannelPermission.call(this._client, this.id, overwriteID, reason);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Create a channel permission overwrite
|
|
119
|
-
* @arg {String} overwriteID The ID of the overwritten user or role
|
|
120
|
-
* @arg {BigInt | Number | String} allow The permissions number for allowed permissions
|
|
121
|
-
* @arg {BigInt | Number | String} deny The permissions number for denied permissions
|
|
122
|
-
* @arg {Number} type The object type of the overwrite, either 1 for "member" or 0 for "role"
|
|
123
|
-
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
124
|
-
* @returns {Promise<PermissionOverwrite>}
|
|
125
|
-
*/
|
|
126
|
-
editPermission(overwriteID, allow, deny, type, reason) {
|
|
127
|
-
return this._client.editChannelPermission.call(this._client, this.id, overwriteID, allow, deny, type, reason);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Get all archived threads in this channel
|
|
132
|
-
* @arg {String} type The type of thread channel, either "public" or "private"
|
|
133
|
-
* @arg {Object} [options] Additional options when requesting archived threads
|
|
134
|
-
* @arg {Date} [options.before] List of threads to return before the timestamp
|
|
135
|
-
* @arg {Number} [options.limit] Maximum number of threads to return
|
|
136
|
-
* @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
|
|
137
|
-
*/
|
|
138
|
-
getArchivedThreads(type, options) {
|
|
139
|
-
return this._client.getArchivedThreads.call(this._client, this.id, type, options);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Get all invites in the channel
|
|
144
|
-
* @returns {Promise<Array<Invite>>}
|
|
145
|
-
*/
|
|
146
|
-
getInvites() {
|
|
147
|
-
return this._client.getChannelInvites.call(this._client, this.id);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Get joined private archived threads in this channel
|
|
152
|
-
* @arg {Object} [options] Additional options when requesting archived threads
|
|
153
|
-
* @arg {Date} [options.before] List of threads to return before the timestamp
|
|
154
|
-
* @arg {Number} [options.limit] Maximum number of threads to return
|
|
155
|
-
* @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
|
|
156
|
-
*/
|
|
157
|
-
getJoinedPrivateArchivedThreads(options) {
|
|
158
|
-
return this._client.getJoinedPrivateArchivedThreads.call(this._client, this.id, options);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Get pinned messages in the channel
|
|
163
|
-
* @arg {Object} [options] The options to use to get pinned messages
|
|
164
|
-
* @arg {Date} [options.before] Get pinned messages before this date
|
|
165
|
-
* @arg {Number} [options.limit=50] The max number of pinned messages to get (1-50, default 50)
|
|
166
|
-
* @returns {Promise<{hasMore: Boolean, items: Array<{pinnedAt: Number, message: Message}>}>}
|
|
167
|
-
*/
|
|
168
|
-
getPins(options) {
|
|
169
|
-
return this._client.getPins.call(this._client, this.id, options);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Pin a message
|
|
174
|
-
* @arg {String} messageID The ID of the message
|
|
175
|
-
* @returns {Promise}
|
|
176
|
-
*/
|
|
177
|
-
pinMessage(messageID) {
|
|
178
|
-
return this._client.pinMessage.call(this._client, this.id, messageID);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Unpin a message
|
|
183
|
-
* @arg {String} messageID The ID of the message
|
|
184
|
-
* @returns {Promise}
|
|
185
|
-
*/
|
|
186
|
-
unpinMessage(messageID) {
|
|
187
|
-
return this._client.unpinMessage.call(this._client, this.id, messageID);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
toJSON(props = []) {
|
|
191
|
-
return super.toJSON([
|
|
192
|
-
"defaultAutoArchiveDuration",
|
|
193
|
-
"nsfw",
|
|
194
|
-
"permissionOverwrites",
|
|
195
|
-
"position",
|
|
196
|
-
"topic",
|
|
197
|
-
...props,
|
|
198
|
-
]);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
module.exports = TextChannel;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Collection = require("../util/Collection");
|
|
4
|
+
const GuildTextableChannel = require("./GuildTextableChannel");
|
|
5
|
+
const PermissionOverwrite = require("./PermissionOverwrite");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents a guild text channel. See GuildTextableChannel for more properties and methods
|
|
9
|
+
* @extends GuildTextableChannel
|
|
10
|
+
* @prop {Number} defaultAutoArchiveDuration The default duration of newly created threads in minutes to automatically archive the thread after inactivity (60, 1440, 4320, 10080)
|
|
11
|
+
* @prop {Number?} lastPinTimestamp The timestamp of the last pinned message
|
|
12
|
+
* @prop {Boolean} nsfw Whether the channel is an NSFW channel or not
|
|
13
|
+
* @prop {Collection<PermissionOverwrite>} permissionOverwrites Collection of PermissionOverwrites in the channel
|
|
14
|
+
* @prop {Number} position The position of the channel
|
|
15
|
+
* @prop {String?} topic The topic of the channel
|
|
16
|
+
*/
|
|
17
|
+
class TextChannel extends GuildTextableChannel {
|
|
18
|
+
constructor(data, client) {
|
|
19
|
+
super(data, client);
|
|
20
|
+
this.update(data);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
update(data) {
|
|
24
|
+
super.update(data);
|
|
25
|
+
if (data.position !== undefined) {
|
|
26
|
+
this.position = data.position;
|
|
27
|
+
}
|
|
28
|
+
if (data.permission_overwrites !== undefined) {
|
|
29
|
+
this.permissionOverwrites = new Collection(PermissionOverwrite);
|
|
30
|
+
data.permission_overwrites.forEach((overwrite) => {
|
|
31
|
+
this.permissionOverwrites.add(overwrite);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (data.nsfw !== undefined) {
|
|
35
|
+
this.nsfw = data.nsfw;
|
|
36
|
+
}
|
|
37
|
+
if (data.topic !== undefined) {
|
|
38
|
+
this.topic = data.topic;
|
|
39
|
+
}
|
|
40
|
+
if (data.default_auto_archive_duration !== undefined) {
|
|
41
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
42
|
+
}
|
|
43
|
+
this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Create an invite for the channel
|
|
48
|
+
* @arg {Object} [options] Invite generation options
|
|
49
|
+
* @arg {Number} [options.maxAge] How long the invite should last in seconds
|
|
50
|
+
* @arg {Number} [options.maxUses] How many uses the invite should last for
|
|
51
|
+
* @arg {String} [options.targetApplicationID] The target application id
|
|
52
|
+
* @arg {Number} [options.targetType] The type of the target application
|
|
53
|
+
* @arg {String} [options.targetUserID] The ID of the user whose stream should be displayed for the invite (`options.targetType` must be `1`)
|
|
54
|
+
* @arg {Boolean} [options.temporary] Whether the invite grants temporary membership or not
|
|
55
|
+
* @arg {Boolean} [options.unique] Whether the invite is unique or not
|
|
56
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
57
|
+
* @returns {Promise<Invite>}
|
|
58
|
+
*/
|
|
59
|
+
createInvite(options, reason) {
|
|
60
|
+
return this._client.createChannelInvite.call(this._client, this.id, options, reason);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Create a thread without an existing message
|
|
65
|
+
* @arg {Object} options The thread options
|
|
66
|
+
* @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)
|
|
67
|
+
* @arg {Boolean} [options.invitable] Whether non-moderators can add other non-moderators to the thread (private threads only)
|
|
68
|
+
* @arg {String} options.name The thread channel name
|
|
69
|
+
* @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)
|
|
70
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
71
|
+
* @arg {Number} [options.type] The channel type of the thread to create. Either `10` (announcement thread, announcement channels only), `11` (public thread) or `12` (private thread)
|
|
72
|
+
* @returns {Promise<NewsThreadChannel | PublicThreadChannel | PrivateThreadChannel>}
|
|
73
|
+
*/
|
|
74
|
+
createThread(options) {
|
|
75
|
+
return this._client.createThread.call(this.client, this.id, options);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Create a thread with an existing message
|
|
80
|
+
* @arg {String} messageID The ID of the message to create the thread from
|
|
81
|
+
* @arg {Object} options The thread options
|
|
82
|
+
* @arg {Number} [options.autoArchiveDuration] Duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080
|
|
83
|
+
* @arg {String} options.name The thread channel name
|
|
84
|
+
* @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)
|
|
85
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
86
|
+
* @returns {Promise<NewsThreadChannel | PublicThreadChannel>}
|
|
87
|
+
*/
|
|
88
|
+
createThreadWithMessage(messageID, options) {
|
|
89
|
+
return this._client.createThreadWithMessage.call(this._client, this.id, messageID, options);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* [DEPRECATED] Create a thread without an existing message. Use `createThread` instead
|
|
94
|
+
* @arg {Object} options The thread options
|
|
95
|
+
* @arg {Number} [options.autoArchiveDuration] Duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080
|
|
96
|
+
* @arg {Boolean} [options.invitable] Whether non-moderators can add other non-moderators to the thread (private threads only)
|
|
97
|
+
* @arg {String} options.name The thread channel name
|
|
98
|
+
* @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)
|
|
99
|
+
* @arg {String} [options.reason] The reason to be displayed in audit logs
|
|
100
|
+
* @arg {Number} [options.type] The channel type of the thread to create. Either `10` (announcement thread, announcement channels only), `11` (public thread) or `12` (private thread)
|
|
101
|
+
* @returns {Promise<NewsThreadChannel | PublicThreadChannel | PrivateThreadChannel>}
|
|
102
|
+
*/
|
|
103
|
+
createThreadWithoutMessage(options) {
|
|
104
|
+
return this._client.createThreadWithoutMessage.call(this._client, this.id, options);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Delete a channel permission overwrite
|
|
109
|
+
* @arg {String} overwriteID The ID of the overwritten user or role
|
|
110
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
111
|
+
* @returns {Promise}
|
|
112
|
+
*/
|
|
113
|
+
deletePermission(overwriteID, reason) {
|
|
114
|
+
return this._client.deleteChannelPermission.call(this._client, this.id, overwriteID, reason);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a channel permission overwrite
|
|
119
|
+
* @arg {String} overwriteID The ID of the overwritten user or role
|
|
120
|
+
* @arg {BigInt | Number | String} allow The permissions number for allowed permissions
|
|
121
|
+
* @arg {BigInt | Number | String} deny The permissions number for denied permissions
|
|
122
|
+
* @arg {Number} type The object type of the overwrite, either 1 for "member" or 0 for "role"
|
|
123
|
+
* @arg {String} [reason] The reason to be displayed in audit logs
|
|
124
|
+
* @returns {Promise<PermissionOverwrite>}
|
|
125
|
+
*/
|
|
126
|
+
editPermission(overwriteID, allow, deny, type, reason) {
|
|
127
|
+
return this._client.editChannelPermission.call(this._client, this.id, overwriteID, allow, deny, type, reason);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get all archived threads in this channel
|
|
132
|
+
* @arg {String} type The type of thread channel, either "public" or "private"
|
|
133
|
+
* @arg {Object} [options] Additional options when requesting archived threads
|
|
134
|
+
* @arg {Date} [options.before] List of threads to return before the timestamp
|
|
135
|
+
* @arg {Number} [options.limit] Maximum number of threads to return
|
|
136
|
+
* @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
|
|
137
|
+
*/
|
|
138
|
+
getArchivedThreads(type, options) {
|
|
139
|
+
return this._client.getArchivedThreads.call(this._client, this.id, type, options);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get all invites in the channel
|
|
144
|
+
* @returns {Promise<Array<Invite>>}
|
|
145
|
+
*/
|
|
146
|
+
getInvites() {
|
|
147
|
+
return this._client.getChannelInvites.call(this._client, this.id);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get joined private archived threads in this channel
|
|
152
|
+
* @arg {Object} [options] Additional options when requesting archived threads
|
|
153
|
+
* @arg {Date} [options.before] List of threads to return before the timestamp
|
|
154
|
+
* @arg {Number} [options.limit] Maximum number of threads to return
|
|
155
|
+
* @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
|
|
156
|
+
*/
|
|
157
|
+
getJoinedPrivateArchivedThreads(options) {
|
|
158
|
+
return this._client.getJoinedPrivateArchivedThreads.call(this._client, this.id, options);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get pinned messages in the channel
|
|
163
|
+
* @arg {Object} [options] The options to use to get pinned messages
|
|
164
|
+
* @arg {Date} [options.before] Get pinned messages before this date
|
|
165
|
+
* @arg {Number} [options.limit=50] The max number of pinned messages to get (1-50, default 50)
|
|
166
|
+
* @returns {Promise<{hasMore: Boolean, items: Array<{pinnedAt: Number, message: Message}>}>}
|
|
167
|
+
*/
|
|
168
|
+
getPins(options) {
|
|
169
|
+
return this._client.getPins.call(this._client, this.id, options);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Pin a message
|
|
174
|
+
* @arg {String} messageID The ID of the message
|
|
175
|
+
* @returns {Promise}
|
|
176
|
+
*/
|
|
177
|
+
pinMessage(messageID) {
|
|
178
|
+
return this._client.pinMessage.call(this._client, this.id, messageID);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Unpin a message
|
|
183
|
+
* @arg {String} messageID The ID of the message
|
|
184
|
+
* @returns {Promise}
|
|
185
|
+
*/
|
|
186
|
+
unpinMessage(messageID) {
|
|
187
|
+
return this._client.unpinMessage.call(this._client, this.id, messageID);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
toJSON(props = []) {
|
|
191
|
+
return super.toJSON([
|
|
192
|
+
"defaultAutoArchiveDuration",
|
|
193
|
+
"nsfw",
|
|
194
|
+
"permissionOverwrites",
|
|
195
|
+
"position",
|
|
196
|
+
"topic",
|
|
197
|
+
...props,
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
module.exports = TextChannel;
|