Compare commits

...

2 commits

Author SHA1 Message Date
8c7b87dbac
push the reminder to the db 2022-11-03 17:45:14 +01:00
a85157fe44
remove message id 2022-11-03 17:45:06 +01:00
2 changed files with 8 additions and 3 deletions

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

View file

@ -49,7 +49,6 @@ const initDatabase = (db: Database) => {
id INTEGER PRIMARY KEY, \ id INTEGER PRIMARY KEY, \
data TEXT, \ data TEXT, \
expiration_date INTEGER, \ expiration_date INTEGER, \
message_id INTEGER, \
option_id INTEGER, \ option_id INTEGER, \
channel_id INTEGER, \ channel_id INTEGER, \
creation_date INTEGER, \ creation_date INTEGER, \