Skip to content

Commit

Permalink
ArtSwitcher: don't set up handler if all buttons are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlul committed Mar 21, 2024
1 parent 0907a43 commit d06baae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/art.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export class ArtSwitcher {

async editReply(parentInteraction: ChatInputCommandInteraction, resultLanguage: Locale): Promise<Message> {
const reply = await parentInteraction.editReply(this.replyOptions);
// Don't bother setting up button handler if all buttons are disabled
if (this.images.length === 1) {
return reply;
}
const filter = (childInteraction: ButtonInteraction): boolean => {
this.logger.info(serialiseInteraction(parentInteraction), `click: ${childInteraction.user.id}`);
if (childInteraction.user.id === parentInteraction.user.id) {
Expand Down

0 comments on commit d06baae

Please sign in to comment.