diff --git a/README.md b/README.md
index be5bc274..09b54e7a 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,8 @@ Features:
* It allows you to do everything official clients can do, programmatically!
+* It can be proxied!
+
* It is very fast!
* It can be easily serialized!
diff --git a/ab.php b/ab.php
deleted file mode 100644
index fc7c2b18..00000000
--- a/ab.php
+++ /dev/null
@@ -1,4 +0,0 @@
-
[$documentAttributeAnimated\_23](../constructors/documentAttributeAnimated_23.md) = \[\];
***
-
[$documentAttributeAudio\_23](../constructors/documentAttributeAudio_23.md) = \['duration' => [int](../types/int.md), \];
+
[$documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md) = \['duration' => [int](../types/int.md), 'title' => [string](../types/string.md), 'performer' => [string](../types/string.md), \];
***
[$documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md) = \['file_name' => [string](../types/string.md), \];
@@ -379,10 +379,10 @@ description: List of constructors
[$documentAttributeImageSize\_23](../constructors/documentAttributeImageSize_23.md) = \['w' => [int](../types/int.md), 'h' => [int](../types/int.md), \];
***
-
[$documentAttributeSticker\_23](../constructors/documentAttributeSticker_23.md) = \[\];
+
[$documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md) = \['alt' => [string](../types/string.md), 'stickerset' => [InputStickerSet](../types/InputStickerSet.md), \];
***
-
[$documentAttributeVideo\_23](../constructors/documentAttributeVideo_23.md) = \['duration' => [int](../types/int.md), 'w' => [int](../types/int.md), 'h' => [int](../types/int.md), \];
+
[$documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md) = \['round_message' => [Bool](../types/Bool.md), 'duration' => [int](../types/int.md), 'w' => [int](../types/int.md), 'h' => [int](../types/int.md), \];
***
[$documentEmpty](../constructors/documentEmpty.md) = \['id' => [long](../types/long.md), \];
diff --git a/docs/API_docs/types/DocumentAttribute.md b/docs/API_docs/types/DocumentAttribute.md
index cddf948e..98e1741b 100644
--- a/docs/API_docs/types/DocumentAttribute.md
+++ b/docs/API_docs/types/DocumentAttribute.md
@@ -35,6 +35,12 @@ description: constructors and methods of type DocumentAttribute
[documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md)
+[documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md)
+
+[documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md)
+
+[documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md)
+
### Methods that return an object of this type (methods):
diff --git a/docs/index.md b/docs/index.md
index be5bc274..9a2bb994 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,3 +1,7 @@
+---
+title: MadelineProto documentation
+description: PHP implementation of telegram's MTProto protocol
+---
# MadelineProto
[![StyleCI](https://styleci.io/repos/61838413/shield)](https://styleci.io/repos/61838413)
[![Build Status](https://travis-ci.org/danog/MadelineProto.svg?branch=master)](https://travis-ci.org/danog/MadelineProto)
@@ -24,6 +28,8 @@ Features:
* It allows you to do everything official clients can do, programmatically!
+* It can be proxied!
+
* It is very fast!
* It can be easily serialized!
diff --git a/secret_bot.php b/secret_bot.php
index bfdd720d..4979d7e5 100755
--- a/secret_bot.php
+++ b/secret_bot.php
@@ -80,6 +80,7 @@ while (true) {
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
//\danog\MadelineProto\Logger::log([$updates]);
foreach ($updates as $update) {
+ echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('s.madeline', $MadelineProto).' bytes'.PHP_EOL;
$offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id
switch ($update['update']['_']) {
/*case 'updateNewChannelMessage':
@@ -88,9 +89,9 @@ while (true) {
break;*/
case 'updateNewMessage':
if ($update['update']['message']['out'] || $update['update']['message']['message'] === '') continue;
-var_dump($update);
break;
case 'updateNewEncryptedMessage':
+ var_dump($MadelineProto->download_to_dir($update['update']['message'], '.'));
if (isset($sent[$update['update']['message']['chat_id']])) continue;
$i = 0;
while ($i < $argv[1]) {
diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php
index d3eacef2..2ab82b2a 100644
--- a/src/danog/MadelineProto/MTProtoTools/Files.php
+++ b/src/danog/MadelineProto/MTProtoTools/Files.php
@@ -95,6 +95,9 @@ trait Files
$res = [];
switch ($message_media['_']) {
case 'encryptedMessage':
+ if ($message_media['decrypted_message']['media']['_'] === 'decryptedMessageMediaExternalDocument') {
+ return $this->get_download_info($message_media['decrypted_message']['media']);
+ }
$res['InputFileLocation'] = ['_' => 'inputEncryptedFileLocation', 'id' => $message_media['file']['id'], 'access_hash' => $message_media['file']['access_hash'], 'dc_id' => $message_media['file']['dc_id']];
$res['size'] = $message_media['decrypted_message']['media']['size'];
$res['key_fingerprint'] = $message_media['file']['key_fingerprint'];
@@ -109,7 +112,10 @@ trait Files
}
if (isset($message_media['decrypted_message']['media']['mime_type'])) {
$res['mime'] = $message_media['decrypted_message']['media']['mime_type'];
+ } else if ($message_media['decrypted_message']['media']['_'] === 'decryptedMessageMediaPhoto') {
+ $res['mime'] = 'image/jpeg';
}
+
if (isset($message_media['decrypted_message']['media']['attributes'])) {
foreach ($message_media['decrypted_message']['media']['attributes'] as $attribute) {
switch ($attribute['_']) {
diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
index 3afaa288..a602c463 100644
--- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
+++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
@@ -26,9 +26,9 @@ trait PeerHandler
switch ($user['_']) {
case 'user':
if (!isset($this->chats[$user['id']]) || $this->chats[$user['id']] !== $user) {
- foreach (str_split(pack('q', $user['access_hash'])) as $char) {
+ /*foreach (str_split(pack('q', $user['access_hash'])) as $char) {
var_dump(ord($char));
- }
+ }*/
$this->chats[$user['id']] = $user;
try {
$this->get_pwr_chat($user['id'], false, true);
diff --git a/src/danog/MadelineProto/SecretChats/AuthKeyHandler.php b/src/danog/MadelineProto/SecretChats/AuthKeyHandler.php
index b637d0ee..10c6b3b3 100644
--- a/src/danog/MadelineProto/SecretChats/AuthKeyHandler.php
+++ b/src/danog/MadelineProto/SecretChats/AuthKeyHandler.php
@@ -22,8 +22,7 @@ trait AuthKeyHandler
protected $temp_requested_secret_chats = [];
protected $secret_chats = [];
- public function accept_secret_chat($params)
- {
+ public function accept_secret_chat($params) {
//var_dump($params['id'],$this->secret_chat_status($params['id']));
if ($this->secret_chat_status($params['id']) !== 0) {
//var_dump($this->secret_chat_status($params['id']));
diff --git a/tests/testing.php b/tests/testing.php
index cac596de..72b82cff 100755
--- a/tests/testing.php
+++ b/tests/testing.php
@@ -94,7 +94,7 @@ var_dump($MadelineProto->get_call($call));
$InputEncryptedChat = $MadelineProto->get_secret_chat($secret)['InputEncryptedChat'];
$sentMessage = $MadelineProto->messages->sendEncrypted(['peer' => $InputEncryptedChat, 'message' => ['_' => 'decryptedMessage', 'media' => ['_' => 'decryptedMessageMediaEmpty'], 'ttl' => 10, 'message' => $message, 'entities' => [['_' => 'messageEntityCode', 'offset' => 0, 'length' => mb_strlen($message)]]]]); // should work with all layers
\danog\MadelineProto\Logger::log([$sentMessage], \danog\MadelineProto\Logger::NOTICE);
-
+ /*
while (true) {
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
//\danog\MadelineProto\Logger::log([$updates]);
@@ -106,7 +106,7 @@ var_dump($MadelineProto->get_call($call));
}
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL;
}
- }
+ }*/
$secret_media = [];