-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Telegram notifications, gpt-4o and landing updates
- Loading branch information
Showing
20 changed files
with
261 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
app/Notifications/Telegram/Admin/BackupHasFailedNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Telegram\Admin; | ||
|
||
use NotificationChannels\Telegram\TelegramMessage; | ||
use Spatie\Backup\Events\BackupHasFailed; | ||
use Spatie\Backup\Notifications\BaseNotification; | ||
|
||
class BackupHasFailedNotification extends BaseNotification | ||
{ | ||
public function __construct(public BackupHasFailed $event) | ||
{ | ||
} | ||
|
||
public function toTelegram($notifiable): \NotificationChannels\Telegram\TelegramBase|TelegramMessage | ||
{ | ||
$telegramMessage = TelegramMessage::create() | ||
->to(config('backup.notifications.telegram.chat_id')) | ||
->content(trans('backup::notifications.backup_failed_subject', ['application_name' => $this->applicationName()])) | ||
->line(trans('backup::notifications.backup_failed_body', ['application_name' => $this->applicationName()])) | ||
->line(trans('backup::notifications.exception_message', ['message' => $this->event->exception->getMessage()])) | ||
->line(trans('backup::notifications.exception_trace', ['trace' => $this->event->exception->getTraceAsString()])); | ||
|
||
$this->backupDestinationProperties()->each(function ($value, $name) use ($telegramMessage) { | ||
$telegramMessage->line("{$name}: {$value}"); | ||
}); | ||
|
||
return $telegramMessage; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/Notifications/Telegram/Admin/BackupWasSuccessfulNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Telegram\Admin; | ||
|
||
use NotificationChannels\Telegram\TelegramMessage; | ||
use Spatie\Backup\Events\BackupWasSuccessful; | ||
use Spatie\Backup\Notifications\BaseNotification; | ||
|
||
class BackupWasSuccessfulNotification extends BaseNotification | ||
{ | ||
public function __construct(public BackupWasSuccessful $event) | ||
{ | ||
} | ||
|
||
public function toTelegram($notifiable): \NotificationChannels\Telegram\TelegramBase|TelegramMessage | ||
{ | ||
$telegramMessage = TelegramMessage::create() | ||
->to(config('backup.notifications.telegram.chat_id')) | ||
->content(trans('backup::notifications.backup_successful_subject_title')); | ||
|
||
$this->backupDestinationProperties()->each(function ($value, $name) use ($telegramMessage) { | ||
$telegramMessage->line("{$name}: {$value}"); | ||
}); | ||
|
||
return $telegramMessage; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/Notifications/Telegram/Admin/CleanupHasFailedNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Telegram\Admin; | ||
|
||
use NotificationChannels\Telegram\TelegramMessage; | ||
use Spatie\Backup\Events\CleanupHasFailed; | ||
use Spatie\Backup\Notifications\BaseNotification; | ||
|
||
class CleanupHasFailedNotification extends BaseNotification | ||
{ | ||
public function __construct(public CleanupHasFailed $event) | ||
{ | ||
} | ||
|
||
public function toTelegram($notifiable): \NotificationChannels\Telegram\TelegramBase|TelegramMessage | ||
{ | ||
$telegramMessage = TelegramMessage::create() | ||
->to(config('backup.notifications.telegram.chat_id')) | ||
->content(trans('backup::notifications.cleanup_failed_subject', ['application_name' => $this->applicationName()])) | ||
->line(trans('backup::notifications.cleanup_failed_body', ['application_name' => $this->applicationName()])) | ||
->line(trans('backup::notifications.exception_message', ['message' => $this->event->exception->getMessage()])) | ||
->line(trans('backup::notifications.exception_trace', ['trace' => $this->event->exception->getTraceAsString()])); | ||
|
||
$this->backupDestinationProperties()->each(function ($value, $name) use ($telegramMessage) { | ||
$telegramMessage->line("{$name}: {$value}"); | ||
}); | ||
|
||
return $telegramMessage; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/Notifications/Telegram/Admin/CleanupWasSuccessfulNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Telegram\Admin; | ||
|
||
use NotificationChannels\Telegram\TelegramMessage; | ||
use Spatie\Backup\Events\CleanupWasSuccessful; | ||
use Spatie\Backup\Notifications\BaseNotification; | ||
|
||
class CleanupWasSuccessfulNotification extends BaseNotification | ||
{ | ||
public function __construct(public CleanupWasSuccessful $event) | ||
{ | ||
} | ||
|
||
public function toTelegram($notifiable): \NotificationChannels\Telegram\TelegramBase|TelegramMessage | ||
{ | ||
$telegramMessage = TelegramMessage::create() | ||
->to(config('backup.notifications.telegram.chat_id')) | ||
->content(trans('backup::notifications.cleanup_successful_subject', ['application_name' => $this->applicationName()])) | ||
->line(trans('backup::notifications.cleanup_successful_body', ['application_name' => $this->applicationName(), 'disk_name' => $this->diskName()])); | ||
|
||
$this->backupDestinationProperties()->each(function ($value, $name) use ($telegramMessage) { | ||
$telegramMessage->line("{$name}: {$value}"); | ||
}); | ||
|
||
return $telegramMessage; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/Notifications/Telegram/Admin/HealthyBackupWasFoundNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Telegram\Admin; | ||
|
||
use NotificationChannels\Telegram\TelegramMessage; | ||
use Spatie\Backup\Events\HealthyBackupWasFound; | ||
use Spatie\Backup\Notifications\BaseNotification; | ||
|
||
class HealthyBackupWasFoundNotification extends BaseNotification | ||
{ | ||
public function __construct(public HealthyBackupWasFound $event) | ||
{ | ||
} | ||
|
||
public function toTelegram($notifiable): \NotificationChannels\Telegram\TelegramBase|TelegramMessage | ||
{ | ||
$telegramMessage = TelegramMessage::create() | ||
->to(config('backup.notifications.telegram.chat_id')) | ||
->content(trans('backup::notifications.healthy_backup_found_subject', ['application_name' => $this->applicationName(), 'disk_name' => $this->diskName()])) | ||
->line(trans('backup::notifications.healthy_backup_found_body', ['application_name' => $this->applicationName()])); | ||
|
||
$this->backupDestinationProperties()->each(function ($value, $name) use ($telegramMessage) { | ||
$telegramMessage->line("{$name}: {$value}"); | ||
}); | ||
|
||
return $telegramMessage; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/Notifications/Telegram/Admin/UnhealthyBackupWasFoundNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Telegram\Admin; | ||
|
||
use NotificationChannels\Telegram\TelegramMessage; | ||
use Spatie\Backup\Events\UnhealthyBackupWasFound; | ||
use Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification as SpatieUnhealthyBackupWasFoundNotification; | ||
|
||
class UnhealthyBackupWasFoundNotification extends SpatieUnhealthyBackupWasFoundNotification | ||
{ | ||
public function __construct(public UnhealthyBackupWasFound $event) | ||
{ | ||
parent::__construct($event); | ||
} | ||
|
||
public function toTelegram($notifiable): \NotificationChannels\Telegram\TelegramBase|TelegramMessage | ||
{ | ||
$telegramMessage = TelegramMessage::create() | ||
->to(config('backup.notifications.telegram.chat_id')) | ||
->content(trans('backup::notifications.unhealthy_backup_found_subject', ['application_name' => $this->applicationName()])) | ||
->line(trans('backup::notifications.unhealthy_backup_found_body', ['application_name' => $this->applicationName(), 'disk_name' => $this->diskName()])) | ||
->line($this->problemDescription()); | ||
|
||
$this->backupDestinationProperties()->each(function ($value, $name) use ($telegramMessage) { | ||
$telegramMessage->line("{$name}: {$value}"); | ||
}); | ||
|
||
if ($this->failure()->wasUnexpected()) { | ||
$telegramMessage | ||
->line('Health check: ' . $this->failure()->healthCheck()->name()) | ||
->line(trans('backup::notifications.exception_message', ['message' => $this->failure()->exception()->getMessage()])) | ||
->line(trans('backup::notifications.exception_trace', ['trace' => $this->failure()->exception()->getTraceAsString()])); | ||
} | ||
|
||
return $telegramMessage; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,12 +193,12 @@ | |
'notifications' => [ | ||
|
||
'notifications' => [ | ||
\Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'], | ||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'], | ||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'], | ||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'], | ||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'], | ||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'], | ||
\App\Notifications\Telegram\Admin\BackupHasFailedNotification::class => ['telegram'], | ||
\App\Notifications\Telegram\Admin\UnhealthyBackupWasFoundNotification::class => ['telegram'], | ||
\App\Notifications\Telegram\Admin\CleanupHasFailedNotification::class => ['telegram'], | ||
\App\Notifications\Telegram\Admin\BackupWasSuccessfulNotification::class => ['telegram'], | ||
\App\Notifications\Telegram\Admin\HealthyBackupWasFoundNotification::class => ['telegram'], | ||
\App\Notifications\Telegram\Admin\CleanupWasSuccessfulNotification::class => ['telegram'], | ||
], | ||
|
||
/* | ||
|
@@ -208,14 +208,18 @@ | |
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class, | ||
|
||
'mail' => [ | ||
'to' => env('ADMIN_EMAIL', null), | ||
'to' => env('ADMIN_EMAIL'), | ||
|
||
'from' => [ | ||
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'), | ||
'name' => env('MAIL_FROM_NAME', 'Example'), | ||
], | ||
], | ||
|
||
'telegram' => [ | ||
'chat_id' => env('TELEGRAM_ADMIN_CHAT_ID'), | ||
], | ||
|
||
'slack' => [ | ||
'webhook_url' => '', | ||
|
||
|
Empty file modified
0
database/migrations/2024_05_12_192223_add_email_id_to_ics_events.php
100644 → 100755
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.