mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
feat(GuildMember): Add timeouts (#7104)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> Co-authored-by: Tiemen <ThaTiemsz@users.noreply.github.com> Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -439,7 +439,15 @@ class ThreadChannel extends Channel {
|
||||
* @readonly
|
||||
*/
|
||||
get manageable() {
|
||||
return this.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_THREADS, false);
|
||||
const permissions = this.permissionsFor(this.client.user);
|
||||
if (!permissions) return false;
|
||||
// This flag allows managing even if timed out
|
||||
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
|
||||
|
||||
return (
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now() &&
|
||||
permissions.has(Permissions.FLAGS.MANAGE_THREADS, false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -460,11 +468,16 @@ class ThreadChannel extends Channel {
|
||||
* @readonly
|
||||
*/
|
||||
get sendable() {
|
||||
const permissions = this.permissionsFor(this.client.user);
|
||||
if (!permissions) return false;
|
||||
// This flag allows sending even if timed out
|
||||
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
|
||||
|
||||
return (
|
||||
(!(this.archived && this.locked && !this.manageable) &&
|
||||
(this.type !== 'GUILD_PRIVATE_THREAD' || this.joined || this.manageable) &&
|
||||
this.permissionsFor(this.client.user)?.has(Permissions.FLAGS.SEND_MESSAGES_IN_THREADS, false)) ??
|
||||
false
|
||||
!(this.archived && this.locked && !this.manageable) &&
|
||||
(this.type !== 'GUILD_PRIVATE_THREAD' || this.joined || this.manageable) &&
|
||||
permissions.has(Permissions.FLAGS.SEND_MESSAGES_IN_THREADS, false) &&
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user