From 93a52ff95ab11fcdcd6cbba3f7972f0c7a56f787 Mon Sep 17 00:00:00 2001 From: Ske Date: Sun, 22 Dec 2019 12:08:52 +0100 Subject: [PATCH] Add exception logging for dropped connections --- PluralKit.Bot/Bot.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PluralKit.Bot/Bot.cs b/PluralKit.Bot/Bot.cs index b7e107f0..57956ad8 100644 --- a/PluralKit.Bot/Bot.cs +++ b/PluralKit.Bot/Bot.cs @@ -150,6 +150,7 @@ namespace PluralKit.Bot public Task Init() { + _client.ShardDisconnected += ShardDisconnected; _client.ShardReady += ShardReady; _client.Log += FrameworkLog; @@ -164,6 +165,12 @@ namespace PluralKit.Bot return Task.CompletedTask; } + private Task ShardDisconnected(Exception ex, DiscordSocketClient shard) + { + _logger.Warning(ex, $"Shard #{shard.ShardId} disconnected"); + return Task.CompletedTask; + } + private Task FrameworkLog(LogMessage msg) { // Bridge D.NET logging to Serilog