updated badges

This commit is contained in:
DeSqBlocki
2026-08-22 22:46:40 +02:00
parent 9e0870c1ed
commit 08d1a8c5cd
11 changed files with 1047 additions and 261 deletions
+41 -9
View File
@@ -1,22 +1,54 @@
const {
buildAchievementsEmbed,
buildProfileButtons,
getProfileTargetId
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileAchievements",
name:
"profileAchievements",
async execute(interaction) {
const userId = getProfileTargetId(interaction);
if (!userId) return;
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
const user = await interaction.client.users.fetch(userId);
const embed = await buildAchievementsEmbed(interaction.guildId, user);
if (!context) {
return;
}
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: [embed],
components: buildProfileButtons()
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
+54
View File
@@ -0,0 +1,54 @@
const {
buildAchievementsEmbed,
buildProfileButtons,
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name:
"profileAchievementsLeft",
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!context) {
return;
}
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: [embed],
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
+54
View File
@@ -0,0 +1,54 @@
const {
buildAchievementsEmbed,
buildProfileButtons,
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name:
"profileAchievementsRight",
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!context) {
return;
}
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: [embed],
components:
buildProfileButtons(
"achievements",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
+41 -9
View File
@@ -1,22 +1,54 @@
const {
buildBadgesEmbed,
buildProfileButtons,
getProfileTargetId
} = require("../../utils/profileSystem");
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileBadges",
name:
"profileBadges",
async execute(interaction) {
const userId = getProfileTargetId(interaction);
if (!userId) return;
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
const user = await interaction.client.users.fetch(userId);
const embed = await buildBadgesEmbed(interaction.guildId, user);
if (!context) {
return;
}
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: [embed],
components: buildProfileButtons()
components:
buildProfileButtons(
"badges",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
+54
View File
@@ -0,0 +1,54 @@
const {
buildBadgesEmbed,
buildProfileButtons,
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name:
"profileBadgesLeft",
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!context) {
return;
}
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: [embed],
components:
buildProfileButtons(
"badges",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
+54
View File
@@ -0,0 +1,54 @@
const {
buildBadgesEmbed,
buildProfileButtons,
getProfileContextFromFooter,
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name:
"profileBadgesRight",
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!context) {
return;
}
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: [embed],
components:
buildProfileButtons(
"badges",
pageContext?.page ?? 0,
pageContext?.pageCount ?? 1
)
});
}
};
+60
View File
@@ -0,0 +1,60 @@
const {
EmbedBuilder
} = require(
"discord.js"
);
const {
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
function delay(
ms
) {
return new Promise(
resolve =>
setTimeout(
resolve,
ms
)
);
}
module.exports = {
name:
"profileClose",
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
if (!context) {
return;
}
await interaction.update({
embeds: [
new EmbedBuilder()
.setTitle(
"Profile Closed"
)
.setDescription(
"Closing profile..."
)
],
components: []
});
await delay(1200);
try {
await interaction.deleteReply();
} catch {}
}
};
+34 -9
View File
@@ -1,22 +1,47 @@
const {
buildProfileOverview,
buildProfileButtons,
getProfileTargetId
} = require("../../utils/profileSystem");
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileOverview",
name:
"profileOverview",
async execute(interaction) {
const userId = getProfileTargetId(interaction);
if (!userId) return;
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
const user = await interaction.client.users.fetch(userId);
const embed = await buildProfileOverview(interaction.guildId, user);
if (!context) {
return;
}
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildProfileOverview(
interaction.guildId,
user,
context.sessionOwnerId
);
return interaction.update({
embeds: [embed],
components: buildProfileButtons()
components:
buildProfileButtons(
"overview",
0,
1
)
});
}
};
+34 -9
View File
@@ -1,22 +1,47 @@
const {
buildStatsEmbed,
buildProfileButtons,
getProfileTargetId
} = require("../../utils/profileSystem");
requireProfileOwner
} = require(
"../../utils/profileSystem"
);
module.exports = {
name: "profileStats",
name:
"profileStats",
async execute(interaction) {
const userId = getProfileTargetId(interaction);
if (!userId) return;
async execute(
interaction
) {
const context =
await requireProfileOwner(
interaction
);
const user = await interaction.client.users.fetch(userId);
const embed = await buildStatsEmbed(interaction.guildId, user);
if (!context) {
return;
}
const user =
await interaction.client.users.fetch(
context.profileUserId
);
const embed =
await buildStatsEmbed(
interaction.guildId,
user,
context.sessionOwnerId
);
return interaction.update({
embeds: [embed],
components: buildProfileButtons()
components:
buildProfileButtons(
"stats",
0,
1
)
});
}
};