Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
fix: Fix bug in /shards when shard count is 1 on shown page
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusbegby committed Aug 21, 2023
1 parent 181dee4 commit 623f4e2
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions src/commands/system/shards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}` })
]
Expand Down

0 comments on commit 623f4e2

Please # to comment.