mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-29 17:27:41 +00:00
🚧 update messages
This commit is contained in:
@ -19,7 +19,7 @@ class MessageSegment(BaseMessageSegment):
|
||||
super().__init__(type=type, data=data)
|
||||
|
||||
@overrides(BaseMessageSegment)
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
type_ = self.type
|
||||
data = self.data.copy()
|
||||
|
||||
@ -37,6 +37,10 @@ class MessageSegment(BaseMessageSegment):
|
||||
def __add__(self, other) -> "Message":
|
||||
return Message(self) + other
|
||||
|
||||
@overrides(BaseMessageSegment)
|
||||
def is_text(self) -> bool:
|
||||
return self.type == "text"
|
||||
|
||||
@staticmethod
|
||||
def anonymous(ignore_failure: Optional[bool] = None) -> "MessageSegment":
|
||||
return MessageSegment("anonymous", {"ignore": _b2s(ignore_failure)})
|
||||
|
Reference in New Issue
Block a user