case_service ¶
Case service for moderation operations.
This service handles case creation, retrieval, and management using the existing database controllers and proper dependency injection.
Classes:
-
CaseService–Service for managing moderation cases.
Classes¶
CaseService ¶
CaseService(case_controller: CaseController)
Service for managing moderation cases.
Provides clean, testable methods for case operations without the complexity of mixin inheritance.
Initialize the case service.
Parameters:
-
case_controller(CaseController) –Database controller for case operations.
Methods:
-
create_case–Create a new moderation case.
-
get_case–Get a case by ID.
-
get_user_cases–Get all cases for a user in a guild.
-
get_active_cases–Get active cases for a user in a guild.
-
update_mod_log_message_id–Update the mod log message ID for a case.
Functions¶
create_case async ¶
create_case(
guild_id: int,
user_id: int,
moderator_id: int,
case_type: CaseType,
reason: str,
**kwargs: Any,
) -> Case
Create a new moderation case.
Parameters:
-
guild_id(int) –ID of the guild.
-
user_id(int) –ID of the target user.
-
moderator_id(int) –ID of the moderator.
-
case_type(CaseType) –Type of moderation action.
-
reason(str) –Reason for the action.
-
**kwargs(Any, default:{}) –Additional case data (use case_expires_at for expiration datetime).
Returns:
-
Case–The created case.