Skip to content

Commit

Permalink
Merge pull request #5688 from GhosterBot/dev
Browse files Browse the repository at this point in the history
Telegram task : Ordering by date
  • Loading branch information
DBa2016 authored Sep 27, 2016
2 parents 0307c2c + 45e1787 commit f65b063
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
15 changes: 13 additions & 2 deletions docs/telegramtask.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,19 @@ This will subscribe you to be notified every time a Dratini has been caught with

> /top 10 iv
List top 10 pokemon, ordered by IV
List top 10 pokemon, ordered by IV, descending order

> /top 15 cp
List top 15 pokemon, ordered by CP
List top 15 pokemon, ordered by CP, descending order

> /top 5 dated
List top 5 pokemon, ordered by catching date, descending order

Same logic for :
/evolved <num> <cp-or-iv-or-dated>
/hatched <num> <cp-or-iv-or-dated>
/caught <num> <cp-or-iv-or-dated>
/released <num> <cp-or-iv-or-dated>
/vanished <num> <cp-or-iv-or-dated>
12 changes: 6 additions & 6 deletions pokemongo_bot/event_handlers/chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_evolved(self, num, order):
else:
num = int(num)

if order not in ["cp", "iv"]:
if order not in ["cp", "iv", "dated"]:
order = "iv"

with self.bot.database as conn:
Expand All @@ -45,7 +45,7 @@ def get_hatched(self, num, order):
else:
num = int(num)

if order not in ["cp", "iv"]:
if order not in ["cp", "iv", "dated"]:
order = "iv"

with self.bot.database as conn:
Expand All @@ -60,7 +60,7 @@ def get_caught(self, num, order):
else:
num = int(num)

if order not in ["cp", "iv"]:
if order not in ["cp", "iv", "dated"]:
order = "iv"

with self.bot.database as conn:
Expand All @@ -87,7 +87,7 @@ def get_released(self, num, order):
else:
num = int(num)

if order not in ["cp", "iv"]:
if order not in ["cp", "iv", "dated"]:
order = "iv"

with self.bot.database as conn:
Expand All @@ -102,7 +102,7 @@ def get_vanished(self, num, order):
else:
num = int(num)

if order not in ["cp", "iv"]:
if order not in ["cp", "iv", "dated"]:
order = "iv"

with self.bot.database as conn:
Expand Down Expand Up @@ -185,7 +185,7 @@ def get_top(self, num, order):
else:
num = int(num)

if order not in ["cp", "iv"]:
if order not in ["cp", "iv", "dated"]:
order = "iv"
pkmns = sorted(inventory.pokemons().all(), key=lambda p: getattr(p, order), reverse=True)[:num]
res = []
Expand Down

0 comments on commit f65b063

Please sign in to comment.