From ac28f0c29055f70daaec3fb2d2a5936268741e9a Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 11 Jul 2025 00:09:02 +0200 Subject: [PATCH] expand event description --- .../DiscordEpisodeSubscriptionsCommand.php | 7 +++++++ app/Models/Episode.php | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/DiscordEpisodeSubscriptionsCommand.php b/app/Console/Commands/DiscordEpisodeSubscriptionsCommand.php index 773550a..0ae19e9 100644 --- a/app/Console/Commands/DiscordEpisodeSubscriptionsCommand.php +++ b/app/Console/Commands/DiscordEpisodeSubscriptionsCommand.php @@ -80,14 +80,21 @@ class DiscordEpisodeSubscriptionsCommand extends Command if ($mtime < $crew->updated_at) { $mtime = $crew->updated_at; } + if ($crew->user && $mtime < $crew->user->updated_at) { + $mtime = $crew->user->updated_at; + } } foreach ($episode->players as $player) { if ($mtime < $player->updated_at) { $mtime = $player->updated_at; + if ($player->user && $mtime < $player->user->updated_at) { + $mtime = $crew->user->updated_at; + } } } $memo = $this->getMemo($guild, $episode); if (is_null($memo->synced_at) || $memo->synced_at < $mtime) { + $this->line('pushing '.$episode->id.' '.$episode->getScheduledEventName()); DiscordBotCommand::episodeEvent($guild, $episode); } } diff --git a/app/Models/Episode.php b/app/Models/Episode.php index df2418a..c6ac07e 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -50,10 +50,11 @@ class Episode extends Model if ($this->title != '') { $parts[] = $this->title; } - if ($this->event->title != '') { + if ($this->event->title != '' && strlen(implode(' - ', $parts).' - '.$this->event->title) < 100) { $parts[] = $this->event->title; } - return implode(' - ', $parts); + $name = implode(' - ', $parts); + return $name; } public function getScheduledEventDescription(): string { @@ -65,6 +66,17 @@ class Episode extends Model if ($this->comment != '') { $description .= $this->comment."\n"; } + if (count($this->players)) { + $description .= "\nPlayers:\n"; + foreach ($this->players as $player) { + $link = $player->getStreamLink(); + if ($link) { + $description .= '- ['.$player->getName().']('.$link.")\n"; + } else { + $description .= '- '.$player->getName()."\n"; + } + } + } return $description; } -- 2.39.5