This commit is contained in:
Mirco Wittrien 2020-02-23 18:55:20 +01:00
parent a1123904e9
commit c91efc76c2
6 changed files with 309 additions and 33 deletions

View File

@ -32,15 +32,15 @@ var CompleteTimestamps = (_ => {
initConstructor () {
this.defaults = {
settings: {
showInChat: {value:true, description:"Replace Chat Timestamp with Complete Timestamp:"},
showInEmbed: {value:true, description:"Replace Embed Timestamp with Complete Timestamp:"},
changeForChat: {value:true, description:"Change the Time for the Chat Time Tooltips:"},
changeForEdit: {value:true, description:"Change the Time for the Edited Time Tooltips:"},
displayTime: {value:true, description:"Display the Time in the Timestamp:"},
displayDate: {value:true, description:"Display the Date in the Timestamp:"},
cutSeconds: {value:false, description:"Cut off Seconds of the Time:"},
forceZeros: {value:false, description:"Force leading Zeros:"},
otherOrder: {value:false, description:"Show the Time before the Date:"}
showInChat: {value:true, description:"Replace Chat Timestamp with Complete Timestamp:"},
showInEmbed: {value:true, description:"Replace Embed Timestamp with Complete Timestamp:"},
changeForChat: {value:true, description:"Change the Time for the Chat Time Tooltips:"},
changeForEdit: {value:true, description:"Change the Time for the Edited Time Tooltips:"},
displayTime: {value:true, description:"Display the Time in the Timestamp:"},
displayDate: {value:true, description:"Display the Date in the Timestamp:"},
cutSeconds: {value:false, description:"Cut off Seconds of the Time:"},
forceZeros: {value:false, description:"Force leading Zeros:"},
otherOrder: {value:false, description:"Show the Time before the Date:"}
},
choices: {
creationDateLang: {value:"$discord", description:"Timestamp Format:"}
@ -155,7 +155,21 @@ var CompleteTimestamps = (_ => {
title: "Placeholder Guide",
collapseStates: collapseStates,
dividertop: true,
children: ["$hour will be replaced with the current hour", "$minute will be replaced with the current minutes", "$second will be replaced with the current seconds", "$msecond will be replaced with the current milliseconds", "$timemode will change $hour to a 12h format and will be replaced with AM/PM", "$year will be replaced with the current year", "$month will be replaced with the current month", "$day will be replaced with the current day", "$monthnameL will be replaced with the monthname in long format based on the Discord Language", "$monthnameS will be replaced with the monthname in short format based on the Discord Language", "$weekdayL will be replaced with the weekday in long format based on the Discord Language", "$weekdayS will be replaced with the weekday in short format based on the Discord Language", "$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)].map(string => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormText, {
children: [
"$hour will be replaced with the current hour",
"$minute will be replaced with the current minutes",
"$second will be replaced with the current seconds",
"$msecond will be replaced with the current milliseconds",
"$timemode will change $hour to a 12h format and will be replaced with AM/PM",
"$year will be replaced with the current year",
"$month will be replaced with the current month",
"$day will be replaced with the current day",
"$monthnameL will be replaced with the monthname in long format based on the Discord Language",
"$monthnameS will be replaced with the monthname in short format based on the Discord Language",
"$weekdayL will be replaced with the weekday in long format based on the Discord Language",
"$weekdayS will be replaced with the weekday in short format based on the Discord Language",
"$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)
].map(string => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormText, {
type: BDFDB.LibraryComponents.FormComponents.FormTextTypes.DESCRIPTION,
children: string
}))
@ -205,8 +219,6 @@ var CompleteTimestamps = (_ => {
stop () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.DOMUtils.removeLocalStyle(this.name + "CompactCorrection");
this.forceUpdateAll();

View File

@ -66,7 +66,7 @@ class CreationDate {
};
}
getSettingsPanel () {
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
@ -158,16 +158,27 @@ class CreationDate {
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
dividertop: true,
collapsed: BDFDB.DataUtils.load(this, "hideInfo", "hideInfo"),
children: ["$hour will be replaced with the current hour", "$minute will be replaced with the current minutes", "$second will be replaced with the current seconds", "$msecond will be replaced with the current milliseconds", "$timemode will change $hour to a 12h format and will be replaced with AM/PM", "$year will be replaced with the current year", "$month will be replaced with the current month", "$day will be replaced with the current day", "$monthnameL will be replaced with the monthname in long format based on the Discord Language", "$monthnameS will be replaced with the monthname in short format based on the Discord Language", "$weekdayL will be replaced with the weekday in long format based on the Discord Language", "$weekdayS will be replaced with the weekday in short format based on the Discord Language", "$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)].map(string => {
collapseStates: collapseStates,
children: [
"$hour will be replaced with the current hour",
"$minute will be replaced with the current minutes",
"$second will be replaced with the current seconds",
"$msecond will be replaced with the current milliseconds",
"$timemode will change $hour to a 12h format and will be replaced with AM/PM",
"$year will be replaced with the current year",
"$month will be replaced with the current month",
"$day will be replaced with the current day",
"$monthnameL will be replaced with the monthname in long format based on the Discord Language",
"$monthnameS will be replaced with the monthname in short format based on the Discord Language",
"$weekdayL will be replaced with the weekday in long format based on the Discord Language",
"$weekdayS will be replaced with the weekday in short format based on the Discord Language",
"$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)
].map(string => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormText, {
type: BDFDB.LibraryComponents.FormComponents.FormTextTypes.DESCRIPTION,
children: string
});
}),
onClick: collapsed => {
BDFDB.DataUtils.save(collapsed, this, "hideInfo", "hideInfo");
}
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);

View File

@ -0,0 +1,219 @@
//META{"name":"CustomQuoter","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/CustomQuoter","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/CustomQuoter/CustomQuoter.plugin.js"}*//
var CustomQuoter = (_ => {
return class CustomQuoter {
getName () {return "CustomQuoter";}
getVersion () {return "1.0.0";}
getAuthor () {return "DevilBro";}
getDescription () {return "Let's you customize the output of the native quote feature of discord";}
initConstructor () {
this.defaults = {
settings: {
ignoreMentionInDM: {value:true, description:"Do not add a mention in DM channels"},
forceZeros: {value:false, description:"Force leading Zeros"}
},
formats: {
customQuote: {value:"$quote $mention", description:"Custom Format:"}
}
};
}
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let formats = BDFDB.DataUtils.get(this, "formats");
let settingspanel, settingsitems = [], inneritems = [];
for (let key in settings) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "Switch",
plugin: this,
keys: ["settings", key],
label: this.defaults.settings[key].description,
value: settings[key],
onChange: (e, instance) => {
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(BDFDB.ReactUtils.findOwner(instance, {name:"BDFDB_SettingsPanel", up:true}), {name:"BDFDB_Select", all:true, noCopies:true}));
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Settings",
collapseStates: collapseStates,
children: inneritems
}));
inneritems = [];
for (let key in formats) inneritems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
className: BDFDB.disCN.marginbottom8,
type: "TextInput",
plugin: this,
keys: ["formats", key],
label: this.defaults.formats[key].description,
basis: "70%",
value: formats[key],
onChange: (e, instance) => {
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(BDFDB.ReactUtils.findOwner(instance, {name:"BDFDB_SettingsPanel", up:true}), {name:"BDFDB_Select", all:true, noCopies:true}));
}
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Format",
collapseStates: collapseStates,
dividertop: true,
children: inneritems
}));
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
collapseStates: collapseStates,
dividertop: true,
children: [
"$quote will be replaced with the quoted message content",
"$mention will be replaced with a mention of the message author",
"$authorId will be replaced with the ID of the message author",
"$authorName will be replaced with the name of the message author",
"$channel will be replaced with a mention of the channel (ignored for DMs)",
"$channelId will be replaced with the ID of the channel",
"$channelName will be replaced with the Name of the channel",
"$serverId will be replaced with the ID of the server",
"$serverName will be replaced with the name of the server",
"$hour will be replaced with the quote hour",
"$minute will be replaced with the quote minutes",
"$second will be replaced with the quote seconds",
"$msecond will be replaced with the quote milliseconds",
"$timemode will change $hour to a 12h format and will be replaced with AM/PM",
"$year will be replaced with the quote year",
"$month will be replaced with the quote month",
"$day will be replaced with the quote day",
"$monthnameL will be replaced with the monthname in long format based on the Discord Language",
"$monthnameS will be replaced with the monthname in short format based on the Discord Language",
"$weekdayL will be replaced with the weekday in long format based on the Discord Language",
"$weekdayS will be replaced with the weekday in short format based on the Discord Language"
].map(string => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormText, {
type: BDFDB.LibraryComponents.FormComponents.FormTextTypes.DESCRIPTION,
children: string
}))
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
}
//legacy
load () {}
start () {
if (!window.BDFDB) window.BDFDB = {myPlugins:{}};
if (window.BDFDB && window.BDFDB.myPlugins && typeof window.BDFDB.myPlugins == "object") window.BDFDB.myPlugins[this.getName()] = this;
let libraryScript = document.querySelector("head script#BDFDBLibraryScript");
if (!libraryScript || (performance.now() - libraryScript.getAttribute("date")) > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("id", "BDFDBLibraryScript");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.min.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", _ => {this.initialize();});
document.head.appendChild(libraryScript);
}
else if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(_ => {
try {return this.initialize();}
catch (err) {console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not initiate plugin! " + err);}
}, 30000);
}
initialize () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.patch(this, BDFDB.LibraryModules.QuoteUtils, "createQuotedText", {instead: e => {
return this.parseQuote(e.methodArguments[0], e.methodArguments[1]);
}});
}
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
}
stop () {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true;
BDFDB.PluginUtils.clear(this);
}
}
// begin of own functions
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
this.forceUpdateAll();
}
}
parseQuote (message, channel) {
let settings = BDFDB.DataUtils.get(this, "settings");
let customQuote = BDFDB.DataUtils.get(this, "formats", "customQuote");
let languageId = BDFDB.LanguageUtils.getLanguage().id;
let timestamp = new Date(message.editedTimestamp || message.timestamp);
let hour = timestamp.getHours(), minute = timestamp.getMinutes(), second = timestamp.getSeconds(), msecond = timestamp.getMilliseconds(), day = timestamp.getDate(), month = timestamp.getMonth()+1, timemode = "";
if (customQuote.indexOf("$timemode") > -1) {
timemode = hour >= 12 ? "PM" : "AM";
hour = hour % 12;
hour = hour ? hour : 12;
}
let unquotedLines = message.content.split("\n").filter(line => !line.startsWith("> "));
unquotedLines = unquotedLines.slice(unquotedLines.findIndex(line => line.trim().length > 0)).join("\n");
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {id: "@me", name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES};
console.log(message);
return customQuote
.replace("$quote", unquotedLines.split("\n").map(line => "> " + line + "\n").join(""))
.replace("$mention", settings.ignoreMentionInDM && channel.isDM() ? "" : `<@!${message.author.id}>`)
.replace("$authorId", message.author.id)
.replace("$authorName", message.author.name)
.replace("$channel", channel.isDM() ? "" : `<#${channel.id}>`)
.replace("$channelId", channel.id)
.replace("$channelName", channel.name)
.replace("$serverId", guild.id)
.replace("$serverName", guild.name)
.replace("$hour", settings.forceZeros && hour < 10 ? "0" + hour : hour)
.replace("$minute", minute < 10 ? "0" + minute : minute)
.replace("$second", second < 10 ? "0" + second : second)
.replace("$msecond", settings.forceZeros ? (msecond < 10 ? "00" + msecond : (msecond < 100 ? "0" + msecond : msecond)) : msecond)
.replace("$timemode", timemode)
.replace("$weekdayL", timestamp.toLocaleDateString(languageId, {weekday: "long"}))
.replace("$weekdayS", timestamp.toLocaleDateString(languageId, {weekday: "short"}))
.replace("$monthnameL", timestamp.toLocaleDateString(languageId, {month: "long"}))
.replace("$monthnameS", timestamp.toLocaleDateString(languageId, {month: "short"}))
.replace("$day", settings.forceZeros && day < 10 ? "0" + day : day)
.replace("$month", settings.forceZeros && month < 10 ? "0" + month : month)
.replace("$year", timestamp.getFullYear())
.trim().split(" ").filter(n => n).join(" ");
}
addLeadingZeros (timestring) {
let chararray = timestring.split("");
let numreg = /[0-9]/;
for (let i = 0; i < chararray.length; i++) if (!numreg.test(chararray[i-1]) && numreg.test(chararray[i]) && !numreg.test(chararray[i+1])) chararray[i] = "0" + chararray[i];
return chararray.join("");
}
forceUpdateAll() {
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
}
})();

