lockdown perms check

This commit is contained in:
Erik 2022-07-25 10:55:27 +03:00
parent 231c150109
commit 6adf87d0d4
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 9 additions and 3 deletions

View File

@ -97,4 +97,8 @@ the channel isn't locked down
the channel is already locked down. the channel is already locked down.
Use `/unlockdown` to unlock it. Use `/unlockdown` to unlock it.
If you've manually reverted the lockdown, resolve case **#{case}** If you've manually reverted the lockdown, resolve case **#{case}**
[INFRACTION_LOCKDOWN_MISSING_PERMS]
The bot is missing the following permissions to execute a lockdown:
**{missing}**

View File

@ -141,7 +141,8 @@ class LockdownInfraction extends Infraction {
async verify() { async verify() {
const perms = this.target.permissionsFor(this.guild.members.me); const perms = this.target.permissionsFor(this.guild.members.me);
if(perms.missing('ManageRoles').length) return this._fail('INFRACTION_LOCKDOWN_MISSING_PERMS'); const missing = perms.missing(['ManageRoles', 'SendMessages', 'AddReactions']);
if(missing.length) return this._fail('INFRACTION_LOCKDOWN_MISSING_PERMS', { missing: missing.join('**, **') });
return super._verify(); return super._verify();
} }

View File

@ -96,7 +96,8 @@ class UnlockdownInfraction extends Infraction {
async verify() { async verify() {
const perms = this.target.permissionsFor(this.guild.members.me); const perms = this.target.permissionsFor(this.guild.members.me);
if (perms.missing('ManageRoles').length) return this._fail('INFRACTION_LOCKDOWN_MISSING_PERMS'); const missing = perms.missing(['ManageRoles', 'SendMessages', 'AddReactions']);
if(missing.length) return this._fail('INFRACTION_LOCKDOWN_MISSING_PERMS', { missing: missing.join('**, **') });
return super._verify(); return super._verify();
} }