Files
DatBrowser/app/Browser/Jobs/EldoradoRobuxPriceSentry/EldoradoRobuxPriceNotification.php
Matthias Guillitte 7d26440d0c
Some checks failed
Test, build and push image to registry / phpunit-tests (push) Failing after 1m33s
Test, build and push image to registry / build-image (push) Has been skipped
Fix eldorado prices
2025-11-06 23:29:49 +01:00

48 lines
1.2 KiB
PHP

<?php
namespace App\Browser\Jobs\EldoradoRobuxPriceSentry;
use App\Models\Job;
use App\Notification\Notification;
use App\Notification\Stringifiable;
use App\Notification\Stringifiable\StringifiableSimpleText;
class EldoradoRobuxPriceNotification extends Notification {
private float $price;
private float $threshold;
private string $link;
public function __construct(int $jobId, int $price, string $link) {
parent::__construct($jobId);
$this->price = $price;
$this->threshold = floatval(Job::find($jobId)->jobInfosTable()->get('eldorado_robux_price_threshold'));
$this->link = $link;
$this->setBody($this->generateBody());
}
private function generateBody() {
return new EldoradoRobuxPriceNotificationBody($this->price, $this->threshold, $this->link);
}
public function getTitle(): Stringifiable {
return new StringifiableSimpleText("Alerte Robux Eldorado 🤑");
}
/**
* @inheritDoc
*/
public function getImageProjectPath(): string|null {
return null;
}
/**
* @inheritDoc
*/
public function getLinkURL(): string|null {
return $this->link;
}
}