VKAPI: Fix 500 error if user didn't subscribed or created a group

VKAPI: Add avatar sizes to the Groups.get method

VKAPI: Fix strange avatar behaviour
This commit is contained in:
veselcraft 2022-07-21 00:37:31 +03:00
parent f5bec29bf6
commit 2e1ef59353
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
2 changed files with 60 additions and 41 deletions

View file

@ -37,6 +37,7 @@ final class Groups extends VKAPIRequestHandler
if(sizeof($clbs) > $count) $ic = $count; if(sizeof($clbs) > $count) $ic = $count;
if (!empty($clbs)) {
$clbs = array_slice($clbs, $offset * $count); $clbs = array_slice($clbs, $offset * $count);
for ($i=0; $i < $ic; $i++) { for ($i=0; $i < $ic; $i++) {
@ -73,7 +74,22 @@ final class Groups extends VKAPIRequestHandler
$rClubs[$i]->photo_max_orig = $usr->getAvatarURL(); $rClubs[$i]->photo_max_orig = $usr->getAvatarURL();
break; break;
case 'photo_max': case 'photo_max':
$rClubs[$i]->photo_max = $usr->getAvatarURL(); $rClubs[$i]->photo_max = $usr->getAvatarURL("original"); // ORIGINAL ANDREI CHINITEL 🥵🥵🥵🥵
break;
case 'photo_50':
$rClubs[$i]->photo_50 = $usr->getAvatarURL();
break;
case 'photo_100':
$rClubs[$i]->photo_100 = $usr->getAvatarURL("tiny");
break;
case 'photo_200':
$rClubs[$i]->photo_200 = $usr->getAvatarURL("normal");
break;
case 'photo_200_orig':
$rClubs[$i]->photo_200_orig = $usr->getAvatarURL("normal");
break;
case 'photo_400_orig':
$rClubs[$i]->photo_400_orig = $usr->getAvatarURL("normal");
break; break;
case 'members_count': case 'members_count':
$rClubs[$i]->members_count = $usr->getFollowersCount(); $rClubs[$i]->members_count = $usr->getFollowersCount();
@ -82,6 +98,9 @@ final class Groups extends VKAPIRequestHandler
} }
} }
} }
} else {
$rClubs = [];
}
return (object) [ return (object) [
"count" => $clbsCount, "count" => $clbsCount,

View file

@ -68,16 +68,16 @@ final class Users extends VKAPIRequestHandler
$response[$i]->photo_50 = $usr->getAvatarURL(); $response[$i]->photo_50 = $usr->getAvatarURL();
break; break;
case 'photo_100': case 'photo_100':
$response[$i]->photo_50 = $usr->getAvatarURL("tiny"); $response[$i]->photo_100 = $usr->getAvatarURL("tiny");
break; break;
case 'photo_200': case 'photo_200':
$response[$i]->photo_50 = $usr->getAvatarURL("normal"); $response[$i]->photo_200 = $usr->getAvatarURL("normal");
break; break;
case 'photo_200_orig': # вообще не ебу к чему эта строка ну пусть будет кек case 'photo_200_orig': # вообще не ебу к чему эта строка ну пусть будет кек
$response[$i]->photo_50 = $usr->getAvatarURL("normal"); $response[$i]->photo_200_orig = $usr->getAvatarURL("normal");
break; break;
case 'photo_400_orig': case 'photo_400_orig':
$response[$i]->photo_50 = $usr->getAvatarURL("normal"); $response[$i]->photo_400_orig = $usr->getAvatarURL("normal");
break; break;
# Она хочет быть выебанной видя матан # Она хочет быть выебанной видя матан