diff --git a/VKAPI/Handlers/Utils.php b/VKAPI/Handlers/Utils.php index 7144a39a..e07de834 100644 --- a/VKAPI/Handlers/Utils.php +++ b/VKAPI/Handlers/Utils.php @@ -1,10 +1,37 @@ getMatchingRoute("/$screen_name")[0]->presenter !== "UnknownTextRouteStrategy") { + if (substr($screen_name, 0, strlen("id")) === "id") { + return (object) [ + "object_id" => intval(substr($screen_name, strlen("id"))), + "type" => "user" + ]; + } else if (substr($screen_name, 0, strlen("club")) === "club") { + return (object) [ + "object_id" => intval(substr($screen_name, strlen("club"))), + "type" => "group" + ]; + } + } else { + $alias = (new Aliases)->getByShortCode($screen_name); + if (!$alias) return (object)[]; + return (object) [ + "object_id" => $alias->getOwnerId(), + "type" => $alias->getType() + ]; + } + } }