IRecognizeContext interface
Context of the received message passed to various recognition methods.
Properties
conversation |
Shared conversation data that's visible to all members of the conversation. |
dialog |
Data for the active dialog. |
intent | (Optional) The top intent identified for the message. |
library |
(Optional) The name of the library passing the context is from. |
locale | DEPRECATED use preferredLocale() instead. |
localizer | The localizer for the session. |
logger | The current session logger. |
message | The message received from the user. For bot originated messages this may only contain the "to" & "from" fields. |
private |
Private conversation data that's only visible to the user. |
user |
Data for the user that's persisted across all conversations with the bot. |
Methods
dialog |
Returns a copy of the current dialog stack for the session. |
gettext(string, any[]) | Loads a localized string for the messages language. If arguments are passed the localized string will be treated as a template and formatted using sprintf-js (see their docs for details.) |
ngettext(string, string, number) | Loads the plural form of a localized string for the messages language. The output string will be formatted to include the count by replacing %d in the string with the count. |
preferred |
Returns the users preferred locale. |
Property Details
conversationData
Shared conversation data that's visible to all members of the conversation.
conversationData: any
Property Value
any
dialogData
Data for the active dialog.
dialogData: any
Property Value
any
intent
(Optional) The top intent identified for the message.
intent?: IIntentRecognizerResult
Property Value
libraryName
(Optional) The name of the library passing the context is from.
libraryName?: string
Property Value
string
locale
localizer
logger
message
The message received from the user. For bot originated messages this may only contain the "to" & "from" fields.
message: IMessage
Property Value
privateConversationData
Private conversation data that's only visible to the user.
privateConversationData: any
Property Value
any
userData
Data for the user that's persisted across all conversations with the bot.
userData: any
Property Value
any
Method Details
dialogStack()
Returns a copy of the current dialog stack for the session.
function dialogStack()
Returns
gettext(string, any[])
Loads a localized string for the messages language. If arguments are passed the localized string will be treated as a template and formatted using sprintf-js (see their docs for details.)
function gettext(msgid: string, args: any[])
Parameters
- msgid
-
string
String to use as a key in the localized string table. Typically this will just be the english version of the string.
- args
-
any[]
(Optional) arguments used to format the final output string.
Returns
string
ngettext(string, string, number)
Loads the plural form of a localized string for the messages language. The output string will be formatted to include the count by replacing %d in the string with the count.
function ngettext(msgid: string, msgid_plural: string, count: number)
Parameters
- msgid
-
string
Singular form of the string to use as a key in the localized string table. Use %d to specify where the count should go.
- msgid_plural
-
string
Plural form of the string to use as a key in the localized string table. Use %d to specify where the count should go.
- count
-
number
Count to use when determining whether the singular or plural form of the string should be used.
Returns
string
preferredLocale()
Returns the users preferred locale.
function preferredLocale()
Returns
string