fixed words.py to always show nicknames with the same count in the same order.

This commit is contained in:
jesopo 2016-04-18 16:51:06 +01:00
parent 1127682872
commit ce4f0f68b0
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -69,7 +69,8 @@ class Module(object):
word = event["args_split"][0].lower()
if word in event["server"].tracked_words:
word_users = event["server"].get_setting("word-%s" % word)
top_10 = sorted(word_users, key=word_users.get, reverse=True)[:10]
top_10 = sorted(word_users.keys())
top_10 = sorted(top_10, key=word_users.get, reverse=True)[:10]
top_10 = ", ".join("%s (%d)" % (nickname, word_users[nickname
]) for nickname in top_10)
event["stdout"].write("Top '%s' users: %s" % (word, top_10))