Hide CSV button if no query_id is available

This commit is contained in:
Davte 2019-09-29 20:18:14 +02:00
parent 0e268414f9
commit f02aa38200
2 changed files with 14 additions and 11 deletions

View File

@ -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"

View File

@ -914,16 +914,19 @@ async def _query_command(bot, update, user_record):
+ f"<code>{query}</code>\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,