1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 11:18:59 +01:00
This commit is contained in:
Daniil Gentili 2017-08-01 12:17:53 +02:00
parent 5cc6719c3d
commit 5a2a515f33
2 changed files with 5 additions and 2 deletions

View File

@ -48,7 +48,7 @@ while (true) {
$res = var_export($update, true);
}
try {
$MadelineProto->messages->sendMessage(['peer' => $update['update']['_'] === 'updateNewMessage' ? $update['update']['message']['from_id'] : $update['update']['message']['to_id'], 'message' => $res, 'reply_to_msg_id' => $update['update']['message']['id'], 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
// $MadelineProto->messages->sendMessage(['peer' => $update['update']['_'] === 'updateNewMessage' ? $update['update']['message']['from_id'] : $update['update']['message']['to_id'], 'message' => $res, 'reply_to_msg_id' => $update['update']['message']['id'], 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
} catch (\danog\MadelineProto\RPCErrorException $e) {
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
}

View File

@ -301,12 +301,15 @@ trait Files
}
if ($res['_'] === 'upload.fileCdnRedirect') {
$cdn = true;
$this->get_config([], ['datacenter' => $this->datacenter->curdc]);
$message_media['file_token'] = $res['file_token'];
$message_media['cdn_key'] = $res['encryption_key'];
$message_media['cdn_iv'] = $res['encryption_iv'];
$old_dc = $datacenter;
$datacenter = $res['dc_id'].'_cdn';
if (!isset($this->datacenter->sockets[$datacenter])) {
$this->config['expires'] = -1;
$this->get_config([], ['datacenter' => $this->datacenter->curdc]);
}
\danog\MadelineProto\Logger::log(['File is stored on CDN!'], \danog\MadelineProto\Logger::NOTICE);
continue;
}