Fix double XP counting in prestige system when users level up

Adjusted the `prestigeUp` function in `aethex-bot/commands/prestige.js` to correctly update `total_xp_earned` and display values, preventing duplicate XP accumulation.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Event-Id: a792080b-bc3a-474f-8aa7-6dcea7ecb128
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/yTaZipL
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sirpiglr 2025-12-08 21:24:37 +00:00
parent d7b41b5b4f
commit 2f414e5616
2 changed files with 6 additions and 3 deletions

View file

@ -22,6 +22,10 @@ externalPort = 80
localPort = 8080
externalPort = 8080
[[ports]]
localPort = 35953
externalPort = 3000
[workflows]
runButton = "Project"

View file

@ -193,8 +193,7 @@ async function prestigeUp(interaction, supabase, client) {
.from('user_profiles')
.update({
xp: 0,
prestige_level: newPrestige,
total_xp_earned: totalEarned + currentXp
prestige_level: newPrestige
})
.eq('id', link.user_id);
@ -216,7 +215,7 @@ async function prestigeUp(interaction, supabase, client) {
.setDescription(`Congratulations! You are now **${newPrestigeInfo.name}**!\n\n**Rewards Unlocked:**\n${getNewRewards(newPrestige).join('\n')}`)
.addFields(
{ name: 'XP Bonus', value: `+${xpBonus}%`, inline: true },
{ name: 'Total XP Earned (All Time)', value: (totalEarned + currentXp).toLocaleString(), inline: true }
{ name: 'Total XP Earned (All Time)', value: totalEarned.toLocaleString(), inline: true }
)
.setThumbnail(interaction.user.displayAvatarURL({ size: 256 }))
.setTimestamp();