Comma-delimit numbers in the !richest response
This commit is contained in:
parent
bc7a00bd4d
commit
60151dc1a0
1 changed files with 3 additions and 1 deletions
|
@ -131,6 +131,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
def _coin_str(self, coins):
|
def _coin_str(self, coins):
|
||||||
return "{0:.2f}".format(coins)
|
return "{0:.2f}".format(coins)
|
||||||
|
def _coin_str_human(self, coins):
|
||||||
|
return "{0:,.2f}".format(coins)
|
||||||
def _parse_coins(self, s, minimum=None):
|
def _parse_coins(self, s, minimum=None):
|
||||||
try:
|
try:
|
||||||
s = utils.parse_number(s)
|
s = utils.parse_number(s)
|
||||||
|
@ -336,7 +338,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
top_10 = utils.top_10(self._all_coins(event["server"]),
|
top_10 = utils.top_10(self._all_coins(event["server"]),
|
||||||
convert_key=lambda nickname: utils.prevent_highlight(
|
convert_key=lambda nickname: utils.prevent_highlight(
|
||||||
event["server"].get_user(nickname).nickname),
|
event["server"].get_user(nickname).nickname),
|
||||||
value_format=lambda value: self._coin_str(value))
|
value_format=lambda value: self._coin_str_human(value))
|
||||||
event["stdout"].write("Richest users: %s" % ", ".join(top_10))
|
event["stdout"].write("Richest users: %s" % ", ".join(top_10))
|
||||||
|
|
||||||
def _redeem_cache(self, server, user):
|
def _redeem_cache(self, server, user):
|
||||||
|
|
Loading…
Reference in a new issue