From d5369a56e3fcf50513f3bc582552c2838b04d199 Mon Sep 17 00:00:00 2001 From: Parbez Date: Fri, 25 Mar 2022 01:30:04 +0530 Subject: [PATCH] fix(util): allow `escapeInlineCode` to escape double backtics (#7638) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(util): allow scapeInlineCode to escape double backtics * fix: replace backtics properly * chore: fix lint --- packages/discord.js/src/util/Util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/src/util/Util.js b/packages/discord.js/src/util/Util.js index eb052d059..4540606e9 100644 --- a/packages/discord.js/src/util/Util.js +++ b/packages/discord.js/src/util/Util.js @@ -189,7 +189,7 @@ class Util extends null { * @returns {string} */ static escapeInlineCode(text) { - return text.replaceAll('`', '\\`'); + return text.replace(/(?<=^|[^`])``?(?=[^`]|$)/g, match => (match.length === 2 ? '\\`\\`' : '\\`')); } /**