mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
Listen to Maritime Memory on Wii U Discontinuation Day
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
9429dfe8d8
commit
c18de2eea3
1 changed files with 25 additions and 6 deletions
|
@ -32,6 +32,11 @@ public sealed class SongUpdateService : BackgroundService
|
||||||
("Off the Hook", "Fly Octo Fly ~ Ebb & Flow (Octo)", new TimeSpan(0, 3, 5))
|
("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 List<Activity> _activityList = [new Activity("with Remora.Discord", ActivityType.Game)];
|
||||||
|
|
||||||
private readonly DiscordGatewayClient _client;
|
private readonly DiscordGatewayClient _client;
|
||||||
|
@ -54,19 +59,33 @@ public sealed class SongUpdateService : BackgroundService
|
||||||
|
|
||||||
while (!ct.IsCancellationRequested)
|
while (!ct.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
var nextSong = SongList[_nextSongIndex];
|
var nextSong = NextSong();
|
||||||
_activityList[0] = new Activity($"{nextSong.Name} / {nextSong.Author}",
|
_activityList[0] = new Activity($"{nextSong.Name} / {nextSong.Author}",
|
||||||
ActivityType.Listening);
|
ActivityType.Listening);
|
||||||
_client.SubmitCommand(
|
_client.SubmitCommand(
|
||||||
new UpdatePresence(
|
new UpdatePresence(
|
||||||
UserStatus.Online, false, DateTimeOffset.UtcNow, _activityList));
|
UserStatus.Online, false, DateTimeOffset.UtcNow, _activityList));
|
||||||
|
|
||||||
|
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++;
|
_nextSongIndex++;
|
||||||
if (_nextSongIndex >= SongList.Length)
|
if (_nextSongIndex >= SongList.Length)
|
||||||
{
|
{
|
||||||
_nextSongIndex = 0;
|
_nextSongIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(nextSong.Duration, ct);
|
return nextSong;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue