Changed handlers.get_accounts to use a guard clause, added comment to clarify, why we are putting account in backticks

This commit is contained in:
StNicolay 2022-11-05 00:25:23 +03:00
parent da42d7ad1d
commit 66ab13b45d

View File

@ -26,9 +26,12 @@ def get_accounts(
) -> None:
base_handler(bot, mes)
accounts = database.get.get_accounts(engine, mes.from_user.id)
if accounts:
if not accounts:
return send_tmp_message(bot, mes.chat.id, "У вас нет аккаунтов")
# Make accounts copyable and escape special chars
accounts = [f"`{account}`" for account in accounts]
return send_tmp_message(
send_tmp_message(
bot,
mes.chat.id,
"Ваши аккаунты:\n"
@ -36,7 +39,6 @@ def get_accounts(
+ "\nНажмите на название, чтобы скопировать",
30,
)
send_tmp_message(bot, mes.chat.id, "У вас нет аккаунтов")
def delete_all(