diff --git a/app/Filament/Pages/Settings/NotificationPage.php b/app/Filament/Pages/Settings/NotificationPage.php old mode 100644 new mode 100755 index a9690be84..155ce86f7 --- a/app/Filament/Pages/Settings/NotificationPage.php +++ b/app/Filament/Pages/Settings/NotificationPage.php @@ -214,19 +214,27 @@ public function sendTestTelegramNotification() { $notificationSettings = new (NotificationSettings::class); - if (count($notificationSettings->telegram_recipients)) { + $bot = config('telegram.bot'); + + if (blank($bot)) { + Notification::make() + ->title('First you need to add \'TELEGRAM_BOT_TOKEN\' on your .env file or add it as environment variable') + ->warning() + ->send(); + } + if (! empty($notificationSettings->telegram_recipients)) { foreach ($notificationSettings->telegram_recipients as $recipient) { \Illuminate\Support\Facades\Notification::route('telegram_chat_id', $recipient['telegram_chat_id']) ->notify(new TelegramNotification('Test notification channel *telegram*')); } Notification::make() - ->title('Test telegram notification sent.') + ->title('Test Telegram notification sent.') ->success() ->send(); } else { Notification::make() - ->title('You need to add recipients to receive telegram notifications.') + ->title('You need to add recipients to receive Telegram notifications.') ->warning() ->send(); } diff --git a/config/telegram.php b/config/telegram.php new file mode 100755 index 000000000..982d6cf95 --- /dev/null +++ b/config/telegram.php @@ -0,0 +1,5 @@ + env('TELEGRAM_BOT_TOKEN', null), +];