From 8c7d4a07cacc8556f197f7e56eeef354736765ac Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 10 Jul 2023 00:26:33 +0200 Subject: [PATCH] fix: Cut /guilds command message reply length to 4000 characters --- system-commands/guilds.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system-commands/guilds.js b/system-commands/guilds.js index 72847ca..15b91a0 100644 --- a/system-commands/guilds.js +++ b/system-commands/guilds.js @@ -31,18 +31,22 @@ module.exports = { return { name: guild.name, memberCount: guild.memberCount - } + }; }) .sort((a, b) => b.memberCount - a.memberCount) .map((guild) => `\`${guild.name} (#${guild.memberCount})\``) .join(', '); + let embedDescription = `**Guilds (${client.guilds.cache.size} total)**\n${guildsList}`; + + if (embedDescription.length >= 4000) { + embedDescription = `${embedDescription.slice(0, 3996)}...`; + } + return await interaction.editReply({ embeds: [ new EmbedBuilder() - .setDescription( - `**Guilds (${client.guilds.cache.size} total)**\n${guildsList}` - ) + .setDescription(embedDescription) .setColor(embedColors.colorInfo) ] });