Fix !gamestats display
This commit is contained in:
parent
56f2bacd3a
commit
022da467ec
@ -412,7 +412,10 @@ def get_game_stats(mode, size):
|
|||||||
|
|
||||||
bits = []
|
bits = []
|
||||||
for row in c:
|
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))
|
bits.append("Total games: {0}".format(total_games))
|
||||||
|
|
||||||
return msg + ", ".join(bits)
|
return msg + ", ".join(bits)
|
||||||
|
@ -288,9 +288,11 @@ def singular(plural):
|
|||||||
# fool is present since we store fool wins as 'fool' rather than
|
# 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
|
# 'fools' as only a single fool wins, however we don't want to
|
||||||
# chop off the l and have it report 'foo wins'
|
# chop off the l and have it report 'foo wins'
|
||||||
|
# same thing with 'everyone'
|
||||||
conv = {"wolves": "wolf",
|
conv = {"wolves": "wolf",
|
||||||
"succubi": "succubus",
|
"succubi": "succubus",
|
||||||
"fool": "fool"}
|
"fool": "fool",
|
||||||
|
"everyone": "everyone"}
|
||||||
if plural in conv:
|
if plural in conv:
|
||||||
return conv[plural]
|
return conv[plural]
|
||||||
# otherwise we just added an s on the end
|
# otherwise we just added an s on the end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user