From 6a2a3d1f34018d20f6232189d468391daeb849bc Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 6 Nov 2017 02:57:46 +0000 Subject: [PATCH] Split message mentions up into different parts --- webapp/titanembeds/static/js/embed.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 2d0dffc..f98358b 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -688,9 +688,11 @@ if (mention.nickname) { username = mention.nickname; } - message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), "@" + username + "#" + mention.discriminator); - message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), "@" + username + "#" + mention.discriminator); - message.content = message.content.replace("<@&" + guild_id + ">", "@everyone"); + console.log(message.content) + var templ = "@" + username + "#" + mention.discriminator + ""; + message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), templ); + message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), templ); + message.content = message.content.replace("<@&" + guild_id + ">", "@everyone"); } return message; } @@ -901,12 +903,12 @@ } else { var avatar = global_guest_icon; } - message = replace_message_mentions(message); message = format_bot_message(message); message = parse_message_time(message); message.content = message.content.replaceAll("\\<", "<"); message.content = message.content.replaceAll("\\>", ">"); message.content = escapeHtml(message.content); + message = replace_message_mentions(message); message = parse_message_attachments(message); message.content = parse_message_markdown(message.content); message = parse_channels_in_message(message);