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" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.3.2" __version__ = "2.3.3"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __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"<code>{query}</code>\n\n"
f"{result}" f"{result}"
) )
reply_markup = make_inline_keyboard( if query_id:
[ reply_markup = make_inline_keyboard(
make_button( [
text='CSV', make_button(
prefix='db_query:///', text='CSV',
data=(['csv', query_id] if query_id else []) prefix='db_query:///',
) data=['csv', query_id]
], )
1 ],
) 1
)
else:
reply_markup = None
return dict( return dict(
chat_id=update['chat']['id'], chat_id=update['chat']['id'],
text=result, text=result,