forked from Galactic/galactic-bot
proper perm checks
This commit is contained in:
parent
c2fe2f8ad5
commit
8ed0051820
@ -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();
|
||||
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user