fix: telegram text

This commit is contained in:
Andras Bacsai 2023-11-06 10:49:35 +01:00
parent 6840ddd3e6
commit 83993cbbb2

View File

@ -46,11 +46,12 @@ class SendMessageToTelegramJob implements ShouldQueue, ShouldBeEncrypted
if (!empty($this->buttons)) { if (!empty($this->buttons)) {
foreach ($this->buttons as $button) { foreach ($this->buttons as $button) {
$buttonUrl = data_get($button, 'url'); $buttonUrl = data_get($button, 'url');
$text = data_get($button, 'text', 'Click here');
if ($buttonUrl && Str::contains($buttonUrl, 'http://localhost')) { if ($buttonUrl && Str::contains($buttonUrl, 'http://localhost')) {
$buttonUrl = str_replace('http://localhost', config('app.url'), $buttonUrl); $buttonUrl = str_replace('http://localhost', config('app.url'), $buttonUrl);
} }
$inlineButtons[] = [ $inlineButtons[] = [
'text' => $button['text'], 'text' => $text,
'url' => $buttonUrl, 'url' => $buttonUrl,
]; ];
} }