From 798b66db9b8684d79e547dc7b4f0620b80cdf93e Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 21 Mar 2022 11:07:42 +0100 Subject: [PATCH] Fixed playing rotate nullref --- .../Administration/PlayingRotate/PlayingRotateService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateService.cs b/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateService.cs index aad897d3f..05bcf65f7 100644 --- a/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateService.cs +++ b/src/NadekoBot/Modules/Administration/PlayingRotate/PlayingRotateService.cs @@ -11,6 +11,7 @@ public sealed class PlayingRotateService : INService, IReadyExecutor private readonly SelfService _selfService; private readonly Replacer _rep; private readonly DbService _db; + private readonly DiscordSocketClient _client; public PlayingRotateService( DiscordSocketClient client, @@ -22,6 +23,7 @@ public sealed class PlayingRotateService : INService, IReadyExecutor _db = db; _bss = bss; _selfService = selfService; + _client = client; if (client.ShardId == 0) _rep = new ReplacementBuilder().WithClient(client).WithProviders(phProviders).Build(); @@ -29,6 +31,9 @@ public sealed class PlayingRotateService : INService, IReadyExecutor public async Task OnReadyAsync() { + if (_client.ShardId != 0) + return; + using var timer = new PeriodicTimer(TimeSpan.FromMinutes(1)); var index = 0; while (await timer.WaitForNextTickAsync())