Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen to Maritime Memory on Wii U Discontinuation Day #299

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/Services/Update/SongUpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ private static readonly (string Author, string Name, TimeSpan Duration)[] SongLi
("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<Activity> _activityList = [new Activity("with Remora.Discord", ActivityType.Game)];

private readonly DiscordGatewayClient _client;
Expand All @@ -54,19 +59,33 @@ protected override async Task ExecuteAsync(CancellationToken ct)

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;
}
}