mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user