perm checks
This commit is contained in:
parent
91a8b135e3
commit
e49eea5672
@ -221,11 +221,15 @@ class Infraction {
|
||||
return this._verify();
|
||||
}
|
||||
|
||||
_verify() {
|
||||
if (this.guild && this.guild._settings.protection.enabled) {
|
||||
async _verify() {
|
||||
if (this.executor.id === this.guild.ownerID) return this._succeed();
|
||||
if (this.guild && this.guild._settings.protection.enabled && this.targetType === 'user') {
|
||||
//Idk what the thought process here has been, but the user object does not have roles, and the executor is a user object
|
||||
const executorHighest = this.guild.members.cache.get(this.executor.id).roles.highest; //this.executor.roles.highest;
|
||||
const targetHighest = this.guild.members.cache.get(this.target.id).roles.highest; //this.member.roles.highest;
|
||||
const executor = await this.guild.members.fetch(this.executor.id).catch();
|
||||
const target = await this.guild.members.fetch(this.target.id).catch();
|
||||
if (!target) return this._succeed();
|
||||
const executorHighest = executor.roles.highest; //this.executor.roles.highest;
|
||||
const targetHighest = target.roles.highest; //this.member.roles.highest;
|
||||
if(executorHighest.comparePositionTo(targetHighest) > 0) {
|
||||
return this._fail('INFRACTION_PROTECTIONERROR');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user