Made dataclasses frozen and slotted for immutability and lower memory usage.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 20s
CI / Tests (Python 3.13) (push) Successful in 22s
CI / Tests (Python 3.14) (push) Successful in 50s
CI / Type Checking (push) Successful in 25s
CI / Spelling (push) Has been cancelled
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (Python 3.12) (push) Successful in 20s
CI / Tests (Python 3.13) (push) Successful in 22s
CI / Tests (Python 3.14) (push) Successful in 50s
CI / Type Checking (push) Successful in 25s
CI / Spelling (push) Has been cancelled
This commit is contained in:
@@ -43,7 +43,7 @@ class CommandMark(TypedDict):
|
||||
cooldown: int | float
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class CommandEvent:
|
||||
"""Parsed command information from a chat message."""
|
||||
|
||||
@@ -57,7 +57,7 @@ class CommandEvent:
|
||||
type CommandHandler = "Callable[[CommandContext], Awaitable[None]]"
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class CommandInfo:
|
||||
"""Metadata about a registered command."""
|
||||
|
||||
@@ -72,7 +72,7 @@ class CommandInfo:
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""Compute derived fields."""
|
||||
self.all_triggers = frozenset({self.name}) | self.aliases
|
||||
object.__setattr__(self, "all_triggers", frozenset({self.name}) | self.aliases)
|
||||
|
||||
|
||||
def on_command(
|
||||
|
||||
Reference in New Issue
Block a user