From 2fbd2e3016224147bd0fafaf062e7e86df8c2d53 Mon Sep 17 00:00:00 2001 From: Essem Date: Fri, 13 Aug 2021 00:09:30 -0500 Subject: [PATCH] Set tag content limit, fixed new pagination showing buttons on single-page messages --- commands/tags/tags.js | 1 + utils/pagination/pagination.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/tags/tags.js b/commands/tags/tags.js index 58f1563..e5cd5ff 100644 --- a/commands/tags/tags.js +++ b/commands/tags/tags.js @@ -78,6 +78,7 @@ class TagsCommand extends Command { async setTag(content, name, message, edit = false) { if ((!content || content.length === 0) && message.attachments.length === 0) return "You need to provide the content of the tag!"; + if (content && content.length >= 2000) return "Your tag content is too long!"; if (message.attachments.length !== 0 && content) { await database[edit ? "editTag" : "setTag"](name, { content: `${content} ${message.attachments[0].url}`, author: message.author.id }, message.channel.guild); } else if (message.attachments.length !== 0) { diff --git a/utils/pagination/pagination.js b/utils/pagination/pagination.js index b88063d..d7f2c8a 100644 --- a/utils/pagination/pagination.js +++ b/utils/pagination/pagination.js @@ -70,7 +70,7 @@ module.exports = async (client, message, pages, timeout = 120000) => { "Content-Type": "application/json" } }; - let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options, components)); + let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options, pages.length > 1 ? components : {})); if (pages.length > 1) { const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout }); interactionCollector.on("interaction", async (msg, interaction, id, token, member) => {