]> git.localhorst.tv Git - alttp.git/commitdiff
limit chat command to confirmed crew
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 2 Mar 2023 15:43:47 +0000 (16:43 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 2 Mar 2023 15:43:47 +0000 (16:43 +0100)
app/Models/Episode.php
app/TwitchBot/CrewCommand.php

index 2084a32b53f67c53ba0df0720c0f3d0c597973c8..1c16f7f4a9ac7f8fab1bf2719c666514fa2c45cc 100644 (file)
@@ -20,6 +20,10 @@ class Episode extends Model
                return $this->hasMany(EpisodeCrew::class);
        }
 
+       public function confirmedCrew() {
+               return $this->crew()->where('confirmed', true);
+       }
+
        public function event() {
                return $this->belongsTo(Event::class);
        }
index 2fd04264c3dc22eead831f2aefabbc339eab5517..85edfb29ea7976529b04f9392e54617f5f4aeb03 100644 (file)
@@ -8,7 +8,7 @@ class CrewCommand extends ChatCommand {
                $episode = $this->channel->getCurrentEpisode();
                if (!$episode) return;
                $links = [];
-               foreach ($episode->crew as $crew) {
+               foreach ($episode->confirmedCrew as $crew) {
                        $link = $crew->getStreamLink();
                        if (empty($link)) {
                                $link = $crew->getName();