mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-11-04 08:56:42 +00:00 
			
		
		
		
	📝 Docs: 补充 Message.only 文档 (#2155)
This commit is contained in:
		@@ -148,6 +148,15 @@ MessageSegment.text("text") in message
 | 
			
		||||
"text" in message
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
我们还可以使用消息序列的 `only` 方法来检查消息中是否仅包含指定的消息段。
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
# 是否都为指定消息段
 | 
			
		||||
message.only(MessageSegment.text("test"))
 | 
			
		||||
# 是否仅包含指定类型的消息段
 | 
			
		||||
message.only("text")
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 过滤、索引与切片
 | 
			
		||||
 | 
			
		||||
消息序列对列表的索引与切片进行了增强,在原有列表 `int` 索引与 `slice` 切片的基础上,支持 `type` 过滤索引与切片。
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user