This commit is contained in:
Daniil Gentili 2019-06-25 14:09:39 +02:00
parent 45841add14
commit 3f3f2f5ea1
3 changed files with 8 additions and 4 deletions

View File

@ -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']
]

View File

@ -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':

View File

@ -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;
}