Added ability to copy account name from /get_accounts

That also fixed an issue of having wrong behaviour, if using any special chars in account name
This commit is contained in:
StNicolay 2022-11-02 23:02:20 +03:00
parent 4122e15308
commit adf9865fbe

View File

@ -20,15 +20,19 @@ Message = telebot.types.Message
def get_accounts(
bot: telebot.TeleBot, engine: Engine, mes: telebot.types.Message
) -> None:
base_handler(bot, mes)
accounts = database.get.get_accounts(engine, mes.from_user.id)
bot.delete_message(mes.chat.id, mes.id)
if accounts:
accounts = [f"`{account}`" for account in accounts]
return send_tmp_message(
bot,
mes.chat.id,
"Ваши аккаунты:\n" + "\n".join(accounts) if accounts else "У вас нет аккаунтов",
timeout=30,
"Ваши аккаунты:\n"
+ "\n".join(accounts)
+ "\nНажмите на название, чтобы скопировать",
30,
)
send_tmp_message(bot, mes.chat.id, "У вас нет аккаунтов")
def delete_all(