From 623f4e200fbf33613370c974b6c483748fd96cce Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 21 Aug 2023 19:53:55 +0200 Subject: [PATCH] fix: Fix bug in /shards when shard count is 1 on shown page --- src/commands/system/shards.js | 36 +++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/commands/system/shards.js b/src/commands/system/shards.js index 6ca61b4..bf83bde 100644 --- a/src/commands/system/shards.js +++ b/src/commands/system/shards.js @@ -81,22 +81,34 @@ module.exports = { const evenShardIndexesString = evenShardIndexes.map(shardInfoToString).join('\n') + 'ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ'; const oddShardIndexesString = oddShardIndexes.map(shardInfoToString).join('\n'); + const embedFields = []; + + if (currentPageShards.length === 1) { + embedFields.push({ + name: ' ', + value: currentPageShards.map(shardInfoToString).join('\n'), + inline: false + }); + } else { + embedFields.push( + { + name: ' ', + value: evenShardIndexesString, + inline: true + }, + { + name: ' ', + value: oddShardIndexesString, + inline: true + } + ); + } + return await interaction.editReply({ embeds: [ new EmbedBuilder() .setDescription(`**${embedOptions.icons.server} Shard overview - ${shardCount} total shards**\n`) - .addFields( - { - name: ' ', - value: evenShardIndexesString, - inline: true - }, - { - name: ' ', - value: oddShardIndexesString, - inline: true - } - ) + .addFields(...embedFields) .setColor(embedOptions.colors.info) .setFooter({ text: `Shard id: ${client.shard.ids[0]}, page ${pageIndex + 1} of ${totalPages}` }) ]