mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(ThreadChannel): add ThreadChannel#viewable (#6975)
This commit is contained in:
@@ -442,6 +442,18 @@ class ThreadChannel extends Channel {
|
||||
return this.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_THREADS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the thread is viewable by the client user
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
*/
|
||||
get viewable() {
|
||||
if (this.client.user.id === this.guild.ownerId) return true;
|
||||
const permissions = this.permissionsFor(this.client.user);
|
||||
if (!permissions) return false;
|
||||
return permissions.has(Permissions.FLAGS.VIEW_CHANNEL, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the client user can send messages in this thread
|
||||
* @type {boolean}
|
||||
|
||||
Reference in New Issue
Block a user