Defxult / discordLevelingSystem

A library to implement a leveling system into a discord bot. Contains features such as XP, level, ranks, and role awards.
MIT License
91 stars 17 forks source link

sorting users by rank is incorrect #22

Closed xs4u closed 1 year ago

xs4u commented 1 year ago

Describe the bug leaderboard doesn't sort users correctly

You're on the level 3 (#2) and you have 608 XP!

Top 1: someone №1 Top 2: someone №2 Top 3: someone else

while should be:

Top 1: someone №1 Top 2: TheRjavisDev Top 3: someone else

To Reproduce Minimal code to reproduce the bug/error

    data = await lvl.each_member_data(ctx.guild,sort_by='rank')
    if data[1].name and data[2].name and data[3].name:
        await ctx.respond(f"Top 1: {data[1].name} ({data[1].level})\nTop 2: {data[2].name} ({data[2].level})\nTop 3: {data[3].name} ({data[3].level})")
    else:
        await ctx.respond("Not enough members to display leaderboard!")

Traceback if any

N/A

Required Checklist

Version Info What's the exact version of discordLevelingSystem/pycord are you using?

I'm not sure is it a pycord or discordlevelingsystem issue, so you can close it if it's invalid

one more thing: total_xp is not being accepted by sort_by

Defxult commented 1 year ago

Using sort_by='rank' works as expected when testing the code. This library operates under discord.py so I assume using pycord could be causing the issue.. There is no sort by total_xp, only by xp