TurnContext Class
- Inheritance
-
builtins.objectTurnContext
Constructor
TurnContext(adapter_or_context, request: Optional[botbuilder.schema._models_py3.Activity] = None)
Methods
| apply_conversation_reference |
Updates an activity with the delivery information from a conversation reference. Calling this after get_conversation_reference on an incoming activity will properly address the reply to a received activity. :param activity: :param reference: :param is_incoming: :return: |
| copy_to |
Called when this TurnContext instance is passed into the constructor of a new TurnContext instance. Can be overridden in derived classes. :param context: :return: |
| delete_activity |
Deletes an existing activity. :param id_or_reference: :return: |
| get | |
| get_conversation_reference |
Returns the conversation reference for an activity. This can be saved as a plain old JSON object and then later used to message the user proactively. Usage Example: reference = TurnContext.get_conversation_reference(context.request) :param activity: :return: |
| get_mentions | |
| get_reply_conversation_reference | |
| has |
Returns True is set() has been called for a key. The cached value may be of type 'None'. :param key: :return: |
| on_delete_activity |
Registers a handler to be notified of and potentially intercept an activity being deleted. :param handler: :return: |
| on_send_activities |
Registers a handler to be notified of and potentially intercept the sending of activities. :param handler: :return: |
| on_update_activity |
Registers a handler to be notified of and potentially intercept an activity being updated. :param handler: :return: |
| remove_mention_text | |
| remove_recipient_mention | |
| send_activities | |
| send_activity |
Sends a single activity or message to the user. :param activity_or_text: :return: |
| send_trace_activity | |
| set |
Caches a value for the lifetime of the current turn. :param key: :param value: :return: |
| update_activity |
Replaces an existing activity. :param activity: :return: |
apply_conversation_reference
Updates an activity with the delivery information from a conversation reference. Calling this after get_conversation_reference on an incoming activity will properly address the reply to a received activity. :param activity: :param reference: :param is_incoming: :return:
apply_conversation_reference(activity: botbuilder.schema._models_py3.Activity, reference: botbuilder.schema._models_py3.ConversationReference, is_incoming: bool = False) -> botbuilder.schema._models_py3.Activity
Parameters
- activity
- reference
- is_incoming
copy_to
Called when this TurnContext instance is passed into the constructor of a new TurnContext instance. Can be overridden in derived classes. :param context: :return:
copy_to(context: botbuilder.core.turn_context.TurnContext) -> None
Parameters
- context
delete_activity
Deletes an existing activity. :param id_or_reference: :return:
delete_activity(id_or_reference: Union[str, botbuilder.schema._models_py3.ConversationReference])
Parameters
- id_or_reference
get
get(key: str) -> object
Parameters
- key
get_conversation_reference
Returns the conversation reference for an activity. This can be saved as a plain old JSON object and then later used to message the user proactively.
Usage Example: reference = TurnContext.get_conversation_reference(context.request) :param activity: :return:
get_conversation_reference(activity: botbuilder.schema._models_py3.Activity) -> botbuilder.schema._models_py3.ConversationReference
Parameters
- activity
get_mentions
get_mentions(activity: botbuilder.schema._models_py3.Activity) -> List[botbuilder.schema._models_py3.Mention]
Parameters
- activity
get_reply_conversation_reference
get_reply_conversation_reference(activity: botbuilder.schema._models_py3.Activity, reply: botbuilder.schema._models_py3.ResourceResponse) -> botbuilder.schema._models_py3.ConversationReference
Parameters
- activity
- reply
has
Returns True is set() has been called for a key. The cached value may be of type 'None'. :param key: :return:
has(key: str) -> bool
Parameters
- key
on_delete_activity
Registers a handler to be notified of and potentially intercept an activity being deleted. :param handler: :return:
on_delete_activity(handler) -> botbuilder.core.turn_context.TurnContext
Parameters
- handler
on_send_activities
Registers a handler to be notified of and potentially intercept the sending of activities. :param handler: :return:
on_send_activities(handler) -> botbuilder.core.turn_context.TurnContext
Parameters
- handler
on_update_activity
Registers a handler to be notified of and potentially intercept an activity being updated. :param handler: :return:
on_update_activity(handler) -> botbuilder.core.turn_context.TurnContext
Parameters
- handler
remove_mention_text
remove_mention_text(activity: botbuilder.schema._models_py3.Activity, identifier: str) -> str
Parameters
- activity
- identifier
remove_recipient_mention
remove_recipient_mention(activity: botbuilder.schema._models_py3.Activity) -> str
Parameters
- activity
send_activities
send_activities(activities: List[botbuilder.schema._models_py3.Activity]) -> List[botbuilder.schema._models_py3.ResourceResponse]
Parameters
- activities
send_activity
Sends a single activity or message to the user. :param activity_or_text: :return:
send_activity(activity_or_text: Union[botbuilder.schema._models_py3.Activity, str], speak: Optional[str] = None, input_hint: Optional[str] = None) -> botbuilder.schema._models_py3.ResourceResponse
Parameters
- activity_or_text
- speak
- input_hint
send_trace_activity
send_trace_activity(name: str, value: Optional[object] = None, value_type: Optional[str] = None, label: Optional[str] = None) -> botbuilder.schema._models_py3.ResourceResponse
Parameters
- name
- value
- value_type
- label
set
Caches a value for the lifetime of the current turn. :param key: :param value: :return:
set(key: str, value: object) -> None
Parameters
- key
- value
update_activity
Replaces an existing activity. :param activity: :return:
update_activity(activity: botbuilder.schema._models_py3.Activity)
Parameters
- activity
Attributes
activity
The received activity. :return:
responded
If true at least one response has been sent for the current turn of conversation. :return:
services
Map of services and other values cached for the lifetime of the turn. :return: