in my current command, I get the leaderboard from a single json file called users.json that stores several XP from multiple users:
@bot.command(pass_context=True)
async def top(ctx):
with open('profile/users.json', 'r') as fp:
users = json.load(fp)
lb = [(member, users[member.id].get('xp')) for member in ctx.message.server.members if member.id in users]
lb.sort(key=lambda x: x[1], reverse=True)
However, I changed the command, and had each person store their XP in a separate json file:
What was once 'profile/users.json' became several 'profile/{}.json'.format(ctx.message.author.id)
Now inside the profile folder, there are several json files of each user, with their respective xp, instead of a single json file.
I would like a way to do a leaderboard using multiple json files at once, rather than just one, using my code, what can I do?
Complete answers please, if you need more data, please tell me that and I will edit the question