53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
// buttons/profile/achievementsRight.js
|
|
|
|
const {
|
|
requireProfileOwner,
|
|
buildAchievementsEmbed,
|
|
buildProfileButtons,
|
|
buildProfilePaginationButtons
|
|
} = require("../../utils/profileSystem");
|
|
|
|
module.exports = {
|
|
name: "profileAchievementsRight",
|
|
|
|
async execute(interaction) {
|
|
const session = await requireProfileOwner(
|
|
interaction
|
|
);
|
|
|
|
if (!session) {
|
|
return;
|
|
}
|
|
|
|
const user = await interaction.client.users.fetch(
|
|
session.profileUserId
|
|
);
|
|
|
|
const result = await buildAchievementsEmbed(
|
|
interaction.guildId,
|
|
user,
|
|
session.page + 1,
|
|
session.sessionOwnerId
|
|
);
|
|
|
|
const components = [
|
|
...buildProfileButtons()
|
|
];
|
|
|
|
if (result.pageCount > 1) {
|
|
components.push(
|
|
buildProfilePaginationButtons(
|
|
"profileAchievementsLeft",
|
|
"profileAchievementsRight",
|
|
result.page,
|
|
result.pageCount
|
|
)
|
|
);
|
|
}
|
|
|
|
return interaction.update({
|
|
embeds: [result.embed],
|
|
components
|
|
});
|
|
}
|
|
}; |