proper perm checks

This commit is contained in:
Erik 2022-07-23 11:23:26 +03:00
parent c2fe2f8ad5
commit 8ed0051820
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 6 additions and 2 deletions

View File

@ -140,6 +140,8 @@ class LockdownInfraction extends Infraction {
async verify() {
const perms = this.target.permissionsFor(this.guild.members.me);
if(perms.missing('ManageRoles').length) return this._fail('INFRACTION_LOCKDOWN_MISSING_PERMS');
return super._verify();
}

View File

@ -53,7 +53,7 @@ class NicknameInfraction extends Infraction {
}
try {
this.member.setNickname(this.data.name, this._reason);
await this.member.setNickname(this.data.name, this._reason);
} catch (e) {
return this._fail('INFRACTION_ERROR');
}
@ -82,7 +82,7 @@ class NicknameInfraction extends Infraction {
async verify() {
const { highest } = this.member.roles;
if (highest.comparePositionTo(this.guild.members.me.roles.highest) > 0) {
if (highest.comparePositionTo(this.guild.members.me.roles.highest) > 0 || !this.guild.members.me.permissions.has('ManageNicknames')) {
return this._fail('C_NICKNAME_MISSINGPERMISSIONS');
}

View File

@ -95,6 +95,8 @@ class UnlockdownInfraction extends Infraction {
async verify() {
const perms = this.target.permissionsFor(this.guild.members.me);
if (perms.missing('ManageRoles').length) return this._fail('INFRACTION_LOCKDOWN_MISSING_PERMS');
return super._verify();
}