push the reminder to the db

This commit is contained in:
Mylloon 2022-11-03 17:45:14 +01:00
parent a85157fe44
commit 8c7b87dbac
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -163,9 +163,10 @@ export default {
// eslint-disable-next-line no-case-declarations // eslint-disable-next-line no-case-declarations
let time = interaction.options.getString(loc_default?.get(`c_${filename}_sub1_opt1_name`) as string); 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); 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) { if (time != null) {
// Cli // Cli
let option = OptionReminder.Nothing;
// Split time // Split time
if (time?.endsWith('@')) { if (time?.endsWith('@')) {
@ -176,12 +177,17 @@ export default {
option = OptionReminder.DirectMessage; option = OptionReminder.DirectMessage;
} }
const seconds = strToSeconds(time); seconds = strToSeconds(time);
await interaction.reply(`${option} - ${seconds}`); await interaction.reply(`${option} - ${seconds}`);
} else { } else {
// Boîte de dialogue // 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; break;
} }
// List reminders // List reminders