Commit e867ff3d authored by MBoretto's avatar MBoretto

message long more than 4096 are splitted

parent 7b0d58a7
......@@ -249,11 +249,17 @@ class Request
public static function sendMessage(array $data)
{
if (empty($data)) {
throw new TelegramException('Data is empty!');
}
$text = $data['text'];
$string_len_utf8 = mb_strlen($text, 'UTF-8');
if ($string_len_utf8 > 4096) {
$data['text'] = mb_substr($text, 0, 4096);
$result = self::send('sendMessage', $data);
$data['text'] = mb_substr($text, 4096, $string_len_utf8);
return self::sendMessage($data);
}
$result = self::send('sendMessage', $data);
return $result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment