updated DiscordMessages for Server notifications

This commit is contained in:
Jakub Novák
2024-10-01 21:38:12 +02:00
parent 9e2f0fb894
commit f021a42890
6 changed files with 50 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ use App\Models\Server;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\EmailChannel;
use App\Notifications\Channels\TelegramChannel;
use App\Notifications\Dto\DiscordMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -63,9 +64,15 @@ class Unreachable extends Notification implements ShouldQueue
return $mail;
}
public function toDiscord(): string
public function toDiscord(): DiscordMessage
{
$message = "Coolify: Your server '{$this->server->name}' is unreachable. All automations & integrations are turned off! Please check your server! IMPORTANT: We automatically try to revive your server and turn on all automations & integrations.";
$message = new DiscordMessage(
title: "Coolify: Your server '{$this->server->name}' is unreachable.",
description: 'All automations & integrations are turned off! Please check your server!',
color: DiscordMessage::errorColor(),
);
$message->addField('IMPORTANT', 'We automatically try to revive your server and turn on all automations & integrations.');
return $message;
}