Message class
用于简化使用附件生成复杂邮件的邮件生成器类。
构造函数
| Message(Session) | 创建新的消息生成器。 |
方法
构造函数详细信息
Message(Session)
方法详细信息
addAttachment(AttachmentType)
向邮件添加附件。 有关示例,请参阅 IAttachment。
function addAttachment(attachment: AttachmentType)
参数
- attachment
- AttachmentType
要添加的附件。
返回
addEntity(Object)
address(IAddress)
attachmentLayout(string)
attachments(AttachmentType[])
code(string)
compose(string[][], any[])
撰写对用户的复杂随机答复。
function compose(prompts: string[][], args: any[])
参数
- prompts
-
string[][]
- args
-
any[]
返回
composePrompt(Session, string[][], any[])
弃用 改用 compose()。
function composePrompt(session: Session, prompts: string[][], args: any[])
参数
- session
- Session
- prompts
-
string[][]
- args
-
any[]
返回
composePrompt(Session, string[][], any[])
将提示数组合并为单个本地化提示,然后选择性地使用传入的参数填充提示模板槽。
static function composePrompt(session: Session, prompts: string[][], args?: any[])
参数
- session
- Session
用于本地化各个提示部分的会话对象。
- prompts
-
string[][]
提示列表的数组。 数组中的每个条目都是将随机选择的另一个提示数组。 组合的输出文本将分隔空格。
- args
-
any[]
(可选)用于在提示为模板时设置输出文本格式的参数数组。
返回
string
entities(Object[])
inputHint(string)
localTimestamp(string)
发送消息的本地时间(由客户端或机器人设置,例如:2016-09-23T13:07:49.4714686-07:00)。
function localTimestamp(time?: string)
参数
- time
-
string
(可选) 表示为 ISO 字符串的时间。 默认为 new Date().toISOString()。
返回
name(string)
nspeak(TextType, TextType, number)
根据给定的指定计数,有条件地设置消息的说话字段。
function nspeak(ssml: TextType, ssml_plural: TextType, count: number)
参数
- ssml
- TextType
- ssml_plural
- TextType
- count
-
number
返回
ntext(TextType, TextType, number)
有条件地设置给定指定计数的消息文本。
function ntext(msg: TextType, msg_plural: TextType, count: number)
参数
- msg
- TextType
- msg_plural
- TextType
- count
-
number
返回
originalEvent(any)
randomPrompt(TextType)
随机选择提示。
static function randomPrompt(prompts: TextType)
参数
- prompts
- TextType
要从中选择的提示数组。 当提示键入 字符串 将仅返回未修改提示。
返回
string
relatesTo(IAddress)
setChannelData(any)
setLanguage(string)
setNText(Session, string, string, number)
弃用 改为使用 ntext()。
function setNText(session: Session, msg: string, msg_plural: string, count: number)
参数
- session
- Session
- msg
-
string
- msg_plural
-
string
- count
-
number
返回
setText(Session, TextType, any[])
弃用 改用 文本()。
function setText(session: Session, prompt: TextType, args: any[])
参数
- session
- Session
- prompt
- TextType
- args
-
any[]
返回
sourceEvent(ISourceEventMap)
speak(TextType, any[])
将消息的说话字段设置为 语音合成标记语言(SSML)。 这将在受支持的设备上与用户交谈。
function speak(ssml: TextType, args: any[])
参数
- ssml
- TextType
- args
-
any[]
返回
suggestedActions(ISuggestedActions | IIsSuggestedActions)
要发送给用户的可选建议操作。 建议的操作仅显示在支持建议操作的通道上。
function suggestedActions(suggestedActions: ISuggestedActions | IIsSuggestedActions)
参数
- suggestedActions
返回
summary(TextType, any[])
要通过回退和邮件内容的简短说明显示的文本,例如最近对话的列表。
function summary(text: TextType, args: any[])
参数
- text
- TextType
- args
-
any[]