Add discord notification for v2 releases

This commit is contained in:
2025-10-08 17:41:10 +02:00
parent 96a9019eba
commit 725a441d9e
3 changed files with 29 additions and 13 deletions

View File

@@ -76,6 +76,10 @@ class EpisodeController extends Controller
DiscordReleaseNotification::dispatch($episode->slug, 'updateUHD');
}
if ($request->has('v2')) {
DiscordReleaseNotification::dispatch($episode->slug, 'v2');
}
cache()->flush();
return to_route('hentai.index', [

View File

@@ -32,19 +32,24 @@ class DiscordReleaseNotification implements ShouldQueue
*/
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);
switch($this->messageType)
{
case 'release':
DiscordAlert::message("<@&868457842250764289> (´• ω •`)ノ New **4k** Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
break;
case 'update':
# 1080p 48fps added
DiscordAlert::to('update')->message("<@&1283518462584426598> (´• ω •`)ノ Added **48fps** to Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
break;
case 'updateUHD':
# 4k 48fps added
DiscordAlert::to('update')->message("<@&1326860920902778963> (´• ω •`)ノ Added **48fps 4k** to Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
break;
case 'v2':
# v2 re-release
DiscordAlert::to('update')->message("<@&1425505303075754035> (´• ω •`)ノ **v2 Re-**Release! Check it out here: https://hstream.moe/hentai/".$this->slug);
default:
break;
}
}
}

View File

@@ -97,6 +97,13 @@
</div>
<div class="flex flex-wrap flex-shrink-0 justify-end items-center p-4 rounded-b-md">
<div class="inline-block mr-2">
<input class="w-4 h-4 text-rose-600 bg-gray-100 border-gray-300 rounded focus:ring-rose-500 dark:focus:ring-rose-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
type="checkbox" value="true" id="v2" name="v2" />
<label class="inline-block hover:cursor-pointer dark:text-white" for="v2">
v2 Re-Release Notification
</label>
</div>
<button type="button" class="inline-block px-6 pt-2.5 pb-2 text-xs font-medium leading-normal uppercase rounded transition duration-150 ease-in-out bg-primary-100 text-primary-700 hover:bg-primary-accent-100 focus:bg-primary-accent-100 focus:outline-none focus:ring-0 active:bg-primary-accent-200" data-te-modal-dismiss data-te-ripple-init data-te-ripple-color="light">
Cancel
</button>