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:
parent
da42d7ad1d
commit
66ab13b45d
@ -26,17 +26,19 @@ def get_accounts(
|
||||
) -> None:
|
||||
base_handler(bot, mes)
|
||||
accounts = database.get.get_accounts(engine, mes.from_user.id)
|
||||
if accounts:
|
||||
accounts = [f"`{account}`" for account in accounts]
|
||||
return send_tmp_message(
|
||||
bot,
|
||||
mes.chat.id,
|
||||
"Ваши аккаунты:\n"
|
||||
+ "\n".join(accounts)
|
||||
+ "\nНажмите на название, чтобы скопировать",
|
||||
30,
|
||||
)
|
||||
send_tmp_message(bot, mes.chat.id, "У вас нет аккаунтов")
|
||||
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]
|
||||
send_tmp_message(
|
||||
bot,
|
||||
mes.chat.id,
|
||||
"Ваши аккаунты:\n"
|
||||
+ "\n".join(accounts)
|
||||
+ "\nНажмите на название, чтобы скопировать",
|
||||
30,
|
||||
)
|
||||
|
||||
|
||||
def delete_all(
|
||||
|
Reference in New Issue
Block a user