From 28b53ae8cf56fb09cb62b3e0ce02e0feed64d97d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Jul 2018 12:04:17 +0200 Subject: [PATCH] Bugfixes --- phar.php | 12 +++++++----- src/danog/MadelineProto/MTProtoTools/CallHandler.php | 2 +- src/danog/MadelineProto/TL/Conversion/BotAPI.php | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/phar.php b/phar.php index 8200a04d..1345bccc 100644 --- a/phar.php +++ b/phar.php @@ -11,12 +11,14 @@ if (!file_exists('madeline.phar') || !file_exists('madeline.phar.version') || (f unset($phar); } $file = debug_backtrace(0, 1)[0]['file']; -$contents = file_get_contents($file); +if (file_exists($file)) { + $contents = file_get_contents($file); -// Should've added the self-update code in mtproxyd right away, but it's too late now -if (strpos($contents, 'new \danog\MadelineProto\Server') && in_array($contents, [file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/2270bd9a94d168a5e6731ffd7e61821ea244beff/mtproxyd'), file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/7cabb718ec3ccb79e3c8e3d34f5bccbe3f63b0fd/mtproxyd')]) && ($mtproxyd = file_get_contents('https://phar.madelineproto.xyz/mtproxyd?v=new'))) { - file_put_contents($file, $mtproxyd); - unset($mtproxyd); + // Should've added the self-update code in mtproxyd right away, but it's too late now + if (strpos($contents, 'new \danog\MadelineProto\Server') && in_array($contents, [file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/2270bd9a94d168a5e6731ffd7e61821ea244beff/mtproxyd'), file_get_contents('https://github.com/danog/MadelineProtoPhar/raw/7cabb718ec3ccb79e3c8e3d34f5bccbe3f63b0fd/mtproxyd')]) && ($mtproxyd = file_get_contents('https://phar.madelineproto.xyz/mtproxyd?v=new'))) { + file_put_contents($file, $mtproxyd); + unset($mtproxyd); + } } require 'madeline.phar'; diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/danog/MadelineProto/MTProtoTools/CallHandler.php index bff57240..468218ab 100644 --- a/src/danog/MadelineProto/MTProtoTools/CallHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/CallHandler.php @@ -45,7 +45,7 @@ trait CallHandler \danog\MadelineProto\Logger::log('Using media DC'); $aargs['datacenter'] .= '_media'; } - if (isset($args['message']) && is_string($args['message']) && $this->mb_strlen($args['message']) > 4096) { + if (isset($args['message']) && is_string($args['message']) && $this->mb_strlen($args['message']) > $this->config['message_length_max']) { $arg_chunks = $this->split_to_chunks($args); $args = array_shift($arg_chunks); } diff --git a/src/danog/MadelineProto/TL/Conversion/BotAPI.php b/src/danog/MadelineProto/TL/Conversion/BotAPI.php index af0120a5..07cb6b24 100644 --- a/src/danog/MadelineProto/TL/Conversion/BotAPI.php +++ b/src/danog/MadelineProto/TL/Conversion/BotAPI.php @@ -486,7 +486,7 @@ trait BotAPI $multiple_args_base = array_merge($args, ['entities' => [], 'parse_mode' => 'text', 'message' => '']); $multiple_args = [$multiple_args_base]; - $max_length = 4096; + $max_length = $this->config['message_length_max']; $text_arr = []; foreach ($this->multipleExplodeKeepDelimiters(["\n"], $args['message']) as $word) { if ($this->mb_strlen($word) > $max_length) {