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:
Jiralite
2021-12-22 16:54:44 +00:00
committed by GitHub
parent 2ed02f7fc7
commit aa7c1b2081
9 changed files with 138 additions and 21 deletions

View File

@@ -46,7 +46,14 @@ class VoiceChannel extends BaseGuildVoiceChannel {
* @readonly
*/
get speakable() {
return this.permissionsFor(this.client.user).has(Permissions.FLAGS.SPEAK, false);
const permissions = this.permissionsFor(this.client.user);
if (!permissions) return false;
// This flag allows speaking even if timed out
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
return (
this.guild.me.communicationDisabledUntilTimestamp < Date.now() && permissions.has(Permissions.FLAGS.SPEAK, false)
);
}
/**