Centralize text encoding

This commit is contained in:
Essem 2022-09-10 23:48:44 -05:00
parent 20f4849fee
commit 3eae453de3
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
9 changed files with 23 additions and 34 deletions

View file

@ -1,9 +1,10 @@
//import wrap from "../../utils/wrap.js";
import ImageCommand from "../../classes/imageCommand.js";
import { textEncode } from "../../utils/misc.js";
class SonicCommand extends ImageCommand {
params() {
const cleanedMessage = (this.options.text ?? this.args.join(" ")).replaceAll("&", "&amp;").replaceAll(">", "&gt;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;").replaceAll("\\n", "\n");
const cleanedMessage = textEncode(this.options.text ?? this.args.join(" "));
return {
text: cleanedMessage
};