Use media DCs for file operations
This commit is contained in:
parent
1ad6af5743
commit
6947d1b034
@ -69,7 +69,7 @@ trait Files
|
|||||||
$bytes = $ige->encrypt(str_pad($bytes, $part_size, chr(0)));
|
$bytes = $ige->encrypt(str_pad($bytes, $part_size, chr(0)));
|
||||||
}
|
}
|
||||||
hash_update($ctx, $bytes);
|
hash_update($ctx, $bytes);
|
||||||
if (!$this->method_call($method, ['file_id' => $file_id, 'file_part' => $part_num++, 'file_total_parts' => $part_total_num, 'bytes' => $bytes], ['heavy' => true, 'file' => false, 'datacenter' => &$datacenter])) {
|
if (!$this->method_call($method, ['file_id' => $file_id, 'file_part' => $part_num++, 'file_total_parts' => $part_total_num, 'bytes' => $bytes], ['heavy' => true, 'file' => true, 'datacenter' => &$datacenter])) {
|
||||||
throw new \danog\MadelineProto\Exception('An error occurred while uploading file part '.$part_num);
|
throw new \danog\MadelineProto\Exception('An error occurred while uploading file part '.$part_num);
|
||||||
}
|
}
|
||||||
$cb(ftell($f) * 100 / $file_size);
|
$cb(ftell($f) * 100 / $file_size);
|
||||||
@ -393,7 +393,7 @@ trait Files
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$res = $cdn ? $this->method_call('upload.getCdnFile', ['file_token' => $message_media['file_token'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'file' => false, 'datacenter' => $datacenter]) : $this->method_call('upload.getFile', ['location' => $message_media['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'file' => false, 'datacenter' => &$datacenter]);
|
$res = $cdn ? $this->method_call('upload.getCdnFile', ['file_token' => $message_media['file_token'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'file' => true, 'datacenter' => $datacenter]) : $this->method_call('upload.getFile', ['location' => $message_media['InputFileLocation'], 'offset' => $offset, 'limit' => $part_size], ['heavy' => true, 'file' => true, 'datacenter' => &$datacenter]);
|
||||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||||
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0) {
|
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0) {
|
||||||
//if (isset($message_media['MessageMedia']) && !$this->get_self()['bot']) $this->method_call('messages.sendMedia', ['peer' => '@danogentili', 'media' => $message_media['MessageMedia'], 'message' => 'This is broken'], ['datacenter' => $this->datacenter->curdc]);
|
//if (isset($message_media['MessageMedia']) && !$this->get_self()['bot']) $this->method_call('messages.sendMedia', ['peer' => '@danogentili', 'media' => $message_media['MessageMedia'], 'message' => 'This is broken'], ['datacenter' => $this->datacenter->curdc]);
|
||||||
|
@ -45,8 +45,6 @@ echo 'Loading MadelineProto...'.PHP_EOL;
|
|||||||
|
|
||||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||||
|
|
||||||
$MadelineProto->messages->sendMessage(['peer' => '@pwrtelegramgroupita', 'message' => '<b>'.str_repeat('a b c d', 700).'</b>', 'parse_mode' => 'markdown']);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$MadelineProto->get_self();
|
$MadelineProto->get_self();
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
} catch (\danog\MadelineProto\Exception $e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user