role position comparison fix
This commit is contained in:
parent
2bec9eee0f
commit
c9a10bb34a
@ -9,6 +9,7 @@ const {
|
|||||||
} = require('../../constants');
|
} = require('../../constants');
|
||||||
|
|
||||||
const { Util } = require('../../utilities');
|
const { Util } = require('../../utilities');
|
||||||
|
const { inspect } = require('util');
|
||||||
|
|
||||||
const Constants = {
|
const Constants = {
|
||||||
MaxCharacters: 1024, // Max embed description is 2048 characters, however some of those description characters are going to usernames, types, filler text, etc.
|
MaxCharacters: 1024, // Max embed description is 2048 characters, however some of those description characters are going to usernames, types, filler text, etc.
|
||||||
@ -147,7 +148,7 @@ class Infraction {
|
|||||||
if(this._mongoId) filter._id = this._mongoId;
|
if(this._mongoId) filter._id = this._mongoId;
|
||||||
return this.client.storageManager.mongodb.infractions.updateOne(filter, this.json)
|
return this.client.storageManager.mongodb.infractions.updateOne(filter, this.json)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.client.logger.error(`There was an issue saving infraction data to the database.\n${error.stack || error}\nInfraction data:\n${this.json}`);
|
this.client.logger.error(`There was an issue saving infraction data to the database.\n${error.stack || error}\nInfraction data:\n${inspect(this.json)}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +326,7 @@ class Infraction {
|
|||||||
if (protection.type === 'position') {
|
if (protection.type === 'position') {
|
||||||
const executorHighest = executor.roles.highest;
|
const executorHighest = executor.roles.highest;
|
||||||
const targetHighest = target.roles.highest;
|
const targetHighest = target.roles.highest;
|
||||||
if (executorHighest.comparePositionTo(targetHighest) < 0) {
|
if (executorHighest.comparePositionTo(targetHighest) <= 0) {
|
||||||
return this._fail('INFRACTION_PROTECTIONPOSITIONERROR');
|
return this._fail('INFRACTION_PROTECTIONPOSITIONERROR');
|
||||||
}
|
}
|
||||||
} else if (protection.type === 'role') {
|
} else if (protection.type === 'role') {
|
||||||
|
Loading…
Reference in New Issue
Block a user