This commit is contained in:
Mirco Wittrien 2020-02-23 20:24:40 +01:00
parent 24e9006804
commit 799d3d424f
3 changed files with 8 additions and 6 deletions

View File

@ -7660,8 +7660,9 @@
let newdata = ""; let newdata = "";
for (let key of keys) newdata += `{"${key}":`; for (let key of keys) newdata += `{"${key}":`;
value = value != null && value.value != null ? value.value : value; value = value != null && value.value != null ? value.value : value;
let marker = typeof value == "string" ? `"` : ``; let isString = typeof value == "string";
newdata += (marker + value + marker) + "}".repeat(keys.length); let marker = isString ? `"` : ``;
newdata += (marker + (isString ? value.replace(/\\/g, "\\\\") : value) + marker) + "}".repeat(keys.length);
newdata = JSON.parse(newdata); newdata = JSON.parse(newdata);
BDFDB.DataUtils.save(BDFDB.ObjectUtils.is(newdata) ? BDFDB.ObjectUtils.deepAssign({}, data, newdata) : newdata, this.props.plugin, option); BDFDB.DataUtils.save(BDFDB.ObjectUtils.is(newdata) ? BDFDB.ObjectUtils.deepAssign({}, data, newdata) : newdata, this.props.plugin, option);
this.props.plugin.SettingsUpdated = true; this.props.plugin.SettingsUpdated = true;

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@ var CustomQuoter = (_ => {
return class CustomQuoter { return class CustomQuoter {
getName () {return "CustomQuoter";} getName () {return "CustomQuoter";}
getVersion () {return "1.0.2";} getVersion () {return "1.0.3";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -223,7 +223,8 @@ var CustomQuoter = (_ => {
let guild = channel.guild_id ? (BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {id: "850725684241078788", name: "Test Server"}) : {id: "@me", name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES}; let guild = channel.guild_id ? (BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {id: "850725684241078788", name: "Test Server"}) : {id: "@me", name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES};
return customQuote
return BDFDB.StringUtils.insertNRST(customQuote)
.replace("$mention", settings.ignoreMentionInDM && channel.isDM() ? "" : `<@!${message.author.id}>`) .replace("$mention", settings.ignoreMentionInDM && channel.isDM() ? "" : `<@!${message.author.id}>`)
.replace("$authorName", message.author.username || "") .replace("$authorName", message.author.username || "")
.replace("$authorId", message.author.id || "") .replace("$authorId", message.author.id || "")
@ -245,7 +246,7 @@ var CustomQuoter = (_ => {
.replace("$month", settings.forceZeros && month < 10 ? "0" + month : month) .replace("$month", settings.forceZeros && month < 10 ? "0" + month : month)
.replace("$year", timestamp.getFullYear()) .replace("$year", timestamp.getFullYear())
.replace("$quote", unquotedLines.split("\n").map(line => "> " + line + "\n").join("") || "") .replace("$quote", unquotedLines.split("\n").map(line => "> " + line + "\n").join("") || "")
.trim().split(" ").filter(n => n).join(" "); .split(" ").filter(n => n).join(" ");
} }
addLeadingZeros (timestring) { addLeadingZeros (timestring) {