mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-25 01:25:04 +08:00
27 lines
676 B
Python
27 lines
676 B
Python
|
from typing import Union, Mapping, Iterable
|
||
|
from nonebot.adapters import Message as BaseMessage, MessageSegment as BaseMessageSegment
|
||
|
|
||
|
|
||
|
class MessageSegment(BaseMessageSegment):
|
||
|
|
||
|
def __str__(self) -> str:
|
||
|
raise NotImplementedError
|
||
|
|
||
|
def __add__(self, other) -> "Message":
|
||
|
return Message(self) + other
|
||
|
|
||
|
def __radd__(self, other) -> "Message":
|
||
|
return Message(other) + self
|
||
|
|
||
|
def is_text(self) -> bool:
|
||
|
raise NotImplementedError
|
||
|
|
||
|
|
||
|
class Message(BaseMessage):
|
||
|
|
||
|
@staticmethod
|
||
|
def _construct(
|
||
|
msg: Union[str, Mapping,
|
||
|
Iterable[Mapping]]) -> Iterable[MessageSegment]:
|
||
|
raise NotImplementedError
|