diff --git a/bot.php b/bot.php index 195eba78..b08e8d9f 100755 --- a/bot.php +++ b/bot.php @@ -50,7 +50,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler 'peer' => '@danogentili', 'media' => [ '_' => 'inputMediaUploadedDocument', - 'file' => $update, + 'file' => 'https://google.com', 'attributes' => [ ['_' => 'documentAttributeFilename', 'file_name' => 'document.txt'] ] diff --git a/src/danog/MadelineProto/Loop/Update/FeedLoop.php b/src/danog/MadelineProto/Loop/Update/FeedLoop.php index c60c84f3..2e1b4b0d 100644 --- a/src/danog/MadelineProto/Loop/Update/FeedLoop.php +++ b/src/danog/MadelineProto/Loop/Update/FeedLoop.php @@ -160,6 +160,9 @@ class FeedLoop extends ResumableSignalLoop case 'updateNewChannelMessage': case 'updateEditChannelMessage': $channelId = isset($update['message']['to_id']['channel_id']) ? $update['message']['to_id']['channel_id'] : false; + if (!$channelId) { + return false; + } break; case 'updateChannelWebPage': case 'updateDeleteChannelMessages': diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php index 04e47542..44465084 100644 --- a/src/danog/MadelineProto/MTProtoTools/Files.php +++ b/src/danog/MadelineProto/MTProtoTools/Files.php @@ -93,8 +93,8 @@ trait Files } /** @var $response \Amp\Artax\Response */ $response = yield $this->datacenter->getHTTPClient()->request($url); - if (200 !== $status = $response->getStatusCode) { - throw new Exception("Wrong status code: $status"); + if (200 !== $status = $response->getStatus()) { + throw new Exception("Wrong status code: $status ".$response->getReason()); } $mime = trim(explode(';', $response->getHeader('content-type') ?? 'application/octet-stream')[0]); $size = $response->getHeader('content-length') ?? $size; @@ -295,6 +295,7 @@ trait Files $chunk_size = $this->settings['upload']['part_size']; $bridge = new class + { private $done = []; private $pending = []; @@ -346,7 +347,7 @@ trait Files $read = $this->upload_from_callable_async($reader, $size, $mime, '', $cb, false, $encrypted); $write = $this->download_to_callable_async($media, $writer, null, true, 0, -1, $chunk_size); - list($res, ) = yield $this->all([$read, $write]); + list($res) = yield $this->all([$read, $write]); return $res; }