将多个消息连接并将自身作为分割 参数: iterable: 要连接的消息 返回: 连接后的消息
(self, iterable: Iterable[TMS | Self])
| 384 | return self |
| 385 | |
| 386 | def join(self, iterable: Iterable[TMS | Self]) -> Self: |
| 387 | """将多个消息连接并将自身作为分割 |
| 388 | |
| 389 | 参数: |
| 390 | iterable: 要连接的消息 |
| 391 | |
| 392 | 返回: |
| 393 | 连接后的消息 |
| 394 | """ |
| 395 | ret = self.__class__() |
| 396 | for index, msg in enumerate(iterable): |
| 397 | if index != 0: |
| 398 | ret.extend(self) |
| 399 | if isinstance(msg, MessageSegment): |
| 400 | ret.append(msg.copy()) |
| 401 | else: |
| 402 | ret.extend(msg.copy()) |
| 403 | return ret |
| 404 | |
| 405 | def copy(self) -> Self: |
| 406 | """深拷贝消息""" |