mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-26 20:04:45 +01:00
Fix bug with messageMediaWebPage cloning
This commit is contained in:
parent
a743b749d7
commit
7f942b4be1
@ -159,12 +159,26 @@ class Client {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$hasMedia = function($media = []) {
|
||||
foreach ($media as $el) {
|
||||
if (
|
||||
isset($el['_']) &&
|
||||
!in_array($el['_'],['messageMediaWebPage'])
|
||||
){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
foreach ($response['messages'] as $message) {
|
||||
$messageData = [
|
||||
'message' => $message['message'] ?? '',
|
||||
'peer' => $data['to_peer'],
|
||||
];
|
||||
if (array_key_exists('media', $message)) {
|
||||
if (
|
||||
$hasMedia($message['media'] ?? [])
|
||||
) {
|
||||
$messageData['media'] = $message; //MadelineProto сама достанет все media из сообщения.
|
||||
$result[] = $this->sendMedia($messageData);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user