feat: introduce weekly bonus for daily rewards, updating calculations, configuration, and command UI.

This commit is contained in:
syntaxbullet
2025-12-22 13:16:44 +01:00
parent b7b1dd87b8
commit f859618367
4 changed files with 34 additions and 3 deletions

View File

@@ -106,7 +106,11 @@ export const economyService = {
const bonus = (BigInt(streak) - 1n) * config.economy.daily.streakBonus;
const totalReward = config.economy.daily.amount + bonus;
// Weekly bonus check
const isWeeklyCurrent = streak > 0 && streak % 7 === 0;
const weeklyBonusAmount = isWeeklyCurrent ? config.economy.daily.weeklyBonus : 0n;
const totalReward = config.economy.daily.amount + bonus + weeklyBonusAmount;
await txFn.update(users)
.set({
balance: sql`${users.balance} + ${totalReward}`,
@@ -138,7 +142,7 @@ export const economyService = {
description: `Daily reward (Streak: ${streak})`,
});
return { claimed: true, amount: totalReward, streak, nextReadyAt };
return { claimed: true, amount: totalReward, streak, nextReadyAt, isWeekly: isWeeklyCurrent, weeklyBonus: weeklyBonusAmount };
}, tx);
},