From c9a10bb34a5ce5757c26d497c33adf9cf26bfd86 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 27 Jul 2022 23:32:35 +0300 Subject: [PATCH] role position comparison fix --- src/structure/interfaces/Infraction.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/structure/interfaces/Infraction.js b/src/structure/interfaces/Infraction.js index a70e2b4..4d521b3 100644 --- a/src/structure/interfaces/Infraction.js +++ b/src/structure/interfaces/Infraction.js @@ -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') {