profile update with badges and achievements

This commit is contained in:
DeSqBlocki
2026-08-22 20:27:42 +02:00
parent c630543f9e
commit e437c051b9
7 changed files with 542 additions and 1441 deletions
+88 -2
View File
@@ -17,6 +17,10 @@ const {
getUnixTime
} = require("./cookieEconomy");
const {
trackProfileEvent
} = require("./profileSystem");
/*
* ============================================================
@@ -1277,7 +1281,7 @@ async function finishBlackjack(
.setFooter({
text:
`crumbBlackjackResult:${game.userId}:${game.bet}`
`crumbBlackjackResult:${game.userId}:${game.originalBet ?? game.bet}`
})
],
@@ -1350,6 +1354,88 @@ async function finishBlackjack(
game.bet;
let profileResult;
if (
result ===
"Push"
) {
profileResult =
"push";
}
else if (
[
"Win",
"DealerBust",
"Blackjack"
].includes(
result
)
) {
profileResult =
"win";
}
else {
profileResult =
"loss";
}
await trackProfileEvent(
interaction,
game.userId,
{
type:
"game_result",
game:
"blackjack",
result:
profileResult
}
);
if (
profit >
0
) {
await trackProfileEvent(
interaction,
game.userId,
{
type:
"cookie_gain",
amount:
profit
}
);
}
else if (
profit <
0
) {
await trackProfileEvent(
interaction,
game.userId,
{
type:
"cookie_loss",
amount:
Math.abs(
profit
)
}
);
}
const description = [
"**Dealer**",
formatCards(
@@ -1439,7 +1525,7 @@ async function finishBlackjack(
.setFooter({
text:
`crumbBlackjackResult:${game.userId}:${game.bet}`
`crumbBlackjackResult:${game.userId}:${game.originalBet ?? game.bet}`
});