From 1d3acb2392ce587292050bc51d6d2a01cc9d7184 Mon Sep 17 00:00:00 2001 From: Ske Date: Wed, 12 Feb 2020 14:22:15 +0100 Subject: [PATCH] Fix error when trying to DM a user with DMs disabled --- PluralKit.Bot/Services/ProxyService.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Services/ProxyService.cs b/PluralKit.Bot/Services/ProxyService.cs index 301e139d..73684578 100644 --- a/PluralKit.Bot/Services/ProxyService.cs +++ b/PluralKit.Bot/Services/ProxyService.cs @@ -297,7 +297,15 @@ namespace PluralKit.Bot if (msg == null) return; // DM them the message card - await user.SendMessageAsync(embed: await _embeds.CreateMessageInfoEmbed(msg)); + try + { + await user.SendMessageAsync(embed: await _embeds.CreateMessageInfoEmbed(msg)); + } + catch (HttpException e) when (e.DiscordCode == 50007) + { + // Ignore exception if it means we don't have DM permission to this user + // not much else we can do here :/ + } // And finally remove the original reaction (if we can) var msgObj = await message.GetOrDownloadAsync();