Fix text escape
This commit is contained in:
parent
a3f2bd4c7e
commit
1a86730489
3 changed files with 4 additions and 4 deletions
|
@ -3,7 +3,7 @@ import ImageCommand from "../../classes/imageCommand.js";
|
||||||
|
|
||||||
class SonicCommand extends ImageCommand {
|
class SonicCommand extends ImageCommand {
|
||||||
params() {
|
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 {
|
return {
|
||||||
text: cleanedMessage
|
text: cleanedMessage
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,8 +6,8 @@ class MotivateCommand extends ImageCommand {
|
||||||
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
||||||
const [topText, bottomText] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
|
const [topText, bottomText] = newArgs.split(/(?<!\\),/).map(elem => elem.trim());
|
||||||
return {
|
return {
|
||||||
top: topText.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("%", "\\%") : "",
|
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"
|
font: this.specialArgs.font && allowedFonts.includes(this.specialArgs.font.toLowerCase()) ? this.specialArgs.font.toLowerCase() : "times"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ class SnapchatCommand extends ImageCommand {
|
||||||
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
|
||||||
const position = parseFloat(this.specialArgs.position);
|
const position = parseFloat(this.specialArgs.position);
|
||||||
return {
|
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
|
pos: isNaN(position) ? 0.5 : position
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue