检查消息中是否仅包含指定消息段 参数: value: 指定消息段或消息段类型 返回: 是否仅包含指定消息段
(self, value: TMS | str)
| 343 | return len(self[value]) if isinstance(value, str) else super().count(value) |
| 344 | |
| 345 | def only(self, value: TMS | str) -> bool: |
| 346 | """检查消息中是否仅包含指定消息段 |
| 347 | |
| 348 | 参数: |
| 349 | value: 指定消息段或消息段类型 |
| 350 | |
| 351 | 返回: |
| 352 | 是否仅包含指定消息段 |
| 353 | """ |
| 354 | if isinstance(value, str): |
| 355 | return all(seg.type == value for seg in self) |
| 356 | return all(seg == value for seg in self) |
| 357 | |
| 358 | def append( # pyright: ignore[reportIncompatibleMethodOverride] |
| 359 | self, obj: str | TMS |
no outgoing calls