fix pages
This commit is contained in:
parent
2e1b350e15
commit
240b0d0422
1 changed files with 4 additions and 4 deletions
|
@ -281,11 +281,10 @@ export const embedListReminders = async (client: Client, user: User, guildId: st
|
|||
const reminders = await listReminders(client, user.id, guildId);
|
||||
|
||||
const elementPerPage = 5;
|
||||
let pageMax = Math.floor(reminders.length / elementPerPage);
|
||||
const pageMax = Math.ceil(reminders.length / elementPerPage);
|
||||
|
||||
if (pageMax <= 1) {
|
||||
page = 1;
|
||||
pageMax = 1;
|
||||
}
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(Colors.DarkGrey)
|
||||
|
@ -295,9 +294,10 @@ export const embedListReminders = async (client: Client, user: User, guildId: st
|
|||
const limit = elementPerPage * page;
|
||||
|
||||
if (reminders.length > 0 && page <= pageMax) {
|
||||
let curseur = limit - elementPerPage - 1;
|
||||
let curseur = limit - elementPerPage;
|
||||
reminders.splice(0, limit - elementPerPage);
|
||||
reminders.forEach((remind) => {
|
||||
if (curseur <= limit) {
|
||||
if (curseur < limit) {
|
||||
let text = remind.data ?? loc.get('c_reminder7');
|
||||
if (text.length > 1024) {
|
||||
text = `${text.substring(0, 1021)}...`;
|
||||
|
|
Loading…
Reference in a new issue