Files
pricebuddy/app/Enums/NotificationMethods.php
JeremyandClaude Opus 4.8 0ebeb532e1 feat: add Telegram, Discord and ntfy notification channels
Adds three new push notification channels to reach feature parity with
PriceGhost, following the existing channel pattern (app-level service
config + per-user routing target):

- Telegram: shared bot token (app) + per-user chat id, HTML messages
- Discord: rich embed via webhook, app-level default + per-user override
- ntfy: app-level server/auth (defaults to ntfy.sh) + per-user topic,
  optional basic auth for self-hosted servers

Each channel is wired into NotificationMethods, exposes its config in the
app settings and per-user profile forms, and Telegram/Discord get a Test
action. Full unit coverage for settings merging, send payloads, routing
guards and per-channel enable/disable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 08:07:58 +10:00

51 lines
1.2 KiB
PHP
Executable File

<?php
namespace App\Enums;
use App\Notifications\Channels\AppriseChannel;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\GotifyChannel;
use App\Notifications\Channels\NtfyChannel;
use App\Notifications\Channels\TelegramChannel;
use NotificationChannels\Pushover\PushoverChannel;
enum NotificationMethods: string
{
case Mail = 'mail';
case Database = 'database';
case Pushover = 'pushover';
case Gotify = 'gotify';
case Apprise = 'apprise';
case Telegram = 'telegram';
case Discord = 'discord';
case Ntfy = 'ntfy';
public function getChannel(): string
{
return match ($this) {
self::Pushover => PushoverChannel::class,
self::Gotify => GotifyChannel::class,
self::Apprise => AppriseChannel::class,
self::Telegram => TelegramChannel::class,
self::Discord => DiscordChannel::class,
self::Ntfy => NtfyChannel::class,
default => $this->value,
};
}
public function requiresUserSettings(): bool
{
return match ($this) {
self::Database => false,
default => true,
};
}
}