forked from syntaxbullet/AuroraBot-discord
feat: introduce weekly bonus for daily rewards, updating calculations, configuration, and command UI.
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user