response for sharing highest role

This commit is contained in:
Erik 2022-07-27 23:38:19 +03:00
parent c9a10bb34a
commit 2581d91481
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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) {