puntentelling: sort + format

This commit is contained in:
JP
2019-06-03 20:33:37 +02:00
parent c90658a351
commit e957995249
+5 -5
View File
@@ -70,12 +70,12 @@ class Points(object):
"""Hoeveel punten heeft iedereen? """Hoeveel punten heeft iedereen?
""" """
#TODO format message = "**De puntentelling:** \n```"
#TODO sort
message = "De puntentelling: \n"
pointsCount = np.load('pointscount.npy').item() pointsCount = np.load('pointscount.npy').item()
for user in pointsCount: pointsCountSorted = sorted(pointsCount.items(), key=lambda i: i[1]['points'], reverse=True)
message += str(pointsCount[user]["points"]) + " " + pointsCount[user]["name"] + "\n" for user in pointsCountSorted:
message += str(user[1]["points"]).rjust(4) + " " + user[1]["name"] + "\n"
message += "```"
yield from ctx.channel.send(message) yield from ctx.channel.send(message)