MCPcopy
hub / github.com/nonebot/nonebot2 / join

Method join

nonebot/internal/adapter/message.py:386–403  ·  view source on GitHub ↗

将多个消息连接并将自身作为分割 参数: iterable: 要连接的消息 返回: 连接后的消息

(self, iterable: Iterable[TMS | Self])

Source from the content-addressed store, hash-verified

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 """深拷贝消息"""

Callers 15

path_to_module_nameFunction · 0.45
__call__Method · 0.45
__call__Method · 0.45
commandFunction · 0.45
parse_argsMethod · 0.45
shell_commandFunction · 0.45
__repr__Method · 0.45
__repr__Method · 0.45
runMethod · 0.45
type_Function · 0.45
__repr__Method · 0.45
joinMethod · 0.45

Calls 3

extendMethod · 0.80
appendMethod · 0.80
copyMethod · 0.45

Tested by 6

test_http_clientFunction · 0.36
test_http_client_sessionFunction · 0.36
serverFunction · 0.36
test_segment_joinFunction · 0.36
test_message_joinFunction · 0.36