View File

@ -0,0 +1,12 @@
# Custom Quoter - [![Downlad][download-badge]][download-link] [![Paypal][paypal-badge]][paypal-link] [![Patreon][patreon-badge]][patreon-link]
[download-badge]: https://img.shields.io/badge/Download-Plugin-brightgreen.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADGGlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjaY2BgnuDo4uTKJMDAUFBUUuQe5BgZERmlwH6egY2BmYGBgYGBITG5uMAxIMCHgYGBIS8/L5UBFTAyMHy7xsDIwMDAcFnX0cXJlYE0wJpcUFTCwMBwgIGBwSgltTiZgYHhCwMDQ3p5SUEJAwNjDAMDg0hSdkEJAwNjAQMDg0h2SJAzAwNjCwMDE09JakUJAwMDg3N+QWVRZnpGiYKhpaWlgmNKflKqQnBlcUlqbrGCZ15yflFBflFiSWoKAwMD1A4GBgYGXpf8EgX3xMw8BSMDVQYqg4jIKAUICxE+CDEESC4tKoMHJQODAIMCgwGDA0MAQyJDPcMChqMMbxjFGV0YSxlXMN5jEmMKYprAdIFZmDmSeSHzGxZLlg6WW6x6rK2s99gs2aaxfWMPZ9/NocTRxfGFM5HzApcj1xZuTe4FPFI8U3mFeCfxCfNN45fhXyygI7BD0FXwilCq0A/hXhEVkb2i4aJfxCaJG4lfkaiQlJM8JpUvLS19QqZMVl32llyfvIv8H4WtioVKekpvldeqFKiaqP5UO6jepRGqqaT5QeuA9iSdVF0rPUG9V/pHDBYY1hrFGNuayJsym740u2C+02KJ5QSrOutcmzjbQDtXe2sHY0cdJzVnJRcFV3k3BXdlD3VPXS8Tbxsfd99gvwT//ID6wIlBS4N3hVwMfRnOFCEXaRUVEV0RMzN2T9yDBLZE3aSw5IaUNak30zkyLDIzs+ZmX8xlz7PPryjYVPiuWLskq3RV2ZsK/cqSql01jLVedVPrHzbqNdU0n22VaytsP9op3VXUfbpXta+x/+5Em0mzJ/+dGj/t8AyNmf2zvs9JmHt6vvmCpYtEFrcu+bYsc/m9lSGrTq9xWbtvveWGbZtMNm/ZarJt+w6rnft3u+45uy9s/4ODOYd+Hmk/Jn58xUnrU+fOJJ/9dX7SRe1LR68kXv13fc5Nm1t379TfU75/4mHeY7En+59lvhB5efB1/lv5dxc+NH0y/fzq64Lv4T8Ffp360/rP8f9/AA0ADzT6lvFdAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAF1SURBVHja7JihTgNBEIb/K1WkBtEEAsESBKEvgEKRAhLHOxAMfQ9cHwEMBoFA1/ACBEGgzbkmUAwI+BENubTs9WZmLz1CZtZd9v7/u9vMZGdAGFabA05Hn3sWrYQwRB9rwafreikbQN5LiV6qhorDARzAARzAARzAARzAARzAARygGOAQ6a+GLr9jmlwpDuJbsxQrER+YYrXaI2D8EZyAEfangj2Fq0NrnBWry8YI5yb7rkRbBrDAK7X9NevlAYCL7Kns79iQKcunOU0+iO0fuSzV1QyUNjkU2b9wS66qm2nt8L3Q/oO7Gk3tWO2InzPtv3isU9RP9jqxmR8LMKsqdPVqFoC8qiDM/HiAcFUQZ34IYDr0VUGW+QEfK8BkVZBmfqkAWVWQZ37JAOA+n/nEtnh/wGd8JWP81Nt0P0r8Wu4ADvAHAOq2fsaP4N8BvFXi/ZoB3FYCcJMNKDbQw9Kc7YdoYfDzB+6xjUuM5mY+wsXYHvgeABIzsPkSOM/lAAAAAElFTkSuQmCC&style=flat
[download-link]: https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/CustomQuoter/CustomQuoter.plugin.js
[paypal-badge]: https://img.shields.io/badge/Paypal-Donate!-%23003087.svg?logo=paypal&style=flat
[paypal-link]: https://paypal.me/MircoWittrien
[patreon-badge]: https://img.shields.io/badge/Patreon-Support!-%23F96854.svg?logo=patreon&style=flat
[patreon-link]: https://patreon.com/MircoWittrien
Let's you customize the output of the native quote feature of Discord.

