1
0
Fork 0
mirror of synced 2024-05-19 12:02:29 +12:00

Handled exception if no wins or losses have been made with this hero

This commit is contained in:
phxntxm 2016-07-13 22:57:03 -05:00
parent 3f37cc0b14
commit fbd28a8889

View file

@ -54,14 +54,17 @@ class Overwatch:
d = divmod(g_stats['time_played'], 24)
fmt += "\nTime Played: {} days {} hours".format(int(d[0]), int(d[1]))
else:
fmt += "\nWin Percentage: {}".format(g_stats['win_percentage'])
try:
fmt += "\nWin Percentage: {}".format(g_stats['win_percentage'])
except KeyError:
pass
fmt += "\nTime Played: {}".format(g_stats['time_played'])
for i, r in data['hero_stats'].items():
fmt += "\n{}: {}".format(i.replace("_", " ").title(), r)
if hero == "":
await self.bot.say("Overwatch stats for {}: ```py\n{}```".format(user.name, fmt))
else:
await self.bot.say("Overwatch stats for {} using the hero {}: ```py\n{}```: ".format(user.name, hero, fmt))
await self.bot.say("Overwatch stats for {} using the hero {}: ```py\n{}``` ".format(user.name, hero, fmt))
@ow.command(pass_context=True, name="add")
async def add(self, ctx, bt: str):