Skip to content

Commit

Permalink
fix: disable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Feb 19, 2022
1 parent a0a43ba commit f61a8d1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/PaginationEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,15 +860,14 @@ export class PaginationEmbed extends MessageEmbed {
.setLabel(this.buttonInfo.last.label)
.setStyle(this.buttonInfo.last.style);
}

if (this.totalEntry <= this.limit) {
this.buttons.first?.setDisabled();
this.buttons.prev?.setDisabled();
this.buttons.last?.setDisabled();
this.buttons.next?.setDisabled();
} else if (!this.loop) {
this.buttons.first?.setDisabled();
this.buttons.prev?.setDisabled();
Object.values(this.buttons).forEach((button) => button.setDisabled());
if (this.totalEntry > this.limit) {
this.buttons.last?.setDisabled(false);
this.buttons.next?.setDisabled(false);
}
if (this.loop) {
this.buttons.first?.setDisabled(true);
this.buttons.prev?.setDisabled(true);
}
this.mainActionRow.setComponents(Object.values(this.buttons));
this.actionRows = [this.mainActionRow];
Expand Down

0 comments on commit f61a8d1

Please sign in to comment.