mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 01:18:19 +08:00
🔥 remove Message.__init__
method of mirai adapter
This commit is contained in:
parent
c8a8ff28ec
commit
5cff80812e
@ -274,22 +274,6 @@ class MessageChain(BaseMessage[MessageSegment]):
|
||||
def get_segment_class(cls) -> Type[MessageSegment]:
|
||||
return MessageSegment
|
||||
|
||||
@overrides(BaseMessage)
|
||||
def __init__(self, message: Union[List[Dict[str,
|
||||
Any]], Iterable[MessageSegment],
|
||||
MessageSegment, str], **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
if isinstance(message, MessageSegment):
|
||||
self.append(message)
|
||||
elif isinstance(message, str):
|
||||
self.append(MessageSegment.plain(text=message))
|
||||
elif isinstance(message, Iterable):
|
||||
self.extend(self._construct(message))
|
||||
else:
|
||||
raise ValueError(
|
||||
f'Type {type(message).__name__} is not supported in mirai adapter.'
|
||||
)
|
||||
|
||||
@overrides(BaseMessage)
|
||||
def _construct(
|
||||
self, message: Union[List[Dict[str, Any]], Iterable[MessageSegment]]
|
||||
|
Loading…
Reference in New Issue
Block a user