Prevent highlighting users in !wordusers and !richest
This commit is contained in:
parent
fed2d64739
commit
6709fa1878
3 changed files with 9 additions and 6 deletions
3
Utils.py
3
Utils.py
|
@ -216,3 +216,6 @@ def get_closest_setting(event, setting, default=None):
|
|||
else:
|
||||
closest = event["user"]
|
||||
return closest.get_setting(setting, server.get_setting(setting, default))
|
||||
|
||||
def prevent_highlight(nickname):
|
||||
return nickname[0]+"\u200b"+nickname[1:]
|
||||
|
|
|
@ -51,9 +51,9 @@ class Module(object):
|
|||
|
||||
top_10 = sorted(all_coins.keys())
|
||||
top_10 = sorted(top_10, key=all_coins.get, reverse=True)[:10]
|
||||
top_10 = ", ".join("%s (%s)" % (event["server"].get_user(
|
||||
nickname).nickname, "{0:.2f}".format(all_coins[nickname])
|
||||
) for nickname in top_10)
|
||||
top_10 = ", ".join("%s (%s)" % (Utils.prevent_highlight(event[
|
||||
"server"].get_user(nickname).nickname), "{0:.2f}".format(
|
||||
all_coins[nickname])) for nickname in top_10)
|
||||
event["stdout"].write("Richest users: %s" % top_10)
|
||||
|
||||
def redeem_coins(self, event):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
import Utils
|
||||
|
||||
class Module(object):
|
||||
def __init__(self, bot):
|
||||
|
@ -80,8 +80,8 @@ class Module(object):
|
|||
|
||||
top_10 = sorted(word_users.keys())
|
||||
top_10 = sorted(top_10, key=word_users.get, reverse=True)[:10]
|
||||
top_10 = ", ".join("%s (%d)" % (event["server"].get_user(
|
||||
nickname).nickname, word_users[nickname]
|
||||
top_10 = ", ".join("%s (%d)" % (Utils.prevent_highlight(event[
|
||||
"server"].get_user(nickname).nickname), word_users[nickname]
|
||||
) for nickname in top_10)
|
||||
event["stdout"].write("Top '%s' users: %s" % (word, top_10))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue