Handled exception if no wins or losses have been made with this hero
This commit is contained in:
parent
3f37cc0b14
commit
fbd28a8889
|
@ -54,14 +54,17 @@ class Overwatch:
|
||||||
d = divmod(g_stats['time_played'], 24)
|
d = divmod(g_stats['time_played'], 24)
|
||||||
fmt += "\nTime Played: {} days {} hours".format(int(d[0]), int(d[1]))
|
fmt += "\nTime Played: {} days {} hours".format(int(d[0]), int(d[1]))
|
||||||
else:
|
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'])
|
fmt += "\nTime Played: {}".format(g_stats['time_played'])
|
||||||
for i, r in data['hero_stats'].items():
|
for i, r in data['hero_stats'].items():
|
||||||
fmt += "\n{}: {}".format(i.replace("_", " ").title(), r)
|
fmt += "\n{}: {}".format(i.replace("_", " ").title(), r)
|
||||||
if hero == "":
|
if hero == "":
|
||||||
await self.bot.say("Overwatch stats for {}: ```py\n{}```".format(user.name, fmt))
|
await self.bot.say("Overwatch stats for {}: ```py\n{}```".format(user.name, fmt))
|
||||||
else:
|
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")
|
@ow.command(pass_context=True, name="add")
|
||||||
async def add(self, ctx, bt: str):
|
async def add(self, ctx, bt: str):
|
||||||
|
|
Loading…
Reference in a new issue