Added error handling of failed speedtests

re issue #143
This commit is contained in:
Henry Whitaker
2020-07-03 11:59:26 +01:00
parent 5ac9478799
commit 04d8f729b9
16 changed files with 318 additions and 37 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use NotificationChannels\Telegram\TelegramChannel;
use NotificationChannels\Telegram\TelegramMessage;
class SpeedtestFailedTelegram extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
public function via($notifiable)
{
return [
TelegramChannel::class
];
}
/**
* Format tekegram notification
*
* @param mixed $notifiable
* @return TelegramMessage
*/
public function toTelegram($notifiable)
{
$msg = "Error: something went wrong running your speedtest";
return TelegramMessage::create()
->to(env('TELEGRAM_CHAT_ID'))
->content($msg)
->options(['parse_mode' => 'Markdown']);
}
}