From defa3c2e4acc5e30f6e533a2b3480b73e37a05b2 Mon Sep 17 00:00:00 2001 From: Macintxsh <95250141+mctaylors@users.noreply.github.com> Date: Sun, 7 Apr 2024 13:51:28 +0300 Subject: [PATCH] Listen to Maritime Memory on Wii U Discontinuation Day (#299) Due to the shutdown of Wii U online services on April 8 at 23:00 UTC (which affects Splatoon for Wii U), I'm opening a PR to memorialize Splatoon multiplayer on Wii U by replacing bot music with Maritime Memory on April 8-9. Signed-off-by: mctaylors --- src/Services/Update/SongUpdateService.cs | 31 +++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/Services/Update/SongUpdateService.cs b/src/Services/Update/SongUpdateService.cs index 53cc59b..41d5bf3 100644 --- a/src/Services/Update/SongUpdateService.cs +++ b/src/Services/Update/SongUpdateService.cs @@ -32,6 +32,11 @@ public sealed class SongUpdateService : BackgroundService ("Off the Hook", "Fly Octo Fly ~ Ebb & Flow (Octo)", new TimeSpan(0, 3, 5)) ]; + private static readonly (string Author, string Name, TimeSpan Duration)[] SpecialSongList = + [ + ("Squid Sisters", "Maritime Memory", new TimeSpan(0, 2, 47)) + ]; + private readonly List _activityList = [new Activity("with Remora.Discord", ActivityType.Game)]; private readonly DiscordGatewayClient _client; @@ -54,19 +59,33 @@ public sealed class SongUpdateService : BackgroundService while (!ct.IsCancellationRequested) { - var nextSong = SongList[_nextSongIndex]; + var nextSong = NextSong(); _activityList[0] = new Activity($"{nextSong.Name} / {nextSong.Author}", ActivityType.Listening); _client.SubmitCommand( new UpdatePresence( UserStatus.Online, false, DateTimeOffset.UtcNow, _activityList)); - _nextSongIndex++; - if (_nextSongIndex >= SongList.Length) - { - _nextSongIndex = 0; - } await Task.Delay(nextSong.Duration, ct); } } + + private (string Author, string Name, TimeSpan Duration) NextSong() + { + var today = DateTime.Today; + // Discontinuation of Online Services for Nintendo Wii U + if (today.Day is 8 or 9 && today.Month is 4) + { + return SpecialSongList[0]; // Maritime Memory / Squid Sisters + } + + var nextSong = SongList[_nextSongIndex]; + _nextSongIndex++; + if (_nextSongIndex >= SongList.Length) + { + _nextSongIndex = 0; + } + + return nextSong; + } }