Skip to content

Commit

Permalink
Log mute DM failures as a warning instead of crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Jun 28, 2024
1 parent e7e1b80 commit e632c19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Helpers/MuteHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit e632c19

Please sign in to comment.