refactor: streamline configuration loading and enhance admin checks
All checks were successful
CI / lint-and-test (push) Successful in 20s
All checks were successful
CI / lint-and-test (push) Successful in 20s
- Refactored the configuration loading in `config.py` to utilize a single source of truth through the `Settings` class, improving maintainability and clarity. - Introduced the `is_admin_for_telegram_user` function in `repository.py` to centralize admin checks based on usernames and phone numbers. - Updated command handlers to use the new admin check function, ensuring consistent access control across the application. - Enhanced error handling in the `error_handler` to log exceptions when sending error replies to users, improving debugging capabilities. - Improved the handling of user phone updates in `repository.py` to ensure proper normalization and validation of phone numbers.
This commit is contained in:
@@ -190,8 +190,8 @@ async def restore_group_pin_jobs(application) -> None:
|
||||
"""Restore scheduled pin-update jobs for all chats that have a pinned message (on startup)."""
|
||||
loop = asyncio.get_running_loop()
|
||||
chat_ids = await loop.run_in_executor(None, _get_all_pin_chat_ids_sync)
|
||||
next_end = await loop.run_in_executor(None, _get_next_shift_end_sync)
|
||||
for chat_id in chat_ids:
|
||||
next_end = await loop.run_in_executor(None, _get_next_shift_end_sync)
|
||||
await _schedule_next_update(application, chat_id, next_end)
|
||||
logger.info("Restored %s group pin jobs", len(chat_ids))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user