feat: Reminders #44

Merged
Anri merged 54 commits from feat/reminders into main 2023-01-17 12:15:15 +01:00
3 changed files with 25 additions and 34 deletions
Showing only changes of commit 8ebc926d97 - Show all commits

View file

@ -220,38 +220,27 @@ export default {
}
const page = interaction.options.getInteger(loc_default?.get(`c_${filename}_sub2_opt2_name`) as string) ?? 1;
const { remindersExists, list } = await embedListReminders(client, user, interaction.guildId, page, interaction.locale);
const list = await embedListReminders(client, user, interaction.guildId, page, interaction.locale);
let row;
if (remindersExists) {
const idPrec = 'reminderList-prec';
const idNext = 'reminderList-next';
row = new ActionRowBuilder<ButtonBuilder>()
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId(idPrec)
.setLabel('Prec')
.setLabel(loc.get('c_reminder12'))
.setStyle(ButtonStyle.Primary)
.setDisabled(true))
.addComponents(
new ButtonBuilder()
.setCustomId(idNext)
.setLabel('Next')
.setLabel(loc.get('c_reminder13'))
.setStyle(ButtonStyle.Primary),
);
// Buttons interactions
collect(client, interaction, idPrec);
collect(client, interaction, idNext);
} else {
const idUpdate = 'reminderList-update';
row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId(idUpdate)
.setLabel('Update')
.setStyle(ButtonStyle.Primary)
);
}
return await interaction.reply({ ephemeral: true, embeds: [list], components: [row] });
}

View file

@ -46,5 +46,7 @@
"c_reminder8": "Expire dans",
"c_reminder9": "Fais le",
"c_reminder10": "L'utilisateur n'a aucun rappel en attente ou page n°",
"c_reminder11": "vide !"
"c_reminder11": "vide",
"c_reminder12": "Précédent",
"c_reminder13": "Suivant"
}

View file

@ -313,8 +313,8 @@ export const embedListReminders = async (client: Client, user: User, guildId: st
}
});
} else {
embed.addFields({ name: '\u200b', value: `${loc.get('c_reminder10')}${page} ${loc.get('c_reminder11')}` });
embed.addFields({ name: '\u200b', value: `${loc.get('c_reminder10')}${page} ${loc.get('c_reminder11')}.` });
}
return { remindersExists: reminders.length > 0 ? true : false, list: embed };
return embed;
};