We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01c7cc6 commit a6559afCopy full SHA for a6559af
src/TelegramHandler.php
@@ -83,7 +83,7 @@ public function write(array $record): void
83
file_get_contents(
84
'https://api.telegram.org/bot' . $this->botToken . '/sendMessage?'
85
. http_build_query([
86
- 'text' => $this->formatText($record),
+ 'text' => $this->applyTelegramMaxCharactersLimit($this->formatText($record)),
87
'chat_id' => $this->chatId,
88
'parse_mode' => 'html'
89
])
@@ -114,4 +114,13 @@ private function formatText(array $record): string
114
115
);
116
}
117
+
118
+ /**
119
+ * @param string $text
120
+ * @return string
121
+ */
122
+ private function applyTelegramMaxCharactersLimit(string $text): string
123
+ {
124
+ return mb_substr($text, 0, 4096);
125
+ }
126
0 commit comments