minecraftd/responses.py
2025-12-14 15:00:42 +01:00

54 lines
1.2 KiB
Python

from typing import Literal, NotRequired
from typing_extensions import TypedDict
class StartResponse(TypedDict):
status: Literal["running", "started"]
message: str
class StatusResponsePlayers(TypedDict):
online: int
max: int
list: list[str]
class StatusResponse(TypedDict):
status: Literal["online", "offline", "crashed", "maintainance", "starting"]
message: str
reason: NotRequired[str]
motd: NotRequired[str]
icon: NotRequired[str | None]
players: NotRequired[StatusResponsePlayers]
class StopResponse(TypedDict):
status: Literal["stopping"]
message: str
class RestartResponse(TypedDict):
status: Literal["restarting"]
message: str
class MaintainanceResponse(TypedDict):
status: Literal["stopping"]
message: str
class CommandResponse(TypedDict):
status: Literal["executed"]
message: str
output: str
class Responses:
StartResponse = StartResponse
StatusResponsePlayers = StatusResponsePlayers
StatusResponse = StatusResponse
StopResponse = StopResponse
RestartResponse = RestartResponse
MaintainanceResponse = MaintainanceResponse
CommandResponse = CommandResponse