From 4b561510e703102c24f93b7b32cbfbcee81d4f4d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 19 May 2017 16:35:09 +0100 Subject: [PATCH] Added support for video notes (round videos) --- src/danog/MadelineProto/MTProto.php | 2 +- src/danog/MadelineProto/TL/Conversion/BotAPI.php | 2 +- src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php | 10 +++++++++- src/danog/MadelineProto/TL_botAPI.tl | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 833a73ba..c956a62d 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -617,7 +617,7 @@ class MTProto extends \Volatile public function getV() { - return 30; + return 31; } public function get_self() diff --git a/src/danog/MadelineProto/TL/Conversion/BotAPI.php b/src/danog/MadelineProto/TL/Conversion/BotAPI.php index 8191cf98..4c0d9f76 100644 --- a/src/danog/MadelineProto/TL/Conversion/BotAPI.php +++ b/src/danog/MadelineProto/TL/Conversion/BotAPI.php @@ -275,7 +275,7 @@ trait BotAPI break; case 'documentAttributeVideo': - $type_name = 'video'; + $type_name = $attribute['round_message'] ? 'video_note' : 'video'; $res['width'] = $attribute['w']; $res['height'] = $attribute['h']; $res['duration'] = $attribute['duration']; diff --git a/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php b/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php index ab4055bc..11ebcb28 100644 --- a/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php +++ b/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php @@ -116,7 +116,15 @@ trait BotAPIFiles case 'bot_video': unset($deserialized['_']); - $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeVideo']]]); + $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeVideo', 'round_message' => false]]]); + + $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; + + return $res; + + case 'bot_video_note': + unset($deserialized['_']); + $constructor = array_merge($deserialized, ['_' => 'document', 'mime_type' => '', 'attributes' => [['_' => 'documentAttributeVideo', 'round_message' => true]]]); $res['MessageMedia'] = ['_' => 'messageMediaDocument', 'document' => $constructor, 'caption' => '']; diff --git a/src/danog/MadelineProto/TL_botAPI.tl b/src/danog/MadelineProto/TL_botAPI.tl index 6d940faa..0dc9f6c6 100644 --- a/src/danog/MadelineProto/TL_botAPI.tl +++ b/src/danog/MadelineProto/TL_botAPI.tl @@ -6,4 +6,4 @@ bot_document#5 dc_id:int id:long access_hash:long = File; bot_sticker#8 dc_id:int id:long access_hash:long = File; bot_audio#9 dc_id:int id:long access_hash:long = File; bot_gif#A dc_id:int id:long access_hash:long = File; -bot_roundvideo#D dc_id:int id:long access_hash:long = File; +bot_video_note#D dc_id:int id:long access_hash:long = File;