feat: more readable time delta #193

Merged
Anri merged 6 commits from date into dev 2024-10-08 20:53:29 +02:00
3 changed files with 6 additions and 4 deletions
Showing only changes of commit 208dbf0813 - Show all commits

View file

@ -60,7 +60,7 @@
"c_reminder_sub3_desc": "Delete a reminder", "c_reminder_sub3_desc": "Delete a reminder",
"c_reminder_sub3_opt1_name": "id", "c_reminder_sub3_opt1_name": "id",
"c_reminder_sub3_opt1_desc": "Reminder to be deleted", "c_reminder_sub3_opt1_desc": "Reminder to be deleted",
"c_reminder1": "A reminder has been set up for in", "c_reminder1": "A reminder has been set up for",
"c_reminder2": "The ID entered is not valid.", "c_reminder2": "The ID entered is not valid.",
"c_reminder3": "Reminder not found, not in the right guild, or not belonging to you.", "c_reminder3": "Reminder not found, not in the right guild, or not belonging to you.",
"c_reminder4": "Unknown user.", "c_reminder4": "Unknown user.",

View file

@ -60,7 +60,7 @@
"c_reminder_sub3_desc": "Supprime un rappel", "c_reminder_sub3_desc": "Supprime un rappel",
"c_reminder_sub3_opt1_name": "id", "c_reminder_sub3_opt1_name": "id",
"c_reminder_sub3_opt1_desc": "Rappel à supprimé", "c_reminder_sub3_opt1_desc": "Rappel à supprimé",
"c_reminder1": "Un rappel a été configuré pour dans", "c_reminder1": "Un rappel a été configuré pour",
"c_reminder2": "L'ID renseigné n'est pas valide.", "c_reminder2": "L'ID renseigné n'est pas valide.",
"c_reminder3": "Rappel non trouvé, pas sur le bon serveur ou qui ne vous appartiens pas.", "c_reminder3": "Rappel non trouvé, pas sur le bon serveur ou qui ne vous appartiens pas.",
"c_reminder4": "Utilisateur inconnu.", "c_reminder4": "Utilisateur inconnu.",

View file

@ -88,6 +88,8 @@ export const newReminder = async (client: Client, time: string, info: infoRemind
const timeoutId = setTimeoutReminder(client, info, data.option, timeout); const timeoutId = setTimeoutReminder(client, info, data.option, timeout);
const expiration_date = info.createdAt + timeout * 1000;
// Add the remind to the db // Add the remind to the db
client.db.run( client.db.run(
"INSERT INTO reminder ( \ "INSERT INTO reminder ( \
@ -95,7 +97,7 @@ export const newReminder = async (client: Client, time: string, info: infoRemind
) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? );", ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? );",
[ [
info.message, info.message,
`${info.createdAt + timeout * 1000}`, `${expiration_date}`,
data.option.valueOf(), data.option.valueOf(),
info.channelId, info.channelId,
`${info.createdAt}`, `${info.createdAt}`,
@ -110,7 +112,7 @@ export const newReminder = async (client: Client, time: string, info: infoRemind
} }
// Send confirmation to user // Send confirmation to user
ok(`${loc.get("c_reminder1")} ${data.time}.`); ok(`${loc.get("c_reminder1")} ${timeDeltaToString(info.locale, expiration_date)}.`);
}, },
); );
}); });