Fix !gamestats display

This commit is contained in:
Vgr E. Barry 2018-04-24 16:01:10 -04:00
parent 56f2bacd3a
commit 022da467ec
2 changed files with 7 additions and 2 deletions

View File

@ -412,7 +412,10 @@ def get_game_stats(mode, size):
bits = []
for row in c:
bits.append("{0} wins: {1} ({2}%)".format(singular(row[0]).title(), row[1], round(row[1]/total_games * 100)))
winner = singular(row[0]).title()
if not winner:
winner = botconfig.NICK.title()
bits.append("{0} wins: {1} ({2}%)".format(winner, row[1], round(row[1]/total_games * 100)))
bits.append("Total games: {0}".format(total_games))
return msg + ", ".join(bits)

View File

@ -288,9 +288,11 @@ def singular(plural):
# fool is present since we store fool wins as 'fool' rather than
# 'fools' as only a single fool wins, however we don't want to
# chop off the l and have it report 'foo wins'
# same thing with 'everyone'
conv = {"wolves": "wolf",
"succubi": "succubus",
"fool": "fool"}
"fool": "fool",
"everyone": "everyone"}
if plural in conv:
return conv[plural]
# otherwise we just added an s on the end