diff --git a/examples/downloadRenameBot.php b/examples/downloadRenameBot.php index b9ca8fe1..6e8b1f72 100644 --- a/examples/downloadRenameBot.php +++ b/examples/downloadRenameBot.php @@ -20,6 +20,7 @@ */ use danog\MadelineProto\Logger; +use League\Uri\Contracts\UriException; /* * Various ways to load MadelineProto @@ -141,7 +142,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler yield $this->messages->deleteMessages(['revoke' => true, 'id' => [$id]]); } } catch (\Throwable $e) { - if (\strpos($e->getMessage(), 'Could not connect to URI') === false) { + if (\strpos($e->getMessage(), 'Could not connect to URI') === false && !($e instanceof UriException)) { $this->report((string) $e); $this->logger((string) $e, \danog\MadelineProto\Logger::FATAL_ERROR); } diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php index d29eca5b..50c74a99 100644 --- a/src/danog/MadelineProto/MTProtoTools/Files.php +++ b/src/danog/MadelineProto/MTProtoTools/Files.php @@ -70,7 +70,8 @@ trait Files } } elseif (\is_array($file)) { return yield $this->uploadFromTgfile($file, $cb, $encrypted); - } elseif (!$this->API->settings['upload']['allow_automatic_upload']) { + } + if (!$this->settings['upload']['allow_automatic_upload']) { return yield $this->uploadFromUrl($file, 0, $fileName, $cb, $encrypted); }