30 lines
609 B
Python
30 lines
609 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from typing import Any
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class CommandContext:
|
|
service: str
|
|
channel_identifier: str
|
|
message_id: str
|
|
user_id: int
|
|
message_text: str
|
|
payload: dict[str, Any] = field(default_factory=dict)
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class CommandResult:
|
|
ok: bool
|
|
status: str = "ok"
|
|
error: str = ""
|
|
payload: dict[str, Any] = field(default_factory=dict)
|
|
|
|
|
|
class CommandHandler:
|
|
slug = ""
|
|
|
|
async def execute(self, ctx: CommandContext) -> CommandResult:
|
|
raise NotImplementedError
|