This commit is contained in:
parent
8b0e93d324
commit
866beb0e04
4 changed files with 22 additions and 9 deletions
|
@ -29,7 +29,18 @@ export default async function List(interaction: ButtonInteraction) {
|
|||
|
||||
const totalPages = Math.ceil(moons[1] / pageLength);
|
||||
|
||||
const description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`);
|
||||
let description = ["*none*"];
|
||||
|
||||
if (moons[0].length > 0) {
|
||||
description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`);
|
||||
}
|
||||
|
||||
const moonDifference = totalMoons - moons[1];
|
||||
const isLastPage = pageNumber + 1 == totalPages || moons[0].length == 0;
|
||||
|
||||
if (isLastPage && moonDifference > 0) {
|
||||
description.push(`...plus ${moonDifference} more untracked`);
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${member?.user.username}'s Moons`)
|
||||
|
@ -48,7 +59,7 @@ export default async function List(interaction: ButtonInteraction) {
|
|||
.setCustomId(`moons list ${userId} ${pageNumber + 1}`)
|
||||
.setLabel("Next")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(pageNumber + 1 == totalPages));
|
||||
.setDisabled(isLastPage));
|
||||
|
||||
await interaction.update({
|
||||
embeds: [ embed ],
|
||||
|
|
|
@ -22,6 +22,13 @@ export default async function ListMoons(interaction: CommandInteraction) {
|
|||
description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`);
|
||||
}
|
||||
|
||||
const moonDifference = totalMoons - moons[1];
|
||||
const isLastPage = page + 1 == totalPages || moons[0].length == 0;
|
||||
|
||||
if (isLastPage && moonDifference > 0) {
|
||||
description.push(`...plus ${moonDifference} more untracked`);
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`${user.username}'s Moons`)
|
||||
.setColor(EmbedColours.Ok)
|
||||
|
@ -39,7 +46,7 @@ export default async function ListMoons(interaction: CommandInteraction) {
|
|||
.setCustomId(`moons list ${user.id} ${page + 1}`)
|
||||
.setLabel("Next")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(page + 1 == totalPages || moons[0].length == 0));
|
||||
.setDisabled(isLastPage));
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [ embed ],
|
||||
|
|
|
@ -14,7 +14,7 @@ export default class Moon extends BaseEntity {
|
|||
|
||||
@Column()
|
||||
MoonNumber: number;
|
||||
|
||||
|
||||
@Column()
|
||||
Description: string;
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import DefaultValues from "../constants/DefaultValues";
|
||||
import UserSetting from "../database/entities/UserSetting";
|
||||
|
||||
export default class UserSettingsHelper {
|
||||
}
|
Loading…
Reference in a new issue