From 8d6bf72d62839cf39ef221d31556192ba87bae9e Mon Sep 17 00:00:00 2001 From: Ghoster Date: Mon, 26 Sep 2016 16:58:55 +0200 Subject: [PATCH 1/2] Telegram task : Ordering by date Fix the chat_handler class to allow the ordering by date (parameter _"dated"_) for those Telegram task: /top /evolved /hatched /caught /released /vanished --- pokemongo_bot/event_handlers/chat_handler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pokemongo_bot/event_handlers/chat_handler.py b/pokemongo_bot/event_handlers/chat_handler.py index 13bd2c77ea..196f8449c8 100644 --- a/pokemongo_bot/event_handlers/chat_handler.py +++ b/pokemongo_bot/event_handlers/chat_handler.py @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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 = [] From 6936904346f542cadcb956bda800a96e0b7f9088 Mon Sep 17 00:00:00 2001 From: Ghoster Date: Tue, 27 Sep 2016 16:41:45 +0200 Subject: [PATCH 2/2] Documentation update Update the documentation with dated parameter --- docs/telegramtask.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/telegramtask.md b/docs/telegramtask.md index a98ec2d6ae..6706a5d8b5 100644 --- a/docs/telegramtask.md +++ b/docs/telegramtask.md @@ -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 +/hatched +/caught +/released +/vanished