feat: Reminders #44

Merged
Anri merged 54 commits from feat/reminders into main 2023-01-17 12:15:15 +01:00
Showing only changes of commit 8c7b87dbac - Show all commits

View file

@ -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