Exemplo n.º 1
0
        protected override async Task OnMembersAddedAsync(DelegatingTurnContext <IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
        {
            Activity         messageActivity;
            DisplayDirective directive;

            GenerateMessage(out messageActivity, out directive);

            turnContext.AlexaResponseDirectives().Add(directive);
            await turnContext.SendActivityAsync(messageActivity, cancellationToken);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Override this in a derived class to provide logic specific to
 /// <see cref="ActivityTypes.Message"/> activities, such as the conversational logic.
 /// </summary>
 /// <param name="turnContext">A strongly-typed context object for this turn.</param>
 /// <param name="cancellationToken">A cancellation token that can be used by other objects
 /// or threads to receive notice of cancellation.</param>
 /// <returns>A task that represents the work queued to execute.</returns>
 /// <remarks>
 /// When the <see cref="OnTurnAsync(ITurnContext, CancellationToken)"/>
 /// method receives a message activity, it calls this method.
 /// </remarks>
 /// <seealso cref="OnTurnAsync(ITurnContext, CancellationToken)"/>
 protected virtual Task OnMessageActivityAsync(DelegatingTurnContext <IMessageActivity> delegatingTurnContext, CancellationToken cancellationToken)
 {
     return(Task.CompletedTask);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Override this in a derived class to provide logic for when members other than the bot
 /// join the conversation, such as your bot's welcome logic.
 /// </summary>
 /// <param name="membersAdded">A list of all the members added to the conversation, as
 /// described by the conversation update activity.</param>
 /// <param name="turnContext">A strongly-typed context object for this turn.</param>
 /// <param name="cancellationToken">A cancellation token that can be used by other objects
 /// or threads to receive notice of cancellation.</param>
 /// <returns>A task that represents the work queued to execute.</returns>
 /// <remarks>
 /// When the <see cref="OnConversationUpdateActivityAsync(ITurnContext{IConversationUpdateActivity}, CancellationToken)"/>
 /// method receives a conversation update activity that indicates one or more users other than the bot
 /// are joining the conversation, it calls this method.
 /// </remarks>
 /// <seealso cref="OnConversationUpdateActivityAsync(ITurnContext{IConversationUpdateActivity}, CancellationToken)"/>
 protected virtual Task OnMembersAddedAsync(DelegatingTurnContext <IConversationUpdateActivity> delegatingTurnContext, CancellationToken cancellationToken)
 {
     return(Task.CompletedTask);
 }
Exemplo n.º 4
0
 protected override async Task OnMessageActivityAsync(DelegatingTurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
 {
     await _dialog.RunAsync(turnContext, _conversationState.CreateProperty <DialogState>(nameof(DialogState)), cancellationToken);
 }