MessageActivity 类
包含必填字段和只读属性的已接收消息活动的输出模型。
通过分析和验证关键字参数中的输入数据来创建新模型。
引发 [ValidationError][pydantic_core。如果无法验证输入数据以形成有效的模型,则 ValidationError]。
self 是显式位置仅允许 自己 作为字段名称。
构造函数
MessageActivity(*, serviceUrl: str | None = None, timestamp: datetime | None = None, locale: str | None = None, localTimestamp: datetime | None = None, channelId: Literal['webchat', 'msteams'] | str = 'msteams', from_: Account, conversation: ConversationAccount, replyToId: str | None = None, entities: List[ClientInfoEntity | MentionEntity | MessageEntity | AIMessageEntity | StreamInfoEntity | CitationEntity | SensitiveUsageEntity | ProductInfoEntity | QuotedReplyEntity | TargetedMessageInfoEntity | UnknownEntity] | None = None, channelData: ChannelData | None = None, type: Literal['message'] = 'message', id: str, recipient: Account, text: str = '', summary: str | None = None, textFormat: Literal['markdown', 'plain', 'xml'] | None = None, attachmentLayout: AttachmentLayout | None = None, attachments: List[Attachment] | None = None, suggestedActions: SuggestedActions | None = None, deliveryMode: Literal['normal', 'notification', 'expectReplies', 'ephemeral'] | None = None, value: Any | None = None, **extra_data: Any)
仅限关键字的参数
| 名称 | 说明 |
|---|---|
|
serviceUrl
|
默认值: None
|
|
timestamp
|
默认值: None
|
|
locale
|
默认值: None
|
|
localTimestamp
|
默认值: None
|
|
channelId
|
默认值: msteams
|
|
from_
必需
|
|
|
conversation
必需
|
|
|
replyToId
|
默认值: None
|
|
entities
|
默认值: None
|
|
channelData
|
默认值: None
|
|
type
|
默认值: message
|
|
id
必需
|
|
|
recipient
必需
|
|
|
text
|
|
|
summary
|
默认值: None
|
|
textFormat
|
默认值: None
|
|
attachmentLayout
|
默认值: None
|
|
attachments
|
默认值: None
|
|
suggestedActions
|
默认值: None
|
|
deliveryMode
|
默认值: None
|
|
value
|
默认值: None
|
方法
| get_account_mention |
按帐户 ID 获取提及实体。 |
| get_quoted_messages |
从此消息中获取所有带引号的答复实体。 Warning 即将推出 此 API 即将推出,将来可能会更改。 诊断:ExperimentalTeamsQuotedReplies |
| is_recipient_mentioned |
检查邮件中是否提到收件人帐户。 |
| strip_mentions_text |
删除“<at>...<消息中的 /at>“ 文本。 |
get_account_mention
按帐户 ID 获取提及实体。
get_account_mention(account_id: str) -> MentionEntity | None
参数
| 名称 | 说明 |
|---|---|
|
account_id
必需
|
要搜索的帐户 ID |
返回
| 类型 | 说明 |
|---|---|
|
如果找到提及实体,则为 None;否则为 None |
get_quoted_messages
从此消息中获取所有带引号的答复实体。
Warning
即将推出
此 API 即将推出,将来可能会更改。
诊断:ExperimentalTeamsQuotedReplies
get_quoted_messages() -> list[microsoft_teams.api.models.entity.quoted_reply_entity.QuotedReplyEntity]
返回
| 类型 | 说明 |
|---|---|
|
带引号的答复实体列表,如果无,则为空 |
is_recipient_mentioned
检查邮件中是否提到收件人帐户。
is_recipient_mentioned() -> bool
返回
| 类型 | 说明 |
|---|---|
|
如此 如果提及收件人 |
strip_mentions_text
删除“<at>...<消息中的 /at>“ 文本。
strip_mentions_text(options: StripMentionsTextOptions | None = None) -> Self
参数
| 名称 | 说明 |
|---|---|
|
options
|
用于剥离提及的选项 默认值: None
|
返回
| 类型 | 说明 |
|---|---|
|
自链接方法 |
属性
model_config
模型的配置应为符合 [ConfigDict][pydantic.config的字典。ConfigDict]。
model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=None, validation_alias=<staticmethod(<function CustomBaseModel.validation_alias_generator>)>, serialization_alias=<staticmethod(<function CustomBaseModel.serialization_alias_generator>)>), 'arbitrary_types_allowed': True, 'extra': 'allow', 'populate_by_name': True, 'serialize_by_alias': True, 'validate_by_alias': True, 'validate_by_name': True}
text
消息的文本内容。
text: str