feat(Threads): add support for invitable in private threads (#6501)

Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
ckohen
2021-08-29 05:23:01 -07:00
committed by GitHub
parent 0fe5f88316
commit a6932546e2
4 changed files with 36 additions and 2 deletions

View File

@@ -78,6 +78,8 @@ class ThreadManager extends CachedManager {
* @property {ThreadChannelTypes|number} [type] The type of thread to create. Defaults to `GUILD_PUBLIC_THREAD` if
* created in a {@link TextChannel} <warn>When creating threads in a {@link NewsChannel} this is ignored and is always
* `GUILD_NEWS_THREAD`</warn>
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
* <info>Can only be set when type will be `GUILD_PRIVATE_THREAD`</info>
*/
/**
@@ -106,7 +108,7 @@ class ThreadManager extends CachedManager {
* .then(threadChannel => console.log(threadChannel))
* .catch(console.error);
*/
async create({ name, autoArchiveDuration, startMessage, type, reason } = {}) {
async create({ name, autoArchiveDuration, startMessage, type, invitable, reason } = {}) {
let path = this.client.api.channels(this.channel.id);
if (type && typeof type !== 'string' && typeof type !== 'number') {
throw new TypeError('INVALID_TYPE', 'type', 'ThreadChannelType or Number');
@@ -134,6 +136,7 @@ class ThreadManager extends CachedManager {
name,
auto_archive_duration: autoArchiveDuration,
type: resolvedType,
invitable: resolvedType === ChannelTypes.GUILD_PRIVATE_THREAD ? invitable : undefined,
},
reason,
});