WIP: Planning list.test.ts
All checks were successful
Test / build (push) Successful in 9s

This commit is contained in:
Ethan Lane 2024-10-30 09:35:34 +00:00
parent 866beb0e04
commit 974e298214
3 changed files with 53 additions and 4 deletions

View file

@ -13,13 +13,13 @@ export default async function List(interaction: ButtonInteraction) {
const pageNumber = Number(page);
const member = interaction.guild.members.cache.find(x => x.user.id == userId);
const member = interaction.guild.members.cache.find(x => x.user.id == userId) || await interaction.guild.members.fetch(userId);
const pageLength = 10;
const moons = await Moon.FetchPaginatedMoonsByUserId(userId, pageLength, pageNumber);
if (!moons || moons[0].length == 0) {
if (!moons) {
await interaction.reply(`${member?.user.username ?? "This user"} does not have any moons or page is invalid.`);
return;
}
@ -43,7 +43,7 @@ export default async function List(interaction: ButtonInteraction) {
}
const embed = new EmbedBuilder()
.setTitle(`${member?.user.username}'s Moons`)
.setTitle(`${member.user.username}'s Moons`)
.setColor(EmbedColours.Ok)
.setDescription(description.join("\n"))
.setFooter({ text: `Page ${pageNumber + 1} of ${totalPages} · ${totalMoons} moons` });