File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,8 +39,19 @@ public function hourly(): void
3939 Log::info ("{$ this ->party } Whamageddon: No upcoming song found, adding to party " );
4040 $ this ->addToParty ();
4141 } else {
42- Log::info ("{$ this ->party } Whamageddon: Upcoming song found, adding upvote " );
43- $ this ->addUpvote ($ upcoming );
42+ Log::info ("{$ this ->party } Whamageddon: Upcoming song found " );
43+ if ($ upcoming ->queued_at !== null ) {
44+ $ cutoff = $ upcoming ->queued_at ->addHours (2 );
45+ if (CarbonImmutable::now () >= $ cutoff ) {
46+ Log::info ("{$ this ->party } Whamageddon: Song was last played 2 hours ago - time for another round! " );
47+ $ this ->addToParty ();
48+ } else {
49+ Log::info ("{$ this ->party } Whamageddon: Upcoming song has already been played, waiting until {$ cutoff ->toIso8601String ()}" );
50+ }
51+ } else {
52+ Log::info ("{$ this ->party } Whamageddon: Adding an upvote " );
53+ $ this ->addUpvote ($ upcoming );
54+ }
4455 $ this ->delayPlayback ($ upcoming );
4556 }
4657 }
@@ -78,7 +89,7 @@ public function disable(): void
7889 Log::info ("{$ this ->party } Whamageddon: Upcoming song found, removing from party " );
7990 $ upcoming ->delete ();
8091 }
81- // $this->party->deleteModSetting(self::CODE, 'upcoming_song_id');
92+ $ this ->party ->deleteModSetting (self ::CODE , 'upcoming_song_id ' );
8293 }
8394
8495 protected function addToParty (): void
You can’t perform that action at this time.
0 commit comments