feat(message.py): add Message.from_bytes()

This commit is contained in:
2025-08-28 14:39:59 +02:00
parent 762d09ea9b
commit df55e0c5cb

View File

@@ -89,6 +89,17 @@ class Message:
"""
return cls.from_dict(json.loads(data))
@classmethod
def from_bytes(cls, data: bytes) -> Message:
"""Create a Message from bytes.
Args:
data (bytes): The bytes to create the message from.
Returns:
Message: The created message.
"""
return cls.from_json(data.decode("utf-8"))
@classmethod
def ack(cls) -> Message:
"""Create an ACK message.