fix: Fix bug in /shards when shard count is 1 on shown page

This commit is contained in:
Marius Begby committed 2023-08-21 19:53:55 +02:00
1 parent 181dee4b2c
commit 623f4e200f
1 file changed
+18 -6
+18 -6
View File
@@ -81,11 +81,16 @@ module.exports = {
const evenShardIndexesString = evenShardIndexes.map(shardInfoToString).join('\n') + 'ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ'; const evenShardIndexesString = evenShardIndexes.map(shardInfoToString).join('\n') + 'ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ';
const oddShardIndexesString = oddShardIndexes.map(shardInfoToString).join('\n'); const oddShardIndexesString = oddShardIndexes.map(shardInfoToString).join('\n');
return await interaction.editReply({ const embedFields = [];
embeds: [
new EmbedBuilder() if (currentPageShards.length === 1) {
.setDescription(`**${embedOptions.icons.server} Shard overview - ${shardCount} total shards**\n`) embedFields.push({
.addFields( name: ' ',
value: currentPageShards.map(shardInfoToString).join('\n'),
inline: false
});
} else {
embedFields.push(
{ {
name: ' ', name: ' ',
value: evenShardIndexesString, value: evenShardIndexesString,
@@ -96,7 +101,14 @@ module.exports = {
value: oddShardIndexesString, value: oddShardIndexesString,
inline: true inline: true
} }
) );
}
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(`**${embedOptions.icons.server} Shard overview - ${shardCount} total shards**\n`)
.addFields(...embedFields)
.setColor(embedOptions.colors.info) .setColor(embedOptions.colors.info)
.setFooter({ text: `Shard id: ${client.shard.ids[0]}, page ${pageIndex + 1} of ${totalPages}` }) .setFooter({ text: `Shard id: ${client.shard.ids[0]}, page ${pageIndex + 1} of ${totalPages}` })
] ]