Update banned users handling with async support and improved date parsing

- Modified `change_page` function in `callback_handlers.py` to use async methods for retrieving banned users and their buttons.
- Enhanced `get_banned_users_list` in `helper_func.py` to handle string timestamps and various date formats, ensuring robust date parsing.
- Added a new test case in `test_utils.py` to validate the handling of string timestamps in the banned users list retrieval.
This commit is contained in:
2025-09-08 23:19:19 +03:00
parent 5f6882d348
commit 31e29cdec0
3 changed files with 35 additions and 4 deletions

View File

@@ -219,14 +219,14 @@ async def change_page(
reply_markup=keyboard
)
else:
message_user = get_banned_users_list(int(page_number) * 7 - 7, bot_db)
message_user = await get_banned_users_list(int(page_number) * 7 - 7, bot_db)
await call.bot.edit_message_text(
chat_id=call.message.chat.id,
message_id=call.message.message_id,
text=message_user
)
buttons = get_banned_users_buttons(bot_db)
buttons = await get_banned_users_buttons(bot_db)
keyboard = create_keyboard_with_pagination(page_number, len(buttons), buttons, 'unlock')
await call.bot.edit_message_reply_markup(
chat_id=call.message.chat.id,