role position comparison fix

This commit is contained in:
Erik 2022-07-27 23:32:35 +03:00
parent 2bec9eee0f
commit c9a10bb34a
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -9,6 +9,7 @@ const {
} = require('../../constants');
const { Util } = require('../../utilities');
const { inspect } = require('util');
const Constants = {
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;
return this.client.storageManager.mongodb.infractions.updateOne(filter, this.json)
.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') {
const executorHighest = executor.roles.highest;
const targetHighest = target.roles.highest;
if (executorHighest.comparePositionTo(targetHighest) < 0) {
if (executorHighest.comparePositionTo(targetHighest) <= 0) {
return this._fail('INFRACTION_PROTECTIONPOSITIONERROR');
}
} else if (protection.type === 'role') {