1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-12-02 10:57:46 +01:00

Return a Photo object from getPropicInfo, getPwrChat, getFullInfo

This commit is contained in:
Daniil Gentili 2024-04-27 16:03:13 +02:00
parent a0b9becb31
commit c2b09b6101
7 changed files with 43 additions and 79 deletions

View File

@ -3768,9 +3768,7 @@
<code><![CDATA[$offset['offset']]]></code> <code><![CDATA[$offset['offset']]]></code>
<code><![CDATA[$offset['part_end_at'] - $offset['part_start_at']]]></code> <code><![CDATA[$offset['part_end_at'] - $offset['part_start_at']]]></code>
<code><![CDATA[$offset['part_start_at']]]></code> <code><![CDATA[$offset['part_start_at']]]></code>
<code><![CDATA[$photo]]></code>
<code><![CDATA[$res['mime'] ?? 'image/jpeg']]></code> <code><![CDATA[$res['mime'] ?? 'image/jpeg']]></code>
<code><![CDATA[$size]]></code>
<code><![CDATA[$this->methodCallAsyncRead('upload.getCdnFileHashes', ['file_token' => $file, 'offset' => $offset, 'cancellation' => $cancellation], $this->authorized_dc)]]></code> <code><![CDATA[$this->methodCallAsyncRead('upload.getCdnFileHashes', ['file_token' => $file, 'offset' => $offset, 'cancellation' => $cancellation], $this->authorized_dc)]]></code>
<code><![CDATA[$this->methodCallAsyncRead('upload.reuploadCdnFile', ['file_token' => $messageMedia['file_token'], 'request_token' => $res['request_token'], 'cancellation' => $cancellation], $this->authorized_dc)]]></code> <code><![CDATA[$this->methodCallAsyncRead('upload.reuploadCdnFile', ['file_token' => $messageMedia['file_token'], 'request_token' => $res['request_token'], 'cancellation' => $cancellation], $this->authorized_dc)]]></code>
<code><![CDATA[$url]]></code> <code><![CDATA[$url]]></code>
@ -3873,10 +3871,6 @@
<code><![CDATA[$res['encryption_iv']]]></code> <code><![CDATA[$res['encryption_iv']]]></code>
<code><![CDATA[$res['encryption_key']]]></code> <code><![CDATA[$res['encryption_key']]]></code>
<code><![CDATA[$res['file_token']]]></code> <code><![CDATA[$res['file_token']]]></code>
<code><![CDATA[$res['photo'][$big ? 'big_file_id' : 'small_file_id']]]></code>
<code><![CDATA[$res['photo'][$big ? 'big_file_size' : 'small_file_size']]]></code>
<code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['id']]]></code>
<code><![CDATA[$res['request_token']]]></code> <code><![CDATA[$res['request_token']]]></code>
<code><![CDATA[$res['type']]]></code> <code><![CDATA[$res['type']]]></code>
<code><![CDATA[$res['type']]]></code> <code><![CDATA[$res['type']]]></code>
@ -3941,7 +3935,6 @@
<code><![CDATA[$messageMedia['cdn_key']]]></code> <code><![CDATA[$messageMedia['cdn_key']]]></code>
<code><![CDATA[$messageMedia['decrypted_message']['media']['file']]]></code> <code><![CDATA[$messageMedia['decrypted_message']['media']['file']]]></code>
<code><![CDATA[$messageMedia['file_token']]]></code> <code><![CDATA[$messageMedia['file_token']]]></code>
<code><![CDATA[$photo]]></code>
<code><![CDATA[$res]]></code> <code><![CDATA[$res]]></code>
<code><![CDATA[$res]]></code> <code><![CDATA[$res]]></code>
<code><![CDATA[$res]]></code> <code><![CDATA[$res]]></code>
@ -3979,7 +3972,6 @@
<code><![CDATA[$res['thumb_size']]]></code> <code><![CDATA[$res['thumb_size']]]></code>
<code><![CDATA[$res['thumb_size']]]></code> <code><![CDATA[$res['thumb_size']]]></code>
<code><![CDATA[$res['thumb_size']]]></code> <code><![CDATA[$res['thumb_size']]]></code>
<code><![CDATA[$size]]></code>
<code><![CDATA[$t]]></code> <code><![CDATA[$t]]></code>
<code><![CDATA[$url]]></code> <code><![CDATA[$url]]></code>
</MixedAssignment> </MixedAssignment>
@ -4004,8 +3996,6 @@
<code><![CDATA[$res['name']]]></code> <code><![CDATA[$res['name']]]></code>
<code><![CDATA[$res['name']]]></code> <code><![CDATA[$res['name']]]></code>
<code><![CDATA[$res['name']]]></code> <code><![CDATA[$res['name']]]></code>
<code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['id']]]></code>
</MixedOperand> </MixedOperand>
<MixedPropertyTypeCoercion> <MixedPropertyTypeCoercion>
<code><![CDATA[$this->cdn_hashes]]></code> <code><![CDATA[$this->cdn_hashes]]></code>
@ -4369,6 +4359,7 @@
<code><![CDATA[$chat['id']]]></code> <code><![CDATA[$chat['id']]]></code>
<code><![CDATA[$chat['id']]]></code> <code><![CDATA[$chat['id']]]></code>
<code><![CDATA[$constructor['username']]]></code> <code><![CDATA[$constructor['username']]]></code>
<code><![CDATA[$full[$k]]]></code>
<code><![CDATA[$id]]></code> <code><![CDATA[$id]]></code>
<code><![CDATA[$user['id']]]></code> <code><![CDATA[$user['id']]]></code>
<code><![CDATA[$user['id']]]></code> <code><![CDATA[$user['id']]]></code>
@ -4378,6 +4369,7 @@
<code><![CDATA[$username]]></code> <code><![CDATA[$username]]></code>
</MixedArgument> </MixedArgument>
<MixedArrayAccess> <MixedArrayAccess>
<code><![CDATA[$full[$k]['_']]]></code>
<code><![CDATA[$invite['chat']]]></code> <code><![CDATA[$invite['chat']]]></code>
<code><![CDATA[$this->API->authorization['user']['id']]]></code> <code><![CDATA[$this->API->authorization['user']['id']]]></code>
<code><![CDATA[$this->API->methodCallAsyncRead('help.getSupport', [])['user']]]></code> <code><![CDATA[$this->API->methodCallAsyncRead('help.getSupport', [])['user']]]></code>
@ -4413,8 +4405,8 @@
<code><![CDATA[$this->pendingDb]]></code> <code><![CDATA[$this->pendingDb]]></code>
</MixedPropertyTypeCoercion> </MixedPropertyTypeCoercion>
<MixedReturnStatement> <MixedReturnStatement>
<code><![CDATA[$this->getFull($id)['last_update'] ?? 0]]></code> <code><![CDATA[$this->getFull($id)['inserted'] ?? 0]]></code>
<code><![CDATA[$this->getFull($id)['last_update'] ?? 0]]></code> <code><![CDATA[$this->getFull($id)['inserted'] ?? 0]]></code>
</MixedReturnStatement> </MixedReturnStatement>
<NoValue> <NoValue>
<code><![CDATA[$k]]></code> <code><![CDATA[$k]]></code>
@ -4477,11 +4469,6 @@
<code><![CDATA[$res['id']]]></code> <code><![CDATA[$res['id']]]></code>
<code><![CDATA[$res['participants']]]></code> <code><![CDATA[$res['participants']]]></code>
<code><![CDATA[$res['participants']]]></code> <code><![CDATA[$res['participants']]]></code>
<code><![CDATA[$res['photo']['access_hash']]]></code>
<code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['id']]]></code>
<code><![CDATA[$res['photo']['sizes']]]></code>
<code><![CDATA[$size['type']]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
@ -4496,10 +4483,12 @@
<code><![CDATA[$full['full']['exported_invite']]]></code> <code><![CDATA[$full['full']['exported_invite']]]></code>
<code><![CDATA[$full['full']['exported_invite']['link']]]></code> <code><![CDATA[$full['full']['exported_invite']['link']]]></code>
<code><![CDATA[$full['full']['exported_invite']['link']]]></code> <code><![CDATA[$full['full']['exported_invite']['link']]]></code>
<code><![CDATA[$full['full']['fallback_photo']]]></code>
<code><![CDATA[$full['full']['participants']]]></code> <code><![CDATA[$full['full']['participants']]]></code>
<code><![CDATA[$full['full']['participants']]]></code> <code><![CDATA[$full['full']['participants']]]></code>
<code><![CDATA[$full['full']['participants']['participants']]]></code> <code><![CDATA[$full['full']['participants']['participants']]]></code>
<code><![CDATA[$full['full']['participants']['participants']]]></code> <code><![CDATA[$full['full']['participants']['participants']]]></code>
<code><![CDATA[$full['full']['personal_photo']]]></code>
<code><![CDATA[$full['full']['profile_photo']]]></code> <code><![CDATA[$full['full']['profile_photo']]]></code>
<code><![CDATA[$gres['_']]]></code> <code><![CDATA[$gres['_']]]></code>
<code><![CDATA[$id['chat']['id']]]></code> <code><![CDATA[$id['chat']['id']]]></code>
@ -4530,16 +4519,6 @@
<code><![CDATA[$participant['user_id']]]></code> <code><![CDATA[$participant['user_id']]]></code>
<code><![CDATA[$participant['user_id']]]></code> <code><![CDATA[$participant['user_id']]]></code>
<code><![CDATA[$participant['user_id']]]></code> <code><![CDATA[$participant['user_id']]]></code>
<code><![CDATA[$res['photo']['access_hash']]]></code>
<code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['file_reference']]]></code>
<code><![CDATA[$res['photo']['file_reference']]]></code>
<code><![CDATA[$res['photo']['id']]]></code>
<code><![CDATA[$res['photo']['sizes']]]></code>
<code><![CDATA[$res['photo']['sizes']]]></code>
<code><![CDATA[$res['photo']['sizes'][0]]]></code>
<code><![CDATA[$size['size']]]></code>
<code><![CDATA[$size['type']]]></code>
<code><![CDATA[$support['user']['id']]]></code> <code><![CDATA[$support['user']['id']]]></code>
<code><![CDATA[$this->TL->getConstructors()->findByPredicate($constructor['_'])['type']]]></code> <code><![CDATA[$this->TL->getConstructors()->findByPredicate($constructor['_'])['type']]]></code>
<code><![CDATA[$this->authorization['user']['id']]]></code> <code><![CDATA[$this->authorization['user']['id']]]></code>
@ -4580,7 +4559,6 @@
<code><![CDATA[$participant]]></code> <code><![CDATA[$participant]]></code>
<code><![CDATA[$participant]]></code> <code><![CDATA[$participant]]></code>
<code><![CDATA[$participant]]></code> <code><![CDATA[$participant]]></code>
<code><![CDATA[$photo[$type.'_file_size']]]></code>
<code><![CDATA[$res[$key]]]></code> <code><![CDATA[$res[$key]]]></code>
<code><![CDATA[$res[$key]]]></code> <code><![CDATA[$res[$key]]]></code>
<code><![CDATA[$res[$key]]]></code> <code><![CDATA[$res[$key]]]></code>
@ -4592,16 +4570,16 @@
<code><![CDATA[$res['bot_api_id']]]></code> <code><![CDATA[$res['bot_api_id']]]></code>
<code><![CDATA[$res['channel_id']]]></code> <code><![CDATA[$res['channel_id']]]></code>
<code><![CDATA[$res['chat_id']]]></code> <code><![CDATA[$res['chat_id']]]></code>
<code><![CDATA[$res['fallback_photo']]]></code>
<code><![CDATA[$res['invite']]]></code> <code><![CDATA[$res['invite']]]></code>
<code><![CDATA[$res['invite']]]></code> <code><![CDATA[$res['invite']]]></code>
<code><![CDATA[$res['participants']]]></code> <code><![CDATA[$res['participants']]]></code>
<code><![CDATA[$res['participants']]]></code> <code><![CDATA[$res['participants']]]></code>
<code><![CDATA[$res['photo']]]></code> <code><![CDATA[$res['personal_photo']]]></code>
<code><![CDATA[$res['photo']]]></code> <code><![CDATA[$res['photo']]]></code>
<code><![CDATA[$res['photo']]]></code> <code><![CDATA[$res['photo']]]></code>
<code><![CDATA[$res['photo']]]></code> <code><![CDATA[$res['photo']]]></code>
<code><![CDATA[$res['user_id']]]></code> <code><![CDATA[$res['user_id']]]></code>
<code><![CDATA[$size]]></code>
<code><![CDATA[$this->supportUser]]></code> <code><![CDATA[$this->supportUser]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
</MixedAssignment> </MixedAssignment>
@ -4610,11 +4588,10 @@
</MixedMethodCall> </MixedMethodCall>
<MixedOperand> <MixedOperand>
<code><![CDATA[$constructor['_']]]></code> <code><![CDATA[$constructor['_']]]></code>
<code><![CDATA[$full['last_update'] ?? 0]]></code> <code><![CDATA[$full['inserted'] ?? 0]]></code>
<code><![CDATA[$gres['count']]]></code> <code><![CDATA[$gres['count']]]></code>
<code><![CDATA[$id['_']]]></code> <code><![CDATA[$id['_']]]></code>
<code><![CDATA[$res['admins_count'] ?? 0]]></code> <code><![CDATA[$res['admins_count'] ?? 0]]></code>
<code><![CDATA[$res['photo']]]></code>
<code><![CDATA[($res['participants_count'] ?? 0) + ($res['admins_count'] ?? 0)]]></code> <code><![CDATA[($res['participants_count'] ?? 0) + ($res['admins_count'] ?? 0)]]></code>
<code><![CDATA[-$constructor['id']]]></code> <code><![CDATA[-$constructor['id']]]></code>
<code><![CDATA[-$constructor['id']]]></code> <code><![CDATA[-$constructor['id']]]></code>
@ -6718,9 +6695,11 @@
<code><![CDATA[$data['document']['mime_type']]]></code> <code><![CDATA[$data['document']['mime_type']]]></code>
<code><![CDATA[$data['document']['mime_type']]]></code> <code><![CDATA[$data['document']['mime_type']]]></code>
<code><![CDATA[$data['document']['size']]]></code> <code><![CDATA[$data['document']['size']]]></code>
<code><![CDATA[$data['photo']['sizes']]]></code>
</PossiblyNullArrayAccess> </PossiblyNullArrayAccess>
<PossiblyNullIterator> <PossiblyNullIterator>
<code><![CDATA[$data['document']['attributes']]]></code> <code><![CDATA[$data['document']['attributes']]]></code>
<code><![CDATA[$data['photo']['sizes']]]></code>
</PossiblyNullIterator> </PossiblyNullIterator>
<PossiblyNullReference> <PossiblyNullReference>
<code><![CDATA[$data['document']]]></code> <code><![CDATA[$data['document']]]></code>
@ -6738,6 +6717,7 @@
<code><![CDATA[$arguments[$key]]]></code> <code><![CDATA[$arguments[$key]]]></code>
<code><![CDATA[$arguments[$key]]]></code> <code><![CDATA[$arguments[$key]]]></code>
<code><![CDATA[$data['document']]]></code> <code><![CDATA[$data['document']]]></code>
<code><![CDATA[$data['photo']]]></code>
</PossiblyUndefinedArrayOffset> </PossiblyUndefinedArrayOffset>
</file> </file>
<file src="src/TL/Conversion/BotAPIFiles.php"> <file src="src/TL/Conversion/BotAPIFiles.php">

View File

@ -51,7 +51,7 @@ final class API extends AbstractAPI
* *
* @var string * @var string
*/ */
public const RELEASE = '8.0.0'; public const RELEASE = '8.0.0-beta205';
/** /**
* We're not logged in. * We're not logged in.
* *

View File

@ -997,9 +997,9 @@ abstract class InternalDoc
/** /**
* Gets info of the propic of a user. * Gets info of the propic of a user.
*/ */
final public function getPropicInfo($data, bool $big = true): \danog\MadelineProto\BotApiFileId final public function getPropicInfo($data): ?\danog\MadelineProto\EventHandler\Media\Photo
{ {
return $this->wrapper->getAPI()->getPropicInfo($data, $big); return $this->wrapper->getAPI()->getPropicInfo($data);
} }
/** /**
* Get PSR logger. * Get PSR logger.

View File

@ -661,13 +661,9 @@ trait Files
/** /**
* Gets info of the propic of a user. * Gets info of the propic of a user.
*/ */
public function getPropicInfo($data, bool $big = true): BotApiFileId public function getPropicInfo($data): ?Photo
{ {
$res = $this->getPwrChat($data, false); return $this->getPwrChat($data, false)['photo'] ?? null;
$photo = $res['photo'][$big ? 'big_file_id' : 'small_file_id'];
$size = $res['photo'][$big ? 'big_file_size' : 'small_file_size'];
$name = $res['photo']['id'].'_'.($big ? 'big' : 'small').'_'.$res['photo']['dc_id'];
return new BotApiFileId($photo, $size, $name, false);
} }
/** /**
* Extract file info from bot API message. * Extract file info from bot API message.

View File

@ -28,6 +28,7 @@ use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\DbArrayBuilder; use danog\AsyncOrm\DbArrayBuilder;
use danog\AsyncOrm\KeyType; use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\ValueType; use danog\AsyncOrm\ValueType;
use danog\MadelineProto\EventHandler\Media\Photo;
use danog\MadelineProto\Exception; use danog\MadelineProto\Exception;
use danog\MadelineProto\LegacyMigrator; use danog\MadelineProto\LegacyMigrator;
use danog\MadelineProto\Logger; use danog\MadelineProto\Logger;
@ -255,7 +256,7 @@ final class PeerDatabase implements TLCallback
*/ */
public function fullChatLastUpdated(mixed $id): int public function fullChatLastUpdated(mixed $id): int
{ {
return $this->getFull($id)['last_update'] ?? 0; return $this->getFull($id)['inserted'] ?? 0;
} }
private function recacheChatUsername(int $id, ?array $old, array $new): void private function recacheChatUsername(int $id, ?array $old, array $new): void
@ -584,9 +585,18 @@ final class PeerDatabase implements TLCallback
*/ */
private function addFullChat(array $full): void private function addFullChat(array $full): void
{ {
foreach (['chat_photo', 'personal_photo', 'fallback_photo', 'profile_photo'] as $k) {
if (isset($full[$k])) {
if ($full[$k]['_'] === 'photoEmpty') {
unset($full[$k]);
} else {
$full[$k] = new Photo($this->API, $full[$k], false);
}
}
}
$this->fullDb[$this->API->getIdInternal($full)] = [ $this->fullDb[$this->API->getIdInternal($full)] = [
'full' => $full, 'full' => $full,
'last_update' => time(), 'inserted' => time(),
]; ];
} }

View File

@ -21,9 +21,6 @@ declare(strict_types=1);
namespace danog\MadelineProto\MTProtoTools; namespace danog\MadelineProto\MTProtoTools;
use AssertionError; use AssertionError;
use danog\Decoder\FileId;
use danog\Decoder\FileIdType;
use danog\Decoder\PhotoSizeSource\PhotoSizeSourceThumbnail;
use danog\MadelineProto\API; use danog\MadelineProto\API;
use danog\MadelineProto\Exception; use danog\MadelineProto\Exception;
use danog\MadelineProto\Logger; use danog\MadelineProto\Logger;
@ -633,7 +630,7 @@ trait PeerHandler
*/ */
public function fullChatLastUpdated(mixed $id): int public function fullChatLastUpdated(mixed $id): int
{ {
return $this->peerDatabase->getFull($this->getIdInternal($id))['last_update'] ?? 0; return $this->peerDatabase->getFull($this->getIdInternal($id))['inserted'] ?? 0;
} }
/** /**
* Get full info about peer, returns an FullInfo object. * Get full info about peer, returns an FullInfo object.
@ -648,7 +645,7 @@ trait PeerHandler
return $partial; return $partial;
} }
$full = $this->peerDatabase->getFull($partial['bot_api_id']); $full = $this->peerDatabase->getFull($partial['bot_api_id']);
if (time() - ($full['last_update'] ?? 0) < $this->getSettings()->getPeer()->getFullInfoCacheTime()) { if (time() - ($full['inserted'] ?? 0) < $this->getSettings()->getPeer()->getFullInfoCacheTime()) {
return array_merge($partial, $full); return array_merge($partial, $full);
} }
switch ($partial['type']) { switch ($partial['type']) {
@ -693,9 +690,15 @@ trait PeerHandler
$res[$key] = $full['full'][$key]; $res[$key] = $full['full'][$key];
} }
} }
if (isset($full['full']['profile_photo']['sizes'])) { if (isset($full['full']['profile_photo'])) {
$res['photo'] = $full['full']['profile_photo']; $res['photo'] = $full['full']['profile_photo'];
} }
if (isset($full['full']['fallback_photo'])) {
$res['fallback_photo'] = $full['full']['fallback_photo'];
}
if (isset($full['full']['personal_photo'])) {
$res['personal_photo'] = $full['full']['personal_photo'];
}
break; break;
case 'chat': case 'chat':
foreach (['title', 'participants_count', 'admin', 'admins_enabled'] as $key) { foreach (['title', 'participants_count', 'admin', 'admins_enabled'] as $key) {
@ -711,7 +714,7 @@ trait PeerHandler
if (isset($res['admins_enabled'])) { if (isset($res['admins_enabled'])) {
$res['all_members_are_administrators'] = !$res['admins_enabled']; $res['all_members_are_administrators'] = !$res['admins_enabled'];
} }
if (isset($full['full']['chat_photo']['sizes'])) { if (isset($full['full']['chat_photo'])) {
$res['photo'] = $full['full']['chat_photo']; $res['photo'] = $full['full']['chat_photo'];
} }
if (isset($full['full']['exported_invite']['link'])) { if (isset($full['full']['exported_invite']['link'])) {
@ -733,7 +736,7 @@ trait PeerHandler
$res[$key] = $full['full'][$key]; $res[$key] = $full['full'][$key];
} }
} }
if (isset($full['full']['chat_photo']['sizes'])) { if (isset($full['full']['chat_photo'])) {
$res['photo'] = $full['full']['chat_photo']; $res['photo'] = $full['full']['chat_photo'];
} }
if (isset($full['full']['exported_invite']['link'])) { if (isset($full['full']['exported_invite']['link'])) {
@ -814,34 +817,6 @@ trait PeerHandler
if (!$fullfetch) { if (!$fullfetch) {
unset($res['participants']); unset($res['participants']);
} }
if (isset($res['photo'])) {
$photo = [];
foreach ([
'small' => $res['photo']['sizes'][0],
'big' => Tools::maxSize($res['photo']['sizes']),
] as $type => $size) {
$photoSizeSource = new PhotoSizeSourceThumbnail(
thumbType: $size['type'],
thumbFileType: FileIdType::PHOTO
);
$fileId = new FileId(
dcId: $res['photo']['dc_id'],
type: FileIdType::PHOTO,
id: $res['photo']['id'],
accessHash: $res['photo']['access_hash'],
fileReference: $res['photo']['file_reference'] === null
? null
: (string) $res['photo']['file_reference'],
photoSizeSource: $photoSizeSource
);
$photo[$type.'_file_size'] = $size['size'];
$photo[$type.'_file_id'] = (string) $fileId;
$photo[$type.'_file_unique_id'] = $fileId->getUniqueBotAPI();
}
$res['photo'] += $photo;
}
return $res; return $res;
} }
private function recurseAlphabetSearchParticipants(int $channel, string $filter, string $q, int $total_count, array &$res, int $depth): array private function recurseAlphabetSearchParticipants(int $channel, string $filter, string $q, int $total_count, array &$res, int $depth): array

View File

@ -227,6 +227,9 @@ trait BotAPI
$data['user'] = ($this->getPwrChat($data['user_id'], false)); $data['user'] = ($this->getPwrChat($data['user_id'], false));
unset($data['user_id']); unset($data['user_id']);
return $data; return $data;
case 'photo':
$data = ['photo' => $data];
// no break
case 'messageMediaPhoto': case 'messageMediaPhoto':
if (isset($data['caption'])) { if (isset($data['caption'])) {
$res['caption'] = $data['caption']; $res['caption'] = $data['caption'];