From 1a8673048971dfb5a42575f742535b3c3e540feb Mon Sep 17 00:00:00 2001 From: Essem Date: Tue, 7 Jun 2022 22:07:15 -0500 Subject: [PATCH] Fix text escape --- commands/fun/sonic.js | 2 +- commands/image-editing/motivate.js | 4 ++-- commands/image-editing/snapchat.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/fun/sonic.js b/commands/fun/sonic.js index 0cf28c8..59b6104 100644 --- a/commands/fun/sonic.js +++ b/commands/fun/sonic.js @@ -3,7 +3,7 @@ import ImageCommand from "../../classes/imageCommand.js"; class SonicCommand extends ImageCommand { params() { - const cleanedMessage = (this.options.text ?? this.args.join(" ")).replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"); + const cleanedMessage = (this.options.text ?? this.args.join(" ")).replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"); return { text: cleanedMessage }; diff --git a/commands/image-editing/motivate.js b/commands/image-editing/motivate.js index 1aeb9b1..3940e95 100644 --- a/commands/image-editing/motivate.js +++ b/commands/image-editing/motivate.js @@ -6,8 +6,8 @@ class MotivateCommand extends ImageCommand { const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" "); const [topText, bottomText] = newArgs.split(/(? elem.trim()); return { - top: topText.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"), - bottom: bottomText ? bottomText.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%") : "", + top: topText.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"), + bottom: bottomText ? bottomText.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n") : "", font: this.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "times" }; } diff --git a/commands/image-editing/snapchat.js b/commands/image-editing/snapchat.js index 2dd1fd4..6cd59ab 100644 --- a/commands/image-editing/snapchat.js +++ b/commands/image-editing/snapchat.js @@ -5,7 +5,7 @@ class SnapchatCommand extends ImageCommand { const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" "); const position = parseFloat(this.specialArgs.position); return { - caption: newArgs.replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%"), + caption: newArgs.replaceAll("&", "&").replaceAll(">", ">").replaceAll("<", "<").replaceAll("\"", """).replaceAll("'", "'").replaceAll("\\n", "\n"), pos: isNaN(position) ? 0.5 : position }; }