Store intervals in templates

This commit is contained in:
jude
2023-09-23 22:47:21 +01:00
parent 52cf642455
commit 56ffc43616
5 changed files with 30 additions and 13 deletions

View File

@ -223,11 +223,10 @@ async function fetch_reminders(guild_id) {
}
async function serialize_reminder(node, mode) {
let interval, utc_time, expiration_time;
let utc_time, expiration_time;
let interval = get_interval(node);
if (mode !== "template") {
interval = get_interval(node);
utc_time = luxon.DateTime.fromISO(
node.querySelector('input[name="time"]').value
).setZone("UTC");
@ -356,9 +355,9 @@ async function serialize_reminder(node, mode) {
embed_title: embed_title,
embed_fields: fields,
expires: expiration_time,
interval_seconds: mode !== "template" ? interval.seconds : null,
interval_days: mode !== "template" ? interval.days : null,
interval_months: mode !== "template" ? interval.months : null,
interval_seconds: interval.seconds,
interval_days: interval.days,
interval_months: interval.months,
name: node.querySelector('input[name="name"]').value,
tts: node.querySelector('input[name="tts"]').checked,
username: node.querySelector('input[name="username"]').value,
@ -420,9 +419,9 @@ function deserialize_reminder(reminder, frame, mode) {
.insertBefore(embed_field, lastChild);
}
if (mode !== "template") {
if (reminder["interval_seconds"]) update_interval(frame);
if (reminder["interval_seconds"]) update_interval(frame);
if (mode !== "template") {
let $enableBtn = frame.querySelector(".disable-enable");
$enableBtn.dataset["action"] = reminder["enabled"] ? "disable" : "enable";