src/TelegramBot.php
static function send($channel_code = null) {
        try {
            if(is_numeric($channel_code)) {
                $channel_id = $channel_code;
            } else {
                $channel_id = env('telegram.' . $channel_code);
                $channel_id = $channel_id ? : env('telegram');
            }
            if(!$channel_id) {
                echo 'No channel';
                
                return;
            }
            if(is_array($channel_code)) {
                foreach($channel_code as $_code) {
                    self::send($_code);
                }
                
                return;
            }
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_TIMEOUT, 3);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            $partials = [];
            $current  = '';
            foreach(static::$messages as $message) {
                //если еще есть куда складывать
                if(mb_strlen($current) + mb_strlen($message) < self::MAX) {
                    $current .= PHP_EOL . $message;
                } else {
                    //если складывать некуда, то сбросим текущий слот в очередь
                    $partials[] = $current;
                    //очистим его
                    $current = '';
                    if(mb_strlen($message) > self::MAX) {
                        $strlen = mb_strlen($message);
                        while($strlen) {
                            $partials[] = mb_substr($message, 0, self::MAX, "UTF-8");
                            $message    = mb_substr($message, self::MAX, mb_strlen($message), "UTF-8");
                            $strlen     = mb_strlen($message);
                        }
                    } else {
                        $current = $message;
                    }
                }
                
            }
            $partials[] = $current;
            
            foreach($partials as $partial) {
                $params = http_build_query([
                    'disable_web_page_preview' => 'true',
                    'parse_mode'               => 'HTML',
                    'chat_id'                  => $channel_id,
                    'text'                     => $partial,
                ]);
                $url    = 'https://api.telegram.org/bot' . env('telegram.key') . '/sendMessage?';
                curl_setopt($ch, CURLOPT_URL, $url . $params);
                curl_exec($ch);
            }
            curl_close($ch);
        } catch(\Exception $e) {
            echo $e->getMessage();
        }
    }
static function send($channel_code = null) {
        try {
            if(is_numeric($channel_code)) {
                $channel_id = $channel_code;
            } else {
                $channel_id = env('telegram.' . $channel_code);
                $channel_id = $channel_id ? : env('telegram');
            }
            if(!$channel_id) {
                echo 'No channel';
                
                return;
            }
            if(is_array($channel_code)) {
                foreach($channel_code as $_code) {
                    self::send($_code);
                }
                
                return;
            }
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_TIMEOUT, 3);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            $partials = [];
            $current  = '';
            foreach(static::$messages as $message) {
                //если еще есть куда складывать
                if(mb_strlen($current) + mb_strlen($message) < self::MAX) {
                    $current .= PHP_EOL . $message;
                } else {
                    //если складывать некуда, то сбросим текущий слот в очередь
                    $partials[] = $current;
                    //очистим его
                    $current = '';
                    if(mb_strlen($message) > self::MAX) {
                        $strlen = mb_strlen($message);
                        while($strlen) {
                            $partials[] = mb_substr($message, 0, self::MAX, "UTF-8");
                            $message    = mb_substr($message, self::MAX, mb_strlen($message), "UTF-8");
                            $strlen     = mb_strlen($message);
                        }
                    } else {
                        $current = $message;
                    }
                }
                
            }
            $partials[] = $current;
            
            foreach($partials as $partial) {
                $params = http_build_query([
                    'disable_web_page_preview' => 'true',
                    'parse_mode'               => 'HTML',
                    'chat_id'                  => $channel_id,
                    'text'                     => $partial,
                ]);
                $url    = 'https://api.telegram.org/bot' . env('telegram.key') . '/sendMessage?';
                curl_setopt($ch, CURLOPT_URL, $url . $params);
                curl_exec($ch);
            }
            curl_close($ch);
        } catch(\Exception $e) {
            echo $e->getMessage();
        }
    }
const MAX = 100;