Made it so annual and lifetime xp are the same number instead of being generated twice per message for each db

This commit is contained in:
Lilac-Rose
2025-10-22 21:49:43 +02:00
parent 011f6da838
commit f3551ce02e

View File

@@ -11,6 +11,8 @@ async def add_xp(member):
if is_channel_excluded(last_message.channel.id):
return
base_xp = random_xp()
for lifetime in (True, False): # True = lifetime, False = annual
conn, cur = get_db(lifetime)
cur.execute("SELECT xp, level, last_message FROM xp WHERE user_id = ?", (str(member.id),))
@@ -29,7 +31,7 @@ async def add_xp(member):
)
# Only apply multiplier for lifetime XP
gained = int(random_xp() * get_multiplier(member, apply_multiplier=lifetime))
gained = int(base_xp * get_multiplier(member, apply_multiplier=lifetime))
new_xp = xp + gained
cur.execute(