diff --git a/src/danog/MadelineProto/Db/DbArray.php b/src/danog/MadelineProto/Db/DbArray.php index eedd250a..f98a7991 100644 --- a/src/danog/MadelineProto/Db/DbArray.php +++ b/src/danog/MadelineProto/Db/DbArray.php @@ -14,7 +14,7 @@ interface DbArray extends DbType, \ArrayAccess, \Countable public function offsetUnset($offset): Promise; public function count(): Promise; public function getIterator(): Producer; - + /** * @deprecated * @internal diff --git a/src/danog/MadelineProto/Db/Driver/Redis.php b/src/danog/MadelineProto/Db/Driver/Redis.php index 3829afe8..48dae48c 100644 --- a/src/danog/MadelineProto/Db/Driver/Redis.php +++ b/src/danog/MadelineProto/Db/Driver/Redis.php @@ -5,7 +5,6 @@ namespace danog\MadelineProto\Db\Driver; use Amp\Redis\Config; use Amp\Redis\Redis as RedisRedis; use Amp\Redis\RemoteExecutorFactory; -use Amp\Sql\Common\ConnectionPool; class Redis { diff --git a/src/danog/MadelineProto/Db/DriverArray.php b/src/danog/MadelineProto/Db/DriverArray.php index e01bd3bd..60119156 100644 --- a/src/danog/MadelineProto/Db/DriverArray.php +++ b/src/danog/MadelineProto/Db/DriverArray.php @@ -18,7 +18,7 @@ abstract class DriverArray implements DbArray { throw new \RuntimeException('Native isset not support promises. Use isset method'); } - + abstract protected function initConnection(array $settings): \Generator; /** diff --git a/src/danog/MadelineProto/Db/MysqlArray.php b/src/danog/MadelineProto/Db/MysqlArray.php index f08f74d8..a8ff394e 100644 --- a/src/danog/MadelineProto/Db/MysqlArray.php +++ b/src/danog/MadelineProto/Db/MysqlArray.php @@ -21,7 +21,7 @@ class MysqlArray extends SqlArray { return ['table', 'settings']; } - + /** * Check if key isset. * diff --git a/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php b/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php index 883cdb36..5f1d178c 100644 --- a/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php +++ b/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php @@ -476,7 +476,14 @@ trait ResponseHandler } $botAPI = isset($request['botAPI']) && $request['botAPI']; if (isset($response['_']) && !$this->isCdn() && $this->API->getTL()->getConstructors()->findByPredicate($response['_'])['type'] === 'Updates') { - $response['request'] = ['_' => $request['_'], 'body' => $request['body'] ?? []]; + $body = []; + if (isset($request['body']['peer'])) { + $body['peer'] = $this->API->getID($request['body']['peer']); + } + if (isset($request['body']['message'])) { + $body['message'] = (string) $request['body']['message']; + } + $response['request'] = ['_' => $request['_'], 'body' => $body]; \danog\MadelineProto\Tools::callForkDefer($this->API->handleUpdates($response)); } unset($request); diff --git a/src/danog/MadelineProto/TL/Conversion/BotAPI.php b/src/danog/MadelineProto/TL/Conversion/BotAPI.php index 1a07fc1e..ca489bca 100644 --- a/src/danog/MadelineProto/TL/Conversion/BotAPI.php +++ b/src/danog/MadelineProto/TL/Conversion/BotAPI.php @@ -194,11 +194,11 @@ trait BotAPI case 'updateShortSentMessage': $newd['message_id'] = $data['id']; $newd['date'] = $data['date']; - $newd['text'] = $data['request']['message']; + $newd['text'] = $data['request']['body']['message']; if ($data['out']) { $newd['from'] = (yield from $this->getPwrChat($this->authorization['user'])); } - $newd['chat'] = yield from $this->getPwrChat($data['request']['peer']); + $newd['chat'] = yield from $this->getPwrChat($data['request']['body']['peer']); if (isset($data['entities'])) { $newd['entities'] = yield from $this->MTProtoToBotAPI($data['entities']); } diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index 186f6141..ad5e3438 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -1037,7 +1037,7 @@ class TL return $x['value']; } } elseif ($x['_'] === 'photoStrippedSize') { - $x['inflated'] = Tools::inflateStripped($x['bytes']); + $x['inflated'] = new Types\Bytes(Tools::inflateStripped($x['bytes'])); } if (isset($this->callbacks[TLCallback::CONSTRUCTOR_CALLBACK][$x['_']])) { foreach ($this->callbacks[TLCallback::CONSTRUCTOR_CALLBACK][$x['_']] as $callback) { diff --git a/tools/build_docs/merge.php b/tools/build_docs/merge.php index ba89cd94..835af422 100644 --- a/tools/build_docs/merge.php +++ b/tools/build_docs/merge.php @@ -9,6 +9,9 @@ use danog\MadelineProto\Lang; */ function mergeExtracted(): void { + if (!\file_exists('extracted.json')) { + return; + } foreach (\json_decode(\file_get_contents('extracted.json'), true) as $key => $value) { $key = \preg_replace(['|flags\.\d+[?]|', '/Vector[<].*/'], ['', 'Vector t'], $key); $key = \str_replace('param_hash_type_int', 'param_hash_type_Vector t', $key);