51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
use Spatie\DiscordAlerts\Facades\DiscordAlert;
|
|
|
|
class DiscordReleaseNotification implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
private $slug;
|
|
|
|
private $messageType;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*/
|
|
public function __construct($slug, $messageType)
|
|
{
|
|
$this->slug = $slug;
|
|
$this->messageType = $messageType;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
// Wait 2s to avoid Discord API Rate limit
|
|
sleep(2);
|
|
|
|
if ($this->messageType == 'release') {
|
|
DiscordAlert::message("<@&868457842250764289> (´• ω •`)ノ New **4k** Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
|
|
}
|
|
|
|
if ($this->messageType == 'update') {
|
|
DiscordAlert::to('update')->message("<@&1283518462584426598> (´• ω •`)ノ Added **48fps** to Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
|
|
}
|
|
|
|
if ($this->messageType == 'updateUHD') {
|
|
DiscordAlert::to('update')->message("<@&1326860920902778963> (´• ω •`)ノ Added **48fps 4k** to Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
|
|
}
|
|
}
|
|
}
|