From 2581d9148151b8de98332661d674c505582cc3e6 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 27 Jul 2022 23:38:19 +0300 Subject: [PATCH] response for sharing highest role --- src/localization/en_gb/general/en_gb_moderation.lang | 3 +++ src/structure/interfaces/Infraction.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/localization/en_gb/general/en_gb_moderation.lang b/src/localization/en_gb/general/en_gb_moderation.lang index ff56702..a9b9a9c 100644 --- a/src/localization/en_gb/general/en_gb_moderation.lang +++ b/src/localization/en_gb/general/en_gb_moderation.lang @@ -7,6 +7,9 @@ You can increase the amount of targets by upgrading to premium. [INFRACTION_ERROR] an error occured +[INFRACTION_PROTECTIONPOSITIONERROR_SAME] +they have the same role position as you + [INFRACTION_PROTECTIONPOSITIONERROR] they have hierarchy over you diff --git a/src/structure/interfaces/Infraction.js b/src/structure/interfaces/Infraction.js index 4d521b3..7dc4010 100644 --- a/src/structure/interfaces/Infraction.js +++ b/src/structure/interfaces/Infraction.js @@ -326,9 +326,10 @@ 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_SAME'); + if (executorHighest.comparePositionTo(targetHighest) < 0) return this._fail('INFRACTION_PROTECTIONPOSITIONERROR'); - } } else if (protection.type === 'role') { const contains = target.roles.cache.some((r) => protection.roles.includes(r.id)); if (contains) {