feat: Reminders #44
3 changed files with 25 additions and 34 deletions
|
@ -220,38 +220,27 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const page = interaction.options.getInteger(loc_default?.get(`c_${filename}_sub2_opt2_name`) as string) ?? 1;
|
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 idPrec = 'reminderList-prec';
|
||||||
const idNext = 'reminderList-next';
|
const idNext = 'reminderList-next';
|
||||||
row = new ActionRowBuilder<ButtonBuilder>()
|
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(idPrec)
|
.setCustomId(idPrec)
|
||||||
.setLabel('Prec')
|
.setLabel(loc.get('c_reminder12'))
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setDisabled(true))
|
.setDisabled(true))
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(idNext)
|
.setCustomId(idNext)
|
||||||
.setLabel('Next')
|
.setLabel(loc.get('c_reminder13'))
|
||||||
.setStyle(ButtonStyle.Primary),
|
.setStyle(ButtonStyle.Primary),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Buttons interactions
|
// Buttons interactions
|
||||||
collect(client, interaction, idPrec);
|
collect(client, interaction, idPrec);
|
||||||
collect(client, interaction, idNext);
|
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] });
|
return await interaction.reply({ ephemeral: true, embeds: [list], components: [row] });
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,5 +46,7 @@
|
||||||
"c_reminder8": "Expire dans",
|
"c_reminder8": "Expire dans",
|
||||||
"c_reminder9": "Fais le",
|
"c_reminder9": "Fais le",
|
||||||
"c_reminder10": "L'utilisateur n'a aucun rappel en attente ou page n°",
|
"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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,8 +313,8 @@ export const embedListReminders = async (client: Client, user: User, guildId: st
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} 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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue