From 4c07e9daec99900c052c0987e7b6b3172d727b18 Mon Sep 17 00:00:00 2001 From: Reinhardt Date: Sun, 14 Aug 2022 09:08:29 +0700 Subject: [PATCH] Set bookmark max limit to 25 --- framework/lib/Modules/BookmarkPaginator.ts | 11 +++++++++++ framework/lib/Modules/ReadPaginator.ts | 11 +++++++++++ framework/lib/Modules/ReadSearchPaginator.ts | 11 +++++++++++ framework/lib/Modules/SearchPaginator.ts | 11 +++++++++++ 4 files changed, 44 insertions(+) diff --git a/framework/lib/Modules/BookmarkPaginator.ts b/framework/lib/Modules/BookmarkPaginator.ts index fb2d43b..7e5e02f 100644 --- a/framework/lib/Modules/BookmarkPaginator.ts +++ b/framework/lib/Modules/BookmarkPaginator.ts @@ -271,6 +271,17 @@ export class BookmarkPaginator { UserModel.findOneAndUpdate({ id: interaction.member.id }, { $pull: { "bookmark": embed.author.name } }).exec(); } else { + if (userData.bookmark.length === 25) { + return interaction.createMessage({ + embeds: [ + new Utils.RichEmbed() + .setColor(this.client.config.BOT.COLOUR) + .setDescription(this.client.translate("main.bookmark.maxed")) + ], + flags: Constants.MessageFlags.EPHEMERAL + }); + } + interaction.createMessage({ embeds: [ new Utils.RichEmbed() diff --git a/framework/lib/Modules/ReadPaginator.ts b/framework/lib/Modules/ReadPaginator.ts index a0d15b4..971231d 100644 --- a/framework/lib/Modules/ReadPaginator.ts +++ b/framework/lib/Modules/ReadPaginator.ts @@ -243,6 +243,17 @@ export class ReadPaginator { UserModel.findOneAndUpdate({ id: interaction.member.id }, { $pull: { "bookmark": this.embeds[0].author.name } }).exec(); } else { + if (userData.bookmark.length === 25) { + return interaction.createMessage({ + embeds: [ + new Utils.RichEmbed() + .setColor(this.client.config.BOT.COLOUR) + .setDescription(this.client.translate("main.bookmark.maxed")) + ], + flags: Constants.MessageFlags.EPHEMERAL + }); + } + interaction.createMessage({ embeds: [ new Utils.RichEmbed() diff --git a/framework/lib/Modules/ReadSearchPaginator.ts b/framework/lib/Modules/ReadSearchPaginator.ts index 8187423..4fe9e4f 100644 --- a/framework/lib/Modules/ReadSearchPaginator.ts +++ b/framework/lib/Modules/ReadSearchPaginator.ts @@ -263,6 +263,17 @@ export class ReadSearchPaginator { UserModel.findOneAndUpdate({ id: interaction.member.id }, { $pull: { "bookmark": this.embeds[0].author.name } }).exec(); } else { + if (userData.bookmark.length === 25) { + return interaction.createMessage({ + embeds: [ + new Utils.RichEmbed() + .setColor(this.client.config.BOT.COLOUR) + .setDescription(this.client.translate("main.bookmark.maxed")) + ], + flags: Constants.MessageFlags.EPHEMERAL + }); + } + interaction.createMessage({ embeds: [ new Utils.RichEmbed() diff --git a/framework/lib/Modules/SearchPaginator.ts b/framework/lib/Modules/SearchPaginator.ts index 6f85440..8febf0a 100644 --- a/framework/lib/Modules/SearchPaginator.ts +++ b/framework/lib/Modules/SearchPaginator.ts @@ -295,6 +295,17 @@ export class SearchPaginator { UserModel.findOneAndUpdate({ id: interaction.member.id }, { $pull: { "bookmark": embed.author.name } }).exec(); } else { + if (userData.bookmark.length === 25) { + return interaction.createMessage({ + embeds: [ + new Utils.RichEmbed() + .setColor(this.client.config.BOT.COLOUR) + .setDescription(this.client.translate("main.bookmark.maxed")) + ], + flags: Constants.MessageFlags.EPHEMERAL + }); + } + interaction.createMessage({ embeds: [ new Utils.RichEmbed()