{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/issues/822","repository_url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet","labels_url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/issues/822/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/issues/822/comments","events_url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/issues/822/events","html_url":"https://github.com/Microsoft/botbuilder-dotnet/pull/822","id":348297527,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2Njc5NTg2","number":822,"title":"Add Responded collection to TurnContext","user":{"login":"JeffCordes","id":33933531,"node_id":"MDQ6VXNlcjMzOTMzNTMx","avatar_url":"https://avatars0.githubusercontent.com/u/33933531?v=4","gravatar_id":"","url":"https://api.github.com/users/JeffCordes","html_url":"https://github.com/JeffCordes","followers_url":"https://api.github.com/users/JeffCordes/followers","following_url":"https://api.github.com/users/JeffCordes/following{/other_user}","gists_url":"https://api.github.com/users/JeffCordes/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffCordes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffCordes/subscriptions","organizations_url":"https://api.github.com/users/JeffCordes/orgs","repos_url":"https://api.github.com/users/JeffCordes/repos","events_url":"https://api.github.com/users/JeffCordes/events{/privacy}","received_events_url":"https://api.github.com/users/JeffCordes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-07T12:23:20Z","updated_at":"2018-08-09T11:01:48Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/pulls/822","html_url":"https://github.com/Microsoft/botbuilder-dotnet/pull/822","diff_url":"https://github.com/Microsoft/botbuilder-dotnet/pull/822.diff","patch_url":"https://github.com/Microsoft/botbuilder-dotnet/pull/822.patch"},"body":"This PR adds a Responses collection to the TurnContext.  The BotFrameWorkAdapter will then add all sent activities to the collection.\r\n\r\nThis allows middleware and other logic to query what has responded based on Message type instead of using the responded boolean.\r\n\r\nExample usage:   The typing middleWare currently breaks any code that uses \"if (context.Responded)\" because it responds to everything with a typing event.  Now using LINQ you could instead do \"if (context.Responses.Where(r => r.Type != ActivityTypes.Typing).Any())\"\r\n\r\nThis would resolve issue #800 "},"comment":{"url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/issues/comments/411720321","html_url":"https://github.com/Microsoft/botbuilder-dotnet/pull/822#issuecomment-411720321","issue_url":"https://api.github.com/repos/Microsoft/botbuilder-dotnet/issues/822","id":411720321,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTcyMDMyMQ==","user":{"login":"JeffCordes","id":33933531,"node_id":"MDQ6VXNlcjMzOTMzNTMx","avatar_url":"https://avatars0.githubusercontent.com/u/33933531?v=4","gravatar_id":"","url":"https://api.github.com/users/JeffCordes","html_url":"https://github.com/JeffCordes","followers_url":"https://api.github.com/users/JeffCordes/followers","following_url":"https://api.github.com/users/JeffCordes/following{/other_user}","gists_url":"https://api.github.com/users/JeffCordes/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffCordes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffCordes/subscriptions","organizations_url":"https://api.github.com/users/JeffCordes/orgs","repos_url":"https://api.github.com/users/JeffCordes/repos","events_url":"https://api.github.com/users/JeffCordes/events{/privacy}","received_events_url":"https://api.github.com/users/JeffCordes/received_events","type":"User","site_admin":false},"created_at":"2018-08-09T11:01:48Z","updated_at":"2018-08-09T11:01:48Z","author_association":"NONE","body":"@daveta \r\n\r\nI am not sure how this could be added as middleware.  The underlying concern is that when middleware (or the main onTurn) method runs there is not enough information in the context about what other middleware that is before it in the order of execution has done.\r\n\r\nResponded works if you only have two options, a main function and fallback like @Stevenic said.  in our business requirements we have a lot more.  I used typing as a basic example above, but our solutions is really: typing, Suggested action, message reactions, complex waterfall dialogs, Dispather -> luis -> QnA, \"Backchannel\" Events exchanged for authentication, live chat hand-off, proactive messages, and we are looking at personality chat for the end of the chain.\r\n\r\nWe are really just adding a history to the Context, to allow more complex workflows to be able to evaluate what has happened already and what should respond.  We are finding this is not possible with only the responded boolean.\r\n\r\nLINQ is nice \"syntactic sugar\" to query that in dotnet, but java and python still fully support iterating a collection and evaluating its contents."}}
{"actor":{"display_login":"JeffCordes"}}