From aac491da251edb953f112a9ea53b2420be3398e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Nov=C3=A1k?= Date: Tue, 1 Oct 2024 21:48:14 +0200 Subject: [PATCH] updated DiscordMessages for Container notifications --- app/Notifications/Container/ContainerRestarted.php | 9 +++++++-- app/Notifications/Container/ContainerStopped.php | 11 +++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Notifications/Container/ContainerRestarted.php b/app/Notifications/Container/ContainerRestarted.php index 23f6de264..49c2cecf0 100644 --- a/app/Notifications/Container/ContainerRestarted.php +++ b/app/Notifications/Container/ContainerRestarted.php @@ -3,6 +3,7 @@ namespace App\Notifications\Container; use App\Models\Server; +use App\Notifications\Dto\DiscordMessage; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -34,9 +35,13 @@ class ContainerRestarted extends Notification implements ShouldQueue return $mail; } - public function toDiscord(): string + public function toDiscord(): DiscordMessage { - $message = "Coolify: A resource ({$this->name}) has been restarted automatically on {$this->server->name}"; + $message = new DiscordMessage( + title: "Coolify: A resource ({$this->name}) has been restarted automatically on {$this->server->name}", + description: 'Please check the output below for more information.', + color: DiscordMessage::infoColor(), + ); return $message; } diff --git a/app/Notifications/Container/ContainerStopped.php b/app/Notifications/Container/ContainerStopped.php index bcf5e67a5..d8ed2316b 100644 --- a/app/Notifications/Container/ContainerStopped.php +++ b/app/Notifications/Container/ContainerStopped.php @@ -3,6 +3,7 @@ namespace App\Notifications\Container; use App\Models\Server; +use App\Notifications\Dto\DiscordMessage; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -34,11 +35,13 @@ class ContainerStopped extends Notification implements ShouldQueue return $mail; } - public function toDiscord(): string + public function toDiscord(): DiscordMessage { - $message = "Coolify: A resource ($this->name) has been stopped unexpectedly on {$this->server->name}"; - - return $message; + return new DiscordMessage( + title: "Coolify: A resource ($this->name) has been stopped unexpectedly on {$this->server->name}", + description: 'Please check the output below for more information.', + color: DiscordMessage::errorColor(), + ); } public function toTelegram(): array