View File

@ -68,7 +68,7 @@ class JoinedAtDate {
};
}
getSettingsPanel () {
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
@ -160,16 +160,27 @@ class JoinedAtDate {
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
dividertop: true,
collapsed: BDFDB.DataUtils.load(this, "hideInfo", "hideInfo"),
children: ["$hour will be replaced with the current hour", "$minute will be replaced with the current minutes", "$second will be replaced with the current seconds", "$msecond will be replaced with the current milliseconds", "$timemode will change $hour to a 12h format and will be replaced with AM/PM", "$year will be replaced with the current year", "$month will be replaced with the current month", "$day will be replaced with the current day", "$monthnameL will be replaced with the monthname in long format based on the Discord Language", "$monthnameS will be replaced with the monthname in short format based on the Discord Language", "$weekdayL will be replaced with the weekday in long format based on the Discord Language", "$weekdayS will be replaced with the weekday in short format based on the Discord Language", "$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)].map(string => {
collapseStates: collapseStates,
children: [
"$hour will be replaced with the current hour",
"$minute will be replaced with the current minutes",
"$second will be replaced with the current seconds",
"$msecond will be replaced with the current milliseconds",
"$timemode will change $hour to a 12h format and will be replaced with AM/PM",
"$year will be replaced with the current year",
"$month will be replaced with the current month",
"$day will be replaced with the current day",
"$monthnameL will be replaced with the monthname in long format based on the Discord Language",
"$monthnameS will be replaced with the monthname in short format based on the Discord Language",
"$weekdayL will be replaced with the weekday in long format based on the Discord Language",
"$weekdayS will be replaced with the weekday in short format based on the Discord Language",
"$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)
].map(string => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormText, {
type: BDFDB.LibraryComponents.FormComponents.FormTextTypes.DESCRIPTION,
children: string
});
}),
onClick: collapsed => {
BDFDB.DataUtils.save(collapsed, this, "hideInfo", "hideInfo");
}
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);

View File

@ -69,7 +69,7 @@ class LastMessageDate {
};
}
getSettingsPanel () {
getSettingsPanel (collapseStates = {}) {
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
let settings = BDFDB.DataUtils.get(this, "settings");
let choices = BDFDB.DataUtils.get(this, "choices");
@ -161,16 +161,27 @@ class LastMessageDate {
settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Placeholder Guide",
dividertop: true,
collapsed: BDFDB.DataUtils.load(this, "hideInfo", "hideInfo"),
children: ["$hour will be replaced with the current hour", "$minute will be replaced with the current minutes", "$second will be replaced with the current seconds", "$msecond will be replaced with the current milliseconds", "$timemode will change $hour to a 12h format and will be replaced with AM/PM", "$year will be replaced with the current year", "$month will be replaced with the current month", "$day will be replaced with the current day", "$monthnameL will be replaced with the monthname in long format based on the Discord Language", "$monthnameS will be replaced with the monthname in short format based on the Discord Language", "$weekdayL will be replaced with the weekday in long format based on the Discord Language", "$weekdayS will be replaced with the weekday in short format based on the Discord Language", "$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)].map(string => {
collapseStates: collapseStates,
children: [
"$hour will be replaced with the current hour",
"$minute will be replaced with the current minutes",
"$second will be replaced with the current seconds",
"$msecond will be replaced with the current milliseconds",
"$timemode will change $hour to a 12h format and will be replaced with AM/PM",
"$year will be replaced with the current year",
"$month will be replaced with the current month",
"$day will be replaced with the current day",
"$monthnameL will be replaced with the monthname in long format based on the Discord Language",
"$monthnameS will be replaced with the monthname in short format based on the Discord Language",
"$weekdayL will be replaced with the weekday in long format based on the Discord Language",
"$weekdayS will be replaced with the weekday in short format based on the Discord Language",
"$daysago will be replaced with a string to tell you how many days ago the event occured. For Example: " + BDFDB.LanguageUtils.LanguageStringsFormat("ACTIVITY_FEED_USER_PLAYED_DAYS_AGO", 3)
].map(string => {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormText, {
type: BDFDB.LibraryComponents.FormComponents.FormTextTypes.DESCRIPTION,
children: string
});
}),
onClick: collapsed => {
BDFDB.DataUtils.save(collapsed, this, "hideInfo", "hideInfo");
}
})
}));
return settingspanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);