From e632c19e124e87c106cd194328717977cd25423f Mon Sep 17 00:00:00 2001 From: Erisa A Date: Fri, 28 Jun 2024 21:53:27 +0100 Subject: [PATCH] Log mute DM failures as a warning instead of crashing --- Helpers/MuteHelpers.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Helpers/MuteHelpers.cs b/Helpers/MuteHelpers.cs index 7badb661..6f82fa53 100644 --- a/Helpers/MuteHelpers.cs +++ b/Helpers/MuteHelpers.cs @@ -235,8 +235,13 @@ public static (int MuteHours, int WarnsSinceThreshold) GetHoursToMuteFor(Diction } } } - catch (DSharpPlus.Exceptions.UnauthorizedException) + catch (Exception e) { + if (e is not DSharpPlus.Exceptions.UnauthorizedException) + { + Program.discord.Logger.LogWarning(e, "Failed to send mute DM to user: {user}", naughtyMember.Id); + } + // A DM failing to send isn't important, but let's put it in chat just so it's somewhere. if (channel is not null) {