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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user