WIP: Aurora V3 #48
1 changed files with 8 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Any, Dict, Tuple
|
||||
from typing import TYPE_CHECKING, Any, Dict, Tuple
|
||||
|
||||
from class_registry import ClassRegistry
|
||||
from class_registry.base import AutoRegister
|
||||
|
@ -7,10 +7,13 @@ from discord import Interaction, Member, User
|
|||
from discord.abc import Messageable
|
||||
from redbot.core import commands
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .moderation import Moderation
|
||||
|
||||
type_registry: Dict["str", "Type"] = ClassRegistry(attr_name="key", unique=True)
|
||||
|
||||
|
||||
class Type(AutoRegister(type_registry), ABC):
|
||||
class Type(AutoRegister(registry=type_registry), ABC):
|
||||
"""This is a base class for moderation types.
|
||||
|
||||
Attributes:
|
||||
|
@ -65,7 +68,7 @@ class Type(AutoRegister(type_registry), ABC):
|
|||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
async def resolve_handler(cls, moderation, reason: str) -> Tuple[bool, str]: # pylint: disable=unused-argument
|
||||
async def resolve_handler(cls, moderation: "Moderation", reason: str) -> Tuple[bool, str]: # pylint: disable=unused-argument
|
||||
"""This method should be overridden by any resolvable child classes, but should retain the same keyword arguments.
|
||||
If your moderation type should not be resolvable, do not override this.
|
||||
|
||||
|
@ -76,7 +79,7 @@ class Type(AutoRegister(type_registry), ABC):
|
|||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
async def expiry_handler(cls, moderation) -> int: # pylint: disable=unused-argument
|
||||
async def expiry_handler(cls, moderation: "Moderation") -> int: # pylint: disable=unused-argument
|
||||
"""This method should be overridden by any expirable child classes, but should retain the same keyword arguments and return an integer.
|
||||
If your moderation type should not expire, do not override this, but also do not set an `end_timestamp` when you log your moderation.
|
||||
|
||||
|
@ -86,7 +89,7 @@ class Type(AutoRegister(type_registry), ABC):
|
|||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
async def duration_edit_handler(cls, interaction: Interaction, old_moderation, new_moderation) -> bool: # pylint: disable=unused-argument
|
||||
async def duration_edit_handler(cls, interaction: Interaction, old_moderation: "Moderation", new_moderation: "Moderation") -> bool: # pylint: disable=unused-argument
|
||||
"""This method should be overridden by any child classes with editable durations, but should retain the same keyword arguments and should return True if the duration was successfully modified, or False if it was not.
|
||||
If your moderation type's duration should not be editable, do not override this.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue