From f02aa38200fddc4cea7ab0c847b990aeeb515634 Mon Sep 17 00:00:00 2001 From: Davte Date: Sun, 29 Sep 2019 20:18:14 +0200 Subject: [PATCH] Hide CSV button if no query_id is available --- davtelepot/__init__.py | 2 +- davtelepot/administration_tools.py | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 1f0aff9..2366a1e 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -14,7 +14,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.3.2" +__version__ = "2.3.3" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/administration_tools.py b/davtelepot/administration_tools.py index 75bab75..d2af4ee 100644 --- a/davtelepot/administration_tools.py +++ b/davtelepot/administration_tools.py @@ -914,16 +914,19 @@ async def _query_command(bot, update, user_record): + f"{query}\n\n" f"{result}" ) - reply_markup = make_inline_keyboard( - [ - make_button( - text='CSV', - prefix='db_query:///', - data=(['csv', query_id] if query_id else []) - ) - ], - 1 - ) + if query_id: + reply_markup = make_inline_keyboard( + [ + make_button( + text='CSV', + prefix='db_query:///', + data=['csv', query_id] + ) + ], + 1 + ) + else: + reply_markup = None return dict( chat_id=update['chat']['id'], text=result,