Skip to content

Commit

Permalink
Fix bot crash on telegram egghatch (#5270)
Browse files Browse the repository at this point in the history
* Removed extraneous comma

Extra comma in "forts cached" event emit. Removed.

* Fixed crash on egg_hatch event for telegram

* Corrected invalid keys

Data["iv"] not valid, replaced with "ivcp" and "iv_ads" as per log
message
  • Loading branch information
Gobberwart authored and solderzzc committed Sep 8, 2016
1 parent 9a6ebfe commit 3e33e6d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pokemongo_bot/event_handlers/telegram_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def handle_event(self, event, sender, level, formatted_msg, data):
elif event == 'pokemon_caught':
msg = "Caught {} CP: {}, IV: {}".format(data["pokemon"], data["cp"], data["iv"])
elif event == 'egg_hatched':
msg = "Egg hatched with a {} CP: {}, IV: {}".format(data["pokemon"], data["cp"], data["iv"])
msg = "Egg hatched with a {} CP: {}, IV: {} {}".format(data["name"], data["cp"], data["iv_ads"], data["iv_pct"])
elif event == 'bot_sleep':
msg = "I am too tired, I will take a sleep till {}.".format(data["wake"])
elif event == 'catch_limit':
Expand Down Expand Up @@ -406,10 +406,7 @@ def handle_event(self, event, sender, level, formatted_msg, data):
else:
return
elif event == 'egg_hatched':
try:
msg = "Egg hatched with a {} CP: {}, IV: {}".format(data["pokemon"], data["cp"], data["iv"])
except KeyError:
return
msg = "Egg hatched with a {} CP: {}, IV: {} {}".format(data["name"], data["cp"], data["iv_ads"], data["iv_pct"])
elif event == 'bot_sleep':
msg = "I am too tired, I will take a sleep till {}.".format(data["wake"])
elif event == 'catch_limit':
Expand Down

0 comments on commit 3e33e6d

Please sign in to comment.