From 6706ff95f16566354f363331f6dd05b7f2233ac9 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Fri, 27 Oct 2017 21:07:54 +0300 Subject: [PATCH] Fix user mentions not resolving on bots --- DiscordChatExporter/Services/ExportService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DiscordChatExporter/Services/ExportService.cs b/DiscordChatExporter/Services/ExportService.cs index 71d7cdf..876634b 100644 --- a/DiscordChatExporter/Services/ExportService.cs +++ b/DiscordChatExporter/Services/ExportService.cs @@ -224,7 +224,7 @@ namespace DiscordChatExporter.Services // User mentions (<@id>) foreach (var mentionedUser in message.MentionedUsers) - content = content.Replace($"<@{mentionedUser.Id}>", $"@{mentionedUser}"); + content = Regex.Replace(content, $"<@!?{mentionedUser.Id}>", $"@{mentionedUser}"); // Role mentions (<@&id>) foreach (var mentionedRole in message.MentionedRoles) @@ -279,7 +279,7 @@ namespace DiscordChatExporter.Services // User mentions (<@id>) foreach (var mentionedUser in message.MentionedUsers) { - content = content.Replace($"<@{mentionedUser.Id}>", + content = Regex.Replace(content, $"<@!?{mentionedUser.Id}>", $"" + $"@{HtmlEncode(mentionedUser.Name)}" + "");