From 28d7f970d2fb9da4a7cb356fde5c9b50b53dce8f Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Wed, 9 Jul 2025 15:42:30 +0200 Subject: [PATCH] event banner --- .../EpisodeEventCommand.php | 8 +++++- .../2025_07_09_113355_event_banner.php | 26 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2025_07_09_113355_event_banner.php diff --git a/app/DiscordBotCommands/EpisodeEventCommand.php b/app/DiscordBotCommands/EpisodeEventCommand.php index 3dc03bb..4c716b6 100644 --- a/app/DiscordBotCommands/EpisodeEventCommand.php +++ b/app/DiscordBotCommands/EpisodeEventCommand.php @@ -9,6 +9,7 @@ use Carbon\Carbon; use Discord\Discord; use Discord\Parts\Guild\Guild; use Discord\Parts\Guild\ScheduledEvent; +use Illuminate\Support\Facades\Storage; use React\Promise\PromiseInterface; class EpisodeEventCommand extends BaseCommand { @@ -66,7 +67,12 @@ class EpisodeEventCommand extends BaseCommand { $event->entity_metadata = [ 'location' => $episode->getRestreamLink(), ]; - $event->image = ''; + if ($episode->event && $episode->event->banner) { + $file = Storage::get($episode->event->banner); + $event->image = 'data:image/png;base64,'.base64_encode($file); + } else { + $event->image = ''; + } } } diff --git a/database/migrations/2025_07_09_113355_event_banner.php b/database/migrations/2025_07_09_113355_event_banner.php new file mode 100644 index 0000000..59d8b51 --- /dev/null +++ b/database/migrations/2025_07_09_113355_event_banner.php @@ -0,0 +1,26 @@ +string('banner')->default(''); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void { + Schema::table('events', function(Blueprint $table) { + $table->dropColumn('banner'); + }); + } +}; -- 2.39.5