now download_to_file and download_to_dir return an absolute path, and accept document objects

This commit is contained in:
Daniil Gentili 2017-08-28 01:22:04 +02:00
parent 5f7bf4c907
commit d30bf4b4ee
3 changed files with 3 additions and 3 deletions

View File

@ -181,6 +181,7 @@ trait Files
return $res;
case 'decryptedMessageMediaExternalDocument':
case 'document':
$message_media = ['document' => $message_media];
case 'messageMediaDocument':
foreach ($message_media['document']['attributes'] as $attribute) {
@ -232,7 +233,7 @@ trait Files
public function download_to_file($message_media, $file, $cb = null)
{
$file = str_replace('//', '/', $file);
$file = realpath($file);
$message_media = $this->get_download_info($message_media);
if (!file_exists($file)) {
touch($file);

View File

@ -138,7 +138,6 @@ trait AuthKeyHandler
$this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']);
$this->calls[$params['id']]->configuration['endpoints'] = array_merge([$res['connection']], $res['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']);
$this->calls[$params['id']]->configuration = array_merge([
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,

View File

@ -106,7 +106,7 @@ if (stripos(readline('Do you want to make a call? (y/n): '), 'y') !== false) {
while ($controller->getCallState() < \danog\MadelineProto\VoIP::CALL_STATE_READY) {
$MadelineProto->get_updates();
}
$MadelineProto->messages->sendMessage(['peer' => $controller->getOtherID(), 'message' => 'Emojis: '.implode('', $controller->getVisualization())]);
//$MadelineProto->messages->sendMessage(['peer' => $controller->getOtherID(), 'message' => 'Emojis: '.implode('', $controller->getVisualization())]);
var_dump($controller->configuration);
while ($controller->getCallState() < \danog\MadelineProto\VoIP::CALL_STATE_ENDED) {
$MadelineProto->get_updates();