From 8c7b87dbacbcedf02b71883106c97c2c70dcb0d1 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 3 Nov 2022 17:45:14 +0100 Subject: [PATCH] push the reminder to the db --- src/commands/misc/reminder.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commands/misc/reminder.ts b/src/commands/misc/reminder.ts index 35ee7e0..179c04d 100644 --- a/src/commands/misc/reminder.ts +++ b/src/commands/misc/reminder.ts @@ -163,9 +163,10 @@ export default { // eslint-disable-next-line no-case-declarations let time = interaction.options.getString(loc_default?.get(`c_${filename}_sub1_opt1_name`) as string); const message = interaction.options.getString(loc_default?.get(`c_${filename}_sub1_opt2_name`) as string); + let option = OptionReminder.Nothing; + let seconds: number; if (time != null) { // Cli - let option = OptionReminder.Nothing; // Split time if (time?.endsWith('@')) { @@ -176,12 +177,17 @@ export default { option = OptionReminder.DirectMessage; } - const seconds = strToSeconds(time); + seconds = strToSeconds(time); await interaction.reply(`${option} - ${seconds}`); } else { // BoƮte de dialogue + seconds = 0; } + client.db.run('INSERT INTO reminder ( \ + data, expiration_date, option_id, channel_id, creation_date, user_id, guild_id \ + ) VALUES ( ?, ?, ?, ?, ?, ?, ?);', [message, interaction.createdAt.getTime() + seconds, option.valueOf(), interaction.channelId, interaction.createdAt.getTime(), interaction.user.id, interaction.guildId]); + break; } // List reminders