- Introduced `DependenciesMiddleware` and `BlacklistMiddleware` for enhanced request handling across all routers. - Refactored admin handlers to utilize new middleware, improving access control and error handling. - Updated the `admin_router` to include middleware for access checks and streamlined the process of banning users. - Enhanced the structure of admin handler imports for better organization and maintainability. - Improved error handling in various admin functions to ensure robust user interactions.
37 lines
848 B
Python
37 lines
848 B
Python
from .admin_handlers import admin_router
|
|
from .dependencies import AdminAccessMiddleware, BotDB, Settings
|
|
from .services import AdminService, User, BannedUser
|
|
from .exceptions import (
|
|
AdminError,
|
|
AdminAccessDeniedError,
|
|
UserNotFoundError,
|
|
InvalidInputError,
|
|
UserAlreadyBannedError
|
|
)
|
|
from .utils import (
|
|
return_to_admin_menu,
|
|
handle_admin_error,
|
|
format_user_info,
|
|
format_ban_confirmation,
|
|
escape_html
|
|
)
|
|
|
|
__all__ = [
|
|
'admin_router',
|
|
'AdminAccessMiddleware',
|
|
'BotDB',
|
|
'Settings',
|
|
'AdminService',
|
|
'User',
|
|
'BannedUser',
|
|
'AdminError',
|
|
'AdminAccessDeniedError',
|
|
'UserNotFoundError',
|
|
'InvalidInputError',
|
|
'UserAlreadyBannedError',
|
|
'return_to_admin_menu',
|
|
'handle_admin_error',
|
|
'format_user_info',
|
|
'format_ban_confirmation',
|
|
'escape_html'
|
|
] |