Skip to content

Commit 327c9fc

Browse files
committed
refactor: Simplify Telegram message dispatch by configuring Telegraph for default Markdown parsing.
1 parent 346e694 commit 327c9fc

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

app/Services/Telegram/TelegramMessageService.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,6 @@ private function findSentenceEndSplit(string $text, int $threshold): ?string
137137

138138
private function dispatchMessage(TelegraphChat $chat, string $chunk, bool $markdown): void
139139
{
140-
if ($markdown) {
141-
$converter = new GithubFlavoredMarkdownConverter();
142-
$chunk = $converter->convert($chunk)->getContent();
143-
$chat->html($chunk)->send();
144-
} else {
145-
$chat->message($chunk)->send();
146-
}
140+
$chat->message($chunk)->send();
147141
}
148142
}

config/telegraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Sets Telegraph messages default parse mode
1616
* allowed values: html|markdown|MarkdownV2
1717
*/
18-
'default_parse_mode' => Telegraph::PARSE_HTML,
18+
'default_parse_mode' => Telegraph::PARSE_MARKDOWN,
1919

2020
'webhook' => [
2121
/*

0 commit comments

Comments
 (0)