]> git.localhorst.tv Git - alttp.git/commitdiff
expand event description
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 10 Jul 2025 22:09:02 +0000 (00:09 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 10 Jul 2025 22:09:02 +0000 (00:09 +0200)
app/Console/Commands/DiscordEpisodeSubscriptionsCommand.php
app/Models/Episode.php

index 773550a07f843a363e8b5dccb692c36eac41ec65..0ae19e938627030668dc7250c531bf6978f7be6d 100644 (file)
@@ -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);
                }
        }
index df2418a403a744248cdb2a5ea107f009a3e1893a..c6ac07e935dc8024a945cb196c4173acbb1bb565 100644 (file)
@@ -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;
        }