From: Daniel Karbach Date: Thu, 10 Jul 2025 22:09:02 +0000 (+0200) Subject: expand event description X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=ac28f0c29055f70daaec3fb2d2a5936268741e9a;p=alttp.git expand event description --- 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; }