File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,11 @@ public function addRole($role, ?string $reason = null): PromiseInterface
303303 return reject (new NoPermissionsException ("You do not have permission to add member role in the guild {$ guild ->id }. " ));
304304 }
305305 }
306+ if ($ botHighestRole = $ guild ->roles ->getCurrentMemberHighestRole ()) {
307+ if ($ botHighestRole ->comparePosition ($ this ) <= 0 ) {
308+ return reject (new NoPermissionsException ("The bot's highest role is not higher than the role {$ this ->id } in guild {$ this ->guild_id }. " ));
309+ }
310+ }
306311 }
307312
308313 $ headers = [];
@@ -342,6 +347,11 @@ public function removeRole($role, ?string $reason = null): PromiseInterface
342347 return reject (new NoPermissionsException ("You do not have permission to remove member role in the guild {$ guild ->id }. " ));
343348 }
344349 }
350+ if ($ botHighestRole = $ guild ->roles ->getCurrentMemberHighestRole ()) {
351+ if ($ botHighestRole ->comparePosition ($ this ) <= 0 ) {
352+ return reject (new NoPermissionsException ("The bot's highest role is not higher than the role {$ this ->id } in guild {$ this ->guild_id }. " ));
353+ }
354+ }
345355 }
346356
347357 $ headers = [];
You can’t perform that action at this time.
0 commit comments