@@ -825,6 +825,111 @@ protected virtual Task OnTeamsReadReceiptAsync(ReadReceiptInfo readReceiptInfo,
825825 return Task . CompletedTask ;
826826 }
827827
828+ /// <summary>
829+ /// Invoked when an message update activity is received.
830+ /// <see cref="ActivityTypes.MessageUpdate"/> activities, such as the conversational logic.
831+ /// </summary>
832+ /// <param name="turnContext">A strongly-typed context object for this turn.</param>
833+ /// <param name="cancellationToken">A cancellation token that can be used by other objects
834+ /// or threads to receive notice of cancellation.</param>
835+ /// <returns>A task that represents the work queued to execute.</returns>
836+ /// <remarks>
837+ /// In a derived class, override this method to add logic that applies to all message update activities.
838+ /// </remarks>
839+ protected override Task OnMessageUpdateActivityAsync ( ITurnContext < IMessageUpdateActivity > turnContext , CancellationToken cancellationToken )
840+ {
841+ if ( turnContext . Activity . ChannelId == Channels . Msteams )
842+ {
843+ var channelData = turnContext . Activity . GetChannelData < TeamsChannelData > ( ) ;
844+
845+ if ( channelData != null )
846+ {
847+ switch ( channelData . EventType )
848+ {
849+ case "editMessage" :
850+ return OnTeamsMessageEditAsync ( turnContext , cancellationToken ) ;
851+
852+ case "undeleteMessage" :
853+ return OnTeamsMessageUndeleteAsync ( turnContext , cancellationToken ) ;
854+
855+ default :
856+ return base . OnMessageUpdateActivityAsync ( turnContext , cancellationToken ) ;
857+ }
858+ }
859+ }
860+
861+ return base . OnMessageUpdateActivityAsync ( turnContext , cancellationToken ) ;
862+ }
863+
864+ /// <summary>
865+ /// Invoked when an message delete activity is received.
866+ /// <see cref="ActivityTypes.MessageDelete"/> activities, such as the conversational logic.
867+ /// </summary>
868+ /// <param name="turnContext">A strongly-typed context object for this turn.</param>
869+ /// <param name="cancellationToken">A cancellation token that can be used by other objects
870+ /// or threads to receive notice of cancellation.</param>
871+ /// <returns>A task that represents the work queued to execute.</returns>
872+ /// <remarks>
873+ /// In a derived class, override this method to add logic that applies to all message update activities.
874+ /// </remarks>
875+ protected override Task OnMessageDeleteActivityAsync ( ITurnContext < IMessageDeleteActivity > turnContext , CancellationToken cancellationToken )
876+ {
877+ if ( turnContext . Activity . ChannelId == Channels . Msteams )
878+ {
879+ var channelData = turnContext . Activity . GetChannelData < TeamsChannelData > ( ) ;
880+
881+ if ( channelData != null )
882+ {
883+ switch ( channelData . EventType )
884+ {
885+ case "softDeleteMessage" :
886+ return OnTeamsMessageSoftDeleteAsync ( turnContext , cancellationToken ) ;
887+
888+ default :
889+ return base . OnMessageDeleteActivityAsync ( turnContext , cancellationToken ) ;
890+ }
891+ }
892+ }
893+
894+ return base . OnMessageDeleteActivityAsync ( turnContext , cancellationToken ) ;
895+ }
896+
897+ /// <summary>
898+ /// Invoked when a edit message event activity is received.
899+ /// </summary>
900+ /// <param name="turnContext">A strongly-typed context object for this turn.</param>
901+ /// <param name="cancellationToken">A cancellation token that can be used by other objects
902+ /// or threads to receive notice of cancellation.</param>
903+ /// <returns>A task that represents the work queued to execute.</returns>
904+ protected virtual Task OnTeamsMessageEditAsync ( ITurnContext < IMessageUpdateActivity > turnContext , CancellationToken cancellationToken )
905+ {
906+ return Task . CompletedTask ;
907+ }
908+
909+ /// <summary>
910+ /// Invoked when a undo soft delete message event activity is received.
911+ /// </summary>
912+ /// <param name="turnContext">A strongly-typed context object for this turn.</param>
913+ /// <param name="cancellationToken">A cancellation token that can be used by other objects
914+ /// or threads to receive notice of cancellation.</param>
915+ /// <returns>A task that represents the work queued to execute.</returns>
916+ protected virtual Task OnTeamsMessageUndeleteAsync ( ITurnContext < IMessageUpdateActivity > turnContext , CancellationToken cancellationToken )
917+ {
918+ return Task . CompletedTask ;
919+ }
920+
921+ /// <summary>
922+ /// Invoked when a soft delete message event activity is received.
923+ /// </summary>
924+ /// <param name="turnContext">A strongly-typed context object for this turn.</param>
925+ /// <param name="cancellationToken">A cancellation token that can be used by other objects
926+ /// or threads to receive notice of cancellation.</param>
927+ /// <returns>A task that represents the work queued to execute.</returns>
928+ protected virtual Task OnTeamsMessageSoftDeleteAsync ( ITurnContext < IMessageDeleteActivity > turnContext , CancellationToken cancellationToken )
929+ {
930+ return Task . CompletedTask ;
931+ }
932+
828933 /// <summary>
829934 /// Safely casts an object to an object of type <typeparamref name="T"/> .
830935 /// </summary>
0 commit comments