Skip to content

Commit

Permalink
Role positions check updated, Release v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JaxkDev committed Dec 2, 2021
1 parent 3fbeb57 commit 82ab054
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Bot/Handlers/CommunicationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,12 @@ private function handleUpdateRolePosition(Role $role): PromiseInterface{
return $role->position;
}, $arr));
$val = array_keys($arr);
$data = array_combine($keys, $val);
/*if($data === false){
$promise->reject(new ApiRejection("Internal error occurred while updating role positions."));
throw new \AssertionError("Keys do not match the associated ID's of the role positions. (If you see this please open a github issue.)");
}*/
try{
$data = array_combine($keys, $val); //Throws valueError on >= PHP8, returns false on < PHP8.
}catch(\ValueError $e){
$promise->reject(new ApiRejection("Internal error occurred while updating role positions. (".$e->getMessage().")"));
return;
}
/** @var DiscordRole|null $k */
$k = $arr[$role->getId()];
if($k === null){
Expand Down

0 comments on commit 82ab054

Please sign in to comment.