updated profile and centralized functions

This commit is contained in:
DeSqBlocki
2026-08-22 23:33:20 +02:00
parent 08d1a8c5cd
commit 030b4b8883
18 changed files with 3747 additions and 1202 deletions
+36 -37
View File
@@ -1,54 +1,53 @@
// buttons/profile/achievementsLeft.js
const {
requireProfileOwner,
buildAchievementsEmbed,
buildProfileButtons,
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
module.exports = {
name:
"profileAchievementsLeft",
name: "profileAchievementsLeft",
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
if (!context) {
if (!session) {
return;
}
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const user = await interaction.client.users.fetch(
session.profileUserId
);
const embed =
await buildAchievementsEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
context.page - 1
);
const result = await buildAchievementsEmbed(
interaction.guildId,
user,
session.page - 1,
session.sessionOwnerId
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
const components = [
...buildProfileButtons()
];
if (result.pageCount > 1) {
components.push(
buildProfilePaginationButtons(
"profileAchievementsLeft",
"profileAchievementsRight",
result.page,
result.pageCount
)
);
}
return interaction.update({
embeds: [embed],
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
embeds: [result.embed],
components
});
}
};
};