added new logic to the new rewards

This commit is contained in:
DeSqBlocki
2026-08-23 00:43:43 +02:00
parent 4d858554be
commit 425686ec40
15 changed files with 1644 additions and 2662 deletions
+39 -36
View File
@@ -1,51 +1,54 @@
const {
requireProfileOwner,
buildAchievementsEmbed,
buildProfileButtons,
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileAchievements",
name:
"profileAchievements",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
return;
}
const user = await interaction.client.users.fetch(
session.profileUserId
);
const result = await buildAchievementsEmbed(
interaction.guildId,
user,
0,
session.sessionOwnerId
);
const components = [
...buildProfileButtons()
];
if (result.pageCount > 1) {
components.push(
buildProfilePaginationButtons(
"profileAchievementsLeft",
"profileAchievementsRight",
result.page,
result.pageCount
)
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildAchievementsEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
0
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
);
}
return interaction.update({
embeds: [result.embed],
components
embeds: [embed],
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
};
+39 -38
View File
@@ -1,53 +1,54 @@
// buttons/profile/achievementsLeft.js
const {
requireProfileOwner,
buildAchievementsEmbed,
buildProfileButtons,
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileAchievementsLeft",
name:
"profileAchievementsLeft",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
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
)
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildAchievementsEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
context.page - 1
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
);
}
return interaction.update({
embeds: [result.embed],
components
embeds: [embed],
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
};
+39 -38
View File
@@ -1,53 +1,54 @@
// buttons/profile/achievementsRight.js
const {
requireProfileOwner,
buildAchievementsEmbed,
buildProfileButtons,
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileAchievementsRight",
name:
"profileAchievementsRight",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
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
)
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildAchievementsEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
context.page + 1
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
);
}
return interaction.update({
embeds: [result.embed],
components
embeds: [embed],
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
};
+39 -36
View File
@@ -1,51 +1,54 @@
const {
requireProfileOwner,
buildBadgesEmbed,
buildProfileButtons,
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileBadges",
name:
"profileBadges",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
return;
}
const user = await interaction.client.users.fetch(
session.profileUserId
);
const result = await buildBadgesEmbed(
interaction.guildId,
user,
0,
session.sessionOwnerId
);
const components = [
...buildProfileButtons()
];
if (result.pageCount > 1) {
components.push(
buildProfilePaginationButtons(
"profileBadgesLeft",
"profileBadgesRight",
result.page,
result.pageCount
)
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildBadgesEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
0
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
);
}
return interaction.update({
embeds: [result.embed],
components
embeds: [embed],
components:
buildProfileButtons(
"badges",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
};
+39 -38
View File
@@ -1,53 +1,54 @@
// buttons/profile/badgesLeft.js
const {
requireProfileOwner,
buildBadgesEmbed,
buildProfileButtons,
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileBadgesLeft",
name:
"profileBadgesLeft",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
return;
}
const user = await interaction.client.users.fetch(
session.profileUserId
);
const result = await buildBadgesEmbed(
interaction.guildId,
user,
session.page - 1,
session.sessionOwnerId
);
const components = [
...buildProfileButtons()
];
if (result.pageCount > 1) {
components.push(
buildProfilePaginationButtons(
"profileBadgesLeft",
"profileBadgesRight",
result.page,
result.pageCount
)
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildBadgesEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
context.page - 1
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
);
}
return interaction.update({
embeds: [result.embed],
components
embeds: [embed],
components:
buildProfileButtons(
"badges",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
};
+39 -38
View File
@@ -1,53 +1,54 @@
// buttons/profile/badgesRight.js
const {
requireProfileOwner,
buildBadgesEmbed,
buildProfileButtons,
buildProfilePaginationButtons
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileBadgesRight",
name:
"profileBadgesRight",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
return;
}
const user = await interaction.client.users.fetch(
session.profileUserId
);
const result = await buildBadgesEmbed(
interaction.guildId,
user,
session.page + 1,
session.sessionOwnerId
);
const components = [
...buildProfileButtons()
];
if (result.pageCount > 1) {
components.push(
buildProfilePaginationButtons(
"profileBadgesLeft",
"profileBadgesRight",
result.page,
result.pageCount
)
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildBadgesEmbed(
interaction.guildId,
user,
context.sessionOwnerId,
context.page + 1
);
const pageContext =
getProfileContextFromFooter(
embed.data.footer?.text
);
}
return interaction.update({
embeds: [result.embed],
components
embeds: [embed],
components:
buildProfileButtons(
"badges",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
};
+33 -20
View File
@@ -1,34 +1,47 @@
const {
requireProfileOwner,
buildProfileStatsEmbed,
buildProfileButtons
} = require("../../utils/profileSystem");
buildStatsEmbed,
buildProfileButtons,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileStats",
name:
"profileStats",
async execute(interaction) {
const session = await requireProfileOwner(
interaction
);
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!session) {
if (!context) {
return;
}
const user = await interaction.client.users.fetch(
session.profileUserId
);
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed = await buildProfileStatsEmbed(
interaction.guildId,
user,
session.sessionOwnerId
);
const embed =
await buildStatsEmbed(
interaction.guildId,
user,
context.sessionOwnerId
);
return interaction.update({
embeds: [embed],
components: buildProfileButtons()
components:
buildProfileButtons(
"stats",
0,
1
)
});
}
};
};