Quality of life changes

Changed default action of /cancel to be handled at message_handler
Added keyboard markup to get_account for easier account selection
This commit is contained in:
2022-12-29 15:38:38 +03:00
parent d4c50432d7
commit d5d87a8f3b
4 changed files with 31 additions and 13 deletions

View File

@ -7,6 +7,11 @@ from . import markups
Message = telebot.types.Message
Handler = Callable[[Message], Awaitable[Any]]
Markups = (
telebot.types.ReplyKeyboardMarkup
| telebot.types.InlineKeyboardMarkup
| telebot.types.ReplyKeyboardRemove
)
states: dict[tuple[int, int], Handler] = {}
@ -48,9 +53,13 @@ async def send_tmp_message(
bot: AsyncTeleBot,
chat_id: telebot.types.Message,
text: str,
*,
sleep_time: int = 5,
markup: Markups | None = None,
) -> None:
bot_mes = await bot.send_message(chat_id, text, parse_mode="MarkdownV2")
bot_mes = await bot.send_message(
chat_id, text, parse_mode="MarkdownV2", reply_markup=markup
)
await delete_message(bot, bot_mes, sleep_time=sleep_time)