Fixed more bugs

This commit is contained in:
Daniil Gentili 2017-01-09 17:23:00 +01:00
parent bb15d89124
commit 40f7548624
2 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
require 'vendor/autoload.php';
@ -31,7 +32,7 @@ while (true) {
$MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
}
try {
if (isset($update['update']['message']['media'])) {
if (isset($update['update']['message']['media']) && $update['update']['message']['media'] == 'messageMediaPhoto' && $update['update']['message']['media'] == 'messageMediaDocument') {
$time = time();
$file = $MadelineProto->download_to_dir($update['update']['message']['media'], '/tmp');
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Downloaded to '.$file.' in '.(time() - $time).' seconds', 'reply_to_msg_id' => $update['update']['message']['id'], 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);

View File

@ -498,7 +498,7 @@ trait FilesHandler
return $res;
default:
throw \danog\MadelineProto\Exception('Invalid constructor provided: '.$message_media['_']);
throw new \danog\MadelineProto\Exception('Invalid constructor provided: '.$message_media['_']);
}
}