diff --git a/src/NadekoBot/ShardedDiscordClient.cs b/src/NadekoBot/ShardedDiscordClient.cs index 2c6037b0..b84cb63c 100644 --- a/src/NadekoBot/ShardedDiscordClient.cs +++ b/src/NadekoBot/ShardedDiscordClient.cs @@ -66,11 +66,18 @@ namespace NadekoBot _log.Info($"Shard #{i} initialized."); - client.Disconnected += (ex) => + var j = i; + client.Disconnected += async (ex) => { - _log.Error("Shard #{0} disconnected", i); - _log.Error(ex); - return Task.CompletedTask; + try + { + _log.Error("Shard #{0} disconnected", j); + _log.Error(ex, ex?.Message ?? "No error"); + + try { await client.DisconnectAsync().ConfigureAwait(false); } catch { } + await client.ConnectAsync().ConfigureAwait(false); + } + catch { } }